jMetal / jMetalPy

A framework for single/multi-objective optimization with metaheuristics
https://jmetal.github.io/jMetalPy/index.html
MIT License
497 stars 150 forks source link

Are constraints strongly enforced? #142

Closed OlegKarandin closed 1 year ago

OlegKarandin commented 2 years ago

Hello, I tried to use jMetalPy for a simple problem with 1 objective and 1 constraint.

I've compared solutions by GeneticAlgorithmand SimulatedAnnealing. GeneticAlgorithmreturns a solution that satisfies the constraint, while SimulatedAnnealingreturns a solution with better objective, but negative value of result.constraints[0].

Does this mean that algorithm hasn't found a single feasible solution? Or it preferred lower objective, even though constraint is violated?

ajnebro commented 2 years ago

Hi. The single objective algorithms in jMetalPy by default do not consider problems with constraints. A way to cope with this issue is to modify them by using the OverallConstraintViolationComparator class when comparing solutions.