Multi-objective environments#
When solving a multi-objective model, the solution process typically proceeds in phases, where each phase solves for one objective. The standard algorithmic parameters influence the strategy used to solve the overall multi-objective model. However, in some cases you may want finer-grain control over the strategies used in each phase. The solver enables this through multi-objective environments.
Multi-objective environments are created via API routines (in
C
,
C++
,
Java
,
.NET
, or
Python
). You set parameters on these
environments as you would with any other environment, but in this case
they only affect one of the several objective solves.
To give a simple example, you could do the following:
/* Create multi-objective environments */
GRBenv *env0 = GRBgetmultiobjenv(model, 0);
GRBenv *env1 = GRBgetmultiobjenv(model, 1);
/* Set parameters on multi-objective environments
(for ease of readability, errors are not checked here) */
error = GRBsetintparam(env0, "Method", 2);
error = GRBsetintparam(env1, "Method", 1);
error = GRBsetintparam(env1, "Presolve", 0);
/* Perform multi-objective optimization */
error = GRBoptimize(model);
// Create multi-objective environments
GRBenv env0 = model.getMultiobjEnv(0);
GRBenv env1 = model.getMultiobjEnv(1);
// Set parameters on multi-objective environments
env0.set("Method", 2);
env1.set("Method", 1);
env1.set("Presolve", 0);
// Perform multi-objective optimization
model.optimize();
// Create multi-objective environments
GRBenv env0 = model.GetMultiobjEnv(0);
GRBenv env1 = model.GetMultiobjEnv(1);
// Set parameters on multi-objective environments
env0.Set("Method", 2);
env1.Set("Method", 1);
env1.Set("Presolve", 0);
// Perform multi-objective optimization
model.Optimize();
// Create multi-objective environments
GRBenv env0 = model.getMultiobjEnv(0);
GRBenv env1 = model.getMultiobjEnv(1);
// Set parameters on multi-objective environments
env0.set("Method", 2);
env1.set("Method", 1);
env1.set("Presolve", 0);
// Perform multi-objective optimization
model.optimize();
# Create multi-objective environments
env0 = model.getMultiobjEnv(0)
env1 = model.getMultiobjEnv(1)
# Set parameters on multi-objective environments
env0.setParam('Method', 2)
env1.setParam('Method', 1)
env1.setParam('Presolve', 0)
# Perform multi-objective optimization
model.optimize()
This would use the barrier solver (Method=2) for the first objective, and the dual simplex solver (Method=1) with no presolve (Presolve=0) for the second. Note that you don’t need a multi-objective environment for each objective - only for those where you want parameters to take different values from those of the model itself.
Please note that parameter values are copied from the model when the multi-objective environment is created. Therefore, changes to parameter values on the model have no effect on multi-objective environments that have already been created. This is a frequent source of confusion.