Description
This function copies a network to a network object, overriding any other network that may be saved in the object. The network to be copied is specified by providing the:
CPXNETcopynet().
fromnode and tonode arrays. Some of the parameters are optional and replaced by default values if NULL is passed for them.
CPXNETcopynet() returns the value 0; if not, it returns a nonzero value to indicate an error.
int CPXNETcopynet (CPXENVptr env,
CPXNETptr net,
int objsen,
int nnodes,
double *supply,
char **nnames,
int narcs,
int *fromnode,
int *tonode,
double *low,
double *up,
double *obj,
char **anames);
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 objsenOptimization sense of the network to be copied. It may take values
CPX_MAX for a maximization problem or CPX_MIN for a minimization problem.
int nnodesNumber of nodes to be copied from the network.
double *supplySupply values for the nodes. If
NULL is passed all supply values will default to 0. Otherwise the size of the array must be at least nnodes.
char **nnamesPointer to an array of names for the nodes. If
NULL is passed, no names are assigned to the nodes. Otherwise the size of the array must be at least nnodes and every name in the array must be a string terminating in 0.
int narcsNumber of arcs to be copied from the network.
int *fromnodeThe array of indices in each arc's "from node". The indices must be in the range
[0, nnodes-1]. The size of the array must be at least narcs.
int *tonodeThe array of indices in each arc's "to node". The indices must be in the range
[0, nnodes-1]. The size of the array must be at least narcs.
double *lowPointer to an array of lower bounds on the flow through arcs. If
NULL is passed, all lower bounds default to 0. Otherwise the size of the array must be at least narcs. Values lower than or equal to -CPX_INFBOUND are considered -infinity.
double *upPointer to an array of upper bounds on the flow through arcs. If
NULL is passed, all lower bounds default to CPX_INFBOUND. Otherwise the size of the array must be at least narcs. Values greater than or equal to CPX_INFBOUND are considered infinity.
double *objPointer to an array of objective values for flow through arcs. If
NULL is passed, all objective values default to 0. Otherwise the size of the array must be at least narcs.
char **anamesPointer to an array of names for the arcs. If
NULL is passed, no names are assigned to the nodes. Otherwise the size of the array must be at least narcs, and every name in the array must be a string terminating in 0.
status = CPXNETcopynet (env, net, CPX_MAX, nnodes, supply, NULL,
narcs, fromnode, tonode, NULL, NULL, obj,
NULL);