anyoptimization / pymoo

NSGA2, NSGA3, R-NSGA3, MOEAD, Genetic Algorithms (GA), Differential Evolution (DE), CMAES, PSO
https://pymoo.org
Apache License 2.0
2.28k stars 392 forks source link

class Termination #4

Closed dongzhiming closed 5 years ago

dongzhiming commented 6 years ago

Hi, What a good multi-objective optimization platform!!! I would like to ask how the termination criterion 'termination' is a member variable of the algorithm? Because some adaptive algorithms require the termination condition.

blankjul commented 6 years ago

Thank you dongdafeng! So far it is used in the solve or _solve method and provided as a parameter, because in all my implementations it is not dependent on the algorithm itself but on the population in each iteration. In the global interface 'minimize' it is a tuple, but on the algorithm level it is a class. Can you be a little bit more concrete in which case the algorithm must override the termination criterion?

dongzhiming commented 6 years ago

Thank you dongdafeng! So far it is used in the solve or _solve method and provided as a parameter, because in all my implementations it is not dependent on the algorithm itself but on the population in each iteration. In the global interface 'minimize' it is a tuple, but on the algorithm level it is a class. Can you be a little bit more concrete in which case the algorithm must override the termination criterion?

Take MOEA/D-LTD (Algorithm 1, line 14) as an example, when updating the weight vector, the maximum generations is required as part of the conditional statement. Of course, my issue is not universal. I will continue to use the pymoo platform later, I really like it.

blankjul commented 6 years ago

Yes, good example where this information might be necessary!

I just committed some changes and now the solve method stores the termination object in self.termination and the algorithm has access to it. However, this is a special case where the algorithm must have the MaximumGenerationTermination otherwise this will not work.

Do you have a case in might where this might be even necessary in the init method for the custom algorithm? I could not think of a scenario right now. In my opinion the initialization of an algorithm should not rely on the termination criteria, but the solve method does.

dongzhiming commented 6 years ago

Yes, I agree with your opinion. But some algorithm designers have this demand.

I have not encountered an algorithm that needs to use the termination criterion at initialization time.