jMetal / jMetalPy

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

Constraints x>3 #109

Closed lotus-prog closed 5 months ago

lotus-prog commented 3 years ago

Hey, My constraints has a form like this : x[0] >= 3 But In JMetalPy, I only saw solution.constraints=x[0]-3. So do I need to use a Penalisazion Method or it is possible to have an inequality?

icarofvilasboas commented 2 years ago

Hello @lotus-prog, Yes, this constraint solution.constraints = x[0] - 3 is an inequality constraint. JMetalPy uses a syntax that your constraint must be of type f(x) >= 0, so if x[0]-3, in your case, is greater than zero your constraint is satisfied.

magal1337 commented 2 years ago

@ajnebro and @icarofvilasboas in a similar example (eg. x[0] == 3) is there any work around? I've read quite a bit about handling constraints and overall constraint violation but can't materialize it by formulating the constraints myself. In this example it's possible to create an equality constraint call a custom conditional function to validate and then call overall constraint violation? Or jmetalpy can't have equality constraints?