3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
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);
49 virtual void _setColName(int col, const std::string & name);
52 virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e);
54 virtual void _getRowCoeffs(int i, RowIterator b);
56 virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e);
58 virtual void _getColCoeffs(int i, ColIterator b);
60 /// Set one element of the coefficient matrix
61 virtual void _setCoeff(int row, int col, Value value);
63 /// Get one element of the coefficient matrix
64 virtual Value _getCoeff(int row, int col);
66 /// The lower bound of a variable (column) have to be given by an
67 /// extended number of type Value, i.e. a finite number of type
68 /// Value or -\ref INF.
69 virtual void _setColLowerBound(int i, Value value);
72 /// The lower bound of a variable (column) is an
73 /// extended number of type Value, i.e. a finite number of type
74 /// Value or -\ref INF.
75 virtual Value _getColLowerBound(int i);
77 /// The upper bound of a variable (column) have to be given by an
78 /// extended number of type Value, i.e. a finite number of type
79 /// Value or \ref INF.
80 virtual void _setColUpperBound(int i, Value value);
83 /// The upper bound of a variable (column) is an
84 /// extended number of type Value, i.e. a finite number of type
85 /// Value or \ref INF.
86 virtual Value _getColUpperBound(int i);
88 // /// The lower 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 _setRowLowerBound(int i, Value value);
94 // /// The upper bound of a linear expression (row) have to be given by an
95 // /// extended number of type Value, i.e. a finite number of type
96 // /// Value or \ref INF.
97 // virtual void _setRowUpperBound(int i, Value value);
99 /// The lower and upper bound of a linear expression (row) have to be
101 /// extended number of type Value, i.e. a finite number of type
102 /// Value or +/-\ref INF.
103 virtual void _setRowBounds(int i, Value lb, Value ub);
107 /// The lower and the upper bound of
108 /// a constraint (row) are
109 /// extended numbers of type Value, i.e. finite numbers of type
110 /// Value, -\ref INF or \ref INF.
111 virtual void _getRowBounds(int i, Value &lb, Value &ub);
116 virtual void _clearObj();
118 virtual void _setObjCoeff(int i, Value obj_coef);
121 virtual Value _getObjCoeff(int i);
125 ///\bug Wrong interface
127 virtual SolveExitStatus _solve();
131 ///\bug Wrong interface
133 virtual Value _getPrimal(int i);
137 ///\bug Wrong interface
139 virtual Value _getDual(int i);
143 ///\bug Wrong interface
145 virtual Value _getPrimalValue();
149 ///\bug Wrong interface
151 virtual SolutionStatus _getPrimalStatus();
154 virtual SolutionStatus _getDualStatus();
158 virtual ProblemTypes _getProblemType();
161 virtual void _setMax();
163 virtual void _setMin();
166 virtual bool _isMax();
171 virtual bool _isBasicCol(int i);
176 LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
181 #endif // LEMON_LP_SKELETON