[1254] | 1 | /* -*- C++ -*- |
---|
| 2 | * |
---|
[1956] | 3 | * This file is a part of LEMON, a generic C++ optimization library |
---|
| 4 | * |
---|
[2553] | 5 | * Copyright (C) 2003-2008 |
---|
[1956] | 6 | * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
---|
[1359] | 7 | * (Egervary Research Group on Combinatorial Optimization, EGRES). |
---|
[1254] | 8 | * |
---|
| 9 | * Permission to use, modify and distribute this software is granted |
---|
| 10 | * provided that this copyright notice appears in all copies. For |
---|
| 11 | * precise terms see the accompanying LICENSE file. |
---|
| 12 | * |
---|
| 13 | * This software is provided "AS IS" with no warranty of any kind, |
---|
| 14 | * express or implied, and with no claim as to its suitability for any |
---|
| 15 | * purpose. |
---|
| 16 | * |
---|
| 17 | */ |
---|
| 18 | |
---|
[1313] | 19 | #ifndef LEMON_LP_SKELETON |
---|
| 20 | #define LEMON_LP_SKELETON |
---|
[1254] | 21 | |
---|
[1356] | 22 | #include <lemon/lp_base.h> |
---|
[1254] | 23 | |
---|
| 24 | ///\file |
---|
| 25 | ///\brief A skeleton file to implement LP solver interfaces |
---|
| 26 | namespace lemon { |
---|
[1508] | 27 | |
---|
[1254] | 28 | ///A skeleton class to implement LP solver interfaces |
---|
[1313] | 29 | class LpSkeleton :public LpSolverBase { |
---|
[1273] | 30 | int col_num,row_num; |
---|
| 31 | |
---|
[1254] | 32 | protected: |
---|
[2363] | 33 | |
---|
[1364] | 34 | ///\e |
---|
| 35 | virtual LpSolverBase &_newLp(); |
---|
| 36 | ///\e |
---|
| 37 | virtual LpSolverBase &_copyLp(); |
---|
[1294] | 38 | /// \e |
---|
[1254] | 39 | virtual int _addCol(); |
---|
[1294] | 40 | /// \e |
---|
[1254] | 41 | virtual int _addRow(); |
---|
[1294] | 42 | /// \e |
---|
[1432] | 43 | virtual void _eraseCol(int i); |
---|
| 44 | /// \e |
---|
| 45 | virtual void _eraseRow(int i); |
---|
| 46 | /// \e |
---|
[2366] | 47 | virtual void _getColName(int col, std::string & name) const; |
---|
[1895] | 48 | /// \e |
---|
| 49 | virtual void _setColName(int col, const std::string & name); |
---|
[2366] | 50 | /// \e |
---|
| 51 | virtual int _colByName(const std::string& name) const; |
---|
[1895] | 52 | |
---|
| 53 | /// \e |
---|
[2364] | 54 | virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e); |
---|
[1294] | 55 | /// \e |
---|
[2366] | 56 | virtual void _getRowCoeffs(int i, RowIterator b) const; |
---|
[2364] | 57 | /// \e |
---|
| 58 | virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e); |
---|
| 59 | /// \e |
---|
[2366] | 60 | virtual void _getColCoeffs(int i, ColIterator b) const; |
---|
[1294] | 61 | |
---|
[1431] | 62 | /// Set one element of the coefficient matrix |
---|
| 63 | virtual void _setCoeff(int row, int col, Value value); |
---|
[1294] | 64 | |
---|
[2324] | 65 | /// Get one element of the coefficient matrix |
---|
[2366] | 66 | virtual Value _getCoeff(int row, int col) const; |
---|
[2324] | 67 | |
---|
[1294] | 68 | /// The lower bound of a variable (column) have to be given by an |
---|
| 69 | /// extended number of type Value, i.e. a finite number of type |
---|
| 70 | /// Value or -\ref INF. |
---|
[1254] | 71 | virtual void _setColLowerBound(int i, Value value); |
---|
[1294] | 72 | /// \e |
---|
| 73 | |
---|
[2328] | 74 | /// The lower bound of a variable (column) is an |
---|
| 75 | /// extended number of type Value, i.e. a finite number of type |
---|
| 76 | /// Value or -\ref INF. |
---|
[2366] | 77 | virtual Value _getColLowerBound(int i) const; |
---|
[2328] | 78 | |
---|
[1294] | 79 | /// The upper bound of a variable (column) have to be given by an |
---|
| 80 | /// extended number of type Value, i.e. a finite number of type |
---|
| 81 | /// Value or \ref INF. |
---|
[1254] | 82 | virtual void _setColUpperBound(int i, Value value); |
---|
[1294] | 83 | /// \e |
---|
| 84 | |
---|
[2328] | 85 | /// The upper bound of a variable (column) is an |
---|
| 86 | /// extended number of type Value, i.e. a finite number of type |
---|
| 87 | /// Value or \ref INF. |
---|
[2366] | 88 | virtual Value _getColUpperBound(int i) const; |
---|
[2328] | 89 | |
---|
[1405] | 90 | // /// The lower bound of a linear expression (row) have to be given by an |
---|
| 91 | // /// extended number of type Value, i.e. a finite number of type |
---|
| 92 | // /// Value or -\ref INF. |
---|
| 93 | // virtual void _setRowLowerBound(int i, Value value); |
---|
| 94 | // /// \e |
---|
| 95 | |
---|
| 96 | // /// The upper bound of a linear expression (row) have to be given by an |
---|
| 97 | // /// extended number of type Value, i.e. a finite number of type |
---|
| 98 | // /// Value or \ref INF. |
---|
| 99 | // virtual void _setRowUpperBound(int i, Value value); |
---|
| 100 | |
---|
| 101 | /// The lower and upper bound of a linear expression (row) have to be |
---|
| 102 | /// given by an |
---|
[1294] | 103 | /// extended number of type Value, i.e. a finite number of type |
---|
[1405] | 104 | /// Value or +/-\ref INF. |
---|
[1389] | 105 | virtual void _setRowBounds(int i, Value lb, Value ub); |
---|
| 106 | /// \e |
---|
| 107 | |
---|
[1294] | 108 | |
---|
[2328] | 109 | /// The lower and the upper bound of |
---|
| 110 | /// a constraint (row) are |
---|
| 111 | /// extended numbers of type Value, i.e. finite numbers of type |
---|
| 112 | /// Value, -\ref INF or \ref INF. |
---|
[2366] | 113 | virtual void _getRowBounds(int i, Value &lb, Value &ub) const; |
---|
[2328] | 114 | /// \e |
---|
| 115 | |
---|
| 116 | |
---|
[1294] | 117 | /// \e |
---|
[1390] | 118 | virtual void _clearObj(); |
---|
| 119 | /// \e |
---|
[1254] | 120 | virtual void _setObjCoeff(int i, Value obj_coef); |
---|
[1294] | 121 | |
---|
[2324] | 122 | /// \e |
---|
[2366] | 123 | virtual Value _getObjCoeff(int i) const; |
---|
[2324] | 124 | |
---|
[1294] | 125 | ///\e |
---|
| 126 | |
---|
| 127 | ///\bug Wrong interface |
---|
| 128 | /// |
---|
[1303] | 129 | virtual SolveExitStatus _solve(); |
---|
[1294] | 130 | |
---|
| 131 | ///\e |
---|
| 132 | |
---|
| 133 | ///\bug Wrong interface |
---|
| 134 | /// |
---|
[2366] | 135 | virtual Value _getPrimal(int i) const; |
---|
[1796] | 136 | |
---|
| 137 | ///\e |
---|
| 138 | |
---|
| 139 | ///\bug Wrong interface |
---|
| 140 | /// |
---|
[2366] | 141 | virtual Value _getDual(int i) const; |
---|
[1796] | 142 | |
---|
[1294] | 143 | ///\e |
---|
| 144 | |
---|
| 145 | ///\bug Wrong interface |
---|
| 146 | /// |
---|
[2366] | 147 | virtual Value _getPrimalValue() const; |
---|
[1796] | 148 | |
---|
[1312] | 149 | ///\e |
---|
| 150 | |
---|
| 151 | ///\bug Wrong interface |
---|
| 152 | /// |
---|
[2366] | 153 | virtual SolutionStatus _getPrimalStatus() const; |
---|
[1312] | 154 | |
---|
[1460] | 155 | ////e |
---|
[2366] | 156 | virtual SolutionStatus _getDualStatus() const; |
---|
[1460] | 157 | |
---|
| 158 | |
---|
| 159 | ///\e |
---|
[2366] | 160 | virtual ProblemTypes _getProblemType() const; |
---|
[1460] | 161 | |
---|
[1312] | 162 | ///\e |
---|
| 163 | virtual void _setMax(); |
---|
| 164 | ///\e |
---|
| 165 | virtual void _setMin(); |
---|
[1843] | 166 | |
---|
| 167 | ///\e |
---|
[2366] | 168 | virtual bool _isMax() const; |
---|
[2324] | 169 | |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | ///\e |
---|
[2366] | 173 | virtual bool _isBasicCol(int i) const; |
---|
[1843] | 174 | |
---|
[1312] | 175 | |
---|
[1294] | 176 | |
---|
[1273] | 177 | public: |
---|
[1313] | 178 | LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {} |
---|
[1254] | 179 | }; |
---|
| 180 | |
---|
| 181 | } //namespace lemon |
---|
| 182 | |
---|
[1313] | 183 | #endif // LEMON_LP_SKELETON |
---|