18 #ifndef DECOMP_APP_INCLUDED
19 #define DECOMP_APP_INCLUDED
31 #if defined (COIN_HAS_METIS)
195 double* obj =
new double[length];
196 memcpy(obj, objective, length *
sizeof(
double));
209 const std::string modelName) {
245 const std::string modelName =
"",
246 const int blockId = 0) {
254 std::map<int, DecompAppModel>::iterator mit =
m_modelRelax.find(blockId);
257 std::cerr <<
"Block " << blockId <<
" relaxation has already been set. "
258 <<
"Only one relaxation definition can be used at one time."
261 "setModelRelax",
"DecompApp");
273 const std::string modelName,
274 const int blockId = 0) {
344 const double tolZero) {
349 const double* origCost,
350 std::vector<DecompSolution*>& xhatIPFeas) {
373 std::vector<double> >& userDualsByBlock) {
377 const double* redCostX,
383 const double* redCostX,
391 std::ostream* os = &std::cout)
const;
396 const std::vector<std::string>& colNames,
397 const double* solution,
398 std::ostream* os = &std::cout)
const;
416 const int* rowsPart);
420 const int* rowsPart);
424 const int* rowsPart);
442 std::set<int>& activeColsSet);
std::list< DecompCut * > DecompCutList
const CoinPackedMatrix * m_matrix
Original constraint matrix for the instance.
void setModelObjective(const double *objective, const int length)
Set the model objective function.
std::map< int, DecompConstraintSet * > m_modelR
virtual void solveRelaxedWhich(std::vector< int > &blocksToSolve, std::map< int, std::vector< double > > &userDualsByBlock)
Initialize the dual vector for PhaseII of PC.
virtual void initDualVector(std::vector< double > &dualVector)
Initialize the dual vector for PhaseII of PC.
DecompAlgo * m_decompAlgo
Pointer to the base algorithmic object.
const double getBestKnownUB() const
Preprocess (standard ): on the TODO list.
void prepareModel(bool modelIsCore=false)
Class to read and write Lp files.
std::string m_classTag
Store the name of the class (for logging/debugging) - "who am I?".
void setBestKnownLB(const double bestKnownLB)
Preprocess (standard ): on the TODO list.
virtual void printOriginalColumn(const int index, std::ostream *os=&std::cout) const
Initialize the dual vector for PhaseII of PC.
DecompApp(UtilParameters &utilParam)
Constructor for base DecompApp class.
std::map< int, DecompAppModel > m_modelRelax
Model data: the relaxed model(s) (A')
void singlyBorderStructureDetection()
Automatically detect singly bordered structure.
void setModelRelaxNest(DecompConstraintSet *model, const std::string modelName, const int blockId=0)
Set the model relaxed (nested) constraint matrix (for a particular block).
DecompAppModel m_modelCore
Model data: the core model (A'')
Sparse Matrix Base Class.
void setModelCore(DecompConstraintSet *model, const std::string modelName)
Set the model core constraint matrix.
int m_threadIndex
serves as an index to track different DecompApp object during Concurrent process, where when m_thread...
void setBestKnownUB(const double bestKnownUB)
Preprocess (standard ): on the TODO list.
void readBlockFile()
Read block file.
void setModel(DecompConstraintSet *model)
void preprocess()
Preprocess (standard ): on the TODO list.
const double * m_objective
Model data: objective function.
std::map< int, std::vector< int > > m_blocks
Definition of blocks (by rows)
virtual int generateCuts(const double *x, DecompCutList &newCuts)
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 ~DecompApp()
Destructor.
std::ostream * m_osLog
Log file.
void getSettings(UtilParameters ¶m)
void createModelPartSparse(DecompConstraintSet *model, const int nRowsPart, const int *rowsPart)
void startupLog()
Print startup message to log.
const std::string getInstanceName()
Get Intance name.
CoinLpIO m_lpIO
LP object for reading instances.
DecompAlgo * getDecompAlgo() const
Get a pointer to the base algorithm class.
virtual void initializeApp(UtilParameters &utilParam)
Initialize applications.
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 var...
std::map< int, std::vector< DecompAppModel > > m_modelRelaxNest
Model data: the relaxed (nested) model(s) (A')
void setModelName(const std::string modelName)
const CoinPackedMatrix * readProblem(UtilParameters &utilParam)
Read Problem.
virtual int generateInitVars(DecompVarList &initVars)
Initialize the dual vector for PhaseII of PC.
void findActiveColumns(const std::vector< int > &rowsPart, std::set< int > &activeColsSet)
Find the active columns for some block.
double m_bestKnownLB
The best known LB/UB for this application (if known, for debugging).
DecompParam m_param
Parameters.
#define UtilException(msg, methodN, classN)
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.
int createModel()
Preprocess (standard ): on the TODO list.
virtual int APPheuristics(const double *xhat, const double *origCost, std::vector< DecompSolution * > &xhatIPFeas)
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.
Base class for DECOMP algorithms.
virtual DecompSolverStatus solveRelaxed(const int whichBlock, const double *redCostX, const double target, DecompVarList &varList)
Initialize the dual vector for PhaseII of PC.
void readInitSolutionFile(DecompVarList &initVars)
std::string Instance
0: print nothing 1: print the node objective history
CoinMpsIO m_mpsIO
MPS object for reading instances.
void createModels()
Create model parts.
const double getBestKnownLB() const
Preprocess (standard ): on the TODO list.
const bool hasPrepRun() const
void setModelRelax(DecompConstraintSet *model, const std::string modelName="", const int blockId=0)
Set the model relaxed constraint matrix (for a particular block).
std::list< DecompVar * > DecompVarList
DecompConstraintSet * createModelPart(const int nRowsPart, const int *rowsPart)
void UtilDeleteMapPtr(std::map< S, T * > &mapPtr, typename std::map< S, T * >::iterator first, typename std::map< S, T * >::iterator last)
DecompConstraintSet * m_modelC
The model constraint systems used for different algos.
The main application class.
int NumBlocks
Number of Blocks defalut value 0 set by BlockNumInput parameter.