Multi-Objective Environments#
When solving a multi-objective model, the solution process typically proceeds in phases, where each phase solves one optimization problem that includes all the objective functions with the same priority (ObjNPriority). 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()
' Create multi-objective environments
Dim env0 As GRBEnv = model.GetMultiObjEnv(0)
Dim env1 As GRBEnv = model.GetMultiObjEnv(1)
' Set parameters on multi-objective environments
' (for ease of readability, errors are not checked here)
env0.Set(GRB.IntParam.Method, 2)
env1.Set(GRB.IntParam.Method, 1)
env1.Set(GRB.IntParam.Presolve, 0)
' Perform multi-objective optimization
model.Optimize()
Assuming that the first objective has a higher priority than the second objective, 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 at their default values when the multi-objective environment is created. Whether parameter changes in the model (environment) affect the multi-objective environment can be controlled by the InheritParams parameter. With the default value, all model parameters are applied when a multi-objective environment is used during a solve. This is a frequent source of confusion. See Inheritance of Parameter Values for more details.