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