Dip-All  0.91.0
DecompAlgoD.h
Go to the documentation of this file.
1 //===========================================================================//
2 // This file is part of the DIP Solver Framework. //
3 // //
4 // DIP is distributed under the Eclipse Public License as part of the //
5 // COIN-OR repository (http://www.coin-or.org). //
6 // //
7 // Author: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8 // //
9 // Conceptual Design: Matthew Galati, SAS Institute Inc. //
10 // Ted Ralphs, Lehigh University //
11 // //
12 // Copyright (C) 2002-2015, Lehigh University, Matthew Galati, Ted Ralphs //
13 // All Rights Reserved. //
14 //===========================================================================//
15 
16 
17 //===========================================================================//
18 #ifndef DecompAlgoD_h_
19 #define DecompAlgoD_h_
20 
21 //===========================================================================//
27 //===========================================================================//
28 //THINK: derive from DecompAlgo or DecompAlgoPC?? THINK
29 //THINK: how can we reuse this object since call many times?
30 // if init phase is feasible, we are done....
31 
32 
33 //===========================================================================//
34 #include "DecompAlgoPC.h"
35 
36 //===========================================================================//
37 class DecompAlgoD : public DecompAlgoPC {
38 private:
39 
40  //----------------------------------------------------------------------//
45  //----------------------------------------------------------------------//
49  std::string m_classTag;
50 
51  //TODO
52  double* m_xhatD;
53  //TODO
55  //TODO
57 
58 
59 
60 
65  //-----------------------------------------------------------------------//
70  //-----------------------------------------------------------------------//
74  virtual void createMasterProblem(DecompVarList& initVars);
75  virtual void masterMatrixAddArtCols(CoinPackedMatrix* masterM,
76  double* colLB,
77  double* colUB,
78  double* objCoeff,
79  std::vector<std::string>& colNames,
80  int startRow,
81  int endRow,
82  char origOrBranch);
83  virtual void phaseUpdate(DecompPhase& phase,
84  DecompStatus& status);
85  virtual void phaseDone();
86 
90  virtual inline void setObjBoundIP(const double thisBound) {
92  "setObjBoundIP()", m_param.LogDebugLevel, 2);
93 
94  if (thisBound < m_nodeStats.objBest.second) {
96  (*m_osLog) << "New Global UB = "
97  << UtilDblToStr(thisBound) << std::endl;);
98  //For DECOMP, don't update this object's global UB
99  // otherwise, we might stop to early, since it will
100  // compare to this object's lower bound.
101  //m_nodeStats.objBest.second = thisBound;
102  }
103 
105  "setObjBoundIP()", m_param.LogDebugLevel, 2);
106  }
107 
108 
109 
110 public:
111  void solveD(DecompCutList* newCuts) {
112  m_newCuts = newCuts;
113  //need to change parameters to price, no cut
119  processNode(NULL);
120  }
121 
122 
123 public:
124 
125  //-----------------------------------------------------------------------//
130  //-----------------------------------------------------------------------//
131 private:
135  DecompAlgoD(const DecompAlgoD&);
137 
138 public:
139 
144  UtilParameters* utilParam,
145  double* xhat,
146  int numOrigCols) //need to pass this? :
147  :
148  DecompAlgoPC(app, utilParam,
149  const_cast<std::string&>(DecompAlgoStr[DECOMP]), false),
150  m_classTag ("D-ALGOD"),
151  m_xhatD (xhat),
152  m_newCuts (0),
153  m_numOrigCols(numOrigCols) { //need?
154  std::string paramSection = DecompAlgoStr[DECOMP];
155  m_algo = DECOMP;
156  initSetup(utilParam, paramSection);
157  }
158 
159  //need this?
161  UtilParameters* utilParam,
162  std::string& paramSection,
163  double* xhat,
164  int numOrigCols):
165  DecompAlgoPC(app, utilParam, paramSection, false),
166  m_classTag ("D-ALGOD"),
167  m_xhatD (xhat),
168  m_newCuts (0),
169  m_numOrigCols(numOrigCols) { //need?
170  m_algo = DECOMP;
171  initSetup(utilParam, paramSection);
172  }
173 
181 };
182 
183 #endif
std::list< DecompCut * > DecompCutList
Definition: Decomp.h:55
DecompStatus
Definition: Decomp.h:146
DecompParam m_param
DIP is distributed under the Eclipse Public License as part of the //.
Definition: DecompAlgo.h:81
std::string UtilDblToStr(const double x, const int precision=-1, const double tooBig=UtilSmallerThanTooBig)
Definition: UtilMacros.h:564
virtual void setObjBoundIP(const double thisBound)
Set the current integer bound and update best/history.
Definition: DecompAlgoD.h:90
DecompAlgoD(DecompApp *app, UtilParameters *utilParam, std::string &paramSection, double *xhat, int numOrigCols)
Disable copy constructors.
Definition: DecompAlgoD.h:160
DecompCutList * m_newCuts
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoD.h:54
int LogDebugLevel
0: print nothing 1: print the node objective history
Definition: DecompParam.h:40
DecompAlgoD & operator=(const DecompAlgoD &)
Disable copy constructors.
DecompAlgoD(DecompApp *app, UtilParameters *utilParam, double *xhat, int numOrigCols)
Default constructors.
Definition: DecompAlgoD.h:143
int LimitRoundCutIters
0: print nothing 1: print the node objective history
Definition: DecompParam.h:66
const std::string DecompAlgoStr[5]
Definition: Decomp.h:92
Sparse Matrix Base Class.
void initSetup(UtilParameters *utilParam, std::string &sectionParam)
Initial setup of algorithm structures and solver interfaces.
double * m_xhatD
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoD.h:52
#define UTIL_MSG(param, level, x)
Definition: UtilMacros.h:80
int LimitTotalPriceIters
0: print nothing 1: print the node objective history
Definition: DecompParam.h:65
std::pair< double, double > objBest
The global lower (.first) and upper (.second) bound.
Definition: DecompStats.h:120
DecompAlgoD(const DecompAlgoD &)
Disable copy constructors.
int SolveMasterAsIp
0: print nothing 1: print the node objective history
Definition: DecompParam.h:149
~DecompAlgoD()
Destructor.
Definition: DecompAlgoD.h:177
Class for DECOMP algorithm Decomp.
Definition: DecompAlgoD.h:37
DecompAlgoType m_algo
Type of algorithm for this instance.
Definition: DecompAlgo.h:86
DecompApp * m_app
Pointer to current active DECOMP application.
Definition: DecompAlgo.h:103
Definition: Decomp.h:90
Class for DECOMP algorithm Price and Cut.
Definition: DecompAlgoPC.h:32
virtual void phaseUpdate(DecompPhase &phase, DecompStatus &status)
Create the master problem (all algorithms must define this function).
virtual DecompStatus processNode(const AlpsDecompTreeNode *node, const double globalLB=-DecompInf, const double globalUB=DecompInf)
The main DECOMP process loop for a node.
DecompNodeStats m_nodeStats
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgo.h:109
int LimitRoundPriceIters
0: print nothing 1: print the node objective history
Definition: DecompParam.h:67
int m_numOrigCols
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoD.h:56
virtual void phaseDone()
Create the master problem (all algorithms must define this function).
virtual void createMasterProblem(DecompVarList &initVars)
Create the master problem (all algorithms must define this function).
void UtilPrintFuncBegin(std::ostream *os, const std::string &classTag, const std::string &funcName, const int logLevel, const int logLimit)
DecompParam m_param
Parameters.
Definition: DecompApp.h:81
void solveD(DecompCutList *newCuts)
Create the master problem (all algorithms must define this function).
Definition: DecompAlgoD.h:111
void UtilPrintFuncEnd(std::ostream *os, const std::string &classTag, const std::string &funcName, const int logLevel, const int logLimit)
int LimitTotalCutIters
0: print nothing 1: print the node objective history
Definition: DecompParam.h:64
std::string m_classTag
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoD.h:49
std::ostream * m_osLog
Stream for log file (default to stdout).
Definition: DecompAlgo.h:119
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:53
DecompPhase
Definition: Decomp.h:127
The main application class.
Definition: DecompApp.h:50
virtual void masterMatrixAddArtCols(CoinPackedMatrix *masterM, double *colLB, double *colUB, double *objCoeff, std::vector< std::string > &colNames, int startRow, int endRow, char origOrBranch)
Create the master problem (all algorithms must define this function).