Dip
0.92.4
|
#include <TSP_DecompApp.h>
Public Member Functions | |
virtual DecompSolverStatus | solveRelaxed (const int whichBlock, const double *redCostX, const double convexDual, DecompVarList &varList) |
Solve the relaxed problem. More... | |
virtual int | generateCuts (const double *x, DecompCutList &newCuts) |
Initialize the dual vector for PhaseII of PC. More... | |
virtual bool | APPisUserFeasible (const double *x, const int n_cols, const double tolZero) |
Method to determine if the solution (x) is feasible to the original model. More... | |
virtual void | printOriginalColumn (const int index, ostream *os) const |
Constructor and Destructor | |
TSP_DecompApp (UtilParameters &utilParam) | |
Default constructor. More... | |
virtual | ~TSP_DecompApp () |
Default constructor. More... | |
![]() | |
void | createModels () |
Create model parts. More... | |
DecompConstraintSet * | createModelPart (const int nRowsPart, const int *rowsPart) |
void | createModelPart (DecompConstraintSet *model, const int nRowsPart, const int *rowsPart) |
void | createModelPartSparse (DecompConstraintSet *model, const int nRowsPart, const int *rowsPart) |
void | readInitSolutionFile (DecompVarList &initVars) |
void | readBlockFile () |
Read block file. More... | |
void | readProblem () |
Read Problem. More... | |
void | singlyBorderStructureDetection () |
Automatically detect singly bordered structure. More... | |
void | findActiveColumns (const std::vector< int > &rowsPart, std::set< int > &activeColsSet) |
Find the active columns for some block. More... | |
const std::string | getInstanceName () |
Get Intance name. More... | |
const CoinPackedMatrix * | getMatrix () |
Get constraint matrix for analysis. More... | |
void | setInfinity () |
Set the value of infinity. More... | |
DecompApp (UtilParameters &utilParam) | |
Constructor for base DecompApp class. More... | |
virtual | ~DecompApp () |
Destructor. More... | |
void | startupLog () |
Initialize the DecompApp data. More... | |
int | createModel () |
virtual void | APPcreateModel (double *&objCoeff, map< int, DecompConstraintSet * > &modelCore, map< int, DecompConstraintSet * > &modelRelax)=0 |
virtual int | APPheuristics (const double *xhat, vector< DecompSolution * > &xhatIPFeas) |
virtual int | generateInitVars (DecompVarList &initVars, int whichModel) |
virtual int | generateCuts (const double *x, const DecompConstraintSet &modelCore, const DecompConstraintSet &modelRelax, DecompCutList &newCuts) |
virtual decompStat | APPsolveRelaxed (const int whichModel, const double *redCostX, const double *origCost, const double alpha, const int n_origCols, const bool checkRC, const bool checkDup, OsiSolverInterface *m_subprobSI, list< DecompVar * > &vars) |
virtual void | printOriginalSolution (const int n_cols, const double *solution, ostream *os=&cout) const |
DecompApp (UtilParameters &utilParam) | |
virtual | ~DecompApp () |
void | preprocess () |
Preprocess (standard ): on the TODO list. More... | |
void | startupLog () |
Print startup message to log. More... | |
int | createModel () |
Preprocess (standard ): on the TODO list. More... | |
const double | getBestKnownLB () const |
Preprocess (standard ): on the TODO list. More... | |
const double | getBestKnownUB () const |
Preprocess (standard ): on the TODO list. More... | |
void | setBestKnownLB (const double bestKnownLB) |
Preprocess (standard ): on the TODO list. More... | |
void | setBestKnownUB (const double bestKnownUB) |
Preprocess (standard ): on the TODO list. More... | |
void | setModelObjective (const double *objective, const int length) |
Set the model objective function. More... | |
void | setModelCore (DecompConstraintSet *model, const std::string modelName) |
Set the model core constraint matrix. More... | |
void | setModelRelax (DecompConstraintSet *model, const std::string modelName="", const int blockId=0) |
Set the model relaxed constraint matrix (for a particular block). More... | |
void | setModelRelaxNest (DecompConstraintSet *model, const std::string modelName, const int blockId=0) |
Set the model relaxed (nested) constraint matrix (for a particular block). More... | |
DecompAlgo * | getDecompAlgo () const |
Get a pointer to the base algorithm class. More... | |
virtual void | initDualVector (std::vector< double > &dualVector) |
Initialize the dual vector for PhaseII of PC. More... | |
virtual int | APPheuristics (const double *xhat, const double *origCost, std::vector< DecompSolution * > &xhatIPFeas) |
Initialize the dual vector for PhaseII of PC. More... | |
virtual const double * | getDualForGenerateVars (const double *dual) |
This function allows the user to return their own dual vector to be used in the generation of new variables (in the reduced-cost calculation). More... | |
virtual int | generateInitVars (DecompVarList &initVars) |
Initialize the dual vector for PhaseII of PC. More... | |
virtual void | solveRelaxedWhich (std::vector< int > &blocksToSolve, std::map< int, std::vector< double > > &userDualsByBlock) |
Initialize the dual vector for PhaseII of PC. More... | |
virtual DecompSolverStatus | solveRelaxedNest (const int whichBlock, const double *redCostX, const double target, DecompVarList &varList) |
Initialize the dual vector for PhaseII of PC. More... | |
virtual void | printOriginalColumn (const int index, std::ostream *os=&std::cout) const |
Initialize the dual vector for PhaseII of PC. More... | |
virtual void | printOriginalSolution (const int n_cols, const std::vector< std::string > &colNames, const double *solution, std::ostream *os=&std::cout) const |
Initialize the dual vector for PhaseII of PC. More... | |
Private Member Functions | |
Helper functions (private). | |
void | initializeApp () |
Guts of constructor. More... | |
void | createModels () |
Create models. More... | |
void | createModel2Match (DecompConstraintSet *modelCS) |
Create the two-matching constraints. More... | |
void | createModelTrivialSEC (DecompConstraintSet *modelCS) |
Create trivial subtour elimination constraints. More... | |
int | generateCutsSubtour (DecompCutList &newCuts) |
Guts of constructor. More... | |
void | solveOneTree (const double *cost, const double alpha, vector< pair< int, double > > &edge_cost, DecompVarList &vars, Graph &g) |
Guts of constructor. More... | |
Private Attributes | |
const string | m_classTag |
Class id tag (for log / debugging). More... | |
TSP_Param | m_appParam |
Application specific parameters. More... | |
TSP_Instance | m_tsp |
Storage of TSP instance. More... | |
double * | m_objective |
The model objective coefficients (original space). More... | |
vector< DecompConstraintSet * > | m_models |
The various model constraint systems used for different algos. More... | |
Additional Inherited Members | |
![]() | |
int | NumBlocks |
Number of Blocks defalut value 0 set by BlockNumInput parameter. More... | |
DecompParam | m_param |
Parameters. More... | |
UtilParameters * | m_utilParam |
const double * | m_objective |
Model data: objective function. More... | |
DecompModel | m_modelCore |
Model data: the core model (A'') More... | |
std::map< int, DecompModel > | m_modelRelax |
Model data: the relaxed model(s) (A') More... | |
std::map< int, std::vector < DecompModel > > | m_modelRelaxNest |
Model data: the relaxed (nested) model(s) (A') More... | |
DecompAlgo * | m_decompAlgo |
Pointer to the base algorithmic object. More... | |
CoinMpsIO | m_mpsIO |
MPS object for reading instances. More... | |
CoinLpIO | m_lpIO |
LP object for reading instances. More... | |
const CoinPackedMatrix * | m_matrix |
Original constraint matrix for the instance. More... | |
DecompConstraintSet * | m_modelC |
The model constraint systems used for different algos. More... | |
std::map< int, DecompConstraintSet * > | m_modelR |
std::map< int, std::vector< int > > | m_blocks |
Definition of blocks (by rows) More... | |
int | m_threadIndex |
serves as an index to track different DecompApp object during Concurrent process, where when m_threadIndex is 0, problem is solved by cutting plance from standalone solver, when it is greater than 0, it is solved by branch-and-price, More... | |
double | m_infinity |
The value of infinity. More... | |
DecompModel | m_model |
map< int, DecompConstraintSet * > | m_modelCore |
map< int, DecompConstraintSet * > | m_modelRelax |
![]() | |
std::ostream * | m_osLog |
Log file. More... | |
double | m_bestKnownLB |
The best known LB/UB for this application (if known, for debugging). More... | |
double | m_bestKnownUB |
ostream * | m_osLog |
A DecompApp for solving the Traveling Salesman Problem.
Definition at line 35 of file TSP_DecompApp.h.
|
inline |
Default constructor.
Takes an instance of UtilParameters
Definition at line 98 of file TSP_DecompApp.h.
References TSP_Param::dumpSettings(), TSP_Param::getSettings(), initializeApp(), TSP_Param::LogLevel, and m_appParam.
|
inlinevirtual |
Default constructor.
Takes an instance of UtilParameters
Definition at line 113 of file TSP_DecompApp.h.
References m_models, m_objective, UTIL_DELARR, and UtilDeleteVectorPtr().
|
virtual |
Solve the relaxed problem.
Reimplemented from DecompApp.
|
virtual |
Initialize the dual vector for PhaseII of PC.
The user is passed a reference to the internal data and can manipulate it directly.
This is only called when dual stabilization is used, i.e., when m_param.DualStab > 0, at the first iteration of PhaseII of PC. The vector is immediately smoothed with the initial restricted master duals. By default, the restricted mater is used as the initial dual and, therefore, no smoothing occurs in the first iteration.
Reimplemented from DecompApp.
|
virtual |
Method to determine if the solution (x) is feasible to the original model.
For explicitly defined model components, like the model core constraints (A''), the feasibility of the solution is automatically checked against the constraints. In the case when the relaxed problem constraints (A') are explicitly defined - these are also checked automatically.
However, for some applications, a valid feasible constraint system cannot be explicitly defined (even for the core set of constraints). For example, think of the case of TSP, where A'' is defined as the subtour elimination constraints. These constraints are implicitly defined by deriving the method DecompApp::generateCuts. Therefore, the framework cannot automatically tell if a solution is feasible by checking against the constraint system. In this case, the user must provide this method.
[in] | x | The solution point to check. |
[in] | numCols | The number of variables. |
[in] | tolZero | The integrality tolerance (currently ignored). |
Reimplemented from DecompApp.
|
virtual |
Reimplemented from DecompApp.
|
privatevirtual |
|
private |
Create models.
|
private |
Create the two-matching constraints.
|
private |
Create trivial subtour elimination constraints.
|
private |
Guts of constructor.
|
private |
Guts of constructor.
|
private |
Class id tag (for log / debugging).
Definition at line 38 of file TSP_DecompApp.h.
|
private |
Application specific parameters.
Definition at line 41 of file TSP_DecompApp.h.
Referenced by TSP_DecompApp().
|
private |
Storage of TSP instance.
Definition at line 44 of file TSP_DecompApp.h.
|
private |
The model objective coefficients (original space).
Definition at line 47 of file TSP_DecompApp.h.
Referenced by ~TSP_DecompApp().
|
private |
The various model constraint systems used for different algos.
Definition at line 50 of file TSP_DecompApp.h.
Referenced by ~TSP_DecompApp().