[1254] | 1 | /* -*- C++ -*- |
---|
| 2 | * |
---|
[1956] | 3 | * This file is a part of LEMON, a generic C++ optimization library |
---|
| 4 | * |
---|
| 5 | * Copyright (C) 2003-2006 |
---|
| 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: |
---|
[1364] | 33 | ///\e |
---|
| 34 | virtual LpSolverBase &_newLp(); |
---|
| 35 | ///\e |
---|
| 36 | virtual LpSolverBase &_copyLp(); |
---|
[1294] | 37 | /// \e |
---|
[1254] | 38 | virtual int _addCol(); |
---|
[1294] | 39 | /// \e |
---|
[1254] | 40 | virtual int _addRow(); |
---|
[1294] | 41 | /// \e |
---|
[1432] | 42 | virtual void _eraseCol(int i); |
---|
| 43 | /// \e |
---|
| 44 | virtual void _eraseRow(int i); |
---|
| 45 | /// \e |
---|
[2312] | 46 | virtual void _getColName(int col, std::string & name); |
---|
[1895] | 47 | /// \e |
---|
| 48 | virtual void _setColName(int col, const std::string & name); |
---|
| 49 | |
---|
| 50 | /// \e |
---|
[2312] | 51 | virtual void _setRowCoeffs(int i, LpRowIterator b, LpRowIterator e); |
---|
[1294] | 52 | /// \e |
---|
[2312] | 53 | virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e); |
---|
[1294] | 54 | |
---|
[1431] | 55 | /// Set one element of the coefficient matrix |
---|
| 56 | virtual void _setCoeff(int row, int col, Value value); |
---|
[1294] | 57 | |
---|
[2324] | 58 | /// Get one element of the coefficient matrix |
---|
| 59 | virtual Value _getCoeff(int row, int col); |
---|
| 60 | |
---|
[1294] | 61 | /// The lower bound of a variable (column) have to be given by an |
---|
| 62 | /// extended number of type Value, i.e. a finite number of type |
---|
| 63 | /// Value or -\ref INF. |
---|
[1254] | 64 | virtual void _setColLowerBound(int i, Value value); |
---|
[1294] | 65 | /// \e |
---|
| 66 | |
---|
[2328] | 67 | /// The lower bound of a variable (column) is an |
---|
| 68 | /// extended number of type Value, i.e. a finite number of type |
---|
| 69 | /// Value or -\ref INF. |
---|
| 70 | virtual Value _getColLowerBound(int i); |
---|
| 71 | |
---|
[1294] | 72 | /// The upper bound of a variable (column) have to be given by an |
---|
| 73 | /// extended number of type Value, i.e. a finite number of type |
---|
| 74 | /// Value or \ref INF. |
---|
[1254] | 75 | virtual void _setColUpperBound(int i, Value value); |
---|
[1294] | 76 | /// \e |
---|
| 77 | |
---|
[2328] | 78 | /// The upper bound of a variable (column) is an |
---|
| 79 | /// extended number of type Value, i.e. a finite number of type |
---|
| 80 | /// Value or \ref INF. |
---|
| 81 | virtual Value _getColUpperBound(int i); |
---|
| 82 | |
---|
[1405] | 83 | // /// The lower bound of a linear expression (row) have to be given by an |
---|
| 84 | // /// extended number of type Value, i.e. a finite number of type |
---|
| 85 | // /// Value or -\ref INF. |
---|
| 86 | // virtual void _setRowLowerBound(int i, Value value); |
---|
| 87 | // /// \e |
---|
| 88 | |
---|
| 89 | // /// The upper bound of a linear expression (row) have to be given by an |
---|
| 90 | // /// extended number of type Value, i.e. a finite number of type |
---|
| 91 | // /// Value or \ref INF. |
---|
| 92 | // virtual void _setRowUpperBound(int i, Value value); |
---|
| 93 | |
---|
| 94 | /// The lower and upper bound of a linear expression (row) have to be |
---|
| 95 | /// given by an |
---|
[1294] | 96 | /// extended number of type Value, i.e. a finite number of type |
---|
[1405] | 97 | /// Value or +/-\ref INF. |
---|
[1389] | 98 | virtual void _setRowBounds(int i, Value lb, Value ub); |
---|
| 99 | /// \e |
---|
| 100 | |
---|
[1294] | 101 | |
---|
[2328] | 102 | /// The lower and the upper bound of |
---|
| 103 | /// a constraint (row) are |
---|
| 104 | /// extended numbers of type Value, i.e. finite numbers of type |
---|
| 105 | /// Value, -\ref INF or \ref INF. |
---|
| 106 | virtual void _getRowBounds(int i, Value &lb, Value &ub); |
---|
| 107 | /// \e |
---|
| 108 | |
---|
| 109 | |
---|
[1294] | 110 | /// \e |
---|
[1390] | 111 | virtual void _clearObj(); |
---|
| 112 | /// \e |
---|
[1254] | 113 | virtual void _setObjCoeff(int i, Value obj_coef); |
---|
[1294] | 114 | |
---|
[2324] | 115 | /// \e |
---|
| 116 | virtual Value _getObjCoeff(int i); |
---|
| 117 | |
---|
[1294] | 118 | ///\e |
---|
| 119 | |
---|
| 120 | ///\bug Wrong interface |
---|
| 121 | /// |
---|
[1303] | 122 | virtual SolveExitStatus _solve(); |
---|
[1294] | 123 | |
---|
| 124 | ///\e |
---|
| 125 | |
---|
| 126 | ///\bug Wrong interface |
---|
| 127 | /// |
---|
[1293] | 128 | virtual Value _getPrimal(int i); |
---|
[1796] | 129 | |
---|
| 130 | ///\e |
---|
| 131 | |
---|
| 132 | ///\bug Wrong interface |
---|
| 133 | /// |
---|
| 134 | virtual Value _getDual(int i); |
---|
| 135 | |
---|
[1294] | 136 | ///\e |
---|
| 137 | |
---|
| 138 | ///\bug Wrong interface |
---|
| 139 | /// |
---|
[1312] | 140 | virtual Value _getPrimalValue(); |
---|
[1796] | 141 | |
---|
[1312] | 142 | ///\e |
---|
| 143 | |
---|
| 144 | ///\bug Wrong interface |
---|
| 145 | /// |
---|
| 146 | virtual SolutionStatus _getPrimalStatus(); |
---|
| 147 | |
---|
[1460] | 148 | ////e |
---|
| 149 | virtual SolutionStatus _getDualStatus(); |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | ///\e |
---|
| 153 | virtual ProblemTypes _getProblemType(); |
---|
| 154 | |
---|
[1312] | 155 | ///\e |
---|
| 156 | virtual void _setMax(); |
---|
| 157 | ///\e |
---|
| 158 | virtual void _setMin(); |
---|
[1843] | 159 | |
---|
| 160 | ///\e |
---|
[2324] | 161 | virtual bool _isMax(); |
---|
| 162 | |
---|
| 163 | |
---|
| 164 | |
---|
| 165 | ///\e |
---|
[1843] | 166 | virtual bool _isBasicCol(int i); |
---|
| 167 | |
---|
[1312] | 168 | |
---|
[1294] | 169 | |
---|
[1273] | 170 | public: |
---|
[1313] | 171 | LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {} |
---|
[1254] | 172 | }; |
---|
| 173 | |
---|
| 174 | } //namespace lemon |
---|
| 175 | |
---|
[1313] | 176 | #endif // LEMON_LP_SKELETON |
---|