23#ifndef AlpsSolutionPool_h_
24#define AlpsSolutionPool_h_
88 throw CoinError(
"Can not call popKnowledge()",
89 "popKnowledge()",
"AlpsSolutionPool");
105 std::pair<const double, AlpsSolution*> ps(priority,
dynamic_cast<AlpsSolution*
>(sol));
111 std::multimap< double, AlpsSolution* >::iterator si =
138 if (
static_cast<int>(
solutions_.size()) > maxsols) {
139 std::multimap<double, AlpsSolution*>::
141 for (
int i = 0; i < maxsols; ++i)
173 (std::vector<std::pair<AlpsKnowledge*, double> >& sols)
const {
174 sols.reserve(sols.size() +
solutions_.size());
175 std::multimap<double, AlpsSolution*>::const_iterator si;
178 (si->second), si->first));
185 std::multimap< double, AlpsSolution* >::iterator si =
200#define AlpsSolutionInterface(ref) \
201int getNumSolutions() const { \
202 (ref).getNumSolutions(); \
204int getMaxNumSolutions() const { \
205 return (ref).getMaxNumSolutions(); \
207void setMaxNumSolutions(int num) { \
208 (ref).setMaxNumSolutions(num); \
210bool hasSolution() const { \
211 return (ref).hasSolution(); \
213std::pair<const AlpsSolution*, double> getBestSolution() const { \
214 return (ref).getBestSolution(); \
216void getAllSolutions \
217 (std::vector<std::pair<const AlpsSolution*, double> >& sols) { \
218 return (ref).getAllSolutions(sols); \
220void addSolution(const AlpsSolution* sol, double priority) { \
221 (ref).addSolution(sol, priority); \
AlpsKnowledgePool(const AlpsKnowledgePool &)
The abstract base class of any user-defined class that Alps has to know about in order to encode/deco...
void addKnowledge(AlpsKnowledge *sol, double priority)
Append the solution to the end of the vector of solutions.
void popKnowledge()
Remove a solution from the pool.
int getNumKnowledges() const
query the current number of solutions
std::multimap< double, AlpsSolution * > solutions_
bool hasKnowledge() const
return true if there are any solution stored in the solution pool
void setMaxNumKnowledges(int maxsols)
reset the maximum number of solutions
AlpsSolutionPool(const AlpsSolutionPool &)
AlpsSolutionPool & operator=(const AlpsSolutionPool &)
std::pair< AlpsKnowledge *, double > getKnowledge() const
Get a solution from solution pool, doesn't remove it from the pool.
AlpsSolutionPool(int maxsols=1)
void getAllKnowledges(std::vector< std::pair< AlpsKnowledge *, double > > &sols) const
Return all the solutions of the solution pool in the provided argument vector.
void clean()
Delete all the solutions in pool.
virtual ~AlpsSolutionPool()
std::pair< AlpsKnowledge *, double > getBestKnowledge() const
Return the best solution.
int getMaxNumKnowledges() const
query the maximum number of solutions