Dip  0.92.4
Public Types | Public Member Functions | Protected Attributes | Private Attributes | List of all members
AP3_DecompApp Class Reference

#include <AP3_DecompApp.h>

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

Public Types

enum  ModelType { MODEL_I, MODEL_J, MODEL_K }
 Model types. More...
 

Public Member Functions

void APPcreateModel (double *&objCoeff, map< int, DecompConstraintSet * > &modelCore, map< int, vector< DecompConstraintSet * > > &modelRelax)
 Create the application model(s). More...
 
DecompStatus 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)
 Solve the relaxed problem. More...
 
void printOriginalColumn (const int index, ostream *os=&cout) const
 Print an original column. More...
 
Helper functions (public).
const double getKnownOptimalBound () const
 Get optimal (or best known) objective. More...
 
const string getInstanceName () const
 Get name of instance. More...
 
int indexIJK (const int i, const int j, const int k) const
 Global index for column (i,j,k) in 3D case. More...
 
int indexJIK (const int j, const int i, const int k) const
 Get optimal (or best known) objective. More...
 
int indexKIJ (const int k, const int i, const int j) const
 Get optimal (or best known) objective. More...
 
void index3Inv (const int index, int &ind1, int &ind2, int &ind3) const
 Global index for column (ind1, ind2, ind3) in 3D case. More...
 
int index2 (const int ind1, const int ind2) const
 Global index for column (ind1, ind2) in 2D case. More...
 
pair< int, int > index2Inv (const int index) const
 Return the indices (ind1, ind2) for 2D case. More...
 
const double getOptBound () const
 Return the known optimal bound. More...
 
Constructor and Destructor
 AP3_DecompApp (UtilParameters &utilParam)
 Default constructor. More...
 
virtual ~AP3_DecompApp ()
 Default constructor. More...
 
- Public Member Functions inherited from DecompApp
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 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...
 
DecompAlgogetDecompAlgo () 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 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)
 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 int generateCuts (const double *x, DecompCutList &newCuts)
 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 solveRelaxed (const int whichBlock, const double *redCostX, const double target, DecompVarList &varList)
 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...
 

Protected Attributes

AP3_DecompParam m_appParam
 Application specific parameters. More...
 
- Protected Attributes inherited from DecompApp
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
 

Private Member Functions

Helper functions (private).
void initializeApp (UtilParameters &utilParam) throw (CoinError)
 Guts of constructor. More...
 
void createModelPart (const int modelType, int *rowInd, double *rowEls, DecompConstraintSet *modelCore, DecompConstraintSet *modelRelax) throw (CoinError)
 Create constraint system for one relaxation. More...
 
Copy Constructors

Disable the default copy constructors.

 AP3_DecompApp (const AP3_DecompApp &)
 
AP3_DecompAppoperator= (const AP3_DecompApp &)
 

Private Attributes

const string m_classTag
 Class id tag (for log / debugging). More...
 
AP3_Instance m_ap3data
 AP3 problem instance data. More...
 
map< int, vector< int > > m_intersection
 Helper data for fast cut separation. More...
 
OsiSolverInterfacem_siAP
 Helper data for fast construction of relaxed problems. More...
 
double ** m_assigncostMin
 
int ** m_assignindexMin
 

Additional Inherited Members

- Public Attributes inherited from DecompApp
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
 
map< int, DecompConstraintSet * > m_modelCore
 
map< int, DecompConstraintSet * > m_modelRelax
 

Detailed Description

A DecompApp for solving the 3-Indexed Assignment Problem (AP3).

See Also
DecompApp

Definition at line 34 of file AP3_DecompApp.h.

Member Enumeration Documentation

Model types.

Enumerator
MODEL_I 

Relaxation is 2-D Assignment Problem over JxK.

MODEL_J 

Relaxation is 2-D Assignment Problem over IxK.

MODEL_K 

Relaxation is 2-D Assignment Problem over IxJ.

Definition at line 58 of file AP3_DecompApp.h.

Constructor & Destructor Documentation

AP3_DecompApp::AP3_DecompApp ( const AP3_DecompApp )
private
AP3_DecompApp::AP3_DecompApp ( UtilParameters utilParam)
inline

Default constructor.

Takes an instance of UtilParameters

Definition at line 186 of file AP3_DecompApp.h.

References DecompApp::initializeApp().

virtual AP3_DecompApp::~AP3_DecompApp ( )
inlinevirtual

Default constructor.

Takes an instance of UtilParameters

Definition at line 198 of file AP3_DecompApp.h.

References m_ap3data, m_assigncostMin, m_assignindexMin, AP3_Instance::m_dimension, m_siAP, UTIL_DELARR, and UTIL_DELPTR.

Member Function Documentation

void AP3_DecompApp::APPcreateModel ( double *&  objCoeff,
map< int, DecompConstraintSet * > &  modelCore,
map< int, vector< DecompConstraintSet * > > &  modelRelax 
)

Create the application model(s).

DecompStatus AP3_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 
)
virtual

Solve the relaxed problem.

Reimplemented from DecompApp.

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

Print an original column.

Reimplemented from DecompApp.

const double AP3_DecompApp::getKnownOptimalBound ( ) const
inline

Get optimal (or best known) objective.

Definition at line 99 of file AP3_DecompApp.h.

References m_ap3data, and AP3_Instance::m_optBound.

const string AP3_DecompApp::getInstanceName ( ) const
inline

Get name of instance.

Definition at line 104 of file AP3_DecompApp.h.

References m_ap3data, and AP3_Instance::m_instance.

int AP3_DecompApp::indexIJK ( const int  i,
const int  j,
const int  k 
) const
inline

Global index for column (i,j,k) in 3D case.

Definition at line 109 of file AP3_DecompApp.h.

References m_ap3data, and AP3_Instance::m_dimension.

int AP3_DecompApp::indexJIK ( const int  j,
const int  i,
const int  k 
) const
inline

Get optimal (or best known) objective.

Definition at line 115 of file AP3_DecompApp.h.

References m_ap3data, and AP3_Instance::m_dimension.

int AP3_DecompApp::indexKIJ ( const int  k,
const int  i,
const int  j 
) const
inline

Get optimal (or best known) objective.

Definition at line 121 of file AP3_DecompApp.h.

References m_ap3data, and AP3_Instance::m_dimension.

void AP3_DecompApp::index3Inv ( const int  index,
int &  ind1,
int &  ind2,
int &  ind3 
) const
inline

Global index for column (ind1, ind2, ind3) in 3D case.

Definition at line 129 of file AP3_DecompApp.h.

References m_ap3data, and AP3_Instance::m_dimension.

int AP3_DecompApp::index2 ( const int  ind1,
const int  ind2 
) const
inline

Global index for column (ind1, ind2) in 2D case.

Definition at line 143 of file AP3_DecompApp.h.

References m_ap3data, and AP3_Instance::m_dimension.

pair<int,int> AP3_DecompApp::index2Inv ( const int  index) const
inline

Return the indices (ind1, ind2) for 2D case.

Definition at line 150 of file AP3_DecompApp.h.

References m_ap3data, and AP3_Instance::m_dimension.

const double AP3_DecompApp::getOptBound ( ) const
inline

Return the known optimal bound.

Definition at line 156 of file AP3_DecompApp.h.

References m_ap3data, and AP3_Instance::m_optBound.

void AP3_DecompApp::initializeApp ( UtilParameters utilParam)
throw (CoinError
)
private

Guts of constructor.

void AP3_DecompApp::createModelPart ( const int  modelType,
int *  rowInd,
double *  rowEls,
DecompConstraintSet modelCore,
DecompConstraintSet modelRelax 
)
throw (CoinError
)
private

Create constraint system for one relaxation.

AP3_DecompApp& AP3_DecompApp::operator= ( const AP3_DecompApp )
private

Member Data Documentation

const string AP3_DecompApp::m_classTag
private

Class id tag (for log / debugging).

Definition at line 37 of file AP3_DecompApp.h.

AP3_Instance AP3_DecompApp::m_ap3data
private
map<int, vector<int> > AP3_DecompApp::m_intersection
private

Helper data for fast cut separation.

Definition at line 45 of file AP3_DecompApp.h.

OsiSolverInterface* AP3_DecompApp::m_siAP
private

Helper data for fast construction of relaxed problems.

Definition at line 48 of file AP3_DecompApp.h.

Referenced by ~AP3_DecompApp().

double** AP3_DecompApp::m_assigncostMin
private

Definition at line 49 of file AP3_DecompApp.h.

Referenced by ~AP3_DecompApp().

int** AP3_DecompApp::m_assignindexMin
private

Definition at line 50 of file AP3_DecompApp.h.

Referenced by ~AP3_DecompApp().

AP3_DecompParam AP3_DecompApp::m_appParam
protected

Application specific parameters.

Definition at line 54 of file AP3_DecompApp.h.


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