Minotaur 0.4.1
Docs for developers
Engine.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
13#ifndef MINOTAURENGINE_H
14#define MINOTAURENGINE_H
15
16#include "Types.h"
17
18namespace Minotaur {
19
20 class Solution;
21 class WarmStart;
22 class Engine;
23 typedef Engine* EnginePtr;
24 typedef const Engine* ConstEnginePtr;
25 typedef const Solution* ConstSolutionPtr;
26 typedef WarmStart* WarmStartPtr;
27 typedef const WarmStart* ConstWarmStartPtr;
28
34 class Engine {
35
36 public:
38 Engine();
39
41 virtual ~Engine();
42
44 virtual void addConstraint(ConstraintPtr) = 0;
45
47 virtual void changeBound(ConstraintPtr cons, BoundType lu,
48 double new_val) = 0;
49
51 virtual void changeBound(VariablePtr var, BoundType lu, double new_val)
52 = 0;
53
55 virtual void changeBound(VariablePtr var, double new_lb, double new_ub)
56 = 0;
57
66 double lb, double ub) = 0;
67
74
76 virtual void changeObj(FunctionPtr f, double cb) = 0;
77
79 virtual void clear() = 0;
80
82 virtual void disableStrBrSetup() = 0;
83
85 virtual EnginePtr emptyCopy() {return EnginePtr();} // NULL by default.
86
88 virtual void enableStrBrSetup() = 0;
89
92
94 virtual double getSolutionValue() = 0;
95
97 virtual EngineStatus solve() = 0;
98
100 virtual std::string getName() const = 0;
101
103 virtual EngineStatus getStatus() = 0;
104
106 virtual std::string getStatusString();
107
114
120
125 virtual void load(ProblemPtr problem) = 0;
126
133 virtual void loadFromWarmStart(const WarmStartPtr ws) = 0;
134
136 virtual void negateObj() = 0;
137
139 virtual LoggerPtr getLogger() { return logger_; }
140
147 virtual void removeCons(std::vector<ConstraintPtr> &delcons) = 0;
148
150 virtual void resetIterationLimit() = 0;
151
153 virtual int setDualObjLimit(double) = 0;
154
159 virtual void setIterationLimit(int limit) = 0;
160
162 virtual void setLogger(LoggerPtr logger) { logger_ = logger; }
163
166 virtual void setOptionsForSingleSolve() {};
167
169 virtual void setOptionsForRepeatedSolve() {};
170
175 virtual void writeStats(std::ostream &) const {};
176
178 //structure for parallel algorithms
179 virtual void fillStats(std::vector<double> &) {};
180
181 protected:
184
187
188};
189
190}
191
192#endif
Declare important 'types' used in Minotaur.
The Constraint class is used to manage a constraint.
Definition: Constraint.h:61
Definition: Engine.h:34
virtual EngineStatus getStatus()=0
Get the status of the last solve command.
virtual void resetIterationLimit()=0
Reset the iteration limit to maximum possible.
virtual double getSolutionValue()=0
Get the solution value.
virtual void setOptionsForSingleSolve()
Definition: Engine.h:166
virtual void removeCons(std::vector< ConstraintPtr > &delcons)=0
Delete constraints from the engine.
virtual LoggerPtr getLogger()
Return pointer to the log manager.
Definition: Engine.h:139
virtual std::string getStatusString()
Return a string that describes the status in simple words.
Definition: Engine.cpp:26
virtual void clear()=0
Clear the loaded problem, if any, from the engine.
virtual void fillStats(std::vector< double > &)
Accumulate statistics from different threads in a common data.
Definition: Engine.h:179
virtual void writeStats(std::ostream &) const
Definition: Engine.h:175
virtual EngineStatus solve()=0
Solve the problem that was loaded previously.
virtual ConstSolutionPtr getSolution()=0
Get the solution obtained after solving the problem.
virtual void disableStrBrSetup()=0
Restore settings after strong branching.
virtual EnginePtr emptyCopy()
Get a fresh copy of the engine, without the problem loaded into it.
Definition: Engine.h:85
virtual int setDualObjLimit(double)=0
Set the dual objective limit.
virtual void changeConstraint(ConstraintPtr c, LinearFunctionPtr lf, double lb, double ub)=0
Change the linear function, and the bounds of a constraint.
LoggerPtr logger_
Keep log.
Definition: Engine.h:186
virtual ConstWarmStartPtr getWarmStart()=0
Engine()
Default constructor.
Definition: Engine.cpp:14
virtual ~Engine()
Destroy.
Definition: Engine.cpp:21
virtual void changeConstraint(ConstraintPtr c, NonlinearFunctionPtr nlf)=0
Change the nonlinear function, and the bounds of a constraint.
virtual void changeBound(VariablePtr var, double new_lb, double new_ub)=0
Change both bounds of a variable.
EngineStatus status_
Status of the last solve.
Definition: Engine.h:183
virtual void setLogger(LoggerPtr logger)
Set a new log manager.
Definition: Engine.h:162
virtual void addConstraint(ConstraintPtr)=0
Add a new constraint to the engine.
virtual WarmStartPtr getWarmStartCopy()=0
virtual void negateObj()=0
Negate the objective function. Min f is changed to Min -f.
virtual void loadFromWarmStart(const WarmStartPtr ws)=0
virtual void changeBound(VariablePtr var, BoundType lu, double new_val)=0
Change a bound of a variable.
virtual void enableStrBrSetup()=0
Make settings for strong branching.
virtual void changeBound(ConstraintPtr cons, BoundType lu, double new_val)=0
Change a bound of a constraint.
virtual std::string getName() const =0
Get the name.
virtual void changeObj(FunctionPtr f, double cb)=0
Change objective function.
virtual void setIterationLimit(int limit)=0
virtual void setOptionsForRepeatedSolve()
Set options to solve the NLP repeatedly, with few changes.
Definition: Engine.h:169
virtual void load(ProblemPtr problem)=0
Definition: Function.h:37
The base class linear function is of the form c'x.
Definition: LinearFunction.h:31
Definition: Logger.h:37
Base class for nonlinear functions.
Definition: NonlinearFunction.h:31
Definition: Problem.h:74
Definition: Solution.h:30
Definition: Variable.h:31
Definition: WarmStart.h:45
Definition: ActiveNodeStore.h:20
BoundType
Different types of variable-bounds.
Definition: Types.h:131
EngineStatus
Different status that an external engine may report.
Definition: Types.h:176

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