jMetalPy
jMetalPy copied to clipboard
Equality Constraints
Hi Guys, Does anyone has any example on how to define a problem with some equality and inequality constraints? I read about Overall Constraint violations but can't figure out how to create an practical example...
You can find examples here: https://github.com/jMetal/jMetalPy/blob/main/jmetal/problem/multiobjective/unconstrained.py Some of the problems are defined in https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=996017
About using equality constraints, I have never worked with problems having such kind of constraints, but I think that you can convert them into inequality constraints by using an epsilon value.
Hi @ajnebro you mean something like: x + 3 = 0 to x + 3 - $e$ <= 0 and $e$ need to be a little less then (x+3) ???
I remember that someone mentioned that alternative (with a very low value of e, e.g., 0.00000001) in a paper. I don't know how effective it can be, but it is worth a try.
Hi @magal1337 I recevied your message with the codes but I would need to know how to instantiate the problem:
if __name__ == "__main__":
problem = RoutesOpt()
algorithm = NSGAII(
problem=problem,
population_size=100,
offspring_population_size=100,
mutation=CompositeMutation([IntegerPolynomialMutation(0.01, 20), PolynomialMutation(0.01, 20.0)]),
crossover=CompositeCrossover(
[
IntegerSBXCrossover(probability=1.0, distribution_index=20),
SBXCrossover(probability=1.0, distribution_index=20),
]
),
termination_criterion=StoppingByEvaluations(max_evaluations=25000),
population_evaluator=SequentialEvaluator()
)
algorithm.run()
Hi @ajnebro I actually figure out... the problem was that I was reversing the bounds for integer part xD. But Thanks for all support. Right Now the one Problem that Im having is that it is taking hours to solve my VRP with 57 nodes and 100 constraints and in general is not a feasible solution (Im having some sub routes that are not starting from warehouse). Problem that I wasnt having due to the fact that I was trying with small amount of nodes before.