How to add m.ModelSense for multiobjective optimization?
AnsweredHi,
I have two objectives, one to maximize another one to minimize. How to tell the model that obj1 is maximization and obj2 is minimization? The below ModelSense will consider both objectives as minimization. Just adding minus sign for objective does not seem to be a rigourus way!
0
-
Hi Tanmoy,
As noted in Specifying Multiple Objectives, a multiobjective model has only one sense. Negating the objective will certainly do the job, but a better alternative is to use weights. If obj1 is to be maximized, obj2 is to be minimized, and you set
m.ModelSense = GRB.MINIMIZE
then you should set weight=-1 when you apply obj1 using setObjectiveN.
1 -
thank you. I applied your suggestion to the model.
0
Please sign in to leave a comment.
Comments
2 comments