Minotaur 0.4.1
Docs for developers
SolutionPool.h
Go to the documentation of this file.
1//
2// Minotaur -- It's only 1/2 bull
3//
4// (C)opyright 2008 - 2025 The Minotaur Team.
5//
6
15#ifndef MINOTAURSOLUTIONPOOL_H
16#define MINOTAURSOLUTIONPOOL_H
17
18#include "Problem.h"
19#include "Solution.h"
20#include "Types.h"
21//#include <sys/time.h>
22
23namespace Minotaur {
24
25 class Environment;
26 class Timer;
27
29 public:
32
35
37 SolutionPool(EnvPtr env, ProblemPtr problem, UInt limit=100);
38
41
43 //void setRootSolution(ConstSolutionPtr);
44
46 UInt getNumSols() const;
47
49 UInt getNumSolsFound() const;
50
53
55 //double getWallTime() {
56 //struct timeval time;
57 //if (gettimeofday(&time,NULL)) {
59 //return 0;
60 //}
61 //return (double)time.tv_sec + (double)time.tv_usec * .000001;
62 //}
63
65 void setSizeLimit(UInt limit);
66
68 SolutionIterator solsBegin() { return sols_.begin(); }
69
71 SolutionIterator solsEnd() { return sols_.end(); }
72
74 void addSolution(const double *x, double obj_value);
75
81
86 //SolutionPtr getRootSolution();
87
89 double getBestSolutionValue() const;
90
92 //double getRootSolutionValue() const;
93
95 void writeStats(std::ostream &out) const;
96
97 private:
99 std::vector<SolutionPtr> sols_;
100
105 SolutionPtr bestSolution_;
106
111 //SolutionPtr rootSolution_;
112
114 const static std::string me_;
115
117 UInt numSolsFound_;
118
120 ProblemPtr problem_;
121
123 UInt sizeLimit_;
124
126 double timeBest_;
127
129 double timeFirst_;
130
132 const Timer* timer_;
133
135 //double wallTimeStart_;
136
137 };
138
139 typedef SolutionPool* SolutionPoolPtr;
140}
141#endif
142
Declare the base class Modification.
Implement base class Solution.
Declare important 'types' used in Minotaur.
Definition: Environment.h:28
Definition: Problem.h:74
Definition: SolutionPool.h:28
~SolutionPool()
Destroy.
Definition: SolutionPool.cpp:37
SolutionPool()
Default constructor.
double getBestSolutionValue() const
Get the best objective function value.
Definition: SolutionPool.cpp:82
SolutionIterator solsEnd()
... and the end.
Definition: SolutionPool.h:71
void setSizeLimit(UInt limit)
Get wall clock time.
UInt getNumSolsFound() const
Get number of solutions in the pool.
Definition: SolutionPool.cpp:98
UInt getSizeLimit() const
Get the limit on the number of solutions in the pool.
SolutionPtr getBestSolution()
Definition: SolutionPool.cpp:76
SolutionIterator solsBegin()
Get iterator for the first solution ...
Definition: SolutionPool.h:68
void writeStats(std::ostream &out) const
Get the best objective function value.
Definition: SolutionPool.cpp:104
UInt getNumSols() const
Save the root relaxation solution.
Definition: SolutionPool.cpp:92
void addSolution(ConstSolutionPtr)
Add Solution to the pool.
Definition: SolutionPool.cpp:46
Definition: Solution.h:30
Definition: Timer.h:40
Definition: ActiveNodeStore.h:20
unsigned int UInt
Unsigned integer.
Definition: Types.h:30

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