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