Alps  2.0.2
AlpsKnowledgePool.h
Go to the documentation of this file.
1 /*===========================================================================*
2  * This file is part of the Abstract Library for Parallel Search (ALPS). *
3  * *
4  * ALPS is distributed under the Eclipse Public License as part of the *
5  * COIN-OR repository (http://www.coin-or.org). *
6  * *
7  * Authors: *
8  * *
9  * Yan Xu, Lehigh University *
10  * Aykut Bulut, Lehigh University *
11  * Ted Ralphs, Lehigh University *
12  * *
13  * Conceptual Design: *
14  * *
15  * Yan Xu, Lehigh University *
16  * Ted Ralphs, Lehigh University *
17  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
18  * Matthew Saltzman, Clemson University *
19  * *
20  * *
21  * Copyright (C) 2001-2023, Lehigh University, Yan Xu, Aykut Bulut, and *
22  * Ted Ralphs. *
23  * All Rights Reserved. *
24  *===========================================================================*/
25 
26 
27 #ifndef AlpsKnowledgePool_h_
28 #define AlpsKnowledgePool_h_
29 
30 // STL headers
31 #include <climits>
32 #include <iostream>
33 #include <vector>
34 
35 // CoinUtils headers
36 #include "CoinError.hpp"
37 
38 // Alps headers
39 #include "AlpsKnowledge.h"
40 
49 
50 public:
52 
56  virtual ~AlpsKnowledgePool() {}
58 
60 
61  virtual int getNumKnowledges() const = 0;
64  virtual std::pair<AlpsKnowledge*, double> getKnowledge() const = 0;
66  virtual bool hasKnowledge() const = 0;
68  virtual int getMaxNumKnowledges() const = 0;
70  virtual std::pair<AlpsKnowledge*, double> getBestKnowledge() const = 0;
72  virtual void getAllKnowledges (std::vector<std::pair<AlpsKnowledge*,
73  double> >& kls) const = 0;
75 
77 
78  virtual void addKnowledge(AlpsKnowledge * nk, double priority) = 0;
81  virtual void popKnowledge() = 0;
83 
85 
86  virtual void setMaxNumKnowledges(int num) = 0;
89 
90 private:
95 };
96 
97 #endif
AlpsKnowledgePool::getNumKnowledges
virtual int getNumKnowledges() const =0
Return size of the pool.
AlpsKnowledge.h
AlpsKnowledgePool::type_
AlpsKnowledgePoolType type_
Definition: AlpsKnowledgePool.h:48
AlpsKnowledgePool::getBestKnowledge
virtual std::pair< AlpsKnowledge *, double > getBestKnowledge() const =0
Query the best knowledge in the pool.
AlpsKnowledgePool::getAllKnowledges
virtual void getAllKnowledges(std::vector< std::pair< AlpsKnowledge *, double > > &kls) const =0
Get a reference to all the knowledges in the pool.*‍/.
AlpsKnowledgePool::getMaxNumKnowledges
virtual int getMaxNumKnowledges() const =0
Query the quantity limit of knowledges.
AlpsKnowledgePool::addKnowledge
virtual void addKnowledge(AlpsKnowledge *nk, double priority)=0
Add a knowledge to pool.
AlpsKnowledgePool
This is an abstract base class, fixing an API for pool types of Alps, AlpsNodePool,...
Definition: AlpsKnowledgePool.h:47
AlpsKnowledgePoolType
AlpsKnowledgePoolType
Definition: Alps.h:233
AlpsKnowledgePool::AlpsKnowledgePool
AlpsKnowledgePool(AlpsKnowledgePoolType type)
Default constructor.
Definition: AlpsKnowledgePool.h:54
AlpsKnowledgePool::getKnowledge
virtual std::pair< AlpsKnowledge *, double > getKnowledge() const =0
Check the first item in the pool.
AlpsKnowledge
The abstract base class of Alps knowledges generated during the search.
Definition: AlpsKnowledge.h:63
AlpsKnowledgePool::popKnowledge
virtual void popKnowledge()=0
Pop the first knowledge from the pool.
AlpsKnowledgePool::hasKnowledge
virtual bool hasKnowledge() const =0
Check whether the pool is empty.
AlpsKnowledgePool::~AlpsKnowledgePool
virtual ~AlpsKnowledgePool()
Destructor.
Definition: AlpsKnowledgePool.h:56
AlpsKnowledgePool::setMaxNumKnowledges
virtual void setMaxNumKnowledges(int num)=0
Set the quantity limit of knowledges that can be stored in the pool.
AlpsKnowledgePool::operator=
AlpsKnowledgePool & operator=(AlpsKnowledgePool const &)
Disable copy assignment operator.