• Gurobi Staff

Hi José Miguel,

It is possible by using multi objective environments, see here.

Best regards,
Jaromił

Thank you Jaromił

I tried using the function Model.getMultiobjEnv (in Java), and it is not working as expected. I have tried to use the following programming flows without making Gurobi change its behavior when solving my second objective.

OPTION 1

model = new GRBModel(env);
GRBEnv secondaryEnv = model.getMultiobjEnv(1);
secondaryEnv.set(GRB.DoubleParam.TimeLimit, 15);
secondaryEnv.set(GRB.DoubleParam.MIPGap, 0.01);
secondaryEnv.set(GRB.IntParam.OutputFlag, 0);
createFlowModel()  // function that creates the lexicographic model
model.update();

OPTION 2

model = new GRBModel(env);
createFlowModel()  // function that creates the lexicographic model
GRBEnv secondaryEnv = model.getMultiobjEnv(1);
secondaryEnv.set(GRB.DoubleParam.TimeLimit, 15);
secondaryEnv.set(GRB.DoubleParam.MIPGap, 0.01);
secondaryEnv.set(GRB.IntParam.OutputFlag, 0);
model.update();

Is there any indication as of the moment at which I need to change the environment?

Thanks you

José Miguel

• Gurobi Staff

Hi José Miguel,

Both of your options should work. It is possible that the parameters you set don't have any visible influence on the solution behavior of your second objective. The changed parameters will also not be displayed. In order to check whether your approach really works try setting, e.g., the Presolve parameter to 0 via $$\texttt{secondaryEnv.set(GRB.IntParam.Presolve,0)}$$, which should have a visible impact on the solution process of your second objective.

Please note that the OutputFlag parameter, which you set for your secondary environment is overwritten by the default OutputFlag parameter of the overall environment.

Best regards,
Jaromił