blob: 8f934c9500197d25379ce2675611113913d6a756 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
/* $Id: CbcFathom.hpp 1889 2013-04-07 13:46:46Z stefan $ */
// Copyright (C) 2004, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef CbcFathom_H
#define CbcFathom_H
#include "CbcConfig.h"
/*
This file contains two classes, CbcFathom and CbcOsiSolver. It's unclear why
they're in the same file. CbcOsiSolver is a base class for CbcLinked.
--lh, 071031 --
*/
class CbcModel;
//#############################################################################
/** Fathom base class.
The idea is that after some branching the problem will be effectively smaller than
the original problem and maybe there will be a more specialized technique which can completely
fathom this branch quickly.
One method is to presolve the problem to give a much smaller new problem and then do branch
and cut on that. Another might be dynamic programming.
*/
class CbcFathom {
public:
// Default Constructor
CbcFathom ();
// Constructor with model - assumed before cuts
CbcFathom (CbcModel & model);
virtual ~CbcFathom();
/// update model (This is needed if cliques update matrix etc)
virtual void setModel(CbcModel * model);
/// Clone
virtual CbcFathom * clone() const = 0;
/// Resets stuff if model changes
virtual void resetModel(CbcModel * model) = 0;
/** returns 0 if no fathoming attempted, 1 fully fathomed,
2 incomplete search, 3 incomplete search but treat as complete.
If solution then newSolution will not be NULL and
will be freed by CbcModel. It is expected that the solution is better
than best so far but CbcModel will double check.
If returns 3 then of course there is no guarantee of global optimum
*/
virtual int fathom(double *& newSolution) = 0;
// Is this method possible
inline bool possible() const {
return possible_;
}
protected:
/// Model
CbcModel * model_;
/// Possible - if this method of fathoming can be used
bool possible_;
private:
/// Illegal Assignment operator
CbcFathom & operator=(const CbcFathom& rhs);
};
#include "OsiClpSolverInterface.hpp"
//#############################################################################
/**
This is for codes where solver needs to know about CbcModel
Seems to provide only one value-added feature, a CbcModel object.
*/
class CbcOsiSolver : public OsiClpSolverInterface {
public:
/**@name Constructors and destructors */
//@{
/// Default Constructor
CbcOsiSolver ();
/// Clone
virtual OsiSolverInterface * clone(bool copyData = true) const;
/// Copy constructor
CbcOsiSolver (const CbcOsiSolver &);
/// Assignment operator
CbcOsiSolver & operator=(const CbcOsiSolver& rhs);
/// Destructor
virtual ~CbcOsiSolver ();
//@}
/**@name Sets and Gets */
//@{
/// Set Cbc Model
inline void setCbcModel(CbcModel * model) {
cbcModel_ = model;
}
/// Return Cbc Model
inline CbcModel * cbcModel() const {
return cbcModel_;
}
//@}
//---------------------------------------------------------------------------
protected:
/**@name Private member data */
//@{
/// Pointer back to CbcModel
CbcModel * cbcModel_;
//@}
};
#endif
|