Minotaur 0.4.1
Docs for developers
Loading...
Searching...
No Matches
Variable.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
16#ifndef MINOTAURVARIABLE_H
17#define MINOTAURVARIABLE_H
18
19#include <string>
20
21#include "Types.h"
22
23namespace Minotaur {
24
31 class Variable {
32 public:
35 friend class AnalyticalCenter;
36 friend class ExpHandler;
37 friend class Linearizations;
38 friend class LogHandler;
39 friend class QGHandlerAdvance;
40 friend class ParQGHandlerAdvance;
41 friend class PerspCon;
42 friend class Problem;
43 friend class TransSep;
44 friend class QGHandler;
45 friend class OAHandler;
46 friend class QuadHandler;
47 friend class RecipHandler;
48 friend class MultiSolHeur;
49
51 Variable();
52
54 Variable(UInt id, UInt index, double lb, double ub, VariableType vtype,
55 std::string name);
56
58 virtual ~Variable();
59
61 VariablePtr clone(UInt id) const;
62
64 UInt getId() const { return id_; }
65
72 UInt getIndex() const { return index_; }
73
75 double getInitVal() const { return initVal_; }
76
78 double getLb() const { return lb_; }
79
81 double getUb() const { return ub_; }
82
84 VariableType getType() const { return vtype_; }
85
87 FunctionType getFunType() const { return ftype_; }
88
90 VarSrcType getSrcType() const { return stype_; }
91
93 VarState getState() const { return state_; }
94
95 UInt getNumCons() const;
96
97 UInt getItmp() const;
98
100 ConstrSet::iterator consBegin();
101
103 ConstrSet::iterator consEnd();
104
106 const std::string getName() const;
107
108 void setItmp(UInt itmp);
109
114 void write(std::ostream &out) const;
115
117 void writeConstraintMap(std::ostream &out) const;
118
119 protected:
122 {
123 ftype_ = ftype;
124 return;
125 }
126
128 void setId_(UInt n) { id_ = n; }
129
131 void setIndex_(UInt n) { index_ = n; }
132
134 void setInitVal_(double val) { initVal_ = val; }
135
137 void setLb_(double newLb) { lb_ = newLb; }
138
140 void setName_(std::string newName) { name_ = newName; }
141
143 void setSrcType(VarSrcType stype) { stype_ = stype; }
144
146 void setState_(VarState state)
147 {
148 state_ = state;
149 return;
150 }
151
153 void setType_(VariableType vtype);
154
156 void setUb_(double newUb) { ub_ = newUb; }
157
163
169
171 void clearConstraints_();
172
173 private:
175 ConstrSet cons_;
176
178 FunctionType ftype_;
179
181 UInt id_;
182
184 UInt index_;
185
187 double lb_;
188
190 std::string name_;
191
193 double initVal_;
194
196 VarState state_;
197
199 VarSrcType stype_;
200
202 double ub_;
203
205 VariableType vtype_;
206
208 Variable(const Variable &v);
209
211 Variable &operator=(const Variable &v);
212
214 UInt itmp_;
215 };
216
217 typedef std::set<std::pair<ConstraintPtr, FunctionType>>::const_iterator
218 ConstraintFunIterator;
219} //namespace Minotaur
220
221#endif
Declare important 'types' used in Minotaur.
Definition AnalyticalCenter.h:27
The Constraint class is used to manage a constraint.
Definition Constraint.h:61
Definition ExpHandler.h:31
Definition Linearizations.h:39
Definition LogHandler.h:31
Definition MultiSolHeur.h:38
Handler for convex constraints, based on quesada-grossmann algorithm.
Definition OAHandler.h:46
Handler for convex constraints, based on quesada-grossmann algorithm.
Definition ParQGHandlerAdvance.h:47
Definition PerspCon.h:81
Definition Problem.h:74
Handler for convex constraints, based on quesada-grossmann algorithm.
Definition QGHandlerAdvance.h:53
Handler for convex constraints, based on quesada-grossmann algorithm.
Definition QGHandler.h:45
‍Iterator for LinSqrMap
Definition QuadHandler.h:63
Definition RecipHandler.h:30
Definition TransSep.h:40
Definition Variable.h:31
UInt getIndex() const
Definition Variable.h:72
VarState getState() const
Get the state (fixed, deleted, ...).
Definition Variable.h:93
void setId_(UInt n)
Change the id to a new value.
Definition Variable.h:128
void setLb_(double newLb)
Change the lowerbound to a new value.
Definition Variable.h:137
VarSrcType getSrcType() const
Get the type of origin of this variable.
Definition Variable.h:90
void write(std::ostream &out) const
Write the full description of the variable including name, bounds, type etc.
Definition Variable.cpp:135
ConstrSet::iterator consEnd()
Last iterator of constraints where this variable appears.
Definition Variable.cpp:83
void setSrcType(VarSrcType stype)
Change the type of the origin of this variable.
Definition Variable.h:143
void setType_(VariableType vtype)
Change the type to a new value.
Definition Variable.cpp:121
Variable()
Default constructor.
Definition Variable.cpp:22
double getInitVal() const
Get starting or initial value.
Definition Variable.h:75
ConstrSet::iterator consBegin()
First iterator of constraints where this variable appears.
Definition Variable.cpp:77
void clearConstraints_()
Clear the list of constraints this variable belongs to.
Definition Variable.cpp:71
const std::string getName() const
Get name of the variable.
Definition Variable.cpp:89
void setState_(VarState state)
Change the state to a new value.
Definition Variable.h:146
void writeConstraintMap(std::ostream &out) const
Write the list of constraints in which this variable occurs.
Definition Variable.cpp:169
UInt getId() const
Get the unique id.
Definition Variable.h:64
void setUb_(double newUb)
Change the upperbound to a new value.
Definition Variable.h:156
FunctionType getFunType() const
Get the function type of constraints that this variable is in.
Definition Variable.h:87
VariablePtr clone(UInt id) const
Create a copy.
Definition Variable.cpp:54
void inConstraint_(ConstraintPtr c)
Add the constraint to the list of constraints this variable belongs to.
Definition Variable.cpp:105
void setName_(std::string newName)
Change the name to a new value.
Definition Variable.h:140
double getUb() const
Get upperbound.
Definition Variable.h:81
void setIndex_(UInt n)
Change the index to a new value.
Definition Variable.h:131
VariableType getType() const
Get the type (binary, integer, continuous).
Definition Variable.h:84
void setFunType_(FunctionType ftype)
Change the function type to a new value.
Definition Variable.h:121
virtual ~Variable()
Destroy.
Definition Variable.cpp:65
double getLb() const
Get lowerbound.
Definition Variable.h:78
void setInitVal_(double val)
Change starting value.
Definition Variable.h:134
void outOfConstraint_(ConstraintPtr cPtr)
Remove the constraint from the list of constraints this variable belongs to.
Definition Variable.cpp:111
Definition ActiveNodeStore.h:20
VarState
Different states a variable can be in.
Definition Types.h:137
VariableType
Different types of variables.
Definition Types.h:76
VarSrcType
Where did the variable originate from?
Definition Types.h:85
unsigned int UInt
Unsigned integer.
Definition Types.h:30
FunctionType
Different types of functions in Minotaur.
Definition Types.h:65

Minotaur source code documented by Doxygen 1.9.8 on Mon Jul 13 2026