Dip  0.92.4
Public Member Functions | Public Attributes | Protected Attributes | List of all members
DecompApp Class Referenceabstract

The main application class. More...

#include <DecompApp.h>

+ Inheritance diagram for DecompApp:
+ Collaboration diagram for DecompApp:

Public Member Functions

virtual void initializeApp ()
 Initialize applications. More...
 
void createModels ()
 Create model parts. More...
 
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. 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 CoinPackedMatrixgetMatrix ()
 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 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. More...
 
void startupLog ()
 Print startup message to log. More...
 
int createModel ()
 
const double getBestKnownLB () const
 
const double getBestKnownUB () const
 
void setBestKnownLB (const double bestKnownLB)
 
void setBestKnownUB (const double bestKnownUB)
 
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...
 
DecompAlgogetDecompAlgo () const
 Get a pointer to the base algorithm class. More...
 
Interface methods for user derivation (virtual).
virtual void initDualVector (std::vector< double > &dualVector)
 Initialize the dual vector for PhaseII of PC. More...
 
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. More...
 
virtual int APPheuristics (const double *xhat, const double *origCost, std::vector< DecompSolution * > &xhatIPFeas)
 
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)
 
virtual int generateCuts (const double *x, DecompCutList &newCuts)
 
virtual void solveRelaxedWhich (std::vector< int > &blocksToSolve, std::map< int, std::vector< double > > &userDualsByBlock)
 
virtual DecompSolverStatus solveRelaxed (const int whichBlock, const double *redCostX, const double target, DecompVarList &varList)
 
virtual DecompSolverStatus solveRelaxedNest (const int whichBlock, const double *redCostX, const double target, DecompVarList &varList)
 
virtual void printOriginalColumn (const int index, std::ostream *os=&std::cout) const
 
virtual void printOriginalSolution (const int n_cols, const std::vector< std::string > &colNames, const double *solution, std::ostream *os=&std::cout) const
 

Public Attributes

int NumBlocks
 Number of Blocks defalut value 0 set by BlockNumInput parameter. More...
 
DecompParam m_param
 Parameters. More...
 
UtilParametersm_utilParam
 
const double * m_objective
 Model data: objective function. More...
 
DecompModel m_modelCore
 Model data: the core model (A'') More...
 
std::map< int, DecompModelm_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...
 
DecompAlgom_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 CoinPackedMatrixm_matrix
 Original constraint matrix for the instance. More...
 
DecompConstraintSetm_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
 Model data object. More...
 
map< int, DecompConstraintSet * > m_modelCore
 
map< int, DecompConstraintSet * > m_modelRelax
 

Protected Attributes

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
 Log file. More...
 

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 48 of file DecompApp.h.

Constructor & Destructor Documentation

◆ DecompApp() [1/2]

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 442 of file DecompApp.h.

◆ ~DecompApp() [1/2]

virtual DecompApp::~DecompApp ( )
inlinevirtual

Destructor.

Definition at line 472 of file DecompApp.h.

◆ DecompApp() [2/2]

DecompApp::DecompApp ( UtilParameters utilParam)
inline

Definition at line 137 of file DecompApp.h.

◆ ~DecompApp() [2/2]

virtual DecompApp::~DecompApp ( )
inlinevirtual

Definition at line 146 of file DecompApp.h.

Member Function Documentation

◆ preprocess()

void DecompApp::preprocess ( )

Preprocess (standard ): on the TODO list.

◆ startupLog() [1/2]

void DecompApp::startupLog ( )

Print startup message to log.

◆ createModel() [1/2]

int DecompApp::createModel ( )

◆ getBestKnownLB()

const double DecompApp::getBestKnownLB ( ) const
inline

Definition at line 169 of file DecompApp.h.

◆ getBestKnownUB()

const double DecompApp::getBestKnownUB ( ) const
inline

Definition at line 172 of file DecompApp.h.

◆ setBestKnownLB()

void DecompApp::setBestKnownLB ( const double  bestKnownLB)
inline

Definition at line 176 of file DecompApp.h.

◆ setBestKnownUB()

void DecompApp::setBestKnownUB ( const double  bestKnownUB)
inline

Definition at line 179 of file DecompApp.h.

◆ setModelObjective()

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 189 of file DecompApp.h.

◆ setModelCore()

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 205 of file DecompApp.h.

◆ setModelRelax()

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

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.

◆ setModelRelaxNest()

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

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

◆ getDecompAlgo()

DecompAlgo* DecompApp::getDecompAlgo ( ) const
inline

Get a pointer to the base algorithm class.

Definition at line 256 of file DecompApp.h.

◆ initDualVector()

virtual void DecompApp::initDualVector ( std::vector< double > &  dualVector)
inlinevirtual

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 282 of file DecompApp.h.

◆ APPisUserFeasible() [1/2]

virtual bool DecompApp::APPisUserFeasible ( const double *  x,
const int  numCols,
const double  tolZero 
)
inlinevirtual

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]xThe solution point to check.
[in]numColsThe number of variables.
[in]tolZeroThe integrality tolerance (currently ignored).
Returns
True, if x is feasible; otherwise, false.

Reimplemented in DippyDecompApp.

Definition at line 310 of file DecompApp.h.

◆ APPheuristics() [1/2]

virtual int DecompApp::APPheuristics ( const double *  xhat,
const double *  origCost,
std::vector< DecompSolution * > &  xhatIPFeas 
)
inlinevirtual

Reimplemented in DippyDecompApp.

Definition at line 316 of file DecompApp.h.

◆ getDualForGenerateVars()

virtual const double* DecompApp::getDualForGenerateVars ( const double *  dual)
inlinevirtual

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 330 of file DecompApp.h.

◆ generateInitVars() [1/2]

virtual int DecompApp::generateInitVars ( DecompVarList initVars)
virtual

Reimplemented in DippyDecompApp.

◆ generateCuts() [1/2]

virtual int DecompApp::generateCuts ( const double *  x,
DecompCutList newCuts 
)
virtual

Reimplemented in DippyDecompApp.

◆ solveRelaxedWhich()

virtual void DecompApp::solveRelaxedWhich ( std::vector< int > &  blocksToSolve,
std::map< int, std::vector< double > > &  userDualsByBlock 
)
inlinevirtual

Definition at line 339 of file DecompApp.h.

◆ solveRelaxed()

virtual DecompSolverStatus DecompApp::solveRelaxed ( const int  whichBlock,
const double *  redCostX,
const double  target,
DecompVarList varList 
)
inlinevirtual

Reimplemented in DippyDecompApp.

Definition at line 344 of file DecompApp.h.

◆ solveRelaxedNest()

virtual DecompSolverStatus DecompApp::solveRelaxedNest ( const int  whichBlock,
const double *  redCostX,
const double  target,
DecompVarList varList 
)
inlinevirtual

Definition at line 350 of file DecompApp.h.

◆ printOriginalColumn() [1/2]

virtual void DecompApp::printOriginalColumn ( const int  index,
std::ostream *  os = &std::cout 
) const
virtual

◆ printOriginalSolution() [1/2]

virtual void DecompApp::printOriginalSolution ( const int  n_cols,
const std::vector< std::string > &  colNames,
const double *  solution,
std::ostream *  os = &std::cout 
) const
virtual

◆ initializeApp()

virtual void DecompApp::initializeApp ( )
virtual

Initialize applications.

◆ createModels()

void DecompApp::createModels ( )

Create model parts.

◆ createModelPart() [1/2]

DecompConstraintSet* DecompApp::createModelPart ( const int  nRowsPart,
const int *  rowsPart 
)

◆ createModelPart() [2/2]

void DecompApp::createModelPart ( DecompConstraintSet model,
const int  nRowsPart,
const int *  rowsPart 
)

◆ createModelPartSparse()

void DecompApp::createModelPartSparse ( DecompConstraintSet model,
const int  nRowsPart,
const int *  rowsPart 
)

◆ readInitSolutionFile()

void DecompApp::readInitSolutionFile ( DecompVarList initVars)

◆ readBlockFile()

void DecompApp::readBlockFile ( )

Read block file.

◆ readProblem()

void DecompApp::readProblem ( )

Read Problem.

◆ singlyBorderStructureDetection()

void DecompApp::singlyBorderStructureDetection ( )

Automatically detect singly bordered structure.

◆ findActiveColumns()

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

Find the active columns for some block.

◆ getInstanceName()

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

Get Intance name.

Definition at line 414 of file DecompApp.h.

◆ getMatrix()

const CoinPackedMatrix* DecompApp::getMatrix ( )
inline

Get constraint matrix for analysis.

Definition at line 429 of file DecompApp.h.

◆ setInfinity()

void DecompApp::setInfinity ( )

Set the value of infinity.

◆ startupLog() [2/2]

void DecompApp::startupLog ( )

Initialize the DecompApp data.

◆ createModel() [2/2]

int DecompApp::createModel ( )

◆ APPcreateModel()

virtual void DecompApp::APPcreateModel ( double *&  objCoeff,
map< int, DecompConstraintSet * > &  modelCore,
map< int, DecompConstraintSet * > &  modelRelax 
)
pure virtual

◆ APPisUserFeasible() [2/2]

virtual bool DecompApp::APPisUserFeasible ( const double *  x,
const int  n_cols,
const double  tolZero 
)
inlinevirtual

Reimplemented in DippyDecompApp.

Definition at line 95 of file DecompApp.h.

◆ APPheuristics() [2/2]

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

Definition at line 101 of file DecompApp.h.

◆ generateInitVars() [2/2]

virtual int DecompApp::generateInitVars ( DecompVarList initVars,
int  whichModel 
)
virtual

◆ generateCuts() [2/2]

virtual int DecompApp::generateCuts ( const double *  x,
const DecompConstraintSet modelCore,
const DecompConstraintSet modelRelax,
DecompCutList newCuts 
)
virtual

◆ APPsolveRelaxed()

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

Definition at line 115 of file DecompApp.h.

◆ printOriginalColumn() [2/2]

virtual void DecompApp::printOriginalColumn ( const int  index,
ostream *  os = &cout 
) const
virtual

◆ printOriginalSolution() [2/2]

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

Member Data Documentation

◆ m_osLog [1/2]

std::ostream* DecompApp::m_osLog
protected

Log file.

Definition at line 60 of file DecompApp.h.

◆ m_bestKnownLB

double DecompApp::m_bestKnownLB
protected

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

Definition at line 65 of file DecompApp.h.

◆ m_bestKnownUB

double DecompApp::m_bestKnownUB
protected

Definition at line 66 of file DecompApp.h.

◆ NumBlocks

int DecompApp::NumBlocks

Number of Blocks defalut value 0 set by BlockNumInput parameter.

Definition at line 74 of file DecompApp.h.

◆ m_param

DecompParam DecompApp::m_param

Parameters.

Definition at line 79 of file DecompApp.h.

◆ m_utilParam

UtilParameters* DecompApp::m_utilParam

Definition at line 80 of file DecompApp.h.

◆ m_objective

const double* DecompApp::m_objective

Model data: objective function.

Definition at line 85 of file DecompApp.h.

◆ m_modelCore [1/2]

DecompModel DecompApp::m_modelCore

Model data: the core model (A'')

Definition at line 90 of file DecompApp.h.

◆ m_modelRelax [1/2]

std::map<int, DecompModel> DecompApp::m_modelRelax

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

Definition at line 95 of file DecompApp.h.

◆ m_modelRelaxNest

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

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

Definition at line 100 of file DecompApp.h.

◆ m_decompAlgo

DecompAlgo* DecompApp::m_decompAlgo

Pointer to the base algorithmic object.

NOTE: only for the advanced user

Definition at line 106 of file DecompApp.h.

◆ m_mpsIO

CoinMpsIO DecompApp::m_mpsIO

MPS object for reading instances.

Definition at line 113 of file DecompApp.h.

◆ m_lpIO

CoinLpIO DecompApp::m_lpIO

LP object for reading instances.

Definition at line 116 of file DecompApp.h.

◆ m_matrix

const CoinPackedMatrix* DecompApp::m_matrix

Original constraint matrix for the instance.

Definition at line 120 of file DecompApp.h.

◆ m_modelC

DecompConstraintSet* DecompApp::m_modelC

The model constraint systems used for different algos.

Definition at line 123 of file DecompApp.h.

◆ m_modelR

std::map<int, DecompConstraintSet*> DecompApp::m_modelR

Definition at line 124 of file DecompApp.h.

◆ m_blocks

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

Definition of blocks (by rows)

Definition at line 128 of file DecompApp.h.

◆ m_threadIndex

int DecompApp::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,

Definition at line 140 of file DecompApp.h.

◆ m_infinity

double DecompApp::m_infinity

The value of infinity.

Definition at line 144 of file DecompApp.h.

◆ m_osLog [2/2]

ostream* DecompApp::m_osLog
protected

Log file.

Definition at line 61 of file DecompApp.h.

◆ m_model

DecompModel DecompApp::m_model

Model data object.

Definition at line 72 of file DecompApp.h.

◆ m_modelCore [2/2]

map<int, DecompConstraintSet*> DecompApp::m_modelCore

Definition at line 73 of file DecompApp.h.

◆ m_modelRelax [2/2]

map<int, DecompConstraintSet*> DecompApp::m_modelRelax

Definition at line 74 of file DecompApp.h.


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