23#ifndef BcpsObjectPool_h_
24#define BcpsObjectPool_h_
28#include "AlpsKnowledgePool.h"
48 if (! objects_.empty()) {
55 for (
int i =
static_cast<int> (objects_.size() - 1); i > -1; --i) {
62 inline void clear(){ objects_.clear(); }
66 objects_.push_back(nk);
71 return static_cast<int>(objects_.size());
76 return std::make_pair(objects_[0], 0.0);
81 {
return objects_.empty() ? false :
true; }
85 assert(k > -1 && k < ((
int)objects_.size()));
87 AlpsKnowledge *objectK = getObject(k);
88 std::vector<AlpsKnowledge *>::iterator pos;
89 pos = objects_.begin() + k;
97 const std::vector<AlpsKnowledge *>&
getObjects()
const {
return objects_; }
100 AlpsKnowledge *
getObject(
int k)
const {
return objects_[k]; }
143 const std::vector<AlpsKnowledge *>&
getVariables()
const {
return objects_;}
const std::vector< AlpsKnowledge * > & getConstraints() const
Get the vector of constraints.
virtual ~BcpsConstraintPool()
void deleteConstraint(int k)
Delete constraint k from pool.
AlpsKnowledge * getConstraint(int k) const
Get a constraints.
void addConstraint(BcpsConstraint *con)
Add a constraint to pool.
int getNumConstraints() const
Query how many constraints are in the pool.
Object pool is used to store objects.
virtual std::pair< AlpsKnowledge *, double > getKnowledge() const
Query a knowledge, but doesn't remove it from the pool.
virtual void addKnowledge(AlpsKnowledge *nk, double priority)
Add a knowledge to pool.
const std::vector< AlpsKnowledge * > & getObjects() const
Get all objects.
std::vector< AlpsKnowledge * > objects_
BcpsObjectPool()
Default construct.
virtual bool hasKnowledge() const
Check whether the pool has knowledge.
AlpsKnowledge * getObject(int k) const
Get a object.
void deleteObject(int k)
Delete object k from pool.
void freeGuts()
Free object pointers.
virtual int getNumKnowledges() const
Query how many knowledges are in the pool.
virtual ~BcpsObjectPool()
void clear()
Reset to empty.
virtual ~BcpsVariablePool()
int getNumVariables() const
Query how many variables are in the pool.
void addVariable(BcpsVariable *var)
Add a variable to pool.
AlpsKnowledge * getVariable(int k) const
Get the vector of variables.
void deleteVariable(int k)
Delete variable k from pool.
const std::vector< AlpsKnowledge * > & getVariables() const
Get the vector of variables.