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
|
// $Id: CglStored.hpp 1119 2013-04-06 20:24:18Z stefan $
// Copyright (C) 2005, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef CglStored_H
#define CglStored_H
#include <string>
#include "CglCutGenerator.hpp"
class CoinWarmStartBasis;
class CglTreeProbingInfo;
/** Stored Cut Generator Class */
class CglStored : public CglCutGenerator {
public:
/**@name Generate Cuts */
//@{
/** Generate Mixed Integer Stored cuts for the model of the
solver interface, si.
Insert the generated cuts into OsiCut, cs.
This generator just looks at previously stored cuts
and inserts any that are violated by enough
*/
virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
const CglTreeInfo info = CglTreeInfo());
//@}
/**@name Change criterion on whether to include cut.
Violations of more than this will be added to current cut list
(default 1.0e-5) */
//@{
/// Set
inline void setRequiredViolation(double value)
{ requiredViolation_=value;}
/// Get
inline double getRequiredViolation() const
{ return requiredViolation_;}
/// Takes over ownership of probing info
inline void setProbingInfo(CglTreeProbingInfo * info)
{ probingInfo_ = info;}
//@}
/**@name Cut stuff */
//@{
/// Add cuts
void addCut(const OsiCuts & cs);
/// Add a row cut
void addCut(const OsiRowCut & cut);
/// Add a row cut from a packed vector
void addCut(double lb, double ub, const CoinPackedVector & vector);
/// Add a row cut from elements
void addCut(double lb, double ub, int size, const int * colIndices, const double * elements);
inline int sizeRowCuts() const
{ return cuts_.sizeRowCuts();}
const OsiRowCut * rowCutPointer(int index) const
{ return cuts_.rowCutPtr(index);}
/// Save stuff
void saveStuff(double bestObjective, const double * bestSolution,
const double * lower, const double * upper);
/// Best solution (or NULL)
inline const double * bestSolution() const
{ return bestSolution_;}
/// Best objective
double bestObjective() const;
/// Tight lower bounds
const double * tightLower() const
{ return bounds_;}
/// Tight upper bounds
const double * tightUpper() const
{ return bounds_+numberColumns_;}
//@}
/**@name Constructors and destructors */
//@{
/// Default constructor
CglStored (int numberColumns=0);
/// Copy constructor
CglStored (const CglStored & rhs);
/// Constructor from file
CglStored (const char * fileName);
/// Clone
virtual CglCutGenerator * clone() const;
/// Assignment operator
CglStored &
operator=(const CglStored& rhs);
/// Destructor
virtual
~CglStored ();
//@}
protected:
// Protected member methods
// Protected member data
/**@name Protected member data */
//@{
/// Only add if more than this requiredViolation
double requiredViolation_;
/// Pointer to probing information
CglTreeProbingInfo * probingInfo_;
/// Cuts
OsiCuts cuts_;
/// Number of columns in model
int numberColumns_;
/// Best solution (objective at end)
double * bestSolution_;
/// Tight bounds
double * bounds_;
//@}
};
#endif
|