[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 |
---|
[1895] | 46 | virtual void _getColName(int col, std::string & name); |
---|
| 47 | /// \e |
---|
| 48 | virtual void _setColName(int col, const std::string & name); |
---|
| 49 | |
---|
| 50 | /// \e |
---|
[1294] | 51 | |
---|
| 52 | /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) |
---|
| 53 | /// |
---|
[1254] | 54 | virtual void _setRowCoeffs(int i, |
---|
| 55 | int length, |
---|
| 56 | int const * indices, |
---|
| 57 | Value const * values ); |
---|
[1294] | 58 | /// \e |
---|
| 59 | |
---|
| 60 | /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) |
---|
| 61 | /// |
---|
[1254] | 62 | virtual void _setColCoeffs(int i, |
---|
| 63 | int length, |
---|
| 64 | int const * indices, |
---|
[1294] | 65 | Value const * values ); |
---|
| 66 | |
---|
[1431] | 67 | /// Set one element of the coefficient matrix |
---|
| 68 | virtual void _setCoeff(int row, int col, Value value); |
---|
[1294] | 69 | |
---|
| 70 | /// The lower bound of a variable (column) have to be given by an |
---|
| 71 | /// extended number of type Value, i.e. a finite number of type |
---|
| 72 | /// Value or -\ref INF. |
---|
[1254] | 73 | virtual void _setColLowerBound(int i, Value value); |
---|
[1294] | 74 | /// \e |
---|
| 75 | |
---|
| 76 | /// The upper bound of a variable (column) have to be given by an |
---|
| 77 | /// extended number of type Value, i.e. a finite number of type |
---|
| 78 | /// Value or \ref INF. |
---|
[1254] | 79 | virtual void _setColUpperBound(int i, Value value); |
---|
[1294] | 80 | /// \e |
---|
| 81 | |
---|
[1405] | 82 | // /// The lower bound of a linear expression (row) have to be given by an |
---|
| 83 | // /// extended number of type Value, i.e. a finite number of type |
---|
| 84 | // /// Value or -\ref INF. |
---|
| 85 | // virtual void _setRowLowerBound(int i, Value value); |
---|
| 86 | // /// \e |
---|
| 87 | |
---|
| 88 | // /// The upper 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 _setRowUpperBound(int i, Value value); |
---|
| 92 | |
---|
| 93 | /// The lower and upper bound of a linear expression (row) have to be |
---|
| 94 | /// given by an |
---|
[1294] | 95 | /// extended number of type Value, i.e. a finite number of type |
---|
[1405] | 96 | /// Value or +/-\ref INF. |
---|
[1389] | 97 | virtual void _setRowBounds(int i, Value lb, Value ub); |
---|
| 98 | /// \e |
---|
| 99 | |
---|
[1294] | 100 | |
---|
| 101 | /// \e |
---|
[1390] | 102 | virtual void _clearObj(); |
---|
| 103 | /// \e |
---|
[1254] | 104 | virtual void _setObjCoeff(int i, Value obj_coef); |
---|
[1294] | 105 | |
---|
| 106 | ///\e |
---|
| 107 | |
---|
| 108 | ///\bug Wrong interface |
---|
| 109 | /// |
---|
[1303] | 110 | virtual SolveExitStatus _solve(); |
---|
[1294] | 111 | |
---|
| 112 | ///\e |
---|
| 113 | |
---|
| 114 | ///\bug Wrong interface |
---|
| 115 | /// |
---|
[1293] | 116 | virtual Value _getPrimal(int i); |
---|
[1796] | 117 | |
---|
| 118 | ///\e |
---|
| 119 | |
---|
| 120 | ///\bug Wrong interface |
---|
| 121 | /// |
---|
| 122 | virtual Value _getDual(int i); |
---|
| 123 | |
---|
[1294] | 124 | ///\e |
---|
| 125 | |
---|
| 126 | ///\bug Wrong interface |
---|
| 127 | /// |
---|
[1312] | 128 | virtual Value _getPrimalValue(); |
---|
[1796] | 129 | |
---|
[1312] | 130 | ///\e |
---|
| 131 | |
---|
| 132 | ///\bug Wrong interface |
---|
| 133 | /// |
---|
| 134 | virtual SolutionStatus _getPrimalStatus(); |
---|
| 135 | |
---|
[1460] | 136 | ////e |
---|
| 137 | virtual SolutionStatus _getDualStatus(); |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | ///\e |
---|
| 141 | virtual ProblemTypes _getProblemType(); |
---|
| 142 | |
---|
[1312] | 143 | ///\e |
---|
| 144 | virtual void _setMax(); |
---|
| 145 | ///\e |
---|
| 146 | virtual void _setMin(); |
---|
[1843] | 147 | |
---|
| 148 | ///\e |
---|
| 149 | virtual bool _isBasicCol(int i); |
---|
| 150 | |
---|
[1312] | 151 | |
---|
[1294] | 152 | |
---|
[1273] | 153 | public: |
---|
[1313] | 154 | LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {} |
---|
[1254] | 155 | }; |
---|
| 156 | |
---|
| 157 | } //namespace lemon |
---|
| 158 | |
---|
[1313] | 159 | #endif // LEMON_LP_SKELETON |
---|