/usr/include/coin/ClpEventHandler.hpp is in coinor-libclp-dev 1.12.0-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | /* $Id: ClpEventHandler.hpp 1533 2010-03-23 15:26:32Z forrest $ */
// Copyright (C) 2004, International Business Machines
// Corporation and others. All Rights Reserved.
#ifndef ClpEventHandler_H
#define ClpEventHandler_H
#include "ClpSimplex.hpp"
/** Base class for Clp event handling
This is just here to allow for event handling. By event I mean a Clp event
e.g. end of values pass.
One use would be to let a user handle a system event e.g. Control-C. This could be done
by deriving a class MyEventHandler which knows about such events. If one occurs
MyEventHandler::event() could clear event status and return 3 (stopped).
Clp would then return to user code.
As it is called every iteration this should be fine grained enough.
User can derive and construct from CbcModel - not pretty
*/
class ClpEventHandler {
public:
/** enums for what sort of event.
These will also be returned in ClpModel::secondaryStatus() as int
*/
enum Event {
endOfIteration = 100, // used to set secondary status
endOfFactorization,
endOfValuesPass,
node, // for Cbc
treeStatus, // for Cbc
solution, // for Cbc
theta, // hit in parametrics
pivotRow // used to choose pivot row
};
/**@name Virtual method that the derived classe should provide.
The base class instance does nothing and as event() is only useful method
it would not be very useful NOT providing one!
*/
//@{
/** This can do whatever it likes. If return code -1 then carries on
if 0 sets ClpModel::status() to 5 (stopped by event) and will return to user.
At present if <-1 carries on and if >0 acts as if 0 - this may change
*/
virtual int event(Event whichEvent);
//@}
/**@name Constructors, destructor */
//@{
/** Default constructor. */
ClpEventHandler(ClpSimplex * model = NULL);
/** Destructor */
virtual ~ClpEventHandler();
// Copy
ClpEventHandler(const ClpEventHandler&);
// Assignment
ClpEventHandler& operator=(const ClpEventHandler&);
/// Clone
virtual ClpEventHandler * clone() const;
//@}
/**@name Sets/gets */
//@{
/** set model. */
void setSimplex(ClpSimplex * model);
/// Get model
inline ClpSimplex * simplex() const {
return model_;
}
//@}
protected:
/**@name Data members
The data members are protected to allow access for derived classes. */
//@{
/// Pointer to simplex
ClpSimplex * model_;
//@}
};
/** Base class for Clp disaster handling
This is here to allow for disaster handling. By disaster I mean that Clp
would otherwise give up
*/
class ClpDisasterHandler {
public:
/**@name Virtual methods that the derived classe should provide.
*/
//@{
/// Into simplex
virtual void intoSimplex() = 0;
/// Checks if disaster
virtual bool check() const = 0;
/// saves information for next attempt
virtual void saveInfo() = 0;
/// Type of disaster 0 can fix, 1 abort
virtual int typeOfDisaster();
//@}
/**@name Constructors, destructor */
//@{
/** Default constructor. */
ClpDisasterHandler(ClpSimplex * model = NULL);
/** Destructor */
virtual ~ClpDisasterHandler();
// Copy
ClpDisasterHandler(const ClpDisasterHandler&);
// Assignment
ClpDisasterHandler& operator=(const ClpDisasterHandler&);
/// Clone
virtual ClpDisasterHandler * clone() const = 0;
//@}
/**@name Sets/gets */
//@{
/** set model. */
void setSimplex(ClpSimplex * model);
/// Get model
inline ClpSimplex * simplex() const {
return model_;
}
//@}
protected:
/**@name Data members
The data members are protected to allow access for derived classes. */
//@{
/// Pointer to simplex
ClpSimplex * model_;
//@}
};
#endif
|