Cbc
2.10.13
Toggle main menu visibility
Loading...
Searching...
No Matches
Cbc
src
CbcEventHandler.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2006, International Business Machines Corporation and others.
3
All Rights Reserved.
4
5
This code is licensed under the terms of the Eclipse Public License (EPL).
6
7
$Id$
8
*/
9
10
#ifndef CbcEventHandler_H
11
#define CbcEventHandler_H
12
48
49
#include <cstddef>
50
#include <map>
51
52
/* May well already be declared, but can't hurt. */
53
54
class
CbcModel
;
55
56
/*
57
cvs/svn: $Id$
58
*/
59
81
82
class
CbcEventHandler
{
83
84
public
:
86
87
enum
CbcEvent
{
88
node
= 200,
90
treeStatus
,
92
solution
,
94
heuristicSolution
,
96
beforeSolution1
,
98
beforeSolution2
,
100
afterHeuristic
,
102
smallBranchAndBound
,
104
heuristicPass
,
106
convertToCuts
,
108
generatedCuts
,
110
endSearch
,
112
afterRootCuts
113
};
114
119
120
enum
CbcAction
{
121
noAction
= -1,
123
stop
= 0,
127
restart
,
129
restartRoot
,
131
addCuts
,
133
killSolution
,
135
takeAction
136
137
};
138
140
141
typedef
std::map< CbcEvent, CbcAction >
eaMapPair
;
142
145
152
virtual
CbcAction
event
(
CbcEvent
whichEvent);
153
160
virtual
CbcAction
event
(
CbcEvent
whichEvent,
void
*data);
161
163
166
168
169
CbcEventHandler
(
CbcModel
*
model
= 0
/* was NULL but 4.6 complains */
);
170
172
173
CbcEventHandler
(
const
CbcEventHandler
&orig);
174
176
177
CbcEventHandler
&
operator=
(
const
CbcEventHandler
&rhs);
178
180
181
virtual
CbcEventHandler
*
clone
()
const
;
182
184
185
virtual
~CbcEventHandler
();
186
188
191
193
194
inline
void
setModel
(
CbcModel
*
model
)
195
{
196
model_
=
model
;
197
}
198
200
201
inline
const
CbcModel
*
getModel
()
const
202
{
203
return
model_
;
204
}
205
207
208
inline
void
setDfltAction
(
CbcAction
action)
209
{
210
dfltAction_
= action;
211
}
212
214
215
inline
void
setAction
(
CbcEvent
event
,
CbcAction
action)
216
{
217
if
(
eaMap_
== 0) {
218
eaMap_
=
new
eaMapPair
;
219
}
220
(*eaMap_)[
event
] = action;
221
}
222
224
225
protected
:
231
233
234
CbcModel
*
model_
;
235
237
238
CbcAction
dfltAction_
;
239
241
242
eaMapPair
*
eaMap_
;
243
245
};
246
247
#endif
248
249
/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
250
*/
model
CbcModel * model() const
Return model.
Definition
CbcObject.hpp:252
CbcEventHandler::setDfltAction
void setDfltAction(CbcAction action)
Set the default action.
Definition
CbcEventHandler.hpp:208
CbcEventHandler::CbcAction
CbcAction
Action codes returned by the event handler.
Definition
CbcEventHandler.hpp:120
CbcEventHandler::restartRoot
@ restartRoot
RestartRoot — undo root node and start branch-and-cut afresh.
Definition
CbcEventHandler.hpp:129
CbcEventHandler::noAction
@ noAction
Continue — no action required.
Definition
CbcEventHandler.hpp:121
CbcEventHandler::takeAction
@ takeAction
Take action on modified data.
Definition
CbcEventHandler.hpp:135
CbcEventHandler::restart
@ restart
Restart — restart branch-and-cut search; do not undo root node processing.
Definition
CbcEventHandler.hpp:127
CbcEventHandler::killSolution
@ killSolution
Pretend solution never happened.
Definition
CbcEventHandler.hpp:133
CbcEventHandler::stop
@ stop
Stop — abort the current run at the next opportunity.
Definition
CbcEventHandler.hpp:123
CbcEventHandler::addCuts
@ addCuts
Add special cuts.
Definition
CbcEventHandler.hpp:131
CbcEventHandler::setAction
void setAction(CbcEvent event, CbcAction action)
Set the action code associated with an event.
Definition
CbcEventHandler.hpp:215
CbcEventHandler::clone
virtual CbcEventHandler * clone() const
Clone (virtual) constructor.
CbcEventHandler::~CbcEventHandler
virtual ~CbcEventHandler()
Destructor.
CbcEventHandler::CbcEventHandler
CbcEventHandler(CbcModel *model=0)
Default constructor.
CbcEventHandler::getModel
const CbcModel * getModel() const
Get model.
Definition
CbcEventHandler.hpp:201
CbcEventHandler::event
virtual CbcAction event(CbcEvent whichEvent, void *data)
Return the action to be taken for an event - and modify data.
CbcEventHandler::CbcEventHandler
CbcEventHandler(const CbcEventHandler &orig)
Copy constructor.
CbcEventHandler::eaMapPair
std::map< CbcEvent, CbcAction > eaMapPair
Data type for event/action pairs.
Definition
CbcEventHandler.hpp:141
CbcEventHandler::setModel
void setModel(CbcModel *model)
Set model.
Definition
CbcEventHandler.hpp:194
CbcEventHandler::CbcEvent
CbcEvent
Events known to cbc.
Definition
CbcEventHandler.hpp:87
CbcEventHandler::beforeSolution1
@ beforeSolution1
A solution will be found unless user takes action (first check).
Definition
CbcEventHandler.hpp:96
CbcEventHandler::afterHeuristic
@ afterHeuristic
After failed heuristic.
Definition
CbcEventHandler.hpp:100
CbcEventHandler::smallBranchAndBound
@ smallBranchAndBound
On entry to small branch and bound.
Definition
CbcEventHandler.hpp:102
CbcEventHandler::node
@ node
Processing of the current node is complete.
Definition
CbcEventHandler.hpp:88
CbcEventHandler::solution
@ solution
A solution has been found.
Definition
CbcEventHandler.hpp:92
CbcEventHandler::convertToCuts
@ convertToCuts
When converting constraints to cuts.
Definition
CbcEventHandler.hpp:106
CbcEventHandler::afterRootCuts
@ afterRootCuts
Just before starting branching i.e.
Definition
CbcEventHandler.hpp:112
CbcEventHandler::beforeSolution2
@ beforeSolution2
A solution will be found unless user takes action (thorough check).
Definition
CbcEventHandler.hpp:98
CbcEventHandler::endSearch
@ endSearch
End of search.
Definition
CbcEventHandler.hpp:110
CbcEventHandler::treeStatus
@ treeStatus
A tree status interval has arrived.
Definition
CbcEventHandler.hpp:90
CbcEventHandler::heuristicSolution
@ heuristicSolution
A heuristic solution has been found.
Definition
CbcEventHandler.hpp:94
CbcEventHandler::generatedCuts
@ generatedCuts
Having generated cuts, allows user to think.
Definition
CbcEventHandler.hpp:108
CbcEventHandler::heuristicPass
@ heuristicPass
After a pass of heuristic.
Definition
CbcEventHandler.hpp:104
CbcEventHandler::event
virtual CbcAction event(CbcEvent whichEvent)
Return the action to be taken for an event.
CbcEventHandler::dfltAction_
CbcAction dfltAction_
Default action.
Definition
CbcEventHandler.hpp:238
CbcEventHandler::operator=
CbcEventHandler & operator=(const CbcEventHandler &rhs)
Assignment.
CbcEventHandler::eaMap_
eaMapPair * eaMap_
Pointer to a map that holds non-default event/action pairs.
Definition
CbcEventHandler.hpp:242
CbcEventHandler::model_
CbcModel * model_
Pointer to associated CbcModel.
Definition
CbcEventHandler.hpp:234
CbcModel
Simple Branch and bound class.
Definition
CbcModel.hpp:100
Generated by
1.17.0