Dip  0.92.4
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 // Authors: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8 // Ted Ralphs, Lehigh University (ted@lehigh.edu) //
9 // Jiadong Wang, Lehigh University (jiw408@lehigh.edu) //
10 // //
11 // Copyright (C) 2002-2019, Lehigh University, Matthew Galati, Ted Ralphs //
12 // All Rights Reserved. //
13 //===========================================================================//
14 
15 
16 //===========================================================================//
17 #ifndef DecompAlgoD_h_
18 #define DecompAlgoD_h_
19 
20 //===========================================================================//
26 //===========================================================================//
27 //THINK: derive from DecompAlgo or DecompAlgoPC?? THINK
28 //THINK: how can we reuse this object since call many times?
29 // if init phase is feasible, we are done....
30 
31 
32 //===========================================================================//
33 #include "DecompAlgoPC.h"
34 
35 //===========================================================================//
36 class DecompAlgoD : public DecompAlgoPC {
37 private:
38 
39  //----------------------------------------------------------------------//
44  //----------------------------------------------------------------------//
48  std::string m_classTag;
49 
50  //TODO
51  double* m_xhatD;
52  //TODO
54  //TODO
56 
57 
58 
59 
64  //-----------------------------------------------------------------------//
69  //-----------------------------------------------------------------------//
73  virtual void createMasterProblem(DecompVarList& initVars);
74  virtual void masterMatrixAddArtCols(CoinPackedMatrix* masterM,
75  double* colLB,
76  double* colUB,
77  double* objCoeff,
78  std::vector<std::string>& colNames,
79  int startRow,
80  int endRow,
81  char origOrBranch);
82  virtual void phaseUpdate(DecompPhase& phase,
83  DecompStatus& status);
84  virtual void phaseDone();
85 
89  virtual inline void setObjBoundIP(const double thisBound) {
91  "setObjBoundIP()", m_param.LogDebugLevel, 2);
92 
93  if (thisBound < m_nodeStats.objBest.second) {
95  (*m_osLog) << "New Global UB = "
96  << UtilDblToStr(thisBound) << std::endl;);
97  //For DECOMP, don't update this object's global UB
98  // otherwise, we might stop to early, since it will
99  // compare to this object's lower bound.
100  //m_nodeStats.objBest.second = thisBound;
101  }
102 
104  "setObjBoundIP()", m_param.LogDebugLevel, 2);
105  }
106 
107 
108 
109 public:
110  void solveD(DecompCutList* newCuts) {
111  m_newCuts = newCuts;
112  //need to change parameters to price, no cut
119  }
120 
121 
122 public:
123 
124  //-----------------------------------------------------------------------//
129  //-----------------------------------------------------------------------//
130 private:
134  DecompAlgoD(const DecompAlgoD&);
136 
137 public:
138 
143  UtilParameters& utilParam,
144  double* xhat,
145  int numOrigCols) //need to pass this? :
146  :
147  DecompAlgoPC(app, utilParam, false, DECOMP),
148  m_classTag ("D-ALGOD"),
149  m_xhatD (xhat),
150  m_newCuts (0),
151  m_numOrigCols(numOrigCols)
152  {
153  m_param.CutCglGomory = 0;
154  }
155 
163 };
164 
165 #endif
std::list< DecompCut * > DecompCutList
Definition: Decomp.h:93
virtual DecompStatus processNode(const AlpsDecompTreeNode *node, const double globalLB, const double globalUB)
The main DECOMP process loop for a node.
int RoundCutItersLimit
0: print nothing 1: print the node objective history
Definition: DecompParam.h:64
DecompAlgoD(DecompApp *app, UtilParameters &utilParam, double *xhat, int numOrigCols)
Default constructors.
Definition: DecompAlgoD.h:142
DecompStatus
Definition: Decomp.h:184
DecompParam m_param
Parameters.
Definition: DecompAlgo.h:80
std::string UtilDblToStr(const double x, const int precision=-1, const double tooBig=UtilSmallerThanTooBig)
Definition: UtilMacros.h:563
virtual void setObjBoundIP(const double thisBound)
Set the current integer bound and update best/history.
Definition: DecompAlgoD.h:89
DecompCutList * m_newCuts
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoD.h:53
int LogDebugLevel
0: print nothing 1: print the node objective history
Definition: DecompParam.h:39
DecompAlgoD & operator=(const DecompAlgoD &)
Disable copy constructors.
Sparse Matrix Base Class.
int TotalPriceItersLimit
0: print nothing 1: print the node objective history
Definition: DecompParam.h:63
double * m_xhatD
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoD.h:51
#define UTIL_MSG(param, level, x)
Definition: UtilMacros.h:79
int SolveMasterAsMip
0: print nothing 1: print the node objective history
Definition: DecompParam.h:147
double m_infinity
The value of &quot;infinity&quot;.
Definition: DecompAlgo.h:96
std::pair< double, double > objBest
The global lower (.first) and upper (.second) bound.
Definition: DecompStats.h:119
DecompAlgoD(const DecompAlgoD &)
Disable copy constructors.
~DecompAlgoD()
Destructor.
Definition: DecompAlgoD.h:159
int TotalCutItersLimit
0: print nothing 1: print the node objective history
Definition: DecompParam.h:62
Class for DECOMP algorithm Decomp.
Definition: DecompAlgoD.h:36
DecompApp * m_app
Pointer to current active DECOMP application.
Definition: DecompAlgo.h:108
int RoundPriceItersLimit
0: print nothing 1: print the node objective history
Definition: DecompParam.h:65
Definition: Decomp.h:128
Class for DECOMP algorithm Price and Cut.
Definition: DecompAlgoPC.h:31
virtual void phaseUpdate(DecompPhase &phase, DecompStatus &status)
Create the master problem (all algorithms must define this function).
DecompNodeStats m_nodeStats
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgo.h:114
int CutCglGomory
0: print nothing 1: print the node objective history
Definition: DecompParam.h:106
int m_numOrigCols
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoD.h:55
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:79
void solveD(DecompCutList *newCuts)
Create the master problem (all algorithms must define this function).
Definition: DecompAlgoD.h:110
void UtilPrintFuncEnd(std::ostream *os, const std::string &classTag, const std::string &funcName, const int logLevel, const int logLimit)
std::string m_classTag
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoD.h:48
std::ostream * m_osLog
Stream for log file (default to stdout).
Definition: DecompAlgo.h:124
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:91
DecompPhase
Definition: Decomp.h:165
The main application class.
Definition: DecompApp.h:48
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).