Description
Accesses the solution values for a CPLEX network problem object computed by a previous call to CPXNETprimopt() for that object. The solution values are maintained in the object as long as no changes are applied to it with one of the CPXNETchg...(), CPXNETcopy...() or CPXNETadd...() functions. Whether or not a solution exists can be determined using CPXNETgetstat().CPXNETsolution() are pointers to locations where data is to be written. Such data includes the solution status, the value of the objective function, the values of the primal, dual and slack variables and the reduced costs.CPXNETprimopt(), it is possible that the user will only need a subset of the available data. Thus, if any part of the solution represented by an argument to CPXNETsolution() is not required, a NULL pointer can be passed for that argument.Return Value
If a solution exists, CPXNETsolution() returns the value 0; if not, it returns a nonzero value to indicate an error.Synopsis
int CPXNETsolution (CPXENVptr env,
CPXNETptr net,
int *netstat_p,
double *objval_p,
double *x,
double *pi,
double *slack,
double *dj);
CPXENVptr envThe pointer to the CPLEX environment as returned by one of the
CPXopenCPLEX() routines.
CPXNETptr netA pointer to a CPLEX network problem object as returned by
CPXNETcreateprob().
int *netstat_pPointer to which the solution status is written. The possible values for the solution status are:
If NULL is passed no status will be returned.
double *objval_pPointer to which the objective value is written. If NULL is passed, no objective value will be returned. If the solution status is
CPX_IT_LIM_INFEAS, or CPX_TIME_LIM_INFEAS, or CPX_ABORT_INFEAS, the value returned will depend on the setting of parameter CPX_PARAM_NETDISPLAY. If this parameter is set to 2, objective function values that are penalized for infeasible flows are used to compute the objective value of the solution. Otherwise the true objective function values will be used.
double *xArray to which the solution (flow) vector is written. If NULL is passed, no solution vector will be returned. Otherwise
x must point to an array of a size that is at least the size returned by CPXNETgetnumarcs().
double *piArray to which the dual variables (sometimes called fair prices) are written. If NULL is passed, no dual variables will be returned. Otherwise
pi must point to an array of a size that is at least the size returned by CPXNETgetnumnodes().
double *slackArray to which the slack variables (violation of supplies/demands) are written. If NULL is passed, no slack variables will be returned. Otherwise
slack must point to an array of a size that is at least the size returned by CPXNETgetnumnodes().
double *djArray to which the reduced cost values are written. If NULL is passed, no reduced cost values will be returned. Otherwise
dj must point to an array of a size that is at least the size returned by CPXNETgetnumarcs().
status = CPXNETsolution (env, net, &netstatus, &objval, x, pi,
slack, dj);