- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 * Ted Ralphs, Lehigh University *
11 * *
12 * Conceptual Design: *
13 * *
14 * Yan Xu, Lehigh University *
15 * Ted Ralphs, Lehigh University *
16 * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17 * Matthew Saltzman, Clemson University *
18 * *
19 * *
20 * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
21 *===========================================================================*/
22
23 #ifndef AlpsKnowledgeBroker_h_
24 #define AlpsKnowledgeBroker_h_
25
26 #include <cmath>
27 #include <iosfwd>
28 #include <map>
29 #include <string>
30
31 #include "CoinMessageHandler.hpp"
32
33 #include "AlpsSearchStrategy.h"
34 #include "AlpsEnumProcessT.h"
35 #include "AlpsKnowledge.h"
36 #include "AlpsKnowledgePool.h"
37 #include "AlpsMessage.h"
38 #include "AlpsParams.h"
39 #include "AlpsSolutionPool.h"
40 #include "AlpsSubTree.h"
41 #include "AlpsSubTreePool.h"
42 #include "AlpsModel.h"
43 #include "AlpsTime.h"
44
45 //#############################################################################
46
48 class AlpsKnowledgeBroker {
49
50 private:
51
52 AlpsKnowledgeBroker(const AlpsKnowledgeBroker&);
53 AlpsKnowledgeBroker& operator=(const AlpsKnowledgeBroker&);
54
56 std::map<int, AlpsKnowledge*> decodeMap_;
57
58 protected:
59
61 std::string instanceName_;
62
64 AlpsModel *model_;
65
67 AlpsPhase phase_;
68
75 AlpsSubTreePool* subTreePool_;
76
78 AlpsSolutionPool* solPool_;
79
81 std::map<AlpsKnowledgeType, AlpsKnowledgePool*>* pools_;
83
89 AlpsSubTree* workingSubTree_;
90
92 bool needWorkingSubTree_;
93
95 AlpsNodeIndex_t nextIndex_;
96
98 AlpsNodeIndex_t maxIndex_;
100
105 /***/
107 AlpsTimer timer_;
108
110 AlpsTimer subTreeTimer_;
111
113 AlpsTimer tempTimer_;
114
116 int solNum_;
117
119 int nodeProcessedNum_;
120
122 int nodeBranchedNum_;
123
125 int nodeDiscardedNum_;
126
128 int nodePartialNum_;
129
132 int systemNodeProcessed_;
133
135 int nodeLeftNum_;
136
138 int treeDepth_;
139
141 int bestSolNode_;
142
144 double peakMemory_;
145
147 AlpsExitStatus exitStatus_;
149
155 AlpsSearchStrategy<AlpsSubTree*>* treeSelection_;
156
158 AlpsSearchStrategy<AlpsTreeNode*>* nodeSelection_;
159
161 AlpsSearchStrategy<AlpsTreeNode*>* rampUpNodeSelection_;
163
169 CoinMessageHandler * handler_;
170
172 CoinMessages messages_;
173
176 int msgLevel_;
177
180 int hubMsgLevel_;
181
184 int workerMsgLevel_;
185
188 int logFileLevel_;
189
191 std::string logfile_;
193
195 int nodeMemSize_;
196
198 double nodeProcessingTime_;
199
201 int largeSize_;
202
204 bool userBalancePeriod_;
205
207 int numNodeLog_;
208
209 public:
210
212 AlpsKnowledgeBroker();
213
215 virtual ~AlpsKnowledgeBroker();
216
217 //-------------------------------------------------------------------------
230 void registerClass(int name, AlpsKnowledge* userKnowledge) {
231 // Check if alread have one.
232 std::map<int, AlpsKnowledge*>::iterator pos, pos1;
233 pos = decodeMap_.find(name);
234 pos1 = decodeMap_.end();
235
236 if (pos != pos1) {
237 AlpsKnowledge* kl = pos->second;
238 decodeMap_.erase(pos);
239 delete kl;
240 }
241
242 decodeMap_[name] = userKnowledge;
243 }
244
253 const AlpsKnowledge* decoderObject(int name) {
254 return decodeMap_[name];
255 }
257
258 //------------------------------------------------------
259
265 virtual void initializeSearch(int argc,
266 char* argv[],
267 AlpsModel& model) = 0;
268
270 virtual void rootSearch(AlpsTreeNode* root) = 0;
271
273 virtual void search(AlpsModel *model) {
274 AlpsTreeNode* root = model->createRoot();
275 rootSearch(root);
276 }
278
279 //------------------------------------------------------
280
285 AlpsPhase getPhase() { return phase_; }
286 void setPhase(AlpsPhase ph) { phase_ = ph; }
288
290 AlpsModel *getModel() { return model_; }
291 void setModel(AlpsModel *m) { model_ = m; }
293
295 int getTreeDepth() { return treeDepth_; }
296
298 void setPeakMemory(double size) { peakMemory_ = size; }
299
301 double getPeakMemory() { return peakMemory_; }
302
308 void setupKnowledgePools();
309
311 inline void addKnowledgePool(AlpsKnowledgeType kt, AlpsKnowledgePool* kp) {
312 if(kt == AlpsKnowledgeTypeSolution || kt == AlpsKnowledgeTypeSubTree) {
313 // AlpsKnowledgePool* akp = static_cast<AlpsKnowledgePool*>(kp);
314 pools_->insert
315 (std::pair<AlpsKnowledgeType, AlpsKnowledgePool*>(kt, kp));
316 }
317 else {
318 throw CoinError("Broker doesn't manage this type of knowledge",
319 "addKnowledgePool()", "AlpsKnowledgeBroker");
320 }
321 }
322
324 inline AlpsKnowledgePool* getKnowledgePool(AlpsKnowledgeType kt) const {
325 if(kt == AlpsKnowledgeTypeSolution || kt == AlpsKnowledgeTypeSubTree) {
326 return (*pools_)[kt];
327 }
328 else {
329 throw CoinError("Broker doesn't manage this type of knowledge",
330 "getKnowledgePool()", "AlpsKnowledgeBroker");
331 }
332 }
333
335 virtual int getNumKnowledges(AlpsKnowledgeType kt) const;
336
339 virtual int getMaxNumKnowledges(AlpsKnowledgeType kt) const {
340 if(kt == AlpsKnowledgeTypeSolution || kt == AlpsKnowledgeTypeSubTree) {
341 return getKnowledgePool(kt)->getMaxNumKnowledges();
342 }
343 else {
344 throw CoinError("Broker doesn't manage this type of knowledge",
345 "getMaxNumKnowledges()", "AlpsKnowledgeBroker");
346 }
347 }
348
351 virtual void setMaxNumKnowledges(AlpsKnowledgeType kt, int num) {
352 if(kt == AlpsKnowledgeTypeSolution || kt == AlpsKnowledgeTypeSubTree) {
353 getKnowledgePool(kt)->setMaxNumKnowledges(num);
354 }
355 else {
356 throw CoinError("Broker doesn't manage this type of knowledge",
357 "setMaxNumKnowledges()", "AlpsKnowledgeBroker");
358 }
359 }
360
363 virtual bool hasKnowledge(AlpsKnowledgeType kt) const {
364 if(kt == AlpsKnowledgeTypeSolution || kt == AlpsKnowledgeTypeSubTree)
365 return getKnowledgePool(kt)->hasKnowledge();
366 else
367 throw CoinError("Broker doesn't manage this type of knowledge",
368 "hasKnowledge()", "AlpsKnowledgeBroker");
369 }
370
372 virtual std::pair<AlpsKnowledge*, double>
373 getKnowledge(AlpsKnowledgeType kt) const {
374 if(kt == AlpsKnowledgeTypeSolution || kt == AlpsKnowledgeTypeSubTree) {
375 return getKnowledgePool(kt)->getKnowledge();
376 }
377 else {
378 throw CoinError("Broker doesn't manage this type of knowledge",
379 "getKnowledge()", "AlpsKnowledgeBroker");
380 }
381 }
382
384 virtual void popKnowledge(AlpsKnowledgeType kt) {
385 if(kt == AlpsKnowledgeTypeSolution || kt == AlpsKnowledgeTypeSubTree) {
386 getKnowledgePool(kt)->popKnowledge();
387 }
388 else {
389 throw CoinError("Broker doesn't manage this type of knowledge",
390 "popKnowledge()", "AlpsKnowledgeBroker");
391 }
392 }
393
395 virtual std::pair<AlpsKnowledge*, double>
396 getBestKnowledge(AlpsKnowledgeType kt) const;
397
399 virtual void getAllKnowledges (AlpsKnowledgeType kt,
400 std::vector<std::pair<AlpsKnowledge*,
401 double> >& kls) const {
402 if(kt == AlpsKnowledgeTypeSolution || kt == AlpsKnowledgeTypeSubTree) {
403 getKnowledgePool(kt)->getAllKnowledges(kls);
404 }
405 else {
406 throw CoinError("Broker doesn't manage this type of knowledge",
407 "popKnowledge()", "AlpsKnowledgeBroker");
408 }
409 }
410
412 virtual void addKnowledge(AlpsKnowledgeType kt,
413 AlpsKnowledge* kl,
414 double value ) {
415 if(kt == AlpsKnowledgeTypeSolution || kt == AlpsKnowledgeTypeSubTree) {
416 getKnowledgePool(kt)->addKnowledge(kl, value);
417 }
418 else {
419 throw CoinError("Broker doesn't manage this type of knowledge",
420 "popKnowledge()", "AlpsKnowledgeBroker");
421 }
422 }
424
429 int getNumNodesProcessed() const {
430 return nodeProcessedNum_;
431 }
432
434 int getNumNodesBranched() const {
435 return nodeBranchedNum_;
436 }
437
439 int getNumNodesDiscarded() const {
440 return nodeDiscardedNum_;
441 }
442
444 int getNumNodesPartial() const {
445 return nodePartialNum_;
446 }
447
449 int getNumNodesProcessedSystem() const {
450 return systemNodeProcessed_;
451 }
452
454 virtual int updateNumNodesLeft();
455
457 virtual AlpsTreeNode* getBestNode() const;
458
460 AlpsExitStatus getSolStatus() const {
461 return exitStatus_;
462 }
463
465 void setExitStatus(AlpsExitStatus status) {
466 exitStatus_ = status;
467 }
468
470 AlpsTimer & timer() {
471 return timer_;
472 }
473
475 AlpsTimer & subTreeTimer() {
476 return subTreeTimer_;
477 }
478
480 AlpsTimer & tempTimer() {
481 return tempTimer_;
482 }
483
485 virtual void searchLog() = 0;
487
492 int getNodeMemSize() { return nodeMemSize_; }
493 void setNodeMemSize(int ms) { nodeMemSize_ = ms; }
495
500 double getNodeProcessingTime() { return nodeProcessingTime_; }
501 void setNodeProcessingTime(double npTime) { nodeProcessingTime_ = npTime; }
503
504 int getLargeSize() const { return largeSize_; }
505
512 virtual double getIncumbentValue() const = 0;
513
516 virtual double getBestQuality() const = 0;
517
519 virtual double getBestEstimateQuality() { return ALPS_OBJ_MAX; }
520
521 virtual int getNumNodeLeftSystem(){ return nodeLeftNum_; }
522
525 virtual void printBestSolution(char* outputFile = 0) const = 0;
527
529 virtual int getProcRank() const { return 0; }
530
532 virtual int getMasterRank() const { return 0; }
533
535 virtual AlpsProcessType getProcType() const
536 { return AlpsProcessTypeSerial; } /* Default is serial */
537
544 AlpsNodeIndex_t nextNodeIndex() { return nextIndex_++; }
545
547 AlpsNodeIndex_t getNextNodeIndex() const { return nextIndex_; }
548
550 void setNextNodeIndex(AlpsNodeIndex_t s) { nextIndex_ = s; }
551
553 AlpsNodeIndex_t getMaxNodeIndex() const { return maxIndex_; }
554
556 void setMaxNodeIndex(AlpsNodeIndex_t s) { maxIndex_ = s; }
558
563 AlpsSearchStrategy<AlpsSubTree*>* getSubTreeSelection() const {
564 return treeSelection_;
565 }
566 void setSubTreeSelection(AlpsSearchStrategy<AlpsSubTree*>* tc) {
567 if (treeSelection_) delete treeSelection_;
568 treeSelection_ = tc;
569 subTreePool_->setComparison(*treeSelection_);
570 }
571 AlpsSearchStrategy<AlpsTreeNode*>* getNodeSelection() const {
572 return nodeSelection_;
573 }
574 void setNodeSelection(AlpsSearchStrategy<AlpsTreeNode*>* nc) {
575 if (nodeSelection_) delete nodeSelection_;
576 nodeSelection_ = nc;
577 }
578 AlpsSearchStrategy<AlpsTreeNode*>* getRampUpNodeSelection() const {
579 return rampUpNodeSelection_;
580 }
581 void setRampUpNodeSelection(AlpsSearchStrategy<AlpsTreeNode*>* nc) {
582 if (rampUpNodeSelection_) delete rampUpNodeSelection_;
583 rampUpNodeSelection_ = nc;
584 }
586
590 void passInMessageHandler(CoinMessageHandler * handler);
591
593 void newLanguage(CoinMessages::Language language);
594 void setLanguage(CoinMessages::Language language)
595 { newLanguage(language); }
596
598 CoinMessageHandler * messageHandler() const { return handler_; }
599
601 CoinMessages messages() { return messages_; }
602
604 CoinMessages * messagesPointer() { return &messages_; }
605
607 int getMsgLevel() { return msgLevel_; }
608
610 int getHubMsgLevel() { return hubMsgLevel_; }
611
613 int getMasterMsgLevel() { return workerMsgLevel_; }
614
616 int getlogFileLevel() { return logFileLevel_; }
617
619 int getNumNodeLog() const { return numNodeLog_; }
620
622 void setNumNodeLog(int num) { numNodeLog_ = num; }
624 };
625 #endif
AlpsKnowledgeBroker::setExitStatus
void setExitStatus(AlpsExitStatus status)
Set terminate status.
Definition: AlpsKnowledgeBroker.h:465
AlpsKnowledgeBroker::nextIndex_
AlpsNodeIndex_t nextIndex_
The index to be assigned to a new search tree node.
Definition: AlpsKnowledgeBroker.h:95
AlpsKnowledgeBroker::logFileLevel_
int logFileLevel_
The degree of log file.
Definition: AlpsKnowledgeBroker.h:188
AlpsKnowledgeBroker
The base class of knowledge broker class.
Definition: AlpsKnowledgeBroker.h:48
AlpsKnowledgeBroker::setNodeMemSize
void setNodeMemSize(int ms)
Definition: AlpsKnowledgeBroker.h:493
AlpsKnowledgeBroker::nodeLeftNum_
int nodeLeftNum_
The number of nodes left.
Definition: AlpsKnowledgeBroker.h:135
AlpsKnowledgeBroker::getLargeSize
int getLargeSize() const
Definition: AlpsKnowledgeBroker.h:504
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:351
AlpsKnowledgeBroker::workerMsgLevel_
int workerMsgLevel_
The leve of printing message to screen of workers.
Definition: AlpsKnowledgeBroker.h:184
AlpsKnowledgeBroker::rootSearch
virtual void rootSearch(AlpsTreeNode *root)=0
Explore the tree rooted as the given root.
AlpsKnowledgeBroker::solNum_
int solNum_
The number of solutions found.
Definition: AlpsKnowledgeBroker.h:116
CoinMessageHandler
Base class for message handling.
Definition: CoinMessageHandler.hpp:327
AlpsKnowledgeBroker::getNextNodeIndex
AlpsNodeIndex_t getNextNodeIndex() const
Query the next index assigned to a newly created node.
Definition: AlpsKnowledgeBroker.h:547
AlpsKnowledgeBroker::getHubMsgLevel
int getHubMsgLevel()
Return msg level.
Definition: AlpsKnowledgeBroker.h:610
AlpsKnowledgeBroker::pools_
std::map< AlpsKnowledgeType, AlpsKnowledgePool * > * pools_
The collection of pools managed by the knowledge broker.
Definition: AlpsKnowledgeBroker.h:81
AlpsKnowledgeBroker::decodeMap_
std::map< int, AlpsKnowledge * > decodeMap_
Stores registered knowledge.
Definition: AlpsKnowledgeBroker.h:56
AlpsKnowledgeBroker::tempTimer_
AlpsTimer tempTimer_
Secondary timer.
Definition: AlpsKnowledgeBroker.h:113
AlpsKnowledgeBroker::getNodeMemSize
int getNodeMemSize()
Definition: AlpsKnowledgeBroker.h:492
AlpsKnowledgeBroker::getNumNodeLeftSystem
virtual int getNumNodeLeftSystem()
The process queries the objective value of the incumbent that it stores.
Definition: AlpsKnowledgeBroker.h:521
AlpsKnowledgeBroker::nodeProcessingTime_
double nodeProcessingTime_
The approximately CPU time to process a node.
Definition: AlpsKnowledgeBroker.h:198
AlpsSolutionPool.h
AlpsKnowledgeBroker::exitStatus_
AlpsExitStatus exitStatus_
The status of search when terminated.
Definition: AlpsKnowledgeBroker.h:147
AlpsKnowledgeBroker::subTreeTimer
AlpsTimer & subTreeTimer()
Query subtree timer.
Definition: AlpsKnowledgeBroker.h:475
AlpsKnowledgePool::getMaxNumKnowledges
virtual int getMaxNumKnowledges() const
Query the quantity limit of knowledges.
Definition: AlpsKnowledgePool.h:75
AlpsKnowledgeBroker::setLanguage
void setLanguage(CoinMessages::Language language)
Pass in Message handler (not deleted at end).
Definition: AlpsKnowledgeBroker.h:594
AlpsKnowledgeBroker::~AlpsKnowledgeBroker
virtual ~AlpsKnowledgeBroker()
Destructor.
AlpsKnowledgeBroker::getSubTreeSelection
AlpsSearchStrategy< AlpsSubTree * > * getSubTreeSelection() const
Definition: AlpsKnowledgeBroker.h:563
AlpsKnowledgeBroker::AlpsKnowledgeBroker
AlpsKnowledgeBroker()
Default constructor.
AlpsKnowledgeBroker::operator=
AlpsKnowledgeBroker & operator=(const AlpsKnowledgeBroker &)
AlpsKnowledgeBroker::userBalancePeriod_
bool userBalancePeriod_
Has user input balance period.
Definition: AlpsKnowledgeBroker.h:204
AlpsSubTreePool::setComparison
void setComparison(AlpsSearchStrategy< AlpsSubTree * > &compare)
Set comparison function and resort heap.
Definition: AlpsSubTreePool.h:77
AlpsKnowledgeBroker::popKnowledge
virtual void popKnowledge(AlpsKnowledgeType kt)
Remove the a knowledge from the given type of knowledge pools.
Definition: AlpsKnowledgeBroker.h:384
AlpsKnowledgePool::addKnowledge
virtual void addKnowledge(AlpsKnowledge *nk, double priority)=0
Add a knowledge to pool.
AlpsKnowledgeBroker::updateNumNodesLeft
virtual int updateNumNodesLeft()
Update the number of left nodes on this process.
AlpsModel.h
AlpsKnowledgeBroker::setNodeProcessingTime
void setNodeProcessingTime(double npTime)
Definition: AlpsKnowledgeBroker.h:501
AlpsKnowledgeBroker::getBestQuality
virtual double getBestQuality() const =0
The process (serial) / the master (parallel) queries the quality of the best solution that it knows...
AlpsKnowledgeBroker::bestSolNode_
int bestSolNode_
The number of nodes pocessed to find the solution.
Definition: AlpsKnowledgeBroker.h:141
AlpsKnowledgePool::popKnowledge
virtual void popKnowledge()
Remove the queried knowledge from the pool.
Definition: AlpsKnowledgePool.h:55
AlpsKnowledgeBroker::numNodeLog_
int numNodeLog_
Times that node log is printed.
Definition: AlpsKnowledgeBroker.h:207
AlpsModel
Definition: AlpsModel.h:36
AlpsSubTree
This class contains the data pertaining to a particular subtree in the search tree.
Definition: AlpsSubTree.h:47
AlpsParams.h
AlpsEnumProcessT.h
AlpsKnowledgeBroker::getNodeProcessingTime
double getNodeProcessingTime()
Definition: AlpsKnowledgeBroker.h:500
AlpsKnowledgeBroker::phase_
AlpsPhase phase_
Alps phase.
Definition: AlpsKnowledgeBroker.h:67
AlpsKnowledgeBroker::setupKnowledgePools
void setupKnowledgePools()
Set up knowledge pools for this broker.
AlpsPhase
AlpsPhase
Definition: Alps.h:129
AlpsKnowledgeBroker::search
virtual void search(AlpsModel *model)
Search best solution for a given model.
Definition: AlpsKnowledgeBroker.h:273
AlpsKnowledgeBroker::setNumNodeLog
void setNumNodeLog(int num)
Get times that node log has been printed.
Definition: AlpsKnowledgeBroker.h:622
AlpsSubTreePool
The subtree pool is used to store subtrees.
Definition: AlpsSubTreePool.h:32
AlpsKnowledgeBroker::solPool_
AlpsSolutionPool * solPool_
A solution pool containing the solutions found.
Definition: AlpsKnowledgeBroker.h:78
AlpsKnowledgeBroker::getNumNodesPartial
int getNumNodesPartial() const
Query the number of node in the queue that are pregnant.
Definition: AlpsKnowledgeBroker.h:444
AlpsKnowledgeBroker::logfile_
std::string logfile_
The log file.
Definition: AlpsKnowledgeBroker.h:191
AlpsKnowledgeBroker::rampUpNodeSelection_
AlpsSearchStrategy< AlpsTreeNode * > * rampUpNodeSelection_
Node selection criterion.
Definition: AlpsKnowledgeBroker.h:161
AlpsKnowledgeBroker::getNumNodesProcessed
int getNumNodesProcessed() const
Query the number of node processed by this process.
Definition: AlpsKnowledgeBroker.h:429
AlpsKnowledgePool.h
AlpsKnowledgeBroker::needWorkingSubTree_
bool needWorkingSubTree_
Indicate whether need a new subtree.
Definition: AlpsKnowledgeBroker.h:92
AlpsKnowledgeBroker::getTreeDepth
int getTreeDepth()
Get tree depth.
Definition: AlpsKnowledgeBroker.h:295
AlpsKnowledgeBroker::setSubTreeSelection
void setSubTreeSelection(AlpsSearchStrategy< AlpsSubTree * > *tc)
Definition: AlpsKnowledgeBroker.h:566
AlpsKnowledgeBroker::getNumNodesBranched
int getNumNodesBranched() const
Query the number of node processed by this process.
Definition: AlpsKnowledgeBroker.h:434
AlpsTime.h
AlpsKnowledgeBroker::systemNodeProcessed_
int systemNodeProcessed_
To record how many nodes processed by the system (used in parallel code).
Definition: AlpsKnowledgeBroker.h:132
AlpsKnowledgeBroker::getMaxNodeIndex
AlpsNodeIndex_t getMaxNodeIndex() const
Queriy the upper bound of node indices.
Definition: AlpsKnowledgeBroker.h:553
AlpsProcessType
AlpsProcessType
This enumerative constant describes the various process types.
Definition: AlpsEnumProcessT.h:31
AlpsKnowledgeBroker::tempTimer
AlpsTimer & tempTimer()
Query secondary timer.
Definition: AlpsKnowledgeBroker.h:480
AlpsKnowledgeBroker::getProcType
virtual AlpsProcessType getProcType() const
Query the type (master, hub, or worker) of the process.
Definition: AlpsKnowledgeBroker.h:535
AlpsKnowledgeBroker::getMasterRank
virtual int getMasterRank() const
Query the global rank of the Master.
Definition: AlpsKnowledgeBroker.h:532
AlpsKnowledgeBroker::messagesPointer
CoinMessages * messagesPointer()
Return pointer to messages.
Definition: AlpsKnowledgeBroker.h:604
AlpsTreeNode
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:50
AlpsKnowledgeBroker::setMaxNodeIndex
void setMaxNodeIndex(AlpsNodeIndex_t s)
Set the upper bound of node indices.
Definition: AlpsKnowledgeBroker.h:556
AlpsKnowledgeType
AlpsKnowledgeType
Definition: Alps.h:88
AlpsKnowledgeBroker::messages_
CoinMessages messages_
Alps messages.
Definition: AlpsKnowledgeBroker.h:172
AlpsKnowledgeBroker::hubMsgLevel_
int hubMsgLevel_
The leve of printing message to screen of hubs.
Definition: AlpsKnowledgeBroker.h:180
AlpsKnowledgeBroker::getMsgLevel
int getMsgLevel()
Return msg level.
Definition: AlpsKnowledgeBroker.h:607
AlpsKnowledgeBroker::setPhase
void setPhase(AlpsPhase ph)
Definition: AlpsKnowledgeBroker.h:286
AlpsKnowledgeBroker::decoderObject
const AlpsKnowledge * decoderObject(int name)
This method returns the pointer to an empty object of the registered class name.
Definition: AlpsKnowledgeBroker.h:253
AlpsExitStatus
AlpsExitStatus
Definition: Alps.h:101
AlpsKnowledgeBroker::passInMessageHandler
void passInMessageHandler(CoinMessageHandler *handler)
Pass in Message handler (not deleted at end).
AlpsKnowledgeBroker::maxIndex_
AlpsNodeIndex_t maxIndex_
The maximum index can been assigned on this process.
Definition: AlpsKnowledgeBroker.h:98
AlpsKnowledgeBroker::messages
CoinMessages messages()
Return messages.
Definition: AlpsKnowledgeBroker.h:601
AlpsKnowledgeBroker::subTreePool_
AlpsSubTreePool * subTreePool_
A subtree pool holding a collection of subtrees.
Definition: AlpsKnowledgeBroker.h:75
AlpsSolutionPool
In the solution pool we assume that the lower the priority value the more desirable the solution is...
Definition: AlpsSolutionPool.h:33
AlpsKnowledgeBroker::getModel
AlpsModel * getModel()
Definition: AlpsKnowledgeBroker.h:290
ALPS_OBJ_MAX
#define ALPS_OBJ_MAX
Definition: Alps.h:145
AlpsKnowledgeBroker::getBestEstimateQuality
virtual double getBestEstimateQuality()
Get best estimalted quality in system.
Definition: AlpsKnowledgeBroker.h:519
AlpsKnowledgePool::setMaxNumKnowledges
virtual void setMaxNumKnowledges(int num)
Set the quantity limit of knowledges that can be stored in the pool.
Definition: AlpsKnowledgePool.h:67
CoinMessageHandler.hpp
This is a first attempt at a message handler.
AlpsKnowledgeBroker::peakMemory_
double peakMemory_
Peak memory usage.
Definition: AlpsKnowledgeBroker.h:144
AlpsKnowledgeBroker::largeSize_
int largeSize_
The size of largest message buffer can be sent or received.
Definition: AlpsKnowledgeBroker.h:201
AlpsKnowledgeBroker::msgLevel_
int msgLevel_
The leve of printing message to screen of the master and general message.
Definition: AlpsKnowledgeBroker.h:176
AlpsKnowledge.h
AlpsNodeIndex_t
int AlpsNodeIndex_t
Definition: AlpsTreeNode.h:37
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:339
AlpsKnowledgeBroker::subTreeTimer_
AlpsTimer subTreeTimer_
Subtree timer.
Definition: AlpsKnowledgeBroker.h:110
AlpsKnowledgePool
Definition: AlpsKnowledgePool.h:36
AlpsKnowledge
The abstract base class of any user-defined class that Alps has to know about in order to encode/deco...
Definition: AlpsKnowledge.h:51
AlpsKnowledgeBroker::nodeSelection_
AlpsSearchStrategy< AlpsTreeNode * > * nodeSelection_
Node selection criterion.
Definition: AlpsKnowledgeBroker.h:158
AlpsModel::createRoot
virtual AlpsTreeNode * createRoot()
Create the root node.
Definition: AlpsModel.h:102
AlpsMessage.h
AlpsSubTree.h
AlpsKnowledgeBroker::getRampUpNodeSelection
AlpsSearchStrategy< AlpsTreeNode * > * getRampUpNodeSelection() const
Definition: AlpsKnowledgeBroker.h:578
AlpsKnowledgeBroker::getlogFileLevel
int getlogFileLevel()
Return log file level.
Definition: AlpsKnowledgeBroker.h:616
CoinMessages
Class to hold and manipulate an array of massaged messages.
Definition: CoinMessageHandler.hpp:128
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:399
AlpsKnowledgeBroker::nodeDiscardedNum_
int nodeDiscardedNum_
The number of nodes that have been discarded before processing.
Definition: AlpsKnowledgeBroker.h:125
AlpsKnowledgeBroker::addKnowledgePool
void addKnowledgePool(AlpsKnowledgeType kt, AlpsKnowledgePool *kp)
Add a knowledge pool into the Knowledge pools.
Definition: AlpsKnowledgeBroker.h:311
AlpsKnowledgeBroker::treeDepth_
int treeDepth_
The depth of the tree.
Definition: AlpsKnowledgeBroker.h:138
AlpsKnowledgeBroker::setRampUpNodeSelection
void setRampUpNodeSelection(AlpsSearchStrategy< AlpsTreeNode * > *nc)
Definition: AlpsKnowledgeBroker.h:581
AlpsKnowledgeBroker::getBestKnowledge
virtual std::pair< AlpsKnowledge *, double > getBestKnowledge(AlpsKnowledgeType kt) const
Get the best knowledge in the given type of knowledge pools.
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:544
AlpsKnowledgeBroker::model_
AlpsModel * model_
Pointer to model.
Definition: AlpsKnowledgeBroker.h:64
AlpsKnowledgeBroker::nodeMemSize_
int nodeMemSize_
The approximate memory size (bytes) of a node with full description.
Definition: AlpsKnowledgeBroker.h:195
CoinError
Error Class thrown by an exception.
Definition: CoinError.hpp:42
AlpsSubTreePool.h
AlpsKnowledgeBroker::getPeakMemory
double getPeakMemory()
Get peak memory usage.
Definition: AlpsKnowledgeBroker.h:301
AlpsKnowledgeTypeSubTree
Definition: Alps.h:93
AlpsKnowledgeBroker::getBestNode
virtual AlpsTreeNode * getBestNode() const
Query the best node in the subtree pool.
AlpsKnowledgeBroker::setModel
void setModel(AlpsModel *m)
Definition: AlpsKnowledgeBroker.h:291
AlpsKnowledgeBroker::getNodeSelection
AlpsSearchStrategy< AlpsTreeNode * > * getNodeSelection() const
Definition: AlpsKnowledgeBroker.h:571
AlpsKnowledgeBroker::getPhase
AlpsPhase getPhase()
Definition: AlpsKnowledgeBroker.h:285
AlpsTimer
Definition: AlpsTime.h:75
AlpsSearchStrategy.h
AlpsKnowledgeBroker::workingSubTree_
AlpsSubTree * workingSubTree_
Point to the subtree that being explored.
Definition: AlpsKnowledgeBroker.h:89
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::setNodeSelection
void setNodeSelection(AlpsSearchStrategy< AlpsTreeNode * > *nc)
Definition: AlpsKnowledgeBroker.h:574
AlpsKnowledgeBroker::getKnowledgePool
AlpsKnowledgePool * getKnowledgePool(AlpsKnowledgeType kt) const
Retrieve a knowledge pool in the Knowledge base.
Definition: AlpsKnowledgeBroker.h:324
AlpsKnowledgeBroker::handler_
CoinMessageHandler * handler_
Message handler.
Definition: AlpsKnowledgeBroker.h:169
AlpsKnowledgeBroker::getKnowledge
virtual std::pair< AlpsKnowledge *, double > getKnowledge(AlpsKnowledgeType kt) const
Get a knowledge, but doesn&#39;t remove it from the pool.
Definition: AlpsKnowledgeBroker.h:373
AlpsKnowledgePool::getKnowledge
virtual std::pair< AlpsKnowledge *, double > getKnowledge() const =0
Query a knowledge, but doesn&#39;t remove it from the pool.
AlpsKnowledgeBroker::getNumNodeLog
int getNumNodeLog() const
Get times that node log has been printed.
Definition: AlpsKnowledgeBroker.h:619
AlpsKnowledgeBroker::getMasterMsgLevel
int getMasterMsgLevel()
Return msg level.
Definition: AlpsKnowledgeBroker.h:613
AlpsKnowledgeBroker::nodePartialNum_
int nodePartialNum_
The number of nodes that are pregnant.
Definition: AlpsKnowledgeBroker.h:128
AlpsKnowledgeBroker::timer
AlpsTimer & timer()
Query timer.
Definition: AlpsKnowledgeBroker.h:470
AlpsKnowledgeBroker::getNumNodesDiscarded
int getNumNodesDiscarded() const
Query the number of node processed by this process.
Definition: AlpsKnowledgeBroker.h:439
AlpsKnowledgeBroker::getProcRank
virtual int getProcRank() const
Qeury the global rank of process.
Definition: AlpsKnowledgeBroker.h:529
AlpsKnowledgeBroker::registerClass
void registerClass(int name, AlpsKnowledge *userKnowledge)
Every user derived knowledge class must register.
Definition: AlpsKnowledgeBroker.h:230
AlpsKnowledgeBroker::setNextNodeIndex
void setNextNodeIndex(AlpsNodeIndex_t s)
Set nextIndex_.
Definition: AlpsKnowledgeBroker.h:550
AlpsKnowledgeBroker::addKnowledge
virtual void addKnowledge(AlpsKnowledgeType kt, AlpsKnowledge *kl, double value)
Add a knowledge in the given type of knowledge pools.
Definition: AlpsKnowledgeBroker.h:412
AlpsKnowledgePool::getAllKnowledges
virtual void getAllKnowledges(std::vector< std::pair< AlpsKnowledge *, double > > &kls) const
Get a reference to all the knowledges in the pool.
Definition: AlpsKnowledgePool.h:89
AlpsKnowledgeBroker::initializeSearch
virtual void initializeSearch(int argc, char *argv[], AlpsModel &model)=0
Do some initialization for search.
AlpsKnowledgeBroker::nodeBranchedNum_
int nodeBranchedNum_
The number of nodes that have been branched.
Definition: AlpsKnowledgeBroker.h:122
AlpsKnowledgeBroker::nodeProcessedNum_
int nodeProcessedNum_
The number of nodes that have been processed.
Definition: AlpsKnowledgeBroker.h:119
AlpsKnowledgeBroker::getSolStatus
AlpsExitStatus getSolStatus() const
Query search termination status.
Definition: AlpsKnowledgeBroker.h:460
AlpsKnowledgeBroker::hasKnowledge
virtual bool hasKnowledge(AlpsKnowledgeType kt) const
Query whether there are knowledges in the given type of knowledge pools.
Definition: AlpsKnowledgeBroker.h:363
AlpsKnowledgePool::hasKnowledge
virtual bool hasKnowledge() const
Check whether the pool has knowledge.
Definition: AlpsKnowledgePool.h:61
AlpsKnowledgeBroker::newLanguage
void newLanguage(CoinMessages::Language language)
Set language.
AlpsKnowledgeBroker::getNumNodesProcessedSystem
int getNumNodesProcessedSystem() const
Query the number of node processed by the system.
Definition: AlpsKnowledgeBroker.h:449
CoinMessages::Language
Language
Supported languages.
Definition: CoinMessageHandler.hpp:136
AlpsKnowledgeTypeSolution
Definition: Alps.h:92
AlpsKnowledgeBroker::setPeakMemory
void setPeakMemory(double size)
Set peak memory usage.
Definition: AlpsKnowledgeBroker.h:298
AlpsProcessTypeSerial
Serial.
Definition: AlpsEnumProcessT.h:33
AlpsKnowledgeBroker::searchLog
virtual void searchLog()=0
Search statistics log.
AlpsKnowledgeBroker::instanceName_
std::string instanceName_
The instance name.
Definition: AlpsKnowledgeBroker.h:61
AlpsKnowledgeBroker::timer_
AlpsTimer timer_
Main timer.
Definition: AlpsKnowledgeBroker.h:107
AlpsKnowledgeBroker::getNumKnowledges
virtual int getNumKnowledges(AlpsKnowledgeType kt) const
Query the number of knowledge in the given type of a knowledge pool.
AlpsKnowledgeBroker::getIncumbentValue
virtual double getIncumbentValue() const =0
The process queries the objective value of the incumbent that it stores.
AlpsKnowledgeBroker::treeSelection_
AlpsSearchStrategy< AlpsSubTree * > * treeSelection_
Tree selection criterion.
Definition: AlpsKnowledgeBroker.h:155
AlpsKnowledgeBroker::messageHandler
CoinMessageHandler * messageHandler() const
Return handler.
Definition: AlpsKnowledgeBroker.h:598