CNDSM  1.00
MMCFCplex Class Reference

The class MMCFCplex implements the generic interface for Multicommodity Min-Cost Flow solvers defined by the class MMCFClass [see MMCFClas.h]. More...

#include <MMCFCple.h>

Inheritance diagram for MMCFCplex:
MMCFClass

Public types

CPXENVptr env
 
CPXLPptr lp
 
CPXFILEptr logfile
 
Index_Set StrtCols
 
bool Drctd
 
bool Populate
 
bool Lazy
 
int preind
 
int represolve
 
int prenode
 
int reduce
 
 MMCFCplex (Graph *Gh, istream *iStrm=NULL, CPXENVptr extenv=0)
 
void SetMMCFLog (ostream *outs=0, const char lvl=0)
 The class ouputs "log" information onto the ostream pointed by outs. More...
 
void SetOptEps (const double OE=0)
 
void SetCplexA (MMCFCplexA nCA)
 
void SetCplexParam (int whichparam, const char *value)
 
void SetCplexParam (int whichparam, int value)
 
void SetCplexParam (int whichparam, double value)
 
CPXENVptr GetCplexEnv (void)
 
MMCFStatus SolveMMCF (void)
 
FONumber GetPVal (void)
 
FONumber GetDVal (void)
 
FONumber GetUpprBnd (bool &HvSol)
 Return true if the primal solution is integer. More...
 
bool GetPSol (void)
 
bool GetDSol (void)
 
FONumber CostOf (void)
 
void GetCosts (CRow Csts, cIndex_Set nms=0, cIndex strt=0, Index stp=Inf< Index >())
 
void GetXtrCsts (CRow XtrCs, cIndex_Set nms=0, cIndex strt=0, Index stp=Inf< Index >())
 
void GetICaps (FRow ICps, cIndex_Set nms=0, cIndex strt=0, Index stp=Inf< Index >())
 
void GetMCaps (FRow MCps, cIndex_Set nms=0, cIndex strt=0, Index stp=Inf< Index >())
 
Index NrArcsK (cIndex k)
 
Index NrNodesK (cIndex k)
 
Index TotArcs (void)
 
Index TotNodes (void)
 
Index ArcPosKJ (cIndex k, cIndex j)
 
Index NodePosKJ (cIndex k, cIndex j)
 
cIndex_Set GetActvArcs (void)
 
Index NumActvArcs (void)
 
bool Directed (void)
 
void ChgCosts (cCRow NwCsts, cIndex_Set nms=0, cIndex strt=0, Index stp=Inf< Index >())
 
void ChgXtrCsts (cCRow nwXtrCs, cIndex_Set nms=0, cIndex strt=0, Index stp=Inf< Index >())
 
void ChgXtrBnds (cRow XLr=0, cRow XUr=0, cIndex_Set nms=0, cIndex strt=0, Index stp=Inf< Index >())
 
void ChgICaps (cFRow NwICps, cIndex_Set nms=0, cIndex strt=0, Index stp=Inf< Index >())
 
void ChgMCaps (cFRow NwMCps, cIndex_Set nms=0, cIndex strt=0, Index stp=Inf< Index >())
 
void ChgIntVar (cIndex k=Inf< Index >(), bool IntVld=true, cIndex_Set nms=0, Index strt=0, Index stp=Inf< Index >())
 
void AddExtraVars (cIndex NXV, cCRow XCst=0, cRow XUb=0, cRow XLb=0, bool IntVar=false, cIndex_Set WIntVar=0)
 
void AddExtraConstr (cIndex NXC, int *IBeg, int *Indx, double *Vals, const double *XLr=0, const double *XUr=0)
 
Index GetNode (void)
 Returns the number of nodes processed so far in the active branch-and-cut search. More...
 
 ~MMCFCplex ()
 

Additional Inherited Members

- Public Types inherited from MMCFClass
typedef unsigned int Index
 index of a node or arc ( >= 0 )
 
typedef IndexIndex_Set
 set (array) of indices
 
typedef const Index cIndex
 a read-only index
 
typedef cIndexcIndex_Set
 read-only index array
 
typedef double FNumber
 type of arc flow
 
typedef FNumberFRow
 vector of flows
 
typedef const FNumber cFNumber
 a read-only flow
 
typedef cFNumbercFRow
 read-only flow array
 
typedef double CNumber
 type of arc flow cost
 
typedef CNumberCRow
 vector of costs
 
typedef const CNumber cCNumber
 a read-only cost
 
typedef cCNumbercCRow
 read-only cost array
 
typedef double MFNumber
 a Multicommodity flow variable
 
typedef MFNumberMFRow
 vector of Multicommodity flows
 
typedef const MFNumber cMFNumber
 a read-only Multicommodity flow
 
typedef cMFNumbercMFRow
 read-only Multicommodity array
 
typedef double FONumber
 type of the objective function: has to hold sums of products of MFNumber(s) by CNumber(s)
 
typedef const FONumber cFONumber
 a read-only o.f. value
 
typedef double Number
 an "extra" variable
 
typedef NumberRow
 an "extra" variable array
 
typedef const Number cNumber
 a read-only Number
 
typedef cNumbercRow
 read-only Number array
 
- Public Member Functions inherited from MMCFClass
 MMCFClass (void)
 
void SetMMCFTime (bool TimeIt=true)
 
virtual void SetFsbEps (const double FE=0)
 In many cases, only an "approximate" solution of the problem is possible; alternatively, only an "approximate" solution may be required for the purposes of the caller (in order to save time). More...
 
virtual void SetSubP (cIndex ws=Inf< Index >())
 
virtual FONumber GetLwrBnd (bool &HvSol)
 These methods have to return any known Upper/Lower Bound on the optimal value of the "whole" problem (+/-INF are clearly always a possibility). More...
 
virtual void SetFlwSol (FRow Flw=0, Index_Set Bse=0, cIndex wf=Inf< Index >())
 
virtual void SetMFlwSol (MFRow Flw=0, Index_Set Bse=0, cIndex wf=Inf< Index >())
 
virtual void SetXtrSol (Row Xtr=0, Index_Set Bse=0)
 Set[M]FlwSol() and SetXtrSol() are meant to pass to the object pointers to the memory where (respectively) a flow solution and an extra variables solution (the "primal information") have to be, along with "instructions" about their "format". More...
 
virtual bool GetUBSol (void)
 Called after SolveMMCF() and Set[[M]Flw/Xtr]Sol(), these methods write in the memory provided for the purpose respectively the "optimal" primal solution of the problem and the primal solution of the "whole" problem corresponding to the Upper Bound, according to the required "style" [see Set[[M]Flw/Xtr]Sol()]. More...
 
virtual bool PSolIsFNumber (void)
 
virtual bool UBSolIsFNumber (void)
 These methods tell if the primal solutions (to be retrieved with GetPSol()) and the upper bound solutions (to be retrieved with GetUBSol()) are of type `FNumber' rather than `MFNumber'. More...
 
virtual void SetNPot (CRow NPt=0, cIndex wd=Inf< Index >())
 
virtual void SetRCst (CRow RCs=0, cIndex wd=Inf< Index >())
 
virtual void SetMCCst (CRow MCs=0)
 
virtual void SetXtrRC (Row XRC=0)
 
virtual void SetXtrDV (Row XDV=0)
 SetNPot(), SetRCst(), SetMCCst(), SetXtrRC() and SetXtrDV() are meant to pass to the object pointers to the memory where, respectively,. More...
 
virtual bool GetLBSol (void)
 Called after SolveMMCF() and Set[NPot/RCst/MCCst/XtrRC/XtrDV](), these methods write in the memory provided for the purpose respectively the "optimal" dual solution of the problem and the dual solution of the "whole" problem corresponding to the Lower Bound, according to the required "style". More...
 
void TimeMMCF (double &t_us, double &t_ss)
 
double TimeMMCF (void)
 If these methods are called within any of the methods of the class that are "actively timed" (this depends on the subclasses), they return respectively the user and sistem time and the total time (in seconds) since the start of that method. More...
 
Index NrComm (void)
 
Index NrNodes (void)
 
Index NrArcs (void)
 
virtual Index NrXtrVrs (void)
 
virtual Index NrXtrCnst (void)
 
virtual Index NrSubP (void)
 
virtual void CloseArcs (cIndex_Set whch)=0
 
virtual void OpenArcs (cIndex_Set whch)=0
 Respectively "Close" and "Open" the arcs indicated in whch, that must point to a vector of indices in [ 0 . More...
 
virtual void AddExtraVars (cIndex NXV, cCRow XCst=0, cFRow XUb=0, cFRow XLb=0, bool IntVar=false, cIndex_Set nms=0)
 
virtual void AddExtraConstr (cIndex NXC, int *IBeg, int *Indx, double *Vals, cFRow XLr=0, cFRow XUr=0)
 
virtual ~MMCFClass ()
 
- Protected Attributes inherited from MMCFClass
Index NArcs
 Number of Arcs of the graph.
 
Index NNodes
 Number of Nodes of the graph.
 
Index NComm
 Number of Commodities.
 
Index XtrVrs
 Number of "eXtra" Variables.
 
Index XtrCnst
 Number of "eXtra" Constraints.
 
Index NSubPr
 into how many SubProblems the MMCF can be divided
 
FONumber OptEps
 an OptEps-optimal solution is required
 
FONumber FsbEps
 FsbEps is the max allowed violation of constraints.
 
Index WhchSP
 WhchSP tells which subproblem is one referring to.
 
FRow FSol
 pointer to the memory of the Flow Solution
 
MFRow MFSol
 as above, but of the MFNumber type
 
Index_Set FBse
 if FBse != 0, then it must be "sparse"
 
Index WhchFS
 WhchFS tells its "type" of the Flow Solution.
 
Row XSol
 pointer to the memory of the "extra" solution
 
Index_Set XBse
 if XBse != 0, then it must be "sparse"
 
CRow NPot
 pointer to the memory of the Node Potentials (dual costs for the Flow Conservation constraints (1.k))
 
Index WhchNP
 WhchNP tells its "type" of the Node Potentials.
 
CRow RCst
 pointer to the memory of the flow reduced costs (dual costs for the bound constraints (2.k))
 
Index WhchRC
 WhchRC tells its "type" of the flow reduced costs.
 
CRow MCst
 pointer to the memory of the dual costs for the Mutual Capacity constraints (3)
 
Row XtDV
 pointer to the memory of the dual costs for the "extra" constraints (4)
 
Row XtRC
 pointer to the memory of the reduced costs for the "extra" variables (dual costs for constraints (5))
 
ostream * MMCFLog
 the output stream object
 
char MMCFLLvl
 the "level of verbosity" of the log
 
OPTtimers * MMCFt
 mainly the MMCFSolve() time, probably
 

Detailed Description

The class MMCFCplex implements the generic interface for Multicommodity Min-Cost Flow solvers defined by the class MMCFClass [see MMCFClas.h].

It uses the service class Graph [see Graph.h] for reading the data of the instance to be solved.

MMCFCplex uses the Cplex Callable Library (version 5.0 or higher, currently version 12.3) for solving the problem. It therefore accepts "extra" variobles and "extra" (linear) constraints, if any, in the instance.

WARNING: this class requires FNumber = MFNumber = CNumber = double and perhaps Index = int for working properly.

Member Function Documentation

void SetMMCFLog ( ostream *  outs = 0,
const char  lvl = 0 
)
virtual

The class ouputs "log" information onto the ostream pointed by outs.

lvl controls the "level of verbosity" of the code: lvl == 0 means that nothing at all is printed, and values larger than 0 mean increasing amounts of information, the specific effect of each value being derived- class-dependent. outs == 0 implies lvl == 0.

Reimplemented from MMCFClass.

FONumber GetUpprBnd ( bool &  HvSol)
virtual

Return true if the primal solution is integer.

Reimplemented from MMCFClass.

Index GetNode ( void  )

Returns the number of nodes processed so far in the active branch-and-cut search.