Dip 0.95.0
Loading...
Searching...
No Matches
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//===========================================================================//
31class DecompAlgoPC : public DecompAlgo {
32
33private:
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) {
124 UtilPrintFuncBegin(m_osLog, m_classTag,
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);
136 UtilPrintFuncEnd(m_osLog, m_classTag,
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();
166 void solveMasterAsMIPSym(DecompSolverResult* result);
167 void solveMasterAsMIPCbc(DecompSolverResult* result);
168 void solveMasterAsMIPCpx(DecompSolverResult* result);
169 void solveMasterAsMIPGrb(DecompSolverResult* result);
170 int adjustColumnsEffCnt();
171 int compressColumns ();
172
178 //-----------------------------------------------------------------------//
183 //-----------------------------------------------------------------------//
184public:
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 //---
208 }
209
217};
218
219#endif
DecompAlgoType
Definition: Decomp.h:123
@ PRICE_AND_CUT
Definition: Decomp.h:125
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:92
const double DecompEpsilon
Definition: Decomp.h:100
DecompPhase
Definition: Decomp.h:165
std::list< DecompCut * > DecompCutList
Definition: Decomp.h:93
void UtilPrintFuncEnd(std::ostream *os, const std::string &classTag, const std::string &funcName, const int logLevel, const int logLimit)
void UtilPrintFuncBegin(std::ostream *os, const std::string &classTag, const std::string &funcName, const int logLevel, const int logLimit)
Class for DECOMP algorithm Price and Cut.
Definition: DecompAlgoPC.h:31
~DecompAlgoPC()
Destructor.
Definition: DecompAlgoPC.h:213
DecompAlgoPC(DecompApp *app, UtilParameters &utilParam, bool doSetup=true, const DecompAlgoType algo=PRICE_AND_CUT)
Default constructors.
Definition: DecompAlgoPC.h:197
std::vector< double > & getDualBest()
Definition: DecompAlgoPC.h:186
std::vector< double > & getDualRMP()
Definition: DecompAlgoPC.h:189
Base class for DECOMP algorithms.
Definition: DecompAlgo.h:62
std::ostream * m_osLog
Stream for log file (default to stdout).
Definition: DecompAlgo.h:124
virtual void setObjBoundIP(const double thisBound)
Set the current integer bound and update best/history.
Definition: DecompAlgo.h:904
virtual void setObjBound(const double thisBound, const double thisBoundUB)
Set the current continuous bounds and update best/history.
Definition: DecompAlgo.h:870
virtual int generateVars(DecompVarList &newVars, double &mostNegReducedCost)
std::vector< double > m_dualSolution
Definition: DecompAlgo.h:195
DecompParam m_param
Parameters.
Definition: DecompAlgo.h:80
DecompNodeStats m_nodeStats
Definition: DecompAlgo.h:114
virtual void createMasterProblem(DecompVarList &initVars)
Create the master problem (all algorithms must define this function).
The main application class.
Definition: DecompApp.h:48
std::pair< double, double > objBest
The global lower (.first) and upper (.second) bound.
Definition: DecompStats.h:119
int CutCglGomory
Definition: DecompParam.h:106
int LogDebugLevel
Definition: DecompParam.h:39
Storage of solver result.