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