deba@559
|
1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*-
|
deba@559
|
2 |
*
|
deba@559
|
3 |
* This file is a part of LEMON, a generic C++ optimization library.
|
deba@559
|
4 |
*
|
deba@559
|
5 |
* Copyright (C) 2003-2009
|
deba@559
|
6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
|
deba@559
|
7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES).
|
deba@559
|
8 |
*
|
deba@559
|
9 |
* Permission to use, modify and distribute this software is granted
|
deba@559
|
10 |
* provided that this copyright notice appears in all copies. For
|
deba@559
|
11 |
* precise terms see the accompanying LICENSE file.
|
deba@559
|
12 |
*
|
deba@559
|
13 |
* This software is provided "AS IS" with no warranty of any kind,
|
deba@559
|
14 |
* express or implied, and with no claim as to its suitability for any
|
deba@559
|
15 |
* purpose.
|
deba@559
|
16 |
*
|
deba@559
|
17 |
*/
|
deba@559
|
18 |
|
deba@559
|
19 |
// -*- C++ -*-
|
deba@559
|
20 |
#ifndef LEMON_CBC_H
|
deba@559
|
21 |
#define LEMON_CBC_H
|
deba@559
|
22 |
|
deba@559
|
23 |
///\file
|
deba@559
|
24 |
///\brief Header of the LEMON-CBC mip solver interface.
|
deba@559
|
25 |
///\ingroup lp_group
|
deba@559
|
26 |
|
deba@559
|
27 |
#include <lemon/lp_base.h>
|
deba@559
|
28 |
|
deba@559
|
29 |
class CoinModel;
|
deba@559
|
30 |
class OsiSolverInterface;
|
deba@559
|
31 |
class CbcModel;
|
deba@559
|
32 |
|
deba@559
|
33 |
namespace lemon {
|
deba@559
|
34 |
|
deba@559
|
35 |
/// \brief Interface for the CBC MIP solver
|
deba@559
|
36 |
///
|
deba@559
|
37 |
/// This class implements an interface for the CBC MIP solver.
|
deba@559
|
38 |
///\ingroup lp_group
|
deba@559
|
39 |
class CbcMip : public MipSolver {
|
deba@559
|
40 |
protected:
|
deba@559
|
41 |
|
deba@559
|
42 |
CoinModel *_prob;
|
deba@559
|
43 |
OsiSolverInterface *_osi_solver;
|
deba@559
|
44 |
CbcModel *_cbc_model;
|
deba@559
|
45 |
|
deba@559
|
46 |
public:
|
deba@559
|
47 |
|
deba@559
|
48 |
/// \e
|
deba@559
|
49 |
CbcMip();
|
deba@559
|
50 |
/// \e
|
deba@559
|
51 |
CbcMip(const CbcMip&);
|
deba@559
|
52 |
/// \e
|
deba@559
|
53 |
~CbcMip();
|
deba@559
|
54 |
/// \e
|
deba@559
|
55 |
virtual CbcMip* newSolver() const;
|
deba@559
|
56 |
/// \e
|
deba@559
|
57 |
virtual CbcMip* cloneSolver() const;
|
deba@559
|
58 |
|
deba@559
|
59 |
protected:
|
deba@559
|
60 |
|
deba@559
|
61 |
virtual const char* _solverName() const;
|
deba@559
|
62 |
|
deba@559
|
63 |
virtual int _addCol();
|
deba@559
|
64 |
virtual int _addRow();
|
deba@559
|
65 |
|
deba@559
|
66 |
virtual void _eraseCol(int i);
|
deba@559
|
67 |
virtual void _eraseRow(int i);
|
deba@559
|
68 |
|
deba@559
|
69 |
virtual void _eraseColId(int i);
|
deba@559
|
70 |
virtual void _eraseRowId(int i);
|
deba@559
|
71 |
|
deba@559
|
72 |
virtual void _getColName(int col, std::string& name) const;
|
deba@559
|
73 |
virtual void _setColName(int col, const std::string& name);
|
deba@559
|
74 |
virtual int _colByName(const std::string& name) const;
|
deba@559
|
75 |
|
deba@559
|
76 |
virtual void _getRowName(int row, std::string& name) const;
|
deba@559
|
77 |
virtual void _setRowName(int row, const std::string& name);
|
deba@559
|
78 |
virtual int _rowByName(const std::string& name) const;
|
deba@559
|
79 |
|
deba@559
|
80 |
virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
|
deba@559
|
81 |
virtual void _getRowCoeffs(int i, InsertIterator b) const;
|
deba@559
|
82 |
|
deba@559
|
83 |
virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e);
|
deba@559
|
84 |
virtual void _getColCoeffs(int i, InsertIterator b) const;
|
deba@559
|
85 |
|
deba@559
|
86 |
virtual void _setCoeff(int row, int col, Value value);
|
deba@559
|
87 |
virtual Value _getCoeff(int row, int col) const;
|
deba@559
|
88 |
|
deba@559
|
89 |
virtual void _setColLowerBound(int i, Value value);
|
deba@559
|
90 |
virtual Value _getColLowerBound(int i) const;
|
deba@559
|
91 |
virtual void _setColUpperBound(int i, Value value);
|
deba@559
|
92 |
virtual Value _getColUpperBound(int i) const;
|
deba@559
|
93 |
|
deba@559
|
94 |
virtual void _setRowLowerBound(int i, Value value);
|
deba@559
|
95 |
virtual Value _getRowLowerBound(int i) const;
|
deba@559
|
96 |
virtual void _setRowUpperBound(int i, Value value);
|
deba@559
|
97 |
virtual Value _getRowUpperBound(int i) const;
|
deba@559
|
98 |
|
deba@559
|
99 |
virtual void _setObjCoeffs(ExprIterator b, ExprIterator e);
|
deba@559
|
100 |
virtual void _getObjCoeffs(InsertIterator b) const;
|
deba@559
|
101 |
|
deba@559
|
102 |
virtual void _setObjCoeff(int i, Value obj_coef);
|
deba@559
|
103 |
virtual Value _getObjCoeff(int i) const;
|
deba@559
|
104 |
|
deba@559
|
105 |
virtual void _setSense(Sense sense);
|
deba@559
|
106 |
virtual Sense _getSense() const;
|
deba@559
|
107 |
|
deba@559
|
108 |
virtual ColTypes _getColType(int col) const;
|
deba@559
|
109 |
virtual void _setColType(int col, ColTypes col_type);
|
deba@559
|
110 |
|
deba@559
|
111 |
virtual SolveExitStatus _solve();
|
deba@559
|
112 |
virtual ProblemType _getType() const;
|
deba@559
|
113 |
virtual Value _getSol(int i) const;
|
deba@559
|
114 |
virtual Value _getSolValue() const;
|
deba@559
|
115 |
|
deba@559
|
116 |
virtual void _clear();
|
deba@559
|
117 |
|
deba@559
|
118 |
public:
|
deba@559
|
119 |
|
deba@559
|
120 |
///Enum for \c messageLevel() parameter
|
deba@559
|
121 |
enum MessageLevel {
|
deba@559
|
122 |
/// no output (default value)
|
deba@559
|
123 |
MESSAGE_NO_OUTPUT = 0,
|
deba@559
|
124 |
/// error messages only
|
deba@559
|
125 |
MESSAGE_ERROR_MESSAGE = 1,
|
deba@559
|
126 |
/// normal output
|
deba@559
|
127 |
MESSAGE_NORMAL_OUTPUT = 2,
|
deba@559
|
128 |
/// full output (includes informational messages)
|
deba@559
|
129 |
MESSAGE_FULL_OUTPUT = 3
|
deba@559
|
130 |
};
|
deba@559
|
131 |
|
deba@559
|
132 |
private:
|
deba@559
|
133 |
|
deba@559
|
134 |
MessageLevel _message_level;
|
deba@559
|
135 |
|
deba@559
|
136 |
public:
|
deba@559
|
137 |
|
deba@559
|
138 |
///Set the verbosity of the messages
|
deba@559
|
139 |
|
deba@559
|
140 |
///Set the verbosity of the messages
|
deba@559
|
141 |
///
|
deba@559
|
142 |
///\param m is the level of the messages output by the solver routines.
|
deba@559
|
143 |
void messageLevel(MessageLevel m);
|
deba@559
|
144 |
|
deba@559
|
145 |
|
deba@559
|
146 |
};
|
deba@559
|
147 |
|
deba@559
|
148 |
}
|
deba@559
|
149 |
|
deba@559
|
150 |
#endif
|