COIN-OR::LEMON - Graph Library

source: lemon-0.x/lemon/lp_skeleton.h @ 2364:3a5e67bd42d2

Last change on this file since 2364:3a5e67bd42d2 was 2364:3a5e67bd42d2, checked in by Balazs Dezso, 17 years ago

Lp row and col getter function
lp section reader and writer for lemon IO

File size: 4.6 KB
Line 
1/* -*- C++ -*-
2 *
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
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
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
19#ifndef LEMON_LP_SKELETON
20#define LEMON_LP_SKELETON
21
22#include <lemon/lp_base.h>
23
24///\file
25///\brief A skeleton file to implement LP solver interfaces
26namespace lemon {
27
28  ///A skeleton class to implement LP solver interfaces
29  class LpSkeleton :public LpSolverBase {
30    int col_num,row_num;
31   
32  protected:
33
34    ///\e
35    virtual LpSolverBase &_newLp();
36    ///\e
37    virtual LpSolverBase &_copyLp();
38    /// \e
39    virtual int _addCol();
40    /// \e
41    virtual int _addRow();
42    /// \e
43    virtual void _eraseCol(int i);
44    /// \e
45    virtual void _eraseRow(int i);
46    /// \e
47    virtual void _getColName(int col, std::string & name);
48    /// \e
49    virtual void _setColName(int col, const std::string & name);
50
51    /// \e
52    virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e);
53    /// \e
54    virtual void _getRowCoeffs(int i, RowIterator b);
55    /// \e
56    virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e);
57    /// \e
58    virtual void _getColCoeffs(int i, ColIterator b);
59   
60    /// Set one element of the coefficient matrix
61    virtual void _setCoeff(int row, int col, Value value);
62
63    /// Get one element of the coefficient matrix
64    virtual Value _getCoeff(int row, int col);
65
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);
70    /// \e
71
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);
76
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);
81    /// \e
82
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);
87
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);
92//     /// \e
93
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);
98
99    /// The lower and upper bound of a linear expression (row) have to be
100    /// given by an
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);
104    /// \e
105
106
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);
112    /// \e
113
114
115    /// \e
116    virtual void _clearObj();
117    /// \e
118    virtual void _setObjCoeff(int i, Value obj_coef);
119
120    /// \e
121    virtual Value _getObjCoeff(int i);
122
123    ///\e
124   
125    ///\bug Wrong interface
126    ///
127    virtual SolveExitStatus _solve();
128
129    ///\e
130
131    ///\bug Wrong interface
132    ///
133    virtual Value _getPrimal(int i);
134
135    ///\e
136
137    ///\bug Wrong interface
138    ///
139    virtual Value _getDual(int i);
140
141    ///\e
142
143    ///\bug Wrong interface
144    ///
145    virtual Value _getPrimalValue();
146
147    ///\e
148
149    ///\bug Wrong interface
150    ///
151    virtual SolutionStatus _getPrimalStatus();
152
153    ////e
154    virtual SolutionStatus _getDualStatus();
155
156
157    ///\e
158    virtual ProblemTypes _getProblemType();
159
160    ///\e
161    virtual void _setMax();
162    ///\e
163    virtual void _setMin();
164
165    ///\e
166    virtual bool _isMax();
167
168
169
170    ///\e
171    virtual bool _isBasicCol(int i);
172
173   
174
175  public:
176    LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {}
177  }; 
178
179} //namespace lemon
180
181#endif // LEMON_LP_SKELETON
Note: See TracBrowser for help on using the repository browser.