1.1 --- a/src/work/marci/lp/lp_solver_base.h Tue Feb 01 12:53:30 2005 +0000
1.2 +++ b/src/work/marci/lp/lp_solver_base.h Tue Feb 01 15:26:47 2005 +0000
1.3 @@ -177,10 +177,18 @@
1.4 The aim of this class is to give a general surface to different
1.5 solvers, i.e. it makes possible to write algorithms using LP's,
1.6 in which the solver can be changed to an other one easily.
1.7 + \nosubgrouping
1.8 */
1.9 template <typename _Value>
1.10 class LPSolverBase {
1.11 +
1.12 + /*! @name Unchategorized functions and types (public members)
1.13 + */
1.14 + //@{
1.15 public:
1.16 +
1.17 + //UNCATEGORIZED
1.18 +
1.19 /// \e
1.20 typedef _Value Value;
1.21 /// \e
1.22 @@ -205,18 +213,78 @@
1.23 VALID_CLASS(0), INVALID_CLASS(1) { }
1.24 /// \e
1.25 virtual ~LPSolverBase() { }
1.26 + //@}
1.27
1.28 - //MATRIX INDEPEDENT MANIPULATING FUNCTIONS
1.29 + /*! @name Medium level interface (public members)
1.30 + These functions appear in the low level and also in the high level
1.31 + interfaces thus these each of these functions have to be implemented
1.32 + only once in the different interfaces.
1.33 + This means that these functions have to be reimplemented for all of the
1.34 + different lp solvers. These are basic functions, and have the same
1.35 + parameter lists in the low and high level interfaces.
1.36 + */
1.37 + //@{
1.38 + public:
1.39
1.40 - public:
1.41 + //UNCATEGORIZED FUNCTIONS
1.42 +
1.43 /// \e
1.44 virtual void setMinimize() = 0;
1.45 /// \e
1.46 virtual void setMaximize() = 0;
1.47
1.48 - //LOW LEVEL INTERFACE, MATRIX MANIPULATING FUNCTIONS
1.49 + //SOLVER FUNCTIONS
1.50
1.51 + /// \e
1.52 + virtual void solveSimplex() = 0;
1.53 + /// \e
1.54 + virtual void solvePrimalSimplex() = 0;
1.55 + /// \e
1.56 + virtual void solveDualSimplex() = 0;
1.57 + /// \e
1.58 +
1.59 + //SOLUTION RETRIEVING
1.60 +
1.61 + /// \e
1.62 + virtual _Value getObjVal() = 0;
1.63 +
1.64 + //OTHER FUNCTIONS
1.65 +
1.66 + /// \e
1.67 + virtual int rowNum() const = 0;
1.68 + /// \e
1.69 + virtual int colNum() const = 0;
1.70 + /// \e
1.71 + virtual int warmUp() = 0;
1.72 + /// \e
1.73 + virtual void printWarmUpStatus(int i) = 0;
1.74 + /// \e
1.75 + virtual int getPrimalStatus() = 0;
1.76 + /// \e
1.77 + virtual void printPrimalStatus(int i) = 0;
1.78 + /// \e
1.79 + virtual int getDualStatus() = 0;
1.80 + /// \e
1.81 + virtual void printDualStatus(int i) = 0;
1.82 + /// Returns the status of the slack variable assigned to row \c row_it.
1.83 + virtual int getRowStat(const RowIt& row_it) = 0;
1.84 + /// \e
1.85 + virtual void printRowStatus(int i) = 0;
1.86 + /// Returns the status of the variable assigned to column \c col_it.
1.87 + virtual int getColStat(const ColIt& col_it) = 0;
1.88 + /// \e
1.89 + virtual void printColStatus(int i) = 0;
1.90 +
1.91 + //@}
1.92 +
1.93 + /*! @name Low level interface (protected members)
1.94 + Problem manipulating functions in the low level interface
1.95 + */
1.96 + //@{
1.97 protected:
1.98 +
1.99 + //MATRIX MANIPULATING FUNCTIONS
1.100 +
1.101 /// \e
1.102 virtual int _addCol() = 0;
1.103 /// \e
1.104 @@ -279,16 +347,21 @@
1.105 virtual void _setObjCoef(int i, _Value obj_coef) = 0;
1.106 /// \e
1.107 virtual _Value _getObjCoef(int i) = 0;
1.108 +
1.109 + //SOLUTION RETRIEVING
1.110
1.111 - //LOW LEVEL, SOLUTION RETRIEVING FUNCTIONS
1.112 -
1.113 - protected:
1.114 /// \e
1.115 virtual _Value _getPrimal(int i) = 0;
1.116 + //@}
1.117 +
1.118 + /*! @name High level interface (public members)
1.119 + Problem manipulating functions in the high level interface
1.120 + */
1.121 + //@{
1.122 + public:
1.123
1.124 - //HIGH LEVEL INTERFACE, MATRIX MANIPULATING FUNTIONS
1.125 + //MATRIX MANIPULATING FUNCTIONS
1.126
1.127 - public:
1.128 /// \e
1.129 ColIt addCol() {
1.130 int i=_addCol();
1.131 @@ -402,12 +475,29 @@
1.132 return _getObjCoef(col_iter_map[col_it]);
1.133 }
1.134
1.135 - //MOST HIGH LEVEL, USER FRIEND FUNCTIONS
1.136 + //SOLUTION RETRIEVING FUNCTIONS
1.137 +
1.138 + /// \e
1.139 + _Value getPrimal(const ColIt& col_it) {
1.140 + return _getPrimal(col_iter_map[col_it]);
1.141 + }
1.142 +
1.143 + //@}
1.144 +
1.145 + /*! @name User friend interface
1.146 + Problem manipulating functions in the user friend interface
1.147 + */
1.148 + //@{
1.149 +
1.150 + //EXPRESSION TYPES
1.151
1.152 /// \e
1.153 typedef Expr<ColIt, _Value> Expression;
1.154 /// \e
1.155 typedef Expr<RowIt, _Value> DualExpression;
1.156 +
1.157 + //MATRIX MANIPULATING FUNCTIONS
1.158 +
1.159 /// \e
1.160 void setRowCoeffs(RowIt row_it, const Expression& expr) {
1.161 std::vector<std::pair<int, _Value> > row_coeffs;
1.162 @@ -435,54 +525,7 @@
1.163 setObjCoef((*i).first, (*i).second);
1.164 }
1.165 }
1.166 -
1.167 - //SOLVER FUNCTIONS
1.168 -
1.169 - /// \e
1.170 - virtual void solveSimplex() = 0;
1.171 - /// \e
1.172 - virtual void solvePrimalSimplex() = 0;
1.173 - /// \e
1.174 - virtual void solveDualSimplex() = 0;
1.175 - /// \e
1.176 -
1.177 - //HIGH LEVEL, SOLUTION RETRIEVING FUNCTIONS
1.178 -
1.179 - public:
1.180 -
1.181 - /// \e
1.182 - _Value getPrimal(const ColIt& col_it) {
1.183 - return _getPrimal(col_iter_map[col_it]);
1.184 - }
1.185 - /// \e
1.186 - virtual _Value getObjVal() = 0;
1.187 -
1.188 - //OTHER FUNCTIONS
1.189 -
1.190 - /// \e
1.191 - virtual int rowNum() const = 0;
1.192 - /// \e
1.193 - virtual int colNum() const = 0;
1.194 - /// \e
1.195 - virtual int warmUp() = 0;
1.196 - /// \e
1.197 - virtual void printWarmUpStatus(int i) = 0;
1.198 - /// \e
1.199 - virtual int getPrimalStatus() = 0;
1.200 - /// \e
1.201 - virtual void printPrimalStatus(int i) = 0;
1.202 - /// \e
1.203 - virtual int getDualStatus() = 0;
1.204 - /// \e
1.205 - virtual void printDualStatus(int i) = 0;
1.206 - /// Returns the status of the slack variable assigned to row \c row_it.
1.207 - virtual int getRowStat(const RowIt& row_it) = 0;
1.208 - /// \e
1.209 - virtual void printRowStatus(int i) = 0;
1.210 - /// Returns the status of the variable assigned to column \c col_it.
1.211 - virtual int getColStat(const ColIt& col_it) = 0;
1.212 - /// \e
1.213 - virtual void printColStatus(int i) = 0;
1.214 + //@}
1.215 };
1.216
1.217 template <typename _Value>