3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
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.
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
19 #ifndef LEMON_LP_SKELETON
20 #define LEMON_LP_SKELETON
22 #include <lemon/lp_base.h>
25 ///\brief A skeleton file to implement LP solver interfaces
28 ///A skeleton class to implement LP solver interfaces
29 class LpSkeleton :public LpSolverBase {
35 virtual LpSolverBase* _newLp();
37 virtual LpSolverBase* _copyLp();
39 virtual int _addCol();
41 virtual int _addRow();
43 virtual void _eraseCol(int i);
45 virtual void _eraseRow(int i);
47 virtual void _getColName(int col, std::string & name) const;
49 virtual void _setColName(int col, const std::string & name);
51 virtual int _colByName(const std::string& name) const;
54 virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e);
56 virtual void _getRowCoeffs(int i, RowIterator b) const;
58 virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e);
60 virtual void _getColCoeffs(int i, ColIterator b) const;
62 /// Set one element of the coefficient matrix
63 virtual void _setCoeff(int row, int col, Value value);
65 /// Get one element of the coefficient matrix
66 virtual Value _getCoeff(int row, int col) const;
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.
71 virtual void _setColLowerBound(int i, Value value);
74 /// The lower bound of a variable (column) is an
75 /// extended number of type Value, i.e. a finite number of type
76 /// Value or -\ref INF.
77 virtual Value _getColLowerBound(int i) const;
79 /// The upper bound of a variable (column) have to be given by an
80 /// extended number of type Value, i.e. a finite number of type
81 /// Value or \ref INF.
82 virtual void _setColUpperBound(int i, Value value);
85 /// The upper bound of a variable (column) is an
86 /// extended number of type Value, i.e. a finite number of type
87 /// Value or \ref INF.
88 virtual Value _getColUpperBound(int i) const;
90 // /// The lower 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 _setRowLowerBound(int i, Value value);
96 // /// The upper bound of a linear expression (row) have to be given by an
97 // /// extended number of type Value, i.e. a finite number of type
98 // /// Value or \ref INF.
99 // virtual void _setRowUpperBound(int i, Value value);
101 /// The lower and upper bound of a linear expression (row) have to be
103 /// extended number of type Value, i.e. a finite number of type
104 /// Value or +/-\ref INF.
105 virtual void _setRowBounds(int i, Value lb, Value ub);
109 /// The lower and the upper bound of
110 /// a constraint (row) are
111 /// extended numbers of type Value, i.e. finite numbers of type
112 /// Value, -\ref INF or \ref INF.
113 virtual void _getRowBounds(int i, Value &lb, Value &ub) const;
118 virtual void _clearObj();
120 virtual void _setObjCoeff(int i, Value obj_coef);
123 virtual Value _getObjCoeff(int i) const;
127 ///\bug Wrong interface
129 virtual SolveExitStatus _solve();
133 ///\bug Wrong interface
135 virtual Value _getPrimal(int i) const;
139 ///\bug Wrong interface
141 virtual Value _getDual(int i) const;
145 ///\bug Wrong interface
147 virtual Value _getPrimalValue() const;
151 ///\bug Wrong interface
153 virtual SolutionStatus _getPrimalStatus() const;
156 virtual SolutionStatus _getDualStatus() const;
160 virtual ProblemTypes _getProblemType() const;
163 virtual void _setMax();
165 virtual void _setMin();
168 virtual bool _isMax() const;
173 virtual bool _isBasicCol(int i) const;
178 LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
183 #endif // LEMON_LP_SKELETON