Dip-All  0.91.0
DecompAlgoRC.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 DecompAlgoRC_h_
18 #define DecompAlgoRC_h_
19 
21 //===========================================================================//
22 #include "DecompAlgo.h"
23 
24 //===========================================================================//
25 class DecompAlgoRC : public DecompAlgo {
26 
27  //----------------------------------------------------------------------//
32  //----------------------------------------------------------------------//
33 private:
37  const std::string m_classTag;
38 
39 private:
40  std::vector<double> m_u; //dual vector
41  double* m_rc; //reduced cost
42 
43  double m_UB;
44  double m_LB;
45 
47  int m_iter;
48  double m_step;
49  bool m_zeroSub;
50 
56  //-----------------------------------------------------------------------//
61  //-----------------------------------------------------------------------//
65  void createMasterProblem(DecompVarList& initVars);
66 
72  //not pure
73  void recomposeSolution(const double* solution,
74  double* rsolution);
75 
76 
83  //-----------------------------------------------------------------------//
88  //-----------------------------------------------------------------------//
90  const int maxInnerIter,
91  const int maxOuterIter);
92  int addCutsFromPool();
93  int generateVars(const DecompStatus stat,
94  DecompVarList& newVars,
95  double& mostNegReducedCost);
96  bool updateObjBound(const double mostNegRC = -DecompBigNum);
97 
105  void phaseDone();
106 
107 
112  //-----------------------------------------------------------------------//
117  //-----------------------------------------------------------------------//
118 private:
122  DecompAlgoRC(const DecompAlgoRC&);
124 
125 public:
130  UtilParameters* utilParam):
131  DecompAlgo(RELAX_AND_CUT, app, utilParam),
132  m_classTag("D-ALGORC"),
133  m_u (),
134  m_rc (NULL),
135  m_UB (DecompInf),
136  m_LB (-DecompInf),
137  m_cntSameLB(0),
138  m_iter (0),
139  m_step (2.0), //(0, 2] param?
140  m_zeroSub (false),
141  m_shatVar () {
142  std::string paramSection = DecompAlgoStr[RELAX_AND_CUT];
143  initSetup(utilParam, paramSection);
144  }
145 
147  UtilParameters* utilParam,
148  std::string& paramSection) :
149  DecompAlgo(RELAX_AND_CUT, app, utilParam),
150  m_classTag ("D-ALGORC"),
151  m_u (),
152  m_rc (NULL),
153  m_UB (DecompInf),
154  m_LB (-DecompInf),
155  m_cntSameLB(0),
156  m_iter (0),
157  m_step (2.0), //(0, 2] param?
158  m_zeroSub (false),
159  m_shatVar () {
160  initSetup(utilParam, paramSection);
161  }
162 
167  UTIL_DELARR(m_rc);
168  }
177 public:
178  bool isDone();
179  //name - change to getDual?
180  const double* getRowPrice() {
181  return &m_u[0];
182  }
183  //user needs to do?
184  //STOP
185  void setInitObjUB(const double objUB) {
186  m_UB = objUB;
187  }
188 
189 
190 };
191 #endif
DecompStatus
Definition: Decomp.h:146
std::vector< double > m_u
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:40
double m_UB
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:43
const std::string DecompAlgoStr[5]
Definition: Decomp.h:92
bool updateObjBound(const double mostNegRC=-DecompBigNum)
Run the initial phase for processing node.
#define UTIL_DELARR(x)
Definition: UtilMacros.h:29
void initSetup(UtilParameters *utilParam, std::string &sectionParam)
Initial setup of algorithm structures and solver interfaces.
DecompVar m_shatVar
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:51
DecompAlgoRC(DecompApp *app, UtilParameters *utilParam)
Default constructors.
Definition: DecompAlgoRC.h:129
~DecompAlgoRC()
Destructor.
Definition: DecompAlgoRC.h:166
DecompAlgoRC & operator=(const DecompAlgoRC &)
Disable copy constructors.
int addCutsFromPool()
Run the initial phase for processing node.
void setInitObjUB(const double objUB)
Definition: DecompAlgoRC.h:185
DecompAlgoRC(const DecompAlgoRC &)
Disable copy constructors.
const double * getRowPrice()
Definition: DecompAlgoRC.h:180
void phaseDone()
Run the done phase for processing node.
int m_iter
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:47
void createMasterProblem(DecompVarList &initVars)
Create the master problem (all algorithms must define this function).
double * m_rc
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:41
int generateVars(const DecompStatus stat, DecompVarList &newVars, double &mostNegReducedCost)
Run the initial phase for processing node.
void recomposeSolution(const double *solution, double *rsolution)
Compose solution in x-space from current space.
DecompPhase phaseInit()
Run the initial phase for processing node.
double m_step
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:48
DecompStatus solutionUpdate(const DecompPhase phase, const int maxInnerIter, const int maxOuterIter)
Run the initial phase for processing node.
DecompAlgoRC(DecompApp *app, UtilParameters *utilParam, std::string &paramSection)
Disable copy constructors.
Definition: DecompAlgoRC.h:146
Base class for DECOMP algorithms.
Definition: DecompAlgo.h:63
double m_LB
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:44
bool m_zeroSub
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:49
int m_cntSameLB
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:46
const std::string m_classTag
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Definition: DecompAlgoRC.h:37
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:53
DecompPhase
Definition: Decomp.h:127
const double DecompBigNum
Definition: Decomp.h:61
The main application class.
Definition: DecompApp.h:50