DecompApp Class Reference

The main application class. More...

#include <DecompApp.h>

Inheritance diagram for DecompApp:
Inheritance graph
[legend]
Collaboration diagram for DecompApp:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void initializeApp (UtilParameters &utilParam)
 Initialize applications.
void createModels ()
 Create model parts.
DecompConstraintSetcreateModelPart (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.
const CoinPackedMatrixreadProblem (UtilParameters &utilParam)
 Read Problem.
void singlyBorderStructureDetection ()
 Automatically detect singly bordered structure.
void findActiveColumns (const std::vector< int > &rowsPart, std::set< int > &activeColsSet)
 Find the active columns for some block.
const std::string getInstanceName ()
 Get Intance name.
 DecompApp (UtilParameters &utilParam)
 Constructor for base DecompApp class.
 DecompApp ()
virtual ~DecompApp ()
 Destructor.
void startupLog ()
 Initialize the DecompApp data.
int createModel ()
virtual void APPcreateModel (double *&objCoeff, map< int, DecompConstraintSet * > &modelCore, map< int, DecompConstraintSet * > &modelRelax)=0
virtual bool APPisUserFeasible (const double *x, const int n_cols, const double tolZero)
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 printOriginalColumn (const int index, ostream *os=&cout) const
virtual void printOriginalSolution (const int n_cols, const double *solution, ostream *os=&cout) const
 DecompApp (UtilParameters &utilParam)
virtual ~DecompApp ()
Helper functions.



void preprocess ()
 Preprocess (standard ): on the TODO list.
void startupLog ()
 Print startup message to log.
int createModel ()
 Preprocess (standard ): on the TODO list.
const double getBestKnownLB () const
 Preprocess (standard ): on the TODO list.
const double getBestKnownUB () const
 Preprocess (standard ): on the TODO list.
void setBestKnownLB (const double bestKnownLB)
 Preprocess (standard ): on the TODO list.
void setBestKnownUB (const double bestKnownUB)
 Preprocess (standard ): on the TODO list.
void setModelObjective (const double *objective, const int length)
 Set the model objective function.
void setModelCore (DecompConstraintSet *model, const std::string modelName)
 Set the model core constraint matrix.
void setModelRelax (DecompConstraintSet *model, const std::string modelName="", const int blockId=0)
 Set the model relaxed constraint matrix (for a particular block).
void setModelRelaxNest (DecompConstraintSet *model, const std::string modelName, const int blockId=0)
 Set the model relaxed (nested) constraint matrix (for a particular block).
DecompAlgogetDecompAlgo () const
 Get a pointer to the base algorithm class.
Interface methods for user derivation (virtual).



virtual void initDualVector (std::vector< double > &dualVector)
 Initialize the dual vector for PhaseII of PC.
virtual bool APPisUserFeasible (const double *x, const int numCols, const double tolZero)
 Method to determine if the solution (x) is feasible to the original model.
virtual int APPheuristics (const double *xhat, const double *origCost, std::vector< DecompSolution * > &xhatIPFeas)
 Initialize the dual vector for PhaseII of PC.
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).
virtual int generateInitVars (DecompVarList &initVars)
 Initialize the dual vector for PhaseII of PC.
virtual int generateCuts (const double *x, DecompCutList &newCuts)
 Initialize the dual vector for PhaseII of PC.
virtual void solveRelaxedWhich (std::vector< int > &blocksToSolve, std::map< int, std::vector< double > > &userDualsByBlock)
 Initialize the dual vector for PhaseII of PC.
virtual DecompSolverStatus solveRelaxed (const int whichBlock, const double *redCostX, const double target, DecompVarList &varList)
 Initialize the dual vector for PhaseII of PC.
virtual DecompSolverStatus solveRelaxedNest (const int whichBlock, const double *redCostX, const double target, DecompVarList &varList)
 Initialize the dual vector for PhaseII of PC.
virtual void printOriginalColumn (const int index, std::ostream *os=&std::cout) const
 Initialize the dual vector for PhaseII of PC.
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.

Public Attributes

int NumBlocks
 Number of Blocks defalut value 0 set by BlockNumInput parameter.
DecompParam m_param
 Parameters.
const double * m_objective
 Model data: objective function.
DecompAppModel m_modelCore
 Model data: the core model (A'').
std::map< int, DecompAppModelm_modelRelax
 Model data: the relaxed model(s) (A').
std::map< int, std::vector
< DecompAppModel > > 
m_modelRelaxNest
 Model data: the relaxed (nested) model(s) (A').
DecompAlgom_decompAlgo
 Pointer to the base algorithmic object.
CoinMpsIO m_mpsIO
 MPS object for reading instances.
CoinLpIO m_lpIO
 LP object for reading instances.
const CoinPackedMatrixm_matrix
 Original constraint matrix for the instance.
DecompConstraintSetm_modelC
 The model constraint systems used for different algos.
std::map< int,
DecompConstraintSet * > 
m_modelR
std::map< int, std::vector< int > > m_blocks
 Definition of blocks (by rows).
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,
DecompModel m_model
map< int, DecompConstraintSet * > m_modelCore
map< int, DecompConstraintSet * > m_modelRelax

Protected Attributes

std::ostream * m_osLog
 Log file.
double m_bestKnownLB
 The best known LB/UB for this application (if known, for debugging).
double m_bestKnownUB
ostream * m_osLog

Private Member Functions

 DecompApp (const DecompApp &)
DecompAppoperator= (const DecompApp &)

Private Attributes

std::string m_classTag
 Store the name of the class (for logging/debugging) - "who am I?".

Static Private Attributes

static const char * m_classTag

Detailed Description

The main application class.

The main application class where the user will define the model decomposition and define any application specific methods.

The main application class where the user will define the model decomposition and define any application specific methods.

See also:
DecompModel DecompConstraintSet DecompParam
Todo:
Clone a monkey.

Definition at line 50 of file DecompApp.h.


Constructor & Destructor Documentation

DecompApp::DecompApp ( UtilParameters utilParam  )  [inline]

Constructor for base DecompApp class.

This accepts a generic parameters object (UtilParameters) and reads in the parameter settings into the DecompApp paramter object.

Definition at line 468 of file DecompApp.h.

References DecompParam::getSettings(), m_param, and startupLog().

DecompApp::DecompApp (  )  [inline]

Definition at line 483 of file DecompApp.h.

virtual DecompApp::~DecompApp (  )  [inline, virtual]

Destructor.

Definition at line 505 of file DecompApp.h.

References m_modelC, m_modelR, m_objective, UTIL_DELARR, UTIL_DELPTR, and UtilDeleteMapPtr().

DecompApp::DecompApp ( const DecompApp  )  [private]

Disable copy constructors.

DecompApp::DecompApp ( UtilParameters utilParam  )  [inline]

Definition at line 137 of file DecompApp.h.

References DecompParam::getSettings(), m_param, and startupLog().

virtual DecompApp::~DecompApp (  )  [inline, virtual]

Definition at line 146 of file DecompApp.h.

References m_modelCore, m_modelRelax, and UTIL_DELPTR.


Member Function Documentation

void DecompApp::preprocess (  ) 

Preprocess (standard ): on the TODO list.

void DecompApp::startupLog (  ) 

Print startup message to log.

Referenced by DecompApp().

int DecompApp::createModel (  ) 

Preprocess (standard ): on the TODO list.

const double DecompApp::getBestKnownLB (  )  const [inline]

Preprocess (standard ): on the TODO list.

Definition at line 172 of file DecompApp.h.

References m_bestKnownLB.

const double DecompApp::getBestKnownUB (  )  const [inline]

Preprocess (standard ): on the TODO list.

Definition at line 175 of file DecompApp.h.

References m_bestKnownUB.

void DecompApp::setBestKnownLB ( const double  bestKnownLB  )  [inline]

Preprocess (standard ): on the TODO list.

Definition at line 179 of file DecompApp.h.

References m_bestKnownLB.

void DecompApp::setBestKnownUB ( const double  bestKnownUB  )  [inline]

Preprocess (standard ): on the TODO list.

Definition at line 182 of file DecompApp.h.

References m_bestKnownUB.

void DecompApp::setModelObjective ( const double *  objective,
const int  length 
) [inline]

Set the model objective function.

NOTE: The user application MUST call this method.

Definition at line 192 of file DecompApp.h.

References m_objective.

void DecompApp::setModelCore ( DecompConstraintSet model,
const std::string  modelName 
) [inline]

Set the model core constraint matrix.

NOTE: The user application MUST call this method.

Definition at line 208 of file DecompApp.h.

References DecompConstraintSet::hasPrepRun(), m_modelCore, DecompConstraintSet::prepareModel(), DecompAppModel::setModel(), and DecompAppModel::setModelName().

void DecompApp::setModelRelax ( DecompConstraintSet model,
const std::string  modelName = "",
const int  blockId = 0 
) [inline]

Set the model relaxed constraint matrix (for a particular block).

NOTE: The user application MUST call this method IF they are not deriving the function DecompApp::solveRelaxed.

Definition at line 244 of file DecompApp.h.

References DecompConstraintSet::hasPrepRun(), m_modelRelax, DecompConstraintSet::prepareModel(), and UtilException.

void DecompApp::setModelRelaxNest ( DecompConstraintSet model,
const std::string  modelName,
const int  blockId = 0 
) [inline]

Set the model relaxed (nested) constraint matrix (for a particular block).

Definition at line 272 of file DecompApp.h.

References DecompConstraintSet::hasPrepRun(), m_modelRelaxNest, and DecompConstraintSet::prepareModel().

DecompAlgo* DecompApp::getDecompAlgo (  )  const [inline]

Get a pointer to the base algorithm class.

Definition at line 288 of file DecompApp.h.

References m_decompAlgo.

Referenced by AlpsDecompSolution::print().

virtual void DecompApp::initDualVector ( std::vector< double > &  dualVector  )  [inline, 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.

Definition at line 314 of file DecompApp.h.

virtual bool DecompApp::APPisUserFeasible ( const double *  x,
const int  numCols,
const double  tolZero 
) [inline, 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.

Parameters:
[in] x The solution point to check.
Returns:
True, if x is feasible; otherwise, false.

Reimplemented in ATM_DecompApp, TSP_DecompApp, VRP_DecompApp, and DippyDecompApp.

Definition at line 340 of file DecompApp.h.

virtual int DecompApp::APPheuristics ( const double *  xhat,
const double *  origCost,
std::vector< DecompSolution * > &  xhatIPFeas 
) [inline, 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.

Definition at line 346 of file DecompApp.h.

virtual const double* DecompApp::getDualForGenerateVars ( const double *  dual  )  [inline, virtual]

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

For reference, the user is given the dual vector from the restricted master (or the stabilized dual, if using m_param.DualStab).

Definition at line 360 of file DecompApp.h.

virtual int DecompApp::generateInitVars ( DecompVarList initVars  )  [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 in SmallIP_DecompApp, SmallIP_DecompApp, and DippyDecompApp.

virtual int DecompApp::generateCuts ( const double *  x,
DecompCutList newCuts 
) [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 in TSP_DecompApp, VRP_DecompApp, and DippyDecompApp.

virtual void DecompApp::solveRelaxedWhich ( std::vector< int > &  blocksToSolve,
std::map< int, std::vector< double > > &  userDualsByBlock 
) [inline, 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.

Definition at line 369 of file DecompApp.h.

virtual DecompSolverStatus DecompApp::solveRelaxed ( const int  whichBlock,
const double *  redCostX,
const double  target,
DecompVarList varList 
) [inline, 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 in MMKP_DecompApp, SmallIP_DecompApp, TSP_DecompApp, VRP_DecompApp, and DippyDecompApp.

Definition at line 374 of file DecompApp.h.

References DecompSolStatNoSolution.

virtual DecompSolverStatus DecompApp::solveRelaxedNest ( const int  whichBlock,
const double *  redCostX,
const double  target,
DecompVarList varList 
) [inline, 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.

Definition at line 380 of file DecompApp.h.

References DecompSolStatNoSolution.

virtual void DecompApp::printOriginalColumn ( const int  index,
std::ostream *  os = &std::cout 
) const [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.

virtual void DecompApp::printOriginalSolution ( const int  n_cols,
const std::vector< std::string > &  colNames,
const double *  solution,
std::ostream *  os = &std::cout 
) const [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.

Referenced by AlpsDecompSolution::print().

virtual void DecompApp::initializeApp ( UtilParameters utilParam  )  [virtual]
void DecompApp::createModels (  ) 
DecompConstraintSet* DecompApp::createModelPart ( const int  nRowsPart,
const int *  rowsPart 
)
void DecompApp::createModelPart ( DecompConstraintSet model,
const int  nRowsPart,
const int *  rowsPart 
)
void DecompApp::createModelPartSparse ( DecompConstraintSet model,
const int  nRowsPart,
const int *  rowsPart 
)
void DecompApp::readInitSolutionFile ( DecompVarList initVars  ) 
void DecompApp::readBlockFile (  ) 

Read block file.

const CoinPackedMatrix* DecompApp::readProblem ( UtilParameters utilParam  ) 

Read Problem.

void DecompApp::singlyBorderStructureDetection (  ) 

Automatically detect singly bordered structure.

void DecompApp::findActiveColumns ( const std::vector< int > &  rowsPart,
std::set< int > &  activeColsSet 
)

Find the active columns for some block.

const std::string DecompApp::getInstanceName (  )  [inline]

Get Intance name.

Definition at line 444 of file DecompApp.h.

References DecompParam::Instance, and m_param.

DecompApp& DecompApp::operator= ( const DecompApp  )  [private]
void DecompApp::startupLog (  ) 

Initialize the DecompApp data.

int DecompApp::createModel (  ) 
virtual void DecompApp::APPcreateModel ( double *&  objCoeff,
map< int, DecompConstraintSet * > &  modelCore,
map< int, DecompConstraintSet * > &  modelRelax 
) [pure virtual]
virtual bool DecompApp::APPisUserFeasible ( const double *  x,
const int  n_cols,
const double  tolZero 
) [inline, virtual]

Reimplemented in ATM_DecompApp, TSP_DecompApp, VRP_DecompApp, and DippyDecompApp.

Definition at line 95 of file DecompApp.h.

virtual int DecompApp::APPheuristics ( const double *  xhat,
vector< DecompSolution * > &  xhatIPFeas 
) [inline, virtual]

Definition at line 101 of file DecompApp.h.

virtual int DecompApp::generateInitVars ( DecompVarList initVars,
int  whichModel 
) [virtual]
virtual int DecompApp::generateCuts ( const double *  x,
const DecompConstraintSet modelCore,
const DecompConstraintSet modelRelax,
DecompCutList newCuts 
) [virtual]
virtual decompStat DecompApp::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 
) [inline, virtual]

Definition at line 115 of file DecompApp.h.

References STAT_UNKNOWN.

virtual void DecompApp::printOriginalColumn ( const int  index,
ostream *  os = &cout 
) const [virtual]
virtual void DecompApp::printOriginalSolution ( const int  n_cols,
const double *  solution,
ostream *  os = &cout 
) const [virtual]

Member Data Documentation

std::string DecompApp::m_classTag [private]

Store the name of the class (for logging/debugging) - "who am I?".

Reimplemented in ATM_DecompApp, GAP_DecompApp, MCF_DecompApp, MILP_DecompApp, MMKP_DecompApp, SDPUC_DecompApp, SmallIP_DecompApp, TSP_DecompApp, VRP_DecompApp, and DippyDecompApp.

Definition at line 56 of file DecompApp.h.

std::ostream* DecompApp::m_osLog [protected]

Log file.

Definition at line 62 of file DecompApp.h.

double DecompApp::m_bestKnownLB [protected]

The best known LB/UB for this application (if known, for debugging).

Definition at line 67 of file DecompApp.h.

Referenced by getBestKnownLB(), and setBestKnownLB().

double DecompApp::m_bestKnownUB [protected]

Definition at line 68 of file DecompApp.h.

Referenced by getBestKnownUB(), and setBestKnownUB().

Number of Blocks defalut value 0 set by BlockNumInput parameter.

Definition at line 76 of file DecompApp.h.

const double* DecompApp::m_objective

Model data: the core model (A'').

Definition at line 92 of file DecompApp.h.

Referenced by setModelCore(), ~DecompApp(), and DippyDecompApp::~DippyDecompApp().

Model data: the relaxed model(s) (A').

Definition at line 97 of file DecompApp.h.

Referenced by setModelRelax(), ~DecompApp(), and DippyDecompApp::~DippyDecompApp().

std::map<int, std::vector<DecompAppModel> > DecompApp::m_modelRelaxNest

Model data: the relaxed (nested) model(s) (A').

Definition at line 102 of file DecompApp.h.

Referenced by setModelRelaxNest().

Pointer to the base algorithmic object.

NOTE: only for the advanced user

Definition at line 108 of file DecompApp.h.

Referenced by DecompAlgo::DecompAlgo(), and getDecompAlgo().

MPS object for reading instances.

Reimplemented in MILP_DecompApp.

Definition at line 117 of file DecompApp.h.

LP object for reading instances.

Definition at line 120 of file DecompApp.h.

Original constraint matrix for the instance.

Definition at line 124 of file DecompApp.h.

The model constraint systems used for different algos.

Definition at line 129 of file DecompApp.h.

Referenced by ~DecompApp().

Definition at line 130 of file DecompApp.h.

Referenced by ~DecompApp().

std::map<int, std::vector<int> > DecompApp::m_blocks

Definition of blocks (by rows).

Definition at line 135 of file DecompApp.h.

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,

Definition at line 147 of file DecompApp.h.

const char* DecompApp::m_classTag [static, private]

Store the name of the class (for logging/debugging) - "who am I?"

Reimplemented in ATM_DecompApp, GAP_DecompApp, MCF_DecompApp, MILP_DecompApp, MMKP_DecompApp, SDPUC_DecompApp, SmallIP_DecompApp, TSP_DecompApp, VRP_DecompApp, and DippyDecompApp.

Definition at line 55 of file DecompApp.h.

ostream* DecompApp::m_osLog [protected]

Log file.

Definition at line 61 of file DecompApp.h.

Model data object.

Definition at line 72 of file DecompApp.h.

Definition at line 73 of file DecompApp.h.

Definition at line 74 of file DecompApp.h.


The documentation for this class was generated from the following files:

Generated on 12 Feb 2015 for Dip-All by  doxygen 1.6.1