Minotaur 0.4.1
Docs for developers
VarBoundMod.h
Go to the documentation of this file.
1//
2// Minotaur -- It's only 1/2 bull
3//
4// (C)opyright 2009 - 2025 The Minotaur Team.
5//
6
15#ifndef MINOTAURVARBOUNDMOD_H
16#define MINOTAURVARBOUNDMOD_H
17
18#include "Modification.h"
19
20namespace Minotaur {
21class Engine;
22class VarBoundMod;
23typedef Engine* EnginePtr;
24typedef VarBoundMod* VarBoundModPtr;
25typedef std::vector<VarBoundModPtr> VarBoundModVector;
26typedef VarBoundModVector::iterator VarBoundModIter;
27typedef VarBoundModVector::const_iterator VarBoundModConstIter;
28
30class VarBoundMod : public Modification {
31 public:
33 VarBoundMod(VariablePtr var, BoundType lu, double new_val);
34
37
38 // base class method.
40
41 // base class method.
43
45 VariablePtr getVar() const;
46
48 BoundType getLU() const;
49
51 double getNewVal() const;
52
53 // Implement Modification::applyToProblem().
54 void applyToProblem(ProblemPtr problem);
55
56 // Implement Modification::undoToProblem().
57 void undoToProblem(ProblemPtr problem);
58
59 // Implement Modification::write().
60 void write(std::ostream& out) const;
61
62 private:
64 BoundType lu_;
65
67 double newVal_;
68
70 double oldVal_;
71
73 VariablePtr var_;
74};
75
76class VarBoundMod2;
79typedef std::vector<VarBoundMod2Ptr> VarBoundMod2Vector;
80typedef VarBoundMod2Vector::iterator VarBoundMod2Iter;
81typedef VarBoundMod2Vector::const_iterator VarBoundMod2ConstIter;
82
84class VarBoundMod2 : public Modification {
85 public:
87 VarBoundMod2(VariablePtr var, double new_lb, double new_ub);
88
91
92 // Implement Modification::applyToProblem().
93 void applyToProblem(ProblemPtr problem);
94
95 // base class method.
97
99 VariablePtr getVar() const;
100
102 double getNewLb() const;
103
105 double getNewUb() const;
106
107 // base class method.
109
110 // Implement Modification::undoToProblem().
111 void undoToProblem(ProblemPtr problem);
112
113 // Implement Modification::write().
114 void write(std::ostream&) const {};
115
116 private:
118 double newLb_;
119
121 double newUb_;
122
124 double oldLb_;
125
127 double oldUb_;
128
130 VariablePtr var_;
131};
132} // namespace Minotaur
133
134#endif
135
Definition: Modification.h:29
Definition: Problem.h:74
Definition: Relaxation.h:53
Modification of a both bounds on a variable.
Definition: VarBoundMod.h:84
void undoToProblem(ProblemPtr problem)
Restore the modification for a problem.
Definition: VarBoundMod.cpp:183
void write(std::ostream &) const
Write it to 'out'.
Definition: VarBoundMod.h:114
ModificationPtr fromRel(RelaxationPtr, ProblemPtr) const
Covert a modification for a relaxation to one for its original problem.
Definition: VarBoundMod.cpp:135
double getNewUb() const
Get new value of the bound.
Definition: VarBoundMod.cpp:159
~VarBoundMod2()
Destroy.
Definition: VarBoundMod.cpp:129
ModificationPtr toRel(ProblemPtr, RelaxationPtr) const
Covert a modification for a problem to one for its relaxation.
Definition: VarBoundMod.cpp:171
void applyToProblem(ProblemPtr problem)
Apply it to the problem.
Definition: VarBoundMod.cpp:165
VariablePtr getVar() const
Get the variable whose bound is changed.
Definition: VarBoundMod.cpp:147
double getNewLb() const
Get new value of the bound.
Definition: VarBoundMod.cpp:153
VarBoundMod2(VariablePtr var, double new_lb, double new_ub)
Construct.
Definition: VarBoundMod.cpp:119
Modification of a single bound on a variable.
Definition: VarBoundMod.h:30
ModificationPtr toRel(ProblemPtr, RelaxationPtr) const
Covert a modification for a problem to one for its relaxation.
Definition: VarBoundMod.cpp:86
void applyToProblem(ProblemPtr problem)
Apply it to the problem.
Definition: VarBoundMod.cpp:80
ModificationPtr fromRel(RelaxationPtr, ProblemPtr) const
Covert a modification for a relaxation to one for its original problem.
Definition: VarBoundMod.cpp:52
VarBoundMod(VariablePtr var, BoundType lu, double new_val)
Construct.
Definition: VarBoundMod.cpp:27
void write(std::ostream &out) const
Write it to 'out'.
Definition: VarBoundMod.cpp:102
~VarBoundMod()
Destroy.
Definition: VarBoundMod.cpp:46
VariablePtr getVar() const
Get the variable whose bound is changed.
Definition: VarBoundMod.cpp:62
double getNewVal() const
Get new value of the bound.
Definition: VarBoundMod.cpp:74
void undoToProblem(ProblemPtr problem)
Restore the modification for a problem.
Definition: VarBoundMod.cpp:96
BoundType getLU() const
Get the type of bound that is changed: lower or upper.
Definition: VarBoundMod.cpp:68
Definition: Variable.h:31
Definition: ActiveNodeStore.h:20
BoundType
Different types of variable-bounds.
Definition: Types.h:131

Minotaur source code documented by Doxygen 1.9.4 on Thu Apr 24 2025