alpar@1381
|
1 |
/* -*- C++ -*-
|
alpar@1381
|
2 |
*
|
alpar@1956
|
3 |
* This file is a part of LEMON, a generic C++ optimization library
|
alpar@1956
|
4 |
*
|
alpar@2553
|
5 |
* Copyright (C) 2003-2008
|
alpar@1956
|
6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
|
alpar@1381
|
7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES).
|
alpar@1381
|
8 |
*
|
alpar@1381
|
9 |
* Permission to use, modify and distribute this software is granted
|
alpar@1381
|
10 |
* provided that this copyright notice appears in all copies. For
|
alpar@1381
|
11 |
* precise terms see the accompanying LICENSE file.
|
alpar@1381
|
12 |
*
|
alpar@1381
|
13 |
* This software is provided "AS IS" with no warranty of any kind,
|
alpar@1381
|
14 |
* express or implied, and with no claim as to its suitability for any
|
alpar@1381
|
15 |
* purpose.
|
alpar@1381
|
16 |
*
|
alpar@1381
|
17 |
*/
|
alpar@1381
|
18 |
|
alpar@1381
|
19 |
#ifndef LEMON_LP_CPLEX_H
|
alpar@1381
|
20 |
#define LEMON_LP_CPLEX_H
|
alpar@1381
|
21 |
|
alpar@1381
|
22 |
///\file
|
alpar@1381
|
23 |
///\brief Header of the LEMON-CPLEX lp solver interface.
|
alpar@1381
|
24 |
|
alpar@1381
|
25 |
#include <lemon/lp_base.h>
|
alpar@1398
|
26 |
|
alpar@1381
|
27 |
extern "C" {
|
alpar@1381
|
28 |
#include <ilcplex/cplex.h>
|
alpar@1381
|
29 |
}
|
alpar@1381
|
30 |
|
alpar@1381
|
31 |
namespace lemon {
|
alpar@1381
|
32 |
|
alpar@1381
|
33 |
|
alpar@1398
|
34 |
/// \brief Interface for the CPLEX solver
|
alpar@1381
|
35 |
///
|
alpar@1398
|
36 |
/// This class implements an interface for the CPLEX LP solver.
|
athos@2218
|
37 |
class LpCplex :virtual public LpSolverBase {
|
alpar@1381
|
38 |
|
alpar@1381
|
39 |
public:
|
alpar@1381
|
40 |
|
alpar@1381
|
41 |
typedef LpSolverBase Parent;
|
alpar@1381
|
42 |
|
alpar@1381
|
43 |
/// \e
|
alpar@1381
|
44 |
int status;
|
alpar@1381
|
45 |
CPXENVptr env;
|
alpar@1381
|
46 |
CPXLPptr lp;
|
alpar@1381
|
47 |
|
alpar@1381
|
48 |
|
alpar@1381
|
49 |
/// \e
|
alpar@1381
|
50 |
LpCplex();
|
alpar@1381
|
51 |
/// \e
|
deba@2605
|
52 |
LpCplex(const LpCplex&);
|
deba@2605
|
53 |
/// \e
|
alpar@1381
|
54 |
~LpCplex();
|
alpar@1381
|
55 |
|
alpar@1381
|
56 |
protected:
|
deba@2605
|
57 |
virtual LpSolverBase* _newLp();
|
deba@2605
|
58 |
virtual LpSolverBase* _copyLp();
|
alpar@1381
|
59 |
|
athos@2361
|
60 |
|
alpar@1381
|
61 |
virtual int _addCol();
|
alpar@1381
|
62 |
virtual int _addRow();
|
athos@1432
|
63 |
virtual void _eraseCol(int i);
|
athos@1432
|
64 |
virtual void _eraseRow(int i);
|
deba@2366
|
65 |
virtual void _getColName(int col, std::string & name) const;
|
alpar@1895
|
66 |
virtual void _setColName(int col, const std::string & name);
|
deba@2366
|
67 |
virtual int _colByName(const std::string& name) const;
|
deba@2364
|
68 |
virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e);
|
deba@2366
|
69 |
virtual void _getRowCoeffs(int i, RowIterator b) const;
|
deba@2364
|
70 |
virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e);
|
deba@2366
|
71 |
virtual void _getColCoeffs(int i, ColIterator b) const;
|
athos@1431
|
72 |
virtual void _setCoeff(int row, int col, Value value);
|
deba@2366
|
73 |
virtual Value _getCoeff(int row, int col) const;
|
athos@2361
|
74 |
|
alpar@1381
|
75 |
virtual void _setColLowerBound(int i, Value value);
|
deba@2366
|
76 |
virtual Value _getColLowerBound(int i) const;
|
alpar@1381
|
77 |
virtual void _setColUpperBound(int i, Value value);
|
deba@2366
|
78 |
virtual Value _getColUpperBound(int i) const;
|
athos@2361
|
79 |
|
athos@1405
|
80 |
// virtual void _setRowLowerBound(int i, Value value);
|
athos@1405
|
81 |
// virtual void _setRowUpperBound(int i, Value value);
|
alpar@1381
|
82 |
virtual void _setRowBounds(int i, Value lower, Value upper);
|
deba@2366
|
83 |
virtual void _getRowBounds(int i, Value &lb, Value &ub) const;
|
alpar@1381
|
84 |
virtual void _setObjCoeff(int i, Value obj_coef);
|
deba@2366
|
85 |
virtual Value _getObjCoeff(int i) const;
|
alpar@1381
|
86 |
virtual void _clearObj();
|
athos@2361
|
87 |
|
alpar@1381
|
88 |
|
alpar@1381
|
89 |
virtual SolveExitStatus _solve();
|
deba@2366
|
90 |
virtual Value _getPrimal(int i) const;
|
deba@2366
|
91 |
virtual Value _getDual(int i) const;
|
deba@2366
|
92 |
virtual Value _getPrimalValue() const;
|
deba@2366
|
93 |
virtual bool _isBasicCol(int i) const;
|
alpar@1381
|
94 |
|
deba@2366
|
95 |
virtual SolutionStatus _getPrimalStatus() const;
|
deba@2366
|
96 |
virtual SolutionStatus _getDualStatus() const;
|
deba@2366
|
97 |
virtual ProblemTypes _getProblemType() const;
|
alpar@1381
|
98 |
|
alpar@1381
|
99 |
|
alpar@1381
|
100 |
virtual void _setMax();
|
alpar@1381
|
101 |
virtual void _setMin();
|
alpar@1381
|
102 |
|
deba@2366
|
103 |
virtual bool _isMax() const;
|
athos@2361
|
104 |
|
deba@2605
|
105 |
public:
|
deba@2605
|
106 |
|
deba@2605
|
107 |
CPXENVptr cplexEnv() { return env; }
|
deba@2605
|
108 |
CPXLPptr cplexLp() { return lp; }
|
deba@2605
|
109 |
|
alpar@1381
|
110 |
};
|
alpar@1381
|
111 |
} //END OF NAMESPACE LEMON
|
alpar@1381
|
112 |
|
alpar@1381
|
113 |
#endif //LEMON_LP_CPLEX_H
|
alpar@1381
|
114 |
|