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