| 1 | /* -*- C++ -*- |
|---|
| 2 | * lemon/lp_skeleton.h - Part of LEMON, a generic C++ optimization library |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
|---|
| 5 | * (Egervary Research Group on Combinatorial Optimization, EGRES). |
|---|
| 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 | |
|---|
| 17 | #ifndef LEMON_LP_SKELETON |
|---|
| 18 | #define LEMON_LP_SKELETON |
|---|
| 19 | |
|---|
| 20 | #include <lemon/lp_base.h> |
|---|
| 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 |
|---|
| 27 | class LpSkeleton :public LpSolverBase { |
|---|
| 28 | int col_num,row_num; |
|---|
| 29 | |
|---|
| 30 | protected: |
|---|
| 31 | ///\e |
|---|
| 32 | virtual LpSolverBase &_newLp(); |
|---|
| 33 | ///\e |
|---|
| 34 | virtual LpSolverBase &_copyLp(); |
|---|
| 35 | /// \e |
|---|
| 36 | virtual int _addCol(); |
|---|
| 37 | /// \e |
|---|
| 38 | virtual int _addRow(); |
|---|
| 39 | /// \e |
|---|
| 40 | virtual void _eraseCol(int i); |
|---|
| 41 | /// \e |
|---|
| 42 | virtual void _eraseRow(int i); |
|---|
| 43 | /// \e |
|---|
| 44 | |
|---|
| 45 | /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) |
|---|
| 46 | /// |
|---|
| 47 | virtual void _setRowCoeffs(int i, |
|---|
| 48 | int length, |
|---|
| 49 | int const * indices, |
|---|
| 50 | Value const * values ); |
|---|
| 51 | /// \e |
|---|
| 52 | |
|---|
| 53 | /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) |
|---|
| 54 | /// |
|---|
| 55 | virtual void _setColCoeffs(int i, |
|---|
| 56 | int length, |
|---|
| 57 | int const * indices, |
|---|
| 58 | Value const * values ); |
|---|
| 59 | |
|---|
| 60 | /// Set one element of the coefficient matrix |
|---|
| 61 | virtual void _setCoeff(int row, int col, Value value); |
|---|
| 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. |
|---|
| 66 | virtual void _setColLowerBound(int i, Value value); |
|---|
| 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. |
|---|
| 72 | virtual void _setColUpperBound(int i, Value value); |
|---|
| 73 | /// \e |
|---|
| 74 | |
|---|
| 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 |
|---|
| 88 | /// extended number of type Value, i.e. a finite number of type |
|---|
| 89 | /// Value or +/-\ref INF. |
|---|
| 90 | virtual void _setRowBounds(int i, Value lb, Value ub); |
|---|
| 91 | /// \e |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | /// \e |
|---|
| 95 | virtual void _clearObj(); |
|---|
| 96 | /// \e |
|---|
| 97 | virtual void _setObjCoeff(int i, Value obj_coef); |
|---|
| 98 | |
|---|
| 99 | ///\e |
|---|
| 100 | |
|---|
| 101 | ///\bug Wrong interface |
|---|
| 102 | /// |
|---|
| 103 | virtual SolveExitStatus _solve(); |
|---|
| 104 | |
|---|
| 105 | ///\e |
|---|
| 106 | |
|---|
| 107 | ///\bug Wrong interface |
|---|
| 108 | /// |
|---|
| 109 | virtual Value _getPrimal(int i); |
|---|
| 110 | |
|---|
| 111 | ///\e |
|---|
| 112 | |
|---|
| 113 | ///\bug Wrong interface |
|---|
| 114 | /// |
|---|
| 115 | virtual Value _getDual(int i); |
|---|
| 116 | |
|---|
| 117 | ///\e |
|---|
| 118 | |
|---|
| 119 | ///\bug Wrong interface |
|---|
| 120 | /// |
|---|
| 121 | virtual Value _getPrimalValue(); |
|---|
| 122 | |
|---|
| 123 | ///\e |
|---|
| 124 | |
|---|
| 125 | ///\bug Wrong interface |
|---|
| 126 | /// |
|---|
| 127 | virtual SolutionStatus _getPrimalStatus(); |
|---|
| 128 | |
|---|
| 129 | ////e |
|---|
| 130 | virtual SolutionStatus _getDualStatus(); |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | ///\e |
|---|
| 134 | virtual ProblemTypes _getProblemType(); |
|---|
| 135 | |
|---|
| 136 | ///\e |
|---|
| 137 | virtual void _setMax(); |
|---|
| 138 | ///\e |
|---|
| 139 | virtual void _setMin(); |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | public: |
|---|
| 143 | LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {} |
|---|
| 144 | }; |
|---|
| 145 | |
|---|
| 146 | } //namespace lemon |
|---|
| 147 | |
|---|
| 148 | #endif // LEMON_LP_SKELETON |
|---|