pymoo: Setting a starting solution in Pymoo does not work

Hi all,

I want to use a starting solution for pymoo in the algorithms NSGA2. For that I have the following code

intial_solution = ICSimulation.simulateDays_ConventionalControl()
algorithm = NSGA2(
    pop_size=5,
    n_offsprings=2,
    sampling=FloatRandomSampling(),
    crossover=SBX(prob=0.7, eta=20),
    mutation=PM(eta=40),
    eliminate_duplicates=True
)

algorithm.setup(problem, x0=intial_solution )

So i just create an initial_solution by using an external file that returns an x vector that is the vector of decision variables in pymoo for the evalutation. Then I add algorithm.setup(problem, x0=intial_solution ). When adding this line, the algorithm does not seem to terminate or to generally show some outputs. Further, in the evaluation method I can clearly see, that the algorithm, even in the first iteration, does not use the inital_solution as all solutions in the first iteration are just randomly generated as if there is no inital_solution.

So I want to know, how can I tell pymoo to use the inital_solution as a good starting point for the optimization instead of just radomly initiallyzing the inital solutions?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 23 (2 by maintainers)

Most upvoted comments

@PBerit Sorry for the misunderstood your question. You can check the default parameters in nsga2 algorithm here: https://github.com/anyoptimization/pymoo/blob/566a3d7af9cc78772a2744f61b0cf78fa3f1fe2f/pymoo/algorithms/moo/nsga2.py#L86-L93