mahf-opt / mahf

A framework for modular construction and evaluation of metaheuristics.
GNU General Public License v3.0
10 stars 0 forks source link

Rename termination criterions such that it is obvious when they terminate #161

Closed Saethox closed 1 year ago

Saethox commented 1 year ago

For example, the combined termination criterion

.while_(termination::FixedIterations::new(500) & termination::DistanceToOpt::new(0.01), ...),

could be read as "terminate when 500 iterations are reached and the best objective value found is within 0.01 of the optimum", which would mean the algorithm doesn't terminate until both conditions are true.

What this actually means is that the algorithm terminates when either 500 iterations are reached or the distance to the optimum is less than 0.01.

We should remove the implicit negation in termination criterions so it is readable in a while expression, for example IterationsBelow and DistanceToOptAbove instead FixedIterations and DistanceToOpt:

.while_(termination::IterationsBelow::new(500) & termination::DistanceToOptAbove::new(0.01), ...),
luleyleo commented 1 year ago

I was also thinking about this, and maybe it would be best to abolish the concept of "termination" and just make them normal conditions. The "termination" terminology is really just a relic of the first versions of MAHF and I don't think it makes sense anymore.

HeleNoir commented 1 year ago

I would be okay with that. We can omit the "termination" term and just use a condition.

Saethox commented 1 year ago

Well, FixedIterations and such are already simply Conditions, it's just that their name is not really clear. The only thing that makes them "termination criterions" is that they are located in the conditions::termination module, and that's fine I think because termination is an important concept here.

Or what exactly did you think of, @luleyleo?