use initial known solution #550
faranak1991
started this conversation in
General
Replies: 2 comments
-
The crossover will still be performed. However, it will only create an identical individual. Then the offsprings will be mutated which will create now solutions. Nevertheless, the population will not have much diversity. I recommend doing random sampling. And then replacing ONE individual with the one solution you want to inject. This way you guide the algorithm, but still have a diversity of solutions. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks for all your help Julian. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I have a question that has been on my mind. I currently have an existing solution as the initial one, and I want to improve this known solution. When I set my solution as the initial sample and choose parameters like 5 populations, 10 offspring, and 20 generations for testing, I observe that initially, my existing solution runs to calculate the objective functions. Subsequently, it generates 10 offspring solutions and proceeds to the next generation, where the remaining generations consist of 10 offspring each. Finally, it provides me with the 5 best solutions.
I'm curious about whether the 5 populations should be created from the initial known solution, and if the evaluation should be carried out on the new population as well. I expected to see both the 5 initial population and offspring in the first generation. If only one initial solution is considered as a parent, I'm unclear about how the crossover is performed on that single parent, as my understanding is that crossover involves individuals in two parents.
x0 = np.array([0.1399, 2.85, 0.2, 3.74, 0.2, 2.98, 0.0648, 3.5, 0.0648, 3.5, 0.0648, 3.5, 0.0648, 3.5, 0.0299, 2.5, 0.0299, 2.5, 0.0299, 2.5, 0.0299, 2.5])
algorithm = NSGA2(
pop_size=5,
n_offsprings =10,
crossover=SBX(),
mutation=PolynomialMutation(),
sampling= x0,
verbose=True ,
eliminate_duplicates=True
)
termination = DefaultObjectiveTermination(
ftol=1e-4,
period=10,
n_max_gen= 20,
)
res = minimize(problem,
algorithm,
termination=termination,
callback=MyCallback(),
seed=1,
output=MyOutput(),
save_history=True,
verbose=True)
Beta Was this translation helpful? Give feedback.
All reactions