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 
83  AlpsDecompParam m_param;
84 
88  DecompAlgo* m_decompAlgo;
89 
93  double m_bestLB;
94  double m_bestUB;
95  int m_nodesProcessed;
96  int m_alpsStatus;
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  //-----------------------------------------------------------------------//
167  AlpsExitStatus solve();
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 {
207  return m_decompAlgo->getModelCore().getModel()->getNumRows();
208  }
209 
213  inline const int getNumCoreCols() const {
214  return m_decompAlgo->getModelCore().getModel()->getNumCols();
215  }
216 
220  inline const std::vector<std::string>& getColNames() const {
221  return m_decompAlgo->getModelCore().getModel()->getColNames();
222  }
223 
227  inline const std::vector<std::string>& getRowNames() const {
228  return m_decompAlgo->getModelCore().getModel()->getRowNames();
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
const int getSolStatus() const
AlpsExitStatus solve()
Solve with ALPS and DECOMP.
DecompAlgo * getDecompAlgo()
Get a ptr to the decomp algorithm vector.
AlpsDecompParam & getParam()
const int getNumCoreRows() const
Get number of rows in core decomp model.
const DecompSolution * getBestSolution() const
Get the best solution found.
Derivation of AlpsModel for DECOMP.
const DecompSolution * getXhatIPBest() const
Definition: DecompAlgo.h:725
const int getNumCols() const
const std::vector< std::string > & getColNames() const
AlpsDecompModel(UtilParameters &utilParam, DecompAlgo *decompAlgo)
const double getGlobalLB() const
DecompConstraintSet * getModel() const
Definition: DecompModel.h:35
Parameters passed through to Alps.
virtual AlpsTreeNode * createRoot()
Create the root node of the search tree.
const DecompSubModel & getModelCore() const
Definition: DecompAlgo.h:684
const int getNumRows() const
AlpsDecompModel()
Default constructors.
#define UtilException(msg, methodN, classN)
const std::vector< std::string > & getRowNames() const
Get the row names in core decomp model.
void setAlpsSettings()
Set the ALPS parameters.
virtual ~AlpsDecompModel()
Destructor.
const std::vector< std::string > & getColNames() const
Get the column names in core decomp model.
const double getGlobalUB() const
void setDecompAlgo(DecompAlgo *decompAlgo)
Solve with ALPS and DECOMP.
virtual bool fathomAllNodes()
Return true, if all nodes can be fathomed.
const int getNumNodesProcessed() const
const std::vector< std::string > & getRowNames() const
Base class for DECOMP algorithms.
Definition: DecompAlgo.h:62
const int getNumCoreCols() const
Get number of cols in core decomp model.