Alps  2.0.2
AlpsKnowledgeBroker.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 AlpsKnowledgeBroker_h_
28 #define AlpsKnowledgeBroker_h_
29 
30 #include <cmath>
31 #include <iosfwd>
32 #include <map>
33 #include <string>
34 
35 #include "CoinMessageHandler.hpp"
36 
37 #include "AlpsSearchStrategy.h"
38 #include "AlpsEnumProcessT.h"
39 #include "AlpsKnowledge.h"
40 #include "AlpsKnowledgePool.h"
41 #include "AlpsMessage.h"
42 #include "AlpsParams.h"
43 #include "AlpsSolutionPool.h"
44 #include "AlpsSubTree.h"
45 #include "AlpsSubTreePool.h"
46 #include "AlpsModel.h"
47 #include "AlpsTime.h"
48 
49 //#############################################################################
50 
54  std::map<int, AlpsKnowledge*> decodeMap_;
55 
56 protected:
57 
59  std::string instanceName_;
64 
66 
67 
73  std::map<AlpsKnowledgeType, AlpsKnowledgePool*>* pools_;
75 
77 
78 
87 
89 
90 
97  int solNum_;
116  double peakMemory_;
120 
122 
123 
124  AlpsSearchStrategy<AlpsSubTree*>* treeSelection_;
126  AlpsSearchStrategy<AlpsTreeNode*>* nodeSelection_;
128  AlpsSearchStrategy<AlpsTreeNode*>* rampUpNodeSelection_;
130 
132 
133 
134  CoinMessageHandler * handler_;
136  CoinMessages messages_;
150  std::string logfile_;
152 
163 
164 public:
166 
167 
172  virtual ~AlpsKnowledgeBroker();
174 
176 
177 
185  void registerClass(int name, AlpsKnowledge* userKnowledge) {
186  // Check if alread have one.
187  std::map<int, AlpsKnowledge*>::iterator pos, pos1;
188  pos = decodeMap_.find(name);
189  pos1 = decodeMap_.end();
190 
191  if (pos != pos1) {
192  AlpsKnowledge* kl = pos->second;
193  decodeMap_.erase(pos);
194  delete kl;
195  }
196 
197  decodeMap_[name] = userKnowledge;
198  userKnowledge->setBroker(this);
199  }
207  AlpsKnowledge const * decoderObject(int name) const {
208  // todo(aykut) convert this to .at() once C++11 standard is available.
209  std::map<int,AlpsKnowledge*>::const_iterator it = decodeMap_.find(name);
210  if (it == decodeMap_.end()) {
211  // this should not happen.
212  throw std::exception();
213  }
214  return it->second;
215  }
217 
219 
220 
221  virtual void initializeSearch(int argc,
222  char* argv[],
223  AlpsModel& model,
224  bool showBanner = true) = 0;
225 
227  virtual void rootSearch(AlpsTreeNode* root) = 0;
228 
230  virtual void search(AlpsModel *model) {
231  AlpsTreeNode* root = model->createRoot();
232  root->setBroker(this);
233  root->modifyDesc()->setBroker(this);
234  rootSearch(root);
235  }
237 
239 
240  AlpsPhase getPhase() { return phase_; }
241  void setPhase(AlpsPhase ph) { phase_ = ph; }
243 
245  AlpsModel *getModel() { return model_; }
246  void setModel(AlpsModel *m) { model_ = m; }
248 
250  int getTreeDepth() { return treeDepth_; }
252  void setPeakMemory(double size) { peakMemory_ = size; }
254  double getPeakMemory() { return peakMemory_; }
255 
261  void setupKnowledgePools();
265  // AlpsKnowledgePool* akp = static_cast<AlpsKnowledgePool*>(kp);
266  pools_->insert
267  (std::pair<AlpsKnowledgeType, AlpsKnowledgePool*>(kt, kp));
268  }
269  else {
270  throw CoinError("Broker doesn't manage this type of knowledge",
271  "addKnowledgePool()", "AlpsKnowledgeBroker");
272  }
273  }
277  return (*pools_)[kt];
278  }
279  else {
280  throw CoinError("Broker doesn't manage this type of knowledge",
281  "getKnowledgePool()", "AlpsKnowledgeBroker");
282  }
283  }
285  virtual int getNumKnowledges(AlpsKnowledgeType kt) const;
288  virtual int getMaxNumKnowledges(AlpsKnowledgeType kt) const {
291  }
292  else {
293  throw CoinError("Broker doesn't manage this type of knowledge",
294  "getMaxNumKnowledges()", "AlpsKnowledgeBroker");
295  }
296  }
299  virtual void setMaxNumKnowledges(AlpsKnowledgeType kt, int num) {
302  }
303  else {
304  throw CoinError("Broker doesn't manage this type of knowledge",
305  "setMaxNumKnowledges()", "AlpsKnowledgeBroker");
306  }
307  }
308 
311  virtual bool hasKnowledge(AlpsKnowledgeType kt) const {
313  return getKnowledgePool(kt)->hasKnowledge();
314  else
315  throw CoinError("Broker doesn't manage this type of knowledge",
316  "hasKnowledge()", "AlpsKnowledgeBroker");
317  }
318 
320  virtual std::pair<AlpsKnowledge*, double>
323  return getKnowledgePool(kt)->getKnowledge();
324  }
325  else {
326  throw CoinError("Broker doesn't manage this type of knowledge",
327  "getKnowledge()", "AlpsKnowledgeBroker");
328  }
329  }
330 
332  virtual void popKnowledge(AlpsKnowledgeType kt) {
335  }
336  else {
337  throw CoinError("Broker doesn't manage this type of knowledge",
338  "popKnowledge()", "AlpsKnowledgeBroker");
339  }
340  }
341 
343  virtual std::pair<AlpsKnowledge*, double>
345 
348  std::vector<std::pair<AlpsKnowledge*,
349  double> >& kls) const {
352  }
353  else {
354  throw CoinError("Broker doesn't manage this type of knowledge",
355  "popKnowledge()", "AlpsKnowledgeBroker");
356  }
357  }
358 
361  AlpsKnowledge* kl,
362  double value ) {
364  //todo(aykut) is this the right place to do this?
365  //kl->setType(kt);
366  getKnowledgePool(kt)->addKnowledge(kl, value);
367  }
368  else {
369  throw CoinError("Broker doesn't manage this type of knowledge",
370  "popKnowledge()", "AlpsKnowledgeBroker");
371  }
372  }
374 
379  int getNumNodesProcessed() const {
380  return nodeProcessedNum_;
381  }
383  int getNumNodesBranched() const {
384  return nodeBranchedNum_;
385  }
387  int getNumNodesDiscarded() const {
388  return nodeDiscardedNum_;
389  }
391  int getNumNodesPartial() const {
392  return nodePartialNum_;
393  }
396  return systemNodeProcessed_;
397  }
399  virtual int updateNumNodesLeft();
401  virtual AlpsTreeNode* getBestNode() const;
404  return exitStatus_;
405  }
408  exitStatus_ = status;
409  }
412  return timer_;
413  }
416  return subTreeTimer_;
417  }
420  return tempTimer_;
421  }
423  virtual void searchLog() = 0;
425 
427 
428  int getNodeMemSize() { return nodeMemSize_; }
429  void setNodeMemSize(int ms) { nodeMemSize_ = ms; }
431 
433 
435  void setNodeProcessingTime(double npTime) { nodeProcessingTime_ = npTime; }
437 
438  int getLargeSize() const { return largeSize_; }
439 
441 
442 
444  virtual double getIncumbentValue() const = 0;
445 
448  virtual double getBestQuality() const = 0;
449 
451  virtual double getBestEstimateQuality() { return ALPS_OBJ_MAX; }
452 
453  virtual int getNumNodeLeftSystem(){ return nodeLeftNum_; }
454 
457  virtual void printBestSolution(char* outputFile = 0) const = 0;
459 
461  virtual int getProcRank() const { return 0; }
462 
464  virtual int getMasterRank() const { return 0; }
465 
467  virtual AlpsProcessType getProcType() const
468  { return AlpsProcessTypeSerial; } /* Default is serial */
469 
471 
472 
484 
486 
487  AlpsSearchStrategy<AlpsSubTree*>* getSubTreeSelection() const {
488  return treeSelection_;
489  }
490  void setSubTreeSelection(AlpsSearchStrategy<AlpsSubTree*>* tc) {
491  if (treeSelection_) delete treeSelection_;
492  treeSelection_ = tc;
494  }
495  AlpsSearchStrategy<AlpsTreeNode*>* getNodeSelection() const {
496  return nodeSelection_;
497  }
498  void setNodeSelection(AlpsSearchStrategy<AlpsTreeNode*>* nc) {
499  if (nodeSelection_) delete nodeSelection_;
500  nodeSelection_ = nc;
501  }
502  AlpsSearchStrategy<AlpsTreeNode*>* getRampUpNodeSelection() const {
503  return rampUpNodeSelection_;
504  }
505  void setRampUpNodeSelection(AlpsSearchStrategy<AlpsTreeNode*>* nc) {
508  }
510 
512 
513 
514  void passInMessageHandler(CoinMessageHandler * handler);
516  void newLanguage(CoinMessages::Language language);
517  void setLanguage(CoinMessages::Language language)
518  { newLanguage(language); }
520  CoinMessageHandler * messageHandler() const { return handler_; }
522  CoinMessages messages() { return messages_; }
524  CoinMessages * messagesPointer() { return &messages_; }
526  int getMsgLevel() { return msgLevel_; }
528  int getHubMsgLevel() { return hubMsgLevel_; }
532  int getlogFileLevel() { return logFileLevel_; }
534  int getNumNodeLog() const { return numNodeLog_; }
536  void setNumNodeLog(int num) { numNodeLog_ = num; }
538 
539  //Suresh: added temporarily for warm starting
541 
542 private:
545 };
546 #endif
AlpsKnowledgeBroker::nextIndex_
AlpsNodeIndex_t nextIndex_
The index to be assigned to a new search tree node.
Definition: AlpsKnowledgeBroker.h:83
AlpsKnowledgeBroker::getPeakMemory
double getPeakMemory()
Get peak memory usage.
Definition: AlpsKnowledgeBroker.h:254
AlpsKnowledgeBroker::solPool_
AlpsSolutionPool * solPool_
A solution pool containing the solutions found.
Definition: AlpsKnowledgeBroker.h:71
AlpsKnowledgeBroker::setupKnowledgePools
void setupKnowledgePools()
Set up knowledge pools for this broker.
AlpsKnowledgeBroker::setNodeProcessingTime
void setNodeProcessingTime(double npTime)
Definition: AlpsKnowledgeBroker.h:435
AlpsModel.h
AlpsKnowledgeBroker::phase_
AlpsPhase phase_
Alps phase.
Definition: AlpsKnowledgeBroker.h:63
AlpsSubTree.h
AlpsKnowledgeBroker::model_
AlpsModel * model_
Pointer to model.
Definition: AlpsKnowledgeBroker.h:61
AlpsKnowledge.h
AlpsKnowledgeBroker::searchLog
virtual void searchLog()=0
Search statistics log.
AlpsProcessTypeSerial
@ AlpsProcessTypeSerial
Serial.
Definition: AlpsEnumProcessT.h:36
AlpsKnowledgeBroker::peakMemory_
double peakMemory_
Peak memory usage.
Definition: AlpsKnowledgeBroker.h:116
AlpsKnowledgeBroker::getNumNodesDiscarded
int getNumNodesDiscarded() const
Query the number of node processed by this process.
Definition: AlpsKnowledgeBroker.h:387
AlpsSubTreePool::setComparison
void setComparison(AlpsSearchStrategy< AlpsSubTree * > &compare)
Set comparison function and resort heap.
AlpsKnowledgeBroker::nodeDiscardedNum_
int nodeDiscardedNum_
The number of nodes that have been discarded before processing.
Definition: AlpsKnowledgeBroker.h:103
AlpsModel
AlpsModel is a base class for user application problem data.
Definition: AlpsModel.h:132
AlpsKnowledgeBroker::getNumNodesProcessed
int getNumNodesProcessed() const
Query the number of node processed by this process.
Definition: AlpsKnowledgeBroker.h:379
AlpsKnowledgeBroker::largeSize_
int largeSize_
The size of largest message buffer can be sent or received.
Definition: AlpsKnowledgeBroker.h:158
AlpsTreeNode::modifyDesc
AlpsNodeDesc * modifyDesc()
Access the desc so that can modify it.
Definition: AlpsTreeNode.h:144
AlpsKnowledgeBroker::printBestSolution
virtual void printBestSolution(char *outputFile=0) const =0
The process (serial) / the master (parallel) outputs the best solution that it knows to a file or std...
AlpsKnowledgeBroker::setPhase
void setPhase(AlpsPhase ph)
Definition: AlpsKnowledgeBroker.h:241
AlpsKnowledgeBroker::operator=
AlpsKnowledgeBroker & operator=(const AlpsKnowledgeBroker &)
AlpsTimer
Definition: AlpsTime.h:64
AlpsKnowledgeBroker::getNumNodesPartial
int getNumNodesPartial() const
Query the number of node in the queue that are pregnant.
Definition: AlpsKnowledgeBroker.h:391
AlpsKnowledgeBroker::instanceName_
std::string instanceName_
The instance name.
Definition: AlpsKnowledgeBroker.h:59
AlpsKnowledgeBroker::getSubTreeSelection
AlpsSearchStrategy< AlpsSubTree * > * getSubTreeSelection() const
Definition: AlpsKnowledgeBroker.h:487
AlpsKnowledgeBroker::getBestQuality
virtual double getBestQuality() const =0
The process (serial) / the master (parallel) queries the quality of the best solution that it knows.
AlpsKnowledgeBroker::setExitStatus
void setExitStatus(AlpsExitStatus status)
Set terminate status.
Definition: AlpsKnowledgeBroker.h:407
AlpsKnowledgeBroker::passInMessageHandler
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end).
AlpsKnowledgeBroker::userBalancePeriod_
bool userBalancePeriod_
Has user input balance period.
Definition: AlpsKnowledgeBroker.h:160
AlpsKnowledgeBroker::treeSelection_
AlpsSearchStrategy< AlpsSubTree * > * treeSelection_
Tree selection criterion.
Definition: AlpsKnowledgeBroker.h:124
AlpsKnowledgeBroker::messages
CoinMessages messages()
Return messages.
Definition: AlpsKnowledgeBroker.h:522
AlpsKnowledgeBroker::decoderObject
const AlpsKnowledge * decoderObject(int name) const
This method returns the pointer to an empty object of the registered class name.
Definition: AlpsKnowledgeBroker.h:207
AlpsKnowledgeBroker::getSolStatus
AlpsExitStatus getSolStatus() const
Query search termination status.
Definition: AlpsKnowledgeBroker.h:403
AlpsKnowledgeBroker::tempTimer_
AlpsTimer tempTimer_
Secondary timer.
Definition: AlpsKnowledgeBroker.h:95
AlpsTime.h
AlpsKnowledgeBroker::nodeMemSize_
int nodeMemSize_
The approximate memory size (bytes) of a node with full description.
Definition: AlpsKnowledgeBroker.h:154
AlpsSolutionPool.h
AlpsKnowledgeBroker::logfile_
std::string logfile_
The log file.
Definition: AlpsKnowledgeBroker.h:150
AlpsKnowledgeBroker::subTreeTimer_
AlpsTimer subTreeTimer_
Subtree timer.
Definition: AlpsKnowledgeBroker.h:93
AlpsKnowledgeBroker::getMsgLevel
int getMsgLevel()
Return msg level.
Definition: AlpsKnowledgeBroker.h:526
AlpsKnowledgeBroker::setLanguage
void setLanguage(CoinMessages::Language language)
Definition: AlpsKnowledgeBroker.h:517
AlpsKnowledgeBroker::getNumKnowledges
virtual int getNumKnowledges(AlpsKnowledgeType kt) const
Query the number of knowledge in the given type of a knowledge pool.
AlpsKnowledgeBroker::numNodeLog_
int numNodeLog_
Times that node log is printed.
Definition: AlpsKnowledgeBroker.h:162
AlpsKnowledgeBroker::needWorkingSubTree_
bool needWorkingSubTree_
Indicate whether need a new subtree.
Definition: AlpsKnowledgeBroker.h:81
AlpsKnowledgeBroker::search
virtual void search(AlpsModel *model)
Search best solution for a given model.
Definition: AlpsKnowledgeBroker.h:230
AlpsProcessType
AlpsProcessType
This enumerative constant describes the various process types.
Definition: AlpsEnumProcessT.h:34
AlpsKnowledgeBroker::getNodeSelection
AlpsSearchStrategy< AlpsTreeNode * > * getNodeSelection() const
Definition: AlpsKnowledgeBroker.h:495
AlpsModel::createRoot
virtual AlpsTreeNode * createRoot()=0
Create the root node.
AlpsKnowledgeBroker::getNumNodeLeftSystem
virtual int getNumNodeLeftSystem()
Definition: AlpsKnowledgeBroker.h:453
AlpsKnowledgeBroker::msgLevel_
int msgLevel_
The leve of printing message to screen of the master and general message.
Definition: AlpsKnowledgeBroker.h:139
AlpsKnowledgeBroker::getBestEstimateQuality
virtual double getBestEstimateQuality()
Get best estimalted quality in system.
Definition: AlpsKnowledgeBroker.h:451
AlpsKnowledgeBroker::nodePartialNum_
int nodePartialNum_
The number of nodes that are pregnant.
Definition: AlpsKnowledgeBroker.h:105
AlpsKnowledgeBroker::getMasterRank
virtual int getMasterRank() const
Query the global rank of the Master.
Definition: AlpsKnowledgeBroker.h:464
AlpsPhase
AlpsPhase
Definition: Alps.h:272
AlpsKnowledgeBroker::getBestNode
virtual AlpsTreeNode * getBestNode() const
Query the best node in the subtree pool.
AlpsKnowledgeBroker::rootSearch
virtual void rootSearch(AlpsTreeNode *root)=0
Explore the tree rooted as the given root.
AlpsKnowledgePool::getAllKnowledges
virtual void getAllKnowledges(std::vector< std::pair< AlpsKnowledge *, double > > &kls) const =0
Get a reference to all the knowledges in the pool.*‍/.
AlpsKnowledgeBroker::getNumNodesProcessedSystem
int getNumNodesProcessedSystem() const
Query the number of node processed by the system.
Definition: AlpsKnowledgeBroker.h:395
AlpsKnowledgeBroker::exitStatus_
AlpsExitStatus exitStatus_
The status of search when terminated.
Definition: AlpsKnowledgeBroker.h:118
AlpsKnowledgeBroker::getKnowledge
virtual std::pair< AlpsKnowledge *, double > getKnowledge(AlpsKnowledgeType kt) const
Get a knowledge, but doesn't remove it from the pool.
Definition: AlpsKnowledgeBroker.h:321
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.
AlpsKnowledgeBroker::getRampUpNodeSelection
AlpsSearchStrategy< AlpsTreeNode * > * getRampUpNodeSelection() const
Definition: AlpsKnowledgeBroker.h:502
AlpsTreeNode
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:52
AlpsKnowledgeBroker::nodeProcessedNum_
int nodeProcessedNum_
The number of nodes that have been processed.
Definition: AlpsKnowledgeBroker.h:99
AlpsKnowledgeBroker::newLanguage
void newLanguage(CoinMessages::Language language)
Set language.
AlpsKnowledgeBroker::hubMsgLevel_
int hubMsgLevel_
The leve of printing message to screen of hubs.
Definition: AlpsKnowledgeBroker.h:142
AlpsKnowledgePool
This is an abstract base class, fixing an API for pool types of Alps, AlpsNodePool,...
Definition: AlpsKnowledgePool.h:47
AlpsKnowledgeBroker::getPhase
AlpsPhase getPhase()
Definition: AlpsKnowledgeBroker.h:240
AlpsKnowledgeBroker::timer
AlpsTimer & timer()
Query timer.
Definition: AlpsKnowledgeBroker.h:411
AlpsKnowledgeBroker::setNodeSelection
void setNodeSelection(AlpsSearchStrategy< AlpsTreeNode * > *nc)
Definition: AlpsKnowledgeBroker.h:498
AlpsKnowledgeBroker::setNumNodeLog
void setNumNodeLog(int num)
Get times that node log has been printed.
Definition: AlpsKnowledgeBroker.h:536
AlpsKnowledgeBroker::addKnowledge
virtual void addKnowledge(AlpsKnowledgeType kt, AlpsKnowledge *kl, double value)
Add a knowledge in the given type of knowledge pools.
Definition: AlpsKnowledgeBroker.h:360
AlpsKnowledgeBroker::addKnowledgePool
void addKnowledgePool(AlpsKnowledgeType kt, AlpsKnowledgePool *kp)
Add a knowledge pool into the Knowledge pools.
Definition: AlpsKnowledgeBroker.h:263
AlpsKnowledgeBroker::decodeMap_
std::map< int, AlpsKnowledge * > decodeMap_
Stores registered knowledge.
Definition: AlpsKnowledgeBroker.h:54
AlpsKnowledgeBroker::solNum_
int solNum_
The number of solutions found.
Definition: AlpsKnowledgeBroker.h:97
AlpsKnowledgeBroker::getWorkingSubTree
AlpsSubTree * getWorkingSubTree()
Definition: AlpsKnowledgeBroker.h:540
AlpsKnowledgeBroker::setSubTreeSelection
void setSubTreeSelection(AlpsSearchStrategy< AlpsSubTree * > *tc)
Definition: AlpsKnowledgeBroker.h:490
AlpsKnowledgeBroker::subTreeTimer
AlpsTimer & subTreeTimer()
Query subtree timer.
Definition: AlpsKnowledgeBroker.h:415
AlpsKnowledgeBroker::getNumNodeLog
int getNumNodeLog() const
Get times that node log has been printed.
Definition: AlpsKnowledgeBroker.h:534
AlpsKnowledgeType
AlpsKnowledgeType
Type of knowledge like solution, node, cut...
Definition: Alps.h:223
AlpsKnowledgeBroker::subTreePool_
AlpsSubTreePool * subTreePool_
A subtree pool holding a collection of subtrees.
Definition: AlpsKnowledgeBroker.h:69
AlpsKnowledgeBroker::workerMsgLevel_
int workerMsgLevel_
The leve of printing message to screen of workers.
Definition: AlpsKnowledgeBroker.h:145
AlpsKnowledgeBroker::nodeSelection_
AlpsSearchStrategy< AlpsTreeNode * > * nodeSelection_
Node selection criterion.
Definition: AlpsKnowledgeBroker.h:126
AlpsKnowledge::setBroker
void setBroker(AlpsKnowledgeBroker *broker)
Set knowledge broker.
Definition: AlpsKnowledge.h:90
AlpsSubTreePool
The subtree pool is used to store subtrees.
Definition: AlpsSubTreePool.h:39
AlpsExitStatus
AlpsExitStatus
Definition: Alps.h:244
AlpsKnowledgeBroker::messages_
CoinMessages messages_
Alps messages.
Definition: AlpsKnowledgeBroker.h:136
AlpsKnowledgePool::getKnowledge
virtual std::pair< AlpsKnowledge *, double > getKnowledge() const =0
Check the first item in the pool.
AlpsSubTreePool.h
AlpsKnowledgeBroker::setMaxNumKnowledges
virtual void setMaxNumKnowledges(AlpsKnowledgeType kt, int num)
Set the max number of knowledge can be stored in a given type o fknowledge pools.
Definition: AlpsKnowledgeBroker.h:299
AlpsKnowledgeBroker::maxIndex_
AlpsNodeIndex_t maxIndex_
The maximum index can been assigned on this process.
Definition: AlpsKnowledgeBroker.h:85
AlpsKnowledge
The abstract base class of Alps knowledges generated during the search.
Definition: AlpsKnowledge.h:63
AlpsMessage.h
AlpsKnowledgeBroker::pools_
std::map< AlpsKnowledgeType, AlpsKnowledgePool * > * pools_
The collection of pools managed by the knowledge broker.
Definition: AlpsKnowledgeBroker.h:73
ALPS_OBJ_MAX
#define ALPS_OBJ_MAX
Definition: Alps.h:288
AlpsKnowledgeBroker::rampUpNodeSelection_
AlpsSearchStrategy< AlpsTreeNode * > * rampUpNodeSelection_
Node selection criterion.
Definition: AlpsKnowledgeBroker.h:128
AlpsKnowledgeBroker::getNodeMemSize
int getNodeMemSize()
Definition: AlpsKnowledgeBroker.h:428
AlpsKnowledgeBroker::getNumNodesBranched
int getNumNodesBranched() const
Query the number of node processed by this process.
Definition: AlpsKnowledgeBroker.h:383
AlpsKnowledgeBroker::setNextNodeIndex
void setNextNodeIndex(AlpsNodeIndex_t s)
Set nextIndex_.
Definition: AlpsKnowledgeBroker.h:478
AlpsKnowledgeBroker
The base class of knowledge broker class.
Definition: AlpsKnowledgeBroker.h:52
AlpsKnowledgeBroker::getAllKnowledges
virtual void getAllKnowledges(AlpsKnowledgeType kt, std::vector< std::pair< AlpsKnowledge *, double > > &kls) const
Get all knowledges in the given type of knowledge pools.
Definition: AlpsKnowledgeBroker.h:347
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.
AlpsKnowledgeBroker::setRampUpNodeSelection
void setRampUpNodeSelection(AlpsSearchStrategy< AlpsTreeNode * > *nc)
Definition: AlpsKnowledgeBroker.h:505
AlpsKnowledgePool.h
AlpsKnowledgeBroker::nextNodeIndex
AlpsNodeIndex_t nextNodeIndex()
Query the next index assigned to a newly created node, and then increment the nextIndex_ by 1.
Definition: AlpsKnowledgeBroker.h:474
AlpsKnowledgeBroker::messagesPointer
CoinMessages * messagesPointer()
Return pointer to messages.
Definition: AlpsKnowledgeBroker.h:524
AlpsKnowledgeBroker::getNodeProcessingTime
double getNodeProcessingTime()
Definition: AlpsKnowledgeBroker.h:434
AlpsKnowledgeBroker::getIncumbentValue
virtual double getIncumbentValue() const =0
The process queries the objective value of the incumbent that it stores.
AlpsKnowledgeBroker::registerClass
void registerClass(int name, AlpsKnowledge *userKnowledge)
Every user derived knowledge class must register.
Definition: AlpsKnowledgeBroker.h:185
AlpsKnowledgeBroker::setPeakMemory
void setPeakMemory(double size)
Set peak memory usage.
Definition: AlpsKnowledgeBroker.h:252
AlpsKnowledgeBroker::nodeLeftNum_
int nodeLeftNum_
The number of nodes left.
Definition: AlpsKnowledgeBroker.h:110
AlpsKnowledgeBroker::getMaxNumKnowledges
virtual int getMaxNumKnowledges(AlpsKnowledgeType kt) const
Query the max number of knowledge can be stored in a given type of knowledge pools.
Definition: AlpsKnowledgeBroker.h:288
AlpsEnumProcessT.h
AlpsKnowledgeTypeSubTree
@ AlpsKnowledgeTypeSubTree
Definition: Alps.h:229
AlpsKnowledgeBroker::systemNodeProcessed_
int systemNodeProcessed_
To record how many nodes processed by the system (used in parallel code).
Definition: AlpsKnowledgeBroker.h:108
AlpsKnowledgeBroker::getTreeDepth
int getTreeDepth()
Get tree depth.
Definition: AlpsKnowledgeBroker.h:250
AlpsKnowledgeBroker::nodeBranchedNum_
int nodeBranchedNum_
The number of nodes that have been branched.
Definition: AlpsKnowledgeBroker.h:101
AlpsKnowledgeBroker::setMaxNodeIndex
void setMaxNodeIndex(AlpsNodeIndex_t s)
Set the upper bound of node indices.
Definition: AlpsKnowledgeBroker.h:482
AlpsKnowledgeBroker::workingSubTree_
AlpsSubTree * workingSubTree_
Point to the subtree that being explored.
Definition: AlpsKnowledgeBroker.h:79
AlpsKnowledgeBroker::~AlpsKnowledgeBroker
virtual ~AlpsKnowledgeBroker()
Destructor.
AlpsKnowledgeBroker::nodeProcessingTime_
double nodeProcessingTime_
The approximately CPU time to process a node.
Definition: AlpsKnowledgeBroker.h:156
AlpsKnowledgeBroker::logFileLevel_
int logFileLevel_
The degree of log file.
Definition: AlpsKnowledgeBroker.h:148
AlpsKnowledgeBroker::getMaxNodeIndex
AlpsNodeIndex_t getMaxNodeIndex() const
Queriy the upper bound of node indices.
Definition: AlpsKnowledgeBroker.h:480
AlpsKnowledgeBroker::tempTimer
AlpsTimer & tempTimer()
Query secondary timer.
Definition: AlpsKnowledgeBroker.h:419
AlpsKnowledgeBroker::setModel
void setModel(AlpsModel *m)
Definition: AlpsKnowledgeBroker.h:246
AlpsKnowledgeBroker::getProcRank
virtual int getProcRank() const
Qeury the global rank of process.
Definition: AlpsKnowledgeBroker.h:461
AlpsKnowledgeBroker::getlogFileLevel
int getlogFileLevel()
Return log file level.
Definition: AlpsKnowledgeBroker.h:532
AlpsSolutionPool
This class is a comtainer for the solutions found during the search.
Definition: AlpsSolutionPool.h:43
AlpsKnowledgeBroker::getProcType
virtual AlpsProcessType getProcType() const
Query the type (master, hub, or worker) of the process.
Definition: AlpsKnowledgeBroker.h:467
AlpsKnowledgeBroker::getHubMsgLevel
int getHubMsgLevel()
Return msg level.
Definition: AlpsKnowledgeBroker.h:528
AlpsKnowledgeBroker::popKnowledge
virtual void popKnowledge(AlpsKnowledgeType kt)
Remove the a knowledge from the given type of knowledge pools.
Definition: AlpsKnowledgeBroker.h:332
AlpsSubTree
This class contains the data pertaining to a particular subtree in the search tree.
Definition: AlpsSubTree.h:51
AlpsKnowledgePool::setMaxNumKnowledges
virtual void setMaxNumKnowledges(int num)=0
Set the quantity limit of knowledges that can be stored in the pool.
AlpsSearchStrategy.h
AlpsKnowledgeBroker::updateNumNodesLeft
virtual int updateNumNodesLeft()
Update the number of left nodes on this process.
AlpsKnowledgeBroker::initializeSearch
virtual void initializeSearch(int argc, char *argv[], AlpsModel &model, bool showBanner=true)=0
Do some initialization for search.
AlpsParams.h
AlpsKnowledgeBroker::AlpsKnowledgeBroker
AlpsKnowledgeBroker()
Default constructor.
AlpsKnowledgeBroker::getMasterMsgLevel
int getMasterMsgLevel()
Return msg level.
Definition: AlpsKnowledgeBroker.h:530
AlpsKnowledgeBroker::messageHandler
CoinMessageHandler * messageHandler() const
Return handler.
Definition: AlpsKnowledgeBroker.h:520
AlpsKnowledgeBroker::timer_
AlpsTimer timer_
Main timer.
Definition: AlpsKnowledgeBroker.h:91
AlpsKnowledgeBroker::getModel
AlpsModel * getModel()
Definition: AlpsKnowledgeBroker.h:245
AlpsKnowledgeBroker::setNodeMemSize
void setNodeMemSize(int ms)
Definition: AlpsKnowledgeBroker.h:429
AlpsKnowledgeBroker::getLargeSize
int getLargeSize() const
Definition: AlpsKnowledgeBroker.h:438
AlpsKnowledgeBroker::hasKnowledge
virtual bool hasKnowledge(AlpsKnowledgeType kt) const
Query whether there are knowledges in the given type of knowledge pools.
Definition: AlpsKnowledgeBroker.h:311
AlpsKnowledgeBroker::treeDepth_
int treeDepth_
The depth of the tree.
Definition: AlpsKnowledgeBroker.h:112
AlpsKnowledgeBroker::bestSolNode_
int bestSolNode_
The number of nodes pocessed to find the solution.
Definition: AlpsKnowledgeBroker.h:114
AlpsKnowledgeTypeSolution
@ AlpsKnowledgeTypeSolution
Definition: Alps.h:228
AlpsKnowledgeBroker::getKnowledgePool
AlpsKnowledgePool * getKnowledgePool(AlpsKnowledgeType kt) const
Retrieve a knowledge pool in the Knowledge base.
Definition: AlpsKnowledgeBroker.h:275
AlpsKnowledgeBroker::handler_
CoinMessageHandler * handler_
Message handler.
Definition: AlpsKnowledgeBroker.h:134
AlpsNodeIndex_t
int AlpsNodeIndex_t
Definition: Alps.h:174
AlpsKnowledgeBroker::getNextNodeIndex
AlpsNodeIndex_t getNextNodeIndex() const
Query the next index assigned to a newly created node.
Definition: AlpsKnowledgeBroker.h:476
AlpsKnowledgeBroker::getBestKnowledge
virtual std::pair< AlpsKnowledge *, double > getBestKnowledge(AlpsKnowledgeType kt) const
Get the best knowledge in the given type of knowledge pools.