CPXXsetnumobjs and CPXsetnumobjs

The routine CPXXsetnumobjs/CPXsetnumobjs sets the number of objectives in the problem instance.

int  CPXXsetnumobjs( CPXCENVptr env, CPXCLPptr lp, CPXDIM n)

int  CPXsetnumobjs( CPXCENVptr env, CPXCLPptr lp, int n)

Description

The routine CPXXsetnumobjs/CPXsetnumobjs sets the number of objectives in the problem instance. There is always at least one objective in the problem instance (indexed 0) thus n must be at least 1. If before calling this function there were more objectives in the instance than the specified n then the objectives whose index is ≥n are removed from the instance. If before calling this function the number of objectives was <n then new objectives are created, all with all-zero coefficients and default settings (like priority, weight, etc).

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
The new number of objectives.

Return

The routine returns 0 (zero) if successful and nonzero if an error occurs.

Example


        status = CPXsetnumobjs (env, lp, 3);
      

See also the example multiobjex1.c in the CPLEX User's Manual and in the standard distribution.