Dip-All  0.91.0
DecompAlgoPC.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 #ifndef DecompAlgoPC_h_
18 #define DecompAlgoPC_h_
19 
20 //===========================================================================//
26 //===========================================================================//
27 
28 //===========================================================================//
29 #include "DecompAlgo.h"
30 
31 //===========================================================================//
32 class DecompAlgoPC : public DecompAlgo {
33 
34 private:
35 
36  //----------------------------------------------------------------------//
41  //----------------------------------------------------------------------//
45  std::string m_classTag;
46 
54  std::vector<double> m_dual;
55 
61  std::vector<double> m_dualRM;
62 
68  std::vector<double> m_dualST;
69 
74  //-----------------------------------------------------------------------//
79  //-----------------------------------------------------------------------//
83  virtual void createMasterProblem(DecompVarList& initVars) {
85  }
86  virtual int generateVarsFea(DecompVarList& newVars,
87  double& mostNegReducedCost) {
88  return DecompAlgo::generateVarsFea(newVars, mostNegReducedCost);
89  }
90  virtual void phaseInit(DecompPhase& phase);
91 
92 
93 
102  virtual const double* getMasterDualSolution() const {
103  //---
104  //--- return the duals to be used in pricing step
105  //---
106  if (m_param.DualStab) {
107  return &m_dualST[0];
108  } else {
109  return &m_dualSolution[0];
110  }
111  }
112 
118  virtual void adjustMasterDualSolution();
119 
120 
121 
125  virtual void setObjBound(const double thisBound,
126  const double thisBoundUB) {
128  "setObjBound()", m_param.LogDebugLevel, 2);
129 
130  if (m_param.DualStab) {
131  if (thisBound > (m_nodeStats.objBest.first + DecompEpsilon)) {
132  //(*m_osLog) << "Bound improved " << m_nodeStats.objBest.first
133  // << " to " << thisBound << " , update duals" << endl;
134  copy(m_dualST.begin(), m_dualST.end(), m_dual.begin());
135  }
136  }
137 
138  DecompAlgo::setObjBound(thisBound, thisBoundUB);
140  "setObjBound()", m_param.LogDebugLevel, 2);
141  }
142 
146  virtual inline void setObjBoundIP(const double thisBound) {
147  DecompAlgo::setObjBoundIP(thisBound);
148  }
149 
154  //-----------------------------------------------------------------------//
159  //-----------------------------------------------------------------------//
160  //TODO
161  void addCutsToPool(const double* x,
162  DecompCutList& newCuts,
163  int& n_newCuts);
164 
165  //TODO
166  void phaseDone();
167  int addCutsFromPool();
168  void solutionUpdateAsIP();
169  int adjustColumnsEffCnt();
170  int compressColumns ();
171 
172 
173 
179  //-----------------------------------------------------------------------//
184  //-----------------------------------------------------------------------//
185 public:
186 
187  std::vector<double>& getDualBest() {
188  return m_dual;
189  }
190  std::vector<double>& getDualRMP() {
191  return m_dualRM;
192  }
193 
194 
199  UtilParameters* utilParam,
200  bool doSetup = true) :
201  DecompAlgo(PRICE_AND_CUT, app, utilParam),
202  m_classTag("D-ALGOPC") {
203  //---
204  //--- do any parameter overrides of the defaults here
205  //--- by default turn off gomory cuts for PC
206  //---
207  m_param.CutCglGomory = 0;
208 
209  //---
210  //--- run init setup
211  //---
212  if (doSetup) {
213  std::string paramSection = DecompAlgoStr[PRICE_AND_CUT];
214  initSetup(utilParam, paramSection);
215  }
216  }
217 
219  UtilParameters* utilParam,
220  std::string& paramSection,
221  bool doSetup = true) :
222  //is utilParam used in base class?
223  DecompAlgo(PRICE_AND_CUT, app, utilParam),
224  m_classTag("D-ALGOPC") {
225  //---
226  //--- do any parameter overrides of the defaults here
227  //--- by default turn off gomory cuts for PC
228  //---
229  m_param.CutCglGomory = 0;
230 
231  //---
232  //--- run init setup
233  //---
234  if (doSetup) {
235  initSetup(utilParam, paramSection);
236  }
237  }
238 
239 
247 };
248 
249 #endif
std::list< DecompCut * > DecompCutList
Definition: Decomp.h:55
virtual int generateVarsFea(DecompVarList &newVars, double &mostNegReducedCost)
Create the master problem (all algorithms must define this function).
Definition: DecompAlgoPC.h:86
virtual void createMasterProblem(DecompVarList &initVars)
Create the master problem (all algorithms must define this function).
virtual void adjustMasterDualSolution()
Adjust the current dual solution for master problem.
virtual int generateVarsFea(DecompVarList &newVars, double &mostNegReducedCost)
std::vector< double > & getDualBest()
Default constructors.
Definition: DecompAlgoPC.h:187
int adjustColumnsEffCnt()
The main DECOMP process loop for a node.
virtual const double * getMasterDualSolution() const
Get current dual solution for master problem.
Definition: DecompAlgoPC.h:102
DecompParam m_param
DIP is distributed under the Eclipse Public License as part of the //.
Definition: DecompAlgo.h:81
virtual void phaseInit(DecompPhase &phase)
Create the master problem (all algorithms must define this function).
std::vector< double > & getDualRMP()
Default constructors.
Definition: DecompAlgoPC.h:190
void addCutsToPool(const double *x, DecompCutList &newCuts, int &n_newCuts)
std::vector< double > m_dual
Dual vector.
Definition: DecompAlgoPC.h:54
~DecompAlgoPC()
Destructor.
Definition: DecompAlgoPC.h:243
int LogDebugLevel
0: print nothing 1: print the node objective history
Definition: DecompParam.h:40
std::vector< double > m_dualST
Dual vector stabilized.
Definition: DecompAlgoPC.h:68
const std::string DecompAlgoStr[5]
Definition: Decomp.h:92
void initSetup(UtilParameters *utilParam, std::string &sectionParam)
Initial setup of algorithm structures and solver interfaces.
int addCutsFromPool()
bool DualStab
0: print nothing 1: print the node objective history
Definition: DecompParam.h:181
virtual void setObjBound(const double thisBound, const double thisBoundUB)
Create the master problem (all algorithms must define this function).
Definition: DecompAlgoPC.h:125
DecompAlgoPC(DecompApp *app, UtilParameters *utilParam, bool doSetup=true)
Default constructors.
Definition: DecompAlgoPC.h:198
DecompAlgoPC(DecompApp *app, UtilParameters *utilParam, std::string &paramSection, bool doSetup=true)
Default constructors.
Definition: DecompAlgoPC.h:218
const double DecompEpsilon
Definition: Decomp.h:62
std::pair< double, double > objBest
The global lower (.first) and upper (.second) bound.
Definition: DecompStats.h:120
virtual void setObjBoundIP(const double thisBound)
Set the current integer bound and update best/history.
Definition: DecompAlgoPC.h:146
int compressColumns()
The main DECOMP process loop for a node.
std::vector< double > m_dualSolution
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgo.h:194
Class for DECOMP algorithm Price and Cut.
Definition: DecompAlgoPC.h:32
virtual void createMasterProblem(DecompVarList &initVars)
Create the master problem (all algorithms must define this function).
Definition: DecompAlgoPC.h:83
DecompNodeStats m_nodeStats
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgo.h:109
int CutCglGomory
0: print nothing 1: print the node objective history
Definition: DecompParam.h:108
void UtilPrintFuncBegin(std::ostream *os, const std::string &classTag, const std::string &funcName, const int logLevel, const int logLimit)
void phaseDone()
Run the done phase for processing node.
void UtilPrintFuncEnd(std::ostream *os, const std::string &classTag, const std::string &funcName, const int logLevel, const int logLimit)
virtual void setObjBound(const double thisBound, const double thisBoundUB)
Set the current continuous bounds and update best/history.
Definition: DecompAlgo.h:868
Base class for DECOMP algorithms.
Definition: DecompAlgo.h:63
std::string m_classTag
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoPC.h:45
void solutionUpdateAsIP()
The main DECOMP process loop for a node.
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
virtual void setObjBoundIP(const double thisBound)
Set the current integer bound and update best/history.
Definition: DecompAlgo.h:902
The main application class.
Definition: DecompApp.h:50
std::vector< double > m_dualRM
Dual vector from restricted master.
Definition: DecompAlgoPC.h:61