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