Dip 0.95.0
Loading...
Searching...
No Matches
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//===========================================================================//
33class AlpsTreeNode;
34
35//===========================================================================//
61//===========================================================================//
62
63//===========================================================================//
64class AlpsDecompModel : public AlpsModel {
65
66
67private:
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
101
102 //-----------------------------------------------------------------------//
107 //-----------------------------------------------------------------------//
108public:
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
130 }
131
135 virtual ~AlpsDecompModel() {}
139
140
141 //-----------------------------------------------------------------------//
146 //-----------------------------------------------------------------------//
151
153 virtual bool fathomAllNodes();
157
158 //-----------------------------------------------------------------------//
163 //-----------------------------------------------------------------------//
168
173
177 inline void setDecompAlgo(DecompAlgo* decompAlgo) {
178 m_decompAlgo = decompAlgo;
179 }
180
183
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
AlpsExitStatus
#define UtilException(msg, methodN, classN)
const int getNumCoreCols() const
Get number of cols in core decomp model.
DecompAlgo * getDecompAlgo()
Get a ptr to the decomp algorithm vector.
const int getNumNodesProcessed() const
AlpsDecompModel()
Default constructors.
AlpsExitStatus solve()
Solve with ALPS and DECOMP.
AlpsDecompParam & getParam()
virtual ~AlpsDecompModel()
Destructor.
AlpsDecompModel(UtilParameters &utilParam, DecompAlgo *decompAlgo)
const DecompSolution * getBestSolution() const
Get the best solution found.
const int getSolStatus() const
virtual AlpsTreeNode * createRoot()
Create the root node of the search tree.
const double getGlobalUB() const
void setAlpsSettings()
Set the ALPS parameters.
const int getNumCoreRows() const
Get number of rows in core decomp model.
virtual bool fathomAllNodes()
Return true, if all nodes can be fathomed.
void setDecompAlgo(DecompAlgo *decompAlgo)
Solve with ALPS and DECOMP.
const double getGlobalLB() const
const std::vector< std::string > & getRowNames() const
Get the row names in core decomp model.
const std::vector< std::string > & getColNames() const
Get the column names in core decomp model.
Parameters passed through to Alps.
Base class for DECOMP algorithms.
Definition DecompAlgo.h:62