Previous Page: CPXNETreadcopyprob First PageNext Page: CPXNETwriteprob

CPXNETsolution


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().

The arguments to 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.

Although all the above data will exist after a successful call to 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);

Arguments


CPXENVptr env
The pointer to the CPLEX environment as returned by one of the CPXopenCPLEX() routines.

CPXNETptr net
A pointer to a CPLEX network problem object as returned by CPXNETcreateprob().

int *netstat_p
Pointer to which the solution status is written. The possible values for the solution status are:

CPX_OPTIMAL  
Optimal solution found.  
CPX_INFEASIBLE  
Problem is infeasible.  
CPX_UNBOUNDED  
Problem is unbounded.  
CPX_INForUNB  
Problem is infeasible or unbounded.  
CPX_IT_LIM_FEAS  
Iteration limit is exceeded when a feasible solution is available.  
CPX_IT_LIM_INFEAS  
Iteration limit is exceeded when an infeasible solution is available.  
CPX_TIME_LIM_FEAS  
Time limit is exceeded when a feasible solution is available.  
CPX_TIME_LIM_INFEAS  
Time limit is exceeded when an infeasible solution is available.  
CPX_ABORT_FEAS  
Aborted when a feasible solution is available.  
CPX_ABORT_INFEAS  
Aborted when an infeasible solution is available.  

If NULL is passed no status will be returned.

double *objval_p
Pointer 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 *x
Array 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 *pi
Array 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 *slack
Array 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 *dj
Array 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().

Example

status = CPXNETsolution (env, net, &netstatus, &objval, x, pi,
                         slack, dj);

Previous Page: CPXNETreadcopyprob First PageNext Page: CPXNETwriteprob