Dip  0.92.4
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 // 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 #ifndef DecompAlgoPC_h_
17 #define DecompAlgoPC_h_
18 
19 //===========================================================================//
25 //===========================================================================//
26 
27 //===========================================================================//
28 #include "DecompAlgo.h"
29 
30 //===========================================================================//
31 class DecompAlgoPC : public DecompAlgo {
32 
33 private:
34 
35  //----------------------------------------------------------------------//
40  //----------------------------------------------------------------------//
44  std::string m_classTag;
45 
53  std::vector<double> m_dual;
54 
60  std::vector<double> m_dualRM;
61 
67  std::vector<double> m_dualST;
68 
73  //-----------------------------------------------------------------------//
78  //-----------------------------------------------------------------------//
82  virtual void createMasterProblem(DecompVarList& initVars) {
84  }
85  virtual int generateVars(DecompVarList& newVars,
86  double& mostNegReducedCost) {
87  return DecompAlgo::generateVars(newVars, mostNegReducedCost);
88  }
89  virtual void phaseInit(DecompPhase& phase);
90 
99  virtual const double* getMasterDualSolution() const {
100  //---
101  //--- return the duals to be used in pricing step
102  //---
103  if (m_param.DualStab) {
104  return &m_dualST[0];
105  } else {
106  return &m_dualSolution[0];
107  }
108  }
109 
115  virtual void adjustMasterDualSolution();
116 
117 
118 
122  virtual void setObjBound(const double thisBound,
123  const double thisBoundUB) {
125  "setObjBound()", m_param.LogDebugLevel, 2);
126 
127  if (m_param.DualStab) {
128  if (thisBound > (m_nodeStats.objBest.first + DecompEpsilon)) {
129  //(*m_osLog) << "Bound improved " << m_nodeStats.objBest.first
130  // << " to " << thisBound << " , update duals" << endl;
131  copy(m_dualST.begin(), m_dualST.end(), m_dual.begin());
132  }
133  }
134 
135  DecompAlgo::setObjBound(thisBound, thisBoundUB);
137  "setObjBound()", m_param.LogDebugLevel, 2);
138  }
139 
143  virtual inline void setObjBoundIP(const double thisBound) {
144  DecompAlgo::setObjBoundIP(thisBound);
145  }
146 
151  //-----------------------------------------------------------------------//
156  //-----------------------------------------------------------------------//
157  //TODO
158  void addCutsToPool(const double* x,
159  DecompCutList& newCuts,
160  int& n_newCuts);
161 
162  //TODO
163  void phaseDone();
164  int addCutsFromPool();
165  void solveMasterAsMIP();
170  int adjustColumnsEffCnt();
171  int compressColumns ();
172 
178  //-----------------------------------------------------------------------//
183  //-----------------------------------------------------------------------//
184 public:
185 
186  std::vector<double>& getDualBest() {
187  return m_dual;
188  }
189  std::vector<double>& getDualRMP() {
190  return m_dualRM;
191  }
192 
193 
198  UtilParameters& utilParam,
199  bool doSetup = true,
200  const DecompAlgoType algo = PRICE_AND_CUT) :
201  DecompAlgo(algo, 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 
217 };
218 
219 #endif
std::list< DecompCut * > DecompCutList
Definition: Decomp.h:93
virtual void createMasterProblem(DecompVarList &initVars)
Create the master problem (all algorithms must define this function).
void solveMasterAsMIP()
The main DECOMP process loop for a node.
void solveMasterAsMIPCbc(DecompSolverResult *result)
virtual void adjustMasterDualSolution()
Adjust the current dual solution for master problem.
std::vector< double > & getDualBest()
Default constructors.
Definition: DecompAlgoPC.h:186
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:99
DecompParam m_param
Parameters.
Definition: DecompAlgo.h:80
virtual void phaseInit(DecompPhase &phase)
Create the master problem (all algorithms must define this function).
std::vector< double > & getDualRMP()
Default constructors.
Definition: DecompAlgoPC.h:189
void addCutsToPool(const double *x, DecompCutList &newCuts, int &n_newCuts)
std::vector< double > m_dual
Dual vector.
Definition: DecompAlgoPC.h:53
~DecompAlgoPC()
Destructor.
Definition: DecompAlgoPC.h:213
int LogDebugLevel
0: print nothing 1: print the node objective history
Definition: DecompParam.h:39
std::vector< double > m_dualST
Dual vector stabilized.
Definition: DecompAlgoPC.h:67
virtual int generateVars(DecompVarList &newVars, double &mostNegReducedCost)
DecompAlgoPC(DecompApp *app, UtilParameters &utilParam, bool doSetup=true, const DecompAlgoType algo=PRICE_AND_CUT)
Default constructors.
Definition: DecompAlgoPC.h:197
int addCutsFromPool()
bool DualStab
0: print nothing 1: print the node objective history
Definition: DecompParam.h:179
virtual void setObjBound(const double thisBound, const double thisBoundUB)
Create the master problem (all algorithms must define this function).
Definition: DecompAlgoPC.h:122
virtual int generateVars(DecompVarList &newVars, double &mostNegReducedCost)
Create the master problem (all algorithms must define this function).
Definition: DecompAlgoPC.h:85
void solveMasterAsMIPSym(DecompSolverResult *result)
const double DecompEpsilon
Definition: Decomp.h:100
std::pair< double, double > objBest
The global lower (.first) and upper (.second) bound.
Definition: DecompStats.h:119
virtual void setObjBoundIP(const double thisBound)
Set the current integer bound and update best/history.
Definition: DecompAlgoPC.h:143
DecompAlgoType
Definition: Decomp.h:123
int compressColumns()
The main DECOMP process loop for a node.
void solveMasterAsMIPCpx(DecompSolverResult *result)
std::vector< double > m_dualSolution
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgo.h:195
Class for DECOMP algorithm Price and Cut.
Definition: DecompAlgoPC.h:31
virtual void createMasterProblem(DecompVarList &initVars)
Create the master problem (all algorithms must define this function).
Definition: DecompAlgoPC.h:82
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
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:870
Storage of solver result.
Base class for DECOMP algorithms.
Definition: DecompAlgo.h:62
std::string m_classTag
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoPC.h:44
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
void solveMasterAsMIPGrb(DecompSolverResult *result)
virtual void setObjBoundIP(const double thisBound)
Set the current integer bound and update best/history.
Definition: DecompAlgo.h:904
The main application class.
Definition: DecompApp.h:48
std::vector< double > m_dualRM
Dual vector from restricted master.
Definition: DecompAlgoPC.h:60