CPXXmultiobjsetobj and CPXmultiobjsetobj
The routine
CPXXmultiobjsetobj/CPXmultiobjsetobj
sets the specified objective of the CPLEX problem object.
int CPXXmultiobjsetobj( CPXCENVptr env, CPXLPptr lp, CPXDIM n, CPXDIM objnz, CPXDIM const * objind, double const * objval, double const offset, double const weight, CPXDIM const priority, double const abstol, double const reltol, char const * objname)
int CPXmultiobjsetobj( CPXCENVptr env, CPXLPptr lp, int n, int objnz, int const * objind, double const * objval, double const offset, double const weight, int const priority, double const abstol, double const reltol, char const * objname)
Description
The routine
CPXXmultiobjsetobj/CPXmultiobjsetobj
sets the specified objective of the CPLEX problem object.
The objective to be set is specified by the argument
n which must be in the
interval [0,CPXXgetnumobj(env,lp)-1]. The
number of nonzero coefficients in the objective, the
nonzero coefficients themselves, and the variable
indices they correspond to are specified in
objnz,
objval, and
n. The rest of the
arguments specify the other attributes of the objective.
The objective coefficient of the variables whose
index is not present in
objind, is set to 0.
For more details on multiobjective optimization in CPLEX, see Multiobjective optimization in the CPLEX User's Manual and Multiobjective optimization for related Callable Library functions.
Arguments
- env
-
A pointer to the CPLEX environment as returned by
CPXXopenCPLEX/CPXopenCPLEX. - lp
-
A pointer to a CPLEX problem object as returned by
CPXXcreateprob/CPXcreateprob. - n
- An integer that specifies the objective to be set.
- objnz
-
An integer that specifies the number of nonzero
objective coefficients in the objective to be set. This
specifies the length of the arrays
objindandobjval. - objind
-
The indices of the variables whose objective coefficient
is nonzero in the objective to be set. This argument
can be NULL if
objnzis 0 (zero). - objval
-
The nonzero coefficients in the objective to be set. This argument
can be NULL if
objnzis 0 (zero). - offset
- The constant term associated with the objective function. Specify 0 if no such term exists.
- weight
- The weight of the objective to be set.
- priority
- The priority of the objective to be set.
- abstol
-
A double number that should be the new absolute tolerance of the objective.
Pass in
CPX_NO_ABSTOL_CHANGEto leave the absolute tolerance unchanged. When specifying a new value, the same limits apply as with theCPXPARAM_MIP_Tolerances_AbsMIPGapparameter. See the section on Specifying multiple objective problems in the CPLEX User's Manual for the details on the meaning of this tolerance. - reltol
-
A double number that should be the new relative tolerance of the objective.
Pass in
CPX_NO_RELTOL_CHANGEto leave the relative tolerance unchanged. When specifying a new value, the same limits apply as with theCPXPARAM_MIP_Tolerances_MIPGapparameter. Note that a nondefault setting of this parameter only applies to MIP multiobjective problems. See the section on Specifying multiple objective problems in the CPLEX User's Manual for the details on the meaning of this tolerance. - objname
- A string representing the name of the objective to be set.
Return
The routine returns 0 (zero) if successful and nonzero if an error occurs.Example
status = CPXmultiobjsetobj (env, lp, n, objnz, objind, objval, offset,
weight, priority, abstol, reltol, objname);
See also the example multiobjex1.c in the
CPLEX User's Manual and in the standard distribution.