Menu

#41 Difference between newSolution and Initialization

2.1
open
nobody
None
5
2015-08-28
2015-08-28
Anonymous
No

Hi, I am not sure in which cases the method 'newSolution' is used to obtain new solutions and which cases the Initialization class is used.

In my case, the framework seems to not use 'newSolution' method. However, as I want to distributed it, a FutureSolution is required and the only way to get hold of it transparently seems to be the 'newSolution' method of the DistributedProblem class.

Discussion

  • Anonymous

    Anonymous - 2015-08-28

    newSolution is called to get the definition of a solution for a problem. The resulting solution will define the lower and upper bounds for each decision variable, but the variable will not yet be assigned an actual value.

    The Initialization class is used to generate the initial population for an algorithm. For example, RandomInitialization will generate N solutions whose variables are sampled uniformly at random.

    In general, newSolution is called during initialization. Afterwards, most algorithms just create copies of the parent solutions (using the solution.copy() method) rather than calling newSolution, which is why you probably don't see newSolution called often.

    If you are using the Executor class (see Example1.java included in the source code), then you will not need to worry about DistributedProblem and FutureSolution. The Executor will automatically convert your problem to a DistributedProblem.

    Please refer to Chapter 10 in the User Manual for more details on parallelization.