Error when solving a Multi-objective Optimization model
AnsweredHi,
I am new in multi-objective optimization with gurobi. I have defined a multi-objective model with hierarchical order. My objective function has the following structure:
m.ModelSense = GRB.MINIMIZE
m.setObjectiveN(objfun1, index=0, priority=2, name='obj1')
m.setObjectiveN(objfun2), index=1, priority=1, name='obj2')
If I have understood correctly, Gurobi must optimize the first objective and then find the best solution for the second objective, but only from among those that do not degrade the first solution obtained.
However, when I solve the model, I obtain the following values:
obj1 : 1182.0
obj2: 33.3
If I solve the model with just the first objective, I obtain the following value:
obj1 : 1181.0
I have run the following piece of code:
for w in range(m.SolCount):
m.Params.SolutionNumber = w
# consider all objectives for this solution
for i in range(2):
m.Params.ObjNumber = i
# value of objective i
print(m.ObjNVal)
and I have obtained the following:
1182.0
33.0
1181.0
57.0
1343.0
67.0
Am I doing something wrong?
Thanks in advance.
Marta
-
Hi Marta,
The value of MIPGap is also considered when calculating the objective degradation. Please see the formula in Multiple Objectives - Gurobi Optimizer Reference Manual
Best regards,
Marika0 -
Thank you very much for your reply, Marika!
Setting the OBjNAbsTol = 0 worked!
Best regards,
Marta
0
Please sign in to leave a comment.
Comments
2 comments