Overview | Group | Tree | Graph | Index | Concepts |
The routine CPXsolution
accesses the solution
values produced by the routines CPXlpopt
,
CPXprimopt
, CPXdualopt
,
CPXbaropt
, CPXhybbaropt
,
CPXhybnetopt
, or CPXqpopt
. The solution is
maintained until the CPLEX problem object is freed via a call to
CPXfreeprob
or the solution is rendered invalid because of a
call to one of the problem modification routines.
The arguments to CPXsolution
are pointers to locations
where data are to be written. Such data can include the status of the
optimization, the value of the objective function, the values of the primal
variables, the dual variables, the slacks and the reduced costs. Although
all of the above data exists after a successful call to one of the LP or QP
optimizers, it is possible that the user needs only a subset of the data
available. If any part of the solution represented by an argument to
CPXsolution
is not required, that argument can be passed with
the value NULL in a call to CPXsolution
. If only one part is
required, it may be more convenient to use the CPLEX routine that accesses
that part of the solution individually: CPXgetstat
,
CPXgetobjval
, CPXgetx
,
CPXgetpi
, CPXgetslack
,
CPXgetdj
.
For barrier, the solution values for x
, pi
,
slack
, and dj
correspond to the last iterate of
the primal-dual algorithm, independent of solution status.
If optimization stopped with an infeasible solution, take care to interpret the meaning of the values in the returned arrays as described in the Arguments section.
Example
status = CPXsolution (env, lp, &lpstat, &objval, x, pi, slack, dj);
See also the example lpex1.c
in the
ILOG CPLEX User's Manual and in the standard distribution.
See Also:
env | A pointer to the CPLEX environment as returned by |
lp | A pointer to a CPLEX problem object as returned by |
lpstat_p | A pointer to an integer indicating the result of the optimization. The specific values which |
objval_p | A pointer to a double precision variable where the objective function value is to be stored. |
x | An array to receive the values of the primal variables for the problem. The length of the array must be at least as great as the number of columns in the problem object. If the solution was computed using the dual simplex optimizer, and the solution is not feasible, |
pi | An array to receive the values of the dual variables for each of the constraints. The length of the array must be at least as great as the number of rows in the problem object. If the solution was computed using the primal simplex optimizer, and the solution is not feasible, |
slack | An array to receive the values of the slack or surplus variables for each of the constraints. The length of the array must be at least as great as the number of rows in the problem object. If the solution was computed by the dual simplex optimizer, and the solution is not feasible, |
dj | An array to receive the values of the reduced costs for each of the variables. The length of the array must be at least as great as the number of columns in the problem object. If the solution was computed by the primal simplex optimizer, and the solution is not feasible, |
CPXsolution
returns nonzero.