Menu

Get Best Solution

Chkone
2017-01-19
2017-01-20
  • Chkone

    Chkone - 2017-01-19

    Hello,

    What should be the best way to get the best solution found?
    We have various non-define word: HostFitness vs DeviceFitness...
    On the testCudaOptimize I try to get the solution from SolutionSet:
    But for that I have to do a const_cast because the method inside SolutionSet are non-const:
    SolutionSet ourSolutionsSet = const_cast< SolutionSet >( optimizer->getSolutionSet() );
    Could you give me a guess/clue/... How can I get the best solution found? That should be a pointer to N float.

    Cheers

     
    • Youssef S. G. Nashed

      There's a method specifically for that:
      const float* bestSolution = optimizer.getBestSolution(0);

      where 0 is the solution set index.

      On Thursday, January 19, 2017 10:40 AM, Chkone <chkone@users.sf.net> wrote:
      

      Hello,What should be the best way to get the best solution found?
      We have various non-define word: HostFitness vs DeviceFitness...
      On the testCudaOptimize I try to get the solution from SolutionSet:
      But for that I have to do a const_cast because the method inside SolutionSet are non-const:
      SolutionSet ourSolutionsSet = const_cast< SolutionSet >( optimizer->getSolutionSet() );
      Could you give me a guess/clue/... How can I get the best solution found? That should be a pointer to N float.CheersGet Best SolutionSent from sourceforge.net because you indicated interest in https://sourceforge.net/p/libcudaoptimize/discussion/general/To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
  • Chkone

    Chkone - 2017-01-19

    Thanks.
    Could you clarify 3 parameters:
    Problem Dimension & Number of solution ?
    For example I implement my problem's objective function I have 125 variables.
    Now I can have inside SolutionSet:
    m_solutionNumber 125
    m_problemDimension 125
    m_actualSolutionSize 128
    I got:
    "ERROR: SolutionSet::checkSolutionNumber() ERROR: solution number 128 is not valid!"
    Should I use dimension of solution number as power of 2 (or multiple of 8/16/32) to be dispated correctly by the GPU? (size of wave/wavefront/threadGroup/...)
    Thanks for your time

    Best

     
    • Youssef S. G. Nashed

      In your case, problem dimension = number of variables = 125.
      number of solution = population size = number of candidate solutions you want to evaluate per iteration. Can be any number >= 2.
      When did you get this error message? You only get this message if you're trying to access a solution index that is not valid. i.e. You passed a wrong index to a function. In your case, there are 125 solutions, valid indices are 0-124, you passed 128.
      Don't worry about power of 2 dimensions. The alignment is handled transparently/internally. That's m_actualSolutionSize. You have 125 variables and libCudaOptimize uses an internal representation of 128 variables, the last 3 variables are not used in the computations and are always set to zero. Again, don't worry about alignment.

      On Thursday, January 19, 2017 12:55 PM, Chkone <chkone@users.sf.net> wrote:
      

      Thanks.
      Could you clarify 3 parameters:
      Problem Dimension & Number of solution ?
      For example I implement my problem's objective function I have 125 variables.
      Now I can have inside SolutionSet:
      m_solutionNumber 125
      m_problemDimension 125
      m_actualSolutionSize 128
      I got:
      "ERROR: SolutionSet::checkSolutionNumber() ERROR: solution number 128 is not valid!"
      Should I use dimension of solution number as power of 2 (or multiple of 8/16/32) to be dispated correctly by the GPU? (size of wave/wavefront/threadGroup/...)
      Thanks for your timeBestGet Best SolutionSent from sourceforge.net because you indicated interest in https://sourceforge.net/p/libcudaoptimize/discussion/general/To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.