blob: 364ba5a016e4bd8f36f067eb1533af3b6110e844 (
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
|
// Copyright (C) 2000, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef CglLiftAndProject_H
#define CglLiftAndProject_H
#include <string>
#include "CglCutGenerator.hpp"
/** Lift And Project Cut Generator Class */
class CglLiftAndProject : public CglCutGenerator {
friend void CglLiftAndProjectUnitTest(const OsiSolverInterface * siP,
const std::string mpdDir );
public:
/**@name Generate Cuts */
//@{
/** Generate lift-and-project cuts for the
model of the solver interface, si.
Insert the generated cuts into OsiCut, cs.
*/
virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
const CglTreeInfo info = CglTreeInfo());
/** Get the normalization : Either beta=+1 or beta=-1.
*/
double getBeta() const {
return beta_;
}
/** Set the normalization : Either beta=+1 or beta=-1.
Default value is 1.
*/
void setBeta(int oneOrMinusOne){
if (oneOrMinusOne==1 || oneOrMinusOne==-1){
beta_= static_cast<double>(oneOrMinusOne);
}
else {
throw CoinError("Unallowable value. Beta must be 1 or -1",
"cutGeneration","CglLiftAndProject");
}
}
//@}
/**@name Constructors and destructors */
//@{
/// Default constructor
CglLiftAndProject ();
/// Copy constructor
CglLiftAndProject (
const CglLiftAndProject &);
/// Clone
virtual CglCutGenerator * clone() const;
/// Assignment operator
CglLiftAndProject &
operator=(
const CglLiftAndProject& rhs);
/// Destructor
virtual
~CglLiftAndProject ();
/// Create C++ lines to get to current state
virtual std::string generateCpp( FILE * fp);
//@}
private:
// Private member methods
/**@name Private methods */
//@{
//@}
// Private member data
/**@name Private member data */
//@{
/// The normalization is beta_=1 or beta_=-1
double beta_;
/// epsilon
double epsilon_;
/// 1-epsilon
double onetol_;
//@}
};
//#############################################################################
/** A function that tests the methods in the CglLiftAndProject class. The
only reason for it not to be a member method is that this way it doesn't
have to be compiled into the library. And that's a gain, because the
library should be compiled with optimization on, but this method should be
compiled with debugging. */
void CglLiftAndProjectUnitTest(const OsiSolverInterface * siP,
const std::string mpdDir );
#endif
|