1 | /* -*- C++ -*- |
---|
2 | * src/lemon/lp_skeleton.h |
---|
3 | * - Part of LEMON, a generic C++ optimization library |
---|
4 | * |
---|
5 | * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
---|
6 | * (Egervary Research Group on Combinatorial Optimization, EGRES). |
---|
7 | * |
---|
8 | * Permission to use, modify and distribute this software is granted |
---|
9 | * provided that this copyright notice appears in all copies. For |
---|
10 | * precise terms see the accompanying LICENSE file. |
---|
11 | * |
---|
12 | * This software is provided "AS IS" with no warranty of any kind, |
---|
13 | * express or implied, and with no claim as to its suitability for any |
---|
14 | * purpose. |
---|
15 | * |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef LEMON_LP_SKELETON |
---|
19 | #define LEMON_LP_SKELETON |
---|
20 | |
---|
21 | #include <lemon/lp_base.h> |
---|
22 | |
---|
23 | ///\file |
---|
24 | ///\brief A skeleton file to implement LP solver interfaces |
---|
25 | namespace lemon { |
---|
26 | |
---|
27 | ///A skeleton class to implement LP solver interfaces |
---|
28 | class LpSkeleton :public LpSolverBase { |
---|
29 | int col_num,row_num; |
---|
30 | |
---|
31 | protected: |
---|
32 | ///\e |
---|
33 | virtual LpSolverBase &_newLp(); |
---|
34 | ///\e |
---|
35 | virtual LpSolverBase &_copyLp(); |
---|
36 | /// \e |
---|
37 | virtual int _addCol(); |
---|
38 | /// \e |
---|
39 | virtual int _addRow(); |
---|
40 | /// \e |
---|
41 | |
---|
42 | /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) |
---|
43 | /// |
---|
44 | virtual void _setRowCoeffs(int i, |
---|
45 | int length, |
---|
46 | int const * indices, |
---|
47 | Value const * values ); |
---|
48 | /// \e |
---|
49 | |
---|
50 | /// \warning Arrays are indexed from 1 (datum at index 0 is ignored) |
---|
51 | /// |
---|
52 | virtual void _setColCoeffs(int i, |
---|
53 | int length, |
---|
54 | int const * indices, |
---|
55 | Value const * values ); |
---|
56 | |
---|
57 | /// \e |
---|
58 | |
---|
59 | /// The lower bound of a variable (column) have to be given by an |
---|
60 | /// extended number of type Value, i.e. a finite number of type |
---|
61 | /// Value or -\ref INF. |
---|
62 | virtual void _setColLowerBound(int i, Value value); |
---|
63 | /// \e |
---|
64 | |
---|
65 | /// The upper bound of a variable (column) have to be given by an |
---|
66 | /// extended number of type Value, i.e. a finite number of type |
---|
67 | /// Value or \ref INF. |
---|
68 | virtual void _setColUpperBound(int i, Value value); |
---|
69 | /// \e |
---|
70 | |
---|
71 | /// The lower bound of a linear expression (row) have to be given by an |
---|
72 | /// extended number of type Value, i.e. a finite number of type |
---|
73 | /// Value or -\ref INF. |
---|
74 | virtual void _setRowLowerBound(int i, Value value); |
---|
75 | /// \e |
---|
76 | |
---|
77 | /// \e |
---|
78 | virtual void _setRowBounds(int i, Value lb, Value ub); |
---|
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 | /// \e |
---|
87 | virtual void _setObjCoeff(int i, Value obj_coef); |
---|
88 | |
---|
89 | ///\e |
---|
90 | |
---|
91 | ///\bug Wrong interface |
---|
92 | /// |
---|
93 | virtual SolveExitStatus _solve(); |
---|
94 | |
---|
95 | ///\e |
---|
96 | |
---|
97 | ///\bug Wrong interface |
---|
98 | /// |
---|
99 | virtual Value _getPrimal(int i); |
---|
100 | ///\e |
---|
101 | |
---|
102 | ///\bug Wrong interface |
---|
103 | /// |
---|
104 | virtual Value _getPrimalValue(); |
---|
105 | ///\e |
---|
106 | |
---|
107 | ///\bug Wrong interface |
---|
108 | /// |
---|
109 | virtual SolutionStatus _getPrimalStatus(); |
---|
110 | |
---|
111 | ///\e |
---|
112 | virtual void _setMax(); |
---|
113 | ///\e |
---|
114 | virtual void _setMin(); |
---|
115 | |
---|
116 | |
---|
117 | public: |
---|
118 | LpSkeleton() : LpSolverBase(), col_num(0), row_num(0) {} |
---|
119 | }; |
---|
120 | |
---|
121 | } //namespace lemon |
---|
122 | |
---|
123 | #endif // LEMON_LP_SKELETON |
---|