Dip  0.92.4
AlpsDecompModel.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 AlpsDecompModel_h_
17 #define AlpsDecompModel_h_
18 
19 //===========================================================================//
20 #include "Alps.h"
21 #include "AlpsModel.h"
22 #include "AlpsDecompParam.h"
23 
24 
25 //===========================================================================//
26 #include "DecompAlgo.h"
27 #include "DecompConstraintSet.h"
28 
29 //===========================================================================//
30 #include <string>
31 
32 //===========================================================================//
33 class AlpsTreeNode;
34 
35 //===========================================================================//
61 //===========================================================================//
62 
63 //===========================================================================//
64 class AlpsDecompModel : public AlpsModel {
65 
66 
67 private:
68 
69  //----------------------------------------------------------------------//
74  //----------------------------------------------------------------------//
78  std::string m_classTag;
79 
84 
89 
93  double m_bestLB;
94  double m_bestUB;
97 
102  //-----------------------------------------------------------------------//
107  //-----------------------------------------------------------------------//
108 public:
113  AlpsModel (),
114  m_classTag ("ALPSM"),
115  m_param (),
116  m_decompAlgo (NULL) {
117  }
118 
120  DecompAlgo* decompAlgo) :
121  AlpsModel (),
122  m_classTag ("ALPSM"),
123  m_param (utilParam),
124  m_decompAlgo(decompAlgo) {
125  if (decompAlgo == NULL)
126  throw UtilException("No DecompAlgo algorithm has been set.",
127  "AlpsDecompModel", "AlpsDecompModel");
128 
129  setAlpsSettings();
130  }
131 
135  virtual ~AlpsDecompModel() {}
141  //-----------------------------------------------------------------------//
146  //-----------------------------------------------------------------------//
150  virtual AlpsTreeNode* createRoot();
151 
153  virtual bool fathomAllNodes();
158  //-----------------------------------------------------------------------//
163  //-----------------------------------------------------------------------//
168 
172  void setAlpsSettings();
173 
177  inline void setDecompAlgo(DecompAlgo* decompAlgo) {
178  m_decompAlgo = decompAlgo;
179  }
184  //-----------------------------------------------------------------------//
189  //-----------------------------------------------------------------------//
193  //THINK: return ref?
195  return m_decompAlgo;
196  }
197 
199  return m_param;
200  }
201 
202 
206  inline const int getNumCoreRows() const {
208  }
209 
213  inline const int getNumCoreCols() const {
215  }
216 
220  inline const std::vector<std::string>& getColNames() const {
222  }
223 
227  inline const std::vector<std::string>& getRowNames() const {
229  }
230 
234  inline const DecompSolution* getBestSolution() const {
235  return m_decompAlgo->getXhatIPBest();
236  }
237 
238  const double getGlobalLB() const {
239  return m_bestLB;
240  }
241  const double getGlobalUB() const {
242  return m_bestUB;
243  }
244  const int getSolStatus() const {
245  return m_alpsStatus;
246  }
247  const int getNumNodesProcessed() const {
248  return m_nodesProcessed;
249  }
250 
254 };
255 
256 #endif
virtual AlpsTreeNode * createRoot()
Create the root node of the search tree.
DecompConstraintSet * getModel() const
Definition: DecompModel.h:35
AlpsDecompModel(UtilParameters &utilParam, DecompAlgo *decompAlgo)
Default constructors.
double m_bestUB
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
virtual bool fathomAllNodes()
Return true, if all nodes can be fathomed.
DecompAlgo * m_decompAlgo
Pointer to decomp algorithm used for bounding.
const DecompSolution * getXhatIPBest() const
Get a ptr to the current solution (in x-space).
Definition: DecompAlgo.h:725
const int getNumCoreRows() const
Get number of rows in core decomp model.
Parameters passed through to Alps.
std::string m_classTag
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
const int getNumRows() const
Derivation of AlpsModel for DECOMP.
void setDecompAlgo(DecompAlgo *decompAlgo)
Solve with ALPS and DECOMP.
const int getSolStatus() const
Get a ptr to the decomp algorithm vector.
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:50
const std::vector< std::string > & getRowNames() const
Get the row names in core decomp model.
AlpsExitStatus solve()
Solve with ALPS and DECOMP.
virtual ~AlpsDecompModel()
Destructor.
double m_bestLB
Objective of best solution found.
AlpsExitStatus
Definition: Alps.h:101
const int getNumCoreCols() const
Get number of cols in core decomp model.
const std::vector< std::string > & getColNames() const
Get the column names in core decomp model.
const DecompSubModel & getModelCore() const
Get a ptr to the current solution (in x-space).
Definition: DecompAlgo.h:684
const std::vector< std::string > & getRowNames() const
int m_alpsStatus
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
const std::vector< std::string > & getColNames() const
const double getGlobalLB() const
Get a ptr to the decomp algorithm vector.
const double getGlobalUB() const
Get a ptr to the decomp algorithm vector.
const int getNumNodesProcessed() const
Get a ptr to the decomp algorithm vector.
AlpsDecompModel()
Default constructors.
const int getNumCols() const
#define UtilException(msg, methodN, classN)
AlpsDecompParam m_param
Parameters for Alps.
int m_nodesProcessed
Store the name of the class (for logging/debugging) - &quot;who am I?&quot;.
Base class for DECOMP algorithms.
Definition: DecompAlgo.h:62
const DecompSolution * getBestSolution() const
Get the best solution found.
void setAlpsSettings()
Set the ALPS parameters.
AlpsDecompParam & getParam()
Get a ptr to the decomp algorithm vector.
DecompAlgo * getDecompAlgo()
Get a ptr to the decomp algorithm vector.