CPXXchgobjsen and CPXchgobjsen

The routine CPXXchgobjsen/CPXchgobjsen changes the sense of the optimization for a problem, to maximization or minimization.

int  CPXXchgobjsen( CPXCENVptr env, CPXLPptr lp, int maxormin )

int  CPXchgobjsen( CPXCENVptr env, CPXLPptr lp, int maxormin )

Description

The routine CPXXchgobjsen/CPXchgobjsen changes the sense of the optimization for a problem, to maximization or minimization.

Important: For problems with a quadratic objective function, changing the objective sense may make the problem unsolvable. Further changes to the quadratic coefficients may then be required to restore the convexity (concavity) of a minimization (maximization) problem.
Table 1. Values of maxormin
CPX_MIN (1) new sense is minimize
CPX_MAX (-1) new sense is maximize

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.
maxormin
An integer that specifies the new sense of the problem.

Return

The routine returns 0 (zero) if successful or an error code otherwise.

Example


CPXchgobjsen (env, lp, CPX_MAX);