37 #ifndef __BB_PARA_SOLVER_POOL_H__ 38 #define __BB_PARA_SOLVER_POOL_H__ 100 collectingMode(false),
101 candidateOfCollecting(false),
103 collectingIsProhibited(false),
104 dualBoundGainTesting(false),
107 selectionHeapElement(0),
108 collectingModeSolverHeapElement(0),
110 numOfDiffNodesSolved(0),
112 numOfDiffNodesLeft(0),
113 bestDualBoundValue(0.0),
128 while( selfSplitNodes )
131 selfSplitNodes = selfSplitNodes->
next;
185 int removeBoundedNodes(
186 double incumbentValue ///< incumbent value
190 BbParaNode *preNode = selfSplitNodes;
191 BbParaNode *node = selfSplitNodes;
194 if( node->getDualBoundValue() > incumbentValue )
196 if( preNode == selfSplitNodes ) // head
198 selfSplitNodes = node->next;
199 preNode = selfSplitNodes;
201 node = selfSplitNodes;
205 preNode->next = node->next;
207 node = preNode->next;
236 selfSplitNodes = inNode;
254 selfSplitNodes = selfSplitNodes->
next;
255 currentNode->
next = 0;
259 if( selfSplitNodes->
next )
271 currentNode->
next = 0;
275 THROW_LOGICAL_ERROR1(
"Should not be called. If whole subtrees are removed, TagComleation should be sent and should be inactivated.");
292 assert( selfSplitNodes );
297 selfSplitNodes = selfSplitNodes->
next;
303 if( selfSplitNodes->
next )
319 THROW_LOGICAL_ERROR1(
"Should not be called. If whole subtrees are removed, TagComleation should be sent and should be inactivated.");
337 selfSplitNodes = selfSplitNodes->
next;
343 if( selfSplitNodes->
next )
359 THROW_LOGICAL_ERROR1(
"Should not be called. If whole subtrees are removed, TagComleation should be sent and should be inactivated.");
376 assert( !currentNode->
next );
388 assert( !currentNode->
next );
421 BbParaSolverPoolElementPtr *inSelectionHeapElement
424 selectionHeapElement = inSelectionHeapElement;
441 BbParaSolverPoolElementPtr *inCollectingModeSolverHeapElement
444 collectingModeSolverHeapElement = inCollectingModeSolverHeapElement;
471 long long inNumOfNodesSolved
474 numOfNodesSolved = inNumOfNodesSolved;
495 numOfDiffNodesSolved = inNumOfDiff;
505 numOfNodesLeft = inNumOfNodesLeft;
512 double dualBoundValue
536 numOfDiffNodesLeft = inNumOfDiff;
553 double inBestDualBoundValue
556 bestDualBoundValue = inBestDualBoundValue;
567 currentNode = inNode;
571 bestDualBoundValue = -DBL_MAX;
572 numOfNodesSolved = 0;
584 numOfNodesSolved = -1;
585 bestDualBoundValue = -DBL_MAX;
601 collectingMode =
false;
602 candidateOfCollecting =
false;
603 collectingIsProhibited =
false;
604 dualBoundGainTesting =
false;
606 numOfNodesSolved = 0;
608 numOfDiffNodesLeft = 0;
609 bestDualBoundValue = 0.0;
620 collectingMode =
false;
621 candidateOfCollecting =
false;
622 collectingIsProhibited =
false;
623 dualBoundGainTesting =
false;
624 numOfNodesSolved = 0;
626 numOfDiffNodesLeft = 0;
627 bestDualBoundValue = 0.0;
680 return ( status ==
Active );
690 return (!collectingMode);
730 candidateOfCollecting = b;
741 termState = inTermState;
760 assert( status ==
Racing );
781 return ( status ==
Racing );
819 collectingIsProhibited =
true;
828 collectingIsProhibited =
false;
858 dualBoundGainTesting = value;
898 BbParaSolverPoolElementPtr solver
905 BbParaSolverPoolElementPtr
top(
915 BbParaSolverPoolElementPtr
get(
926 BbParaSolverPoolElementPtr
remove(
959 virtual void updateDualBoundValue(
960 BbParaSolverPoolElementPtr solver,
967 virtual void deleteElement(
968 BbParaSolverPoolElementPtr solver
981 virtual void downHeap(
992 const std::string toString(
1029 virtual void updateDualBoundValue(
1030 BbParaSolverPoolElementPtr solver,
1037 virtual void deleteElement(
1038 BbParaSolverPoolElementPtr solver
1044 virtual void upHeap(
1050 virtual void downHeap(
1080 virtual void updateDualBoundValue(
1081 BbParaSolverPoolElementPtr solver,
1088 virtual void deleteElement(
1089 BbParaSolverPoolElementPtr solver
1095 virtual void upHeap(
1101 virtual void downHeap(
1142 BbParaSolverPoolElementPtr solver
1151 BbParaSolverPoolElementPtr
top(
1161 BbParaSolverPoolElementPtr
remove(
1194 virtual void updateDualBoundValue(
1195 BbParaSolverPoolElementPtr solver,
1202 virtual void deleteElement(
1203 BbParaSolverPoolElementPtr solver
1209 virtual void upHeap(
1216 virtual void downHeap(
1227 const std::string toString();
1263 virtual void updateDualBoundValue(
1264 BbParaSolverPoolElementPtr solver,
1271 virtual void deleteElement(
1272 BbParaSolverPoolElementPtr solver
1278 virtual void upHeap(
1285 virtual void downHeap(
1313 virtual void updateDualBoundValue(
1314 BbParaSolverPoolElementPtr solver,
1321 virtual void deleteElement(
1322 BbParaSolverPoolElementPtr solver
1328 virtual void upHeap(
1335 virtual void downHeap(
1384 virtual void switchInCollectingToSolver(
1403 :
ParaSolverPool(inOriginRank, inParaComm, inParaParams, inParaTimer),
1408 nCollectingModeSolvers(0),
1409 nNodesSolvedInSolvers(0),
1410 nTotalNodesSolved(0),
1412 collectingMode(false),
1413 breakingFirstSubtree(false),
1414 beforeInitialCollect(true),
1415 beforeFinishingFirstCollect(true),
1417 collectingModeSolverHeap(0),
1418 switchOutTime(-1.0),
1419 mCollectingNodes(1),
1420 mMaxCollectingNodes(1),
1421 nDualBoundGainTesting(0)
1423 nSolvers = paraComm->getSize() - inOriginRank;
1426 pool =
new BbParaSolverPoolElementPtr[
nSolvers];
1427 for(
unsigned int i = 0; i <
nSolvers; i++ )
1431 inactiveSolvers.insert(std::make_pair((originRank+i),pool[i]));
1435 nMaxCollectingModeSolvers = std::min(
1440 nMaxCollectingModeSolvers = std::max(nSolvers / 2, (std::size_t)1);
1444 nMaxCollectingModeSolvers =
nSolvers;
1450 breakingFirstSubtree =
true;
1467 :
ParaSolverPool(inOriginRank, inParaComm, inParaParams, inParaTimer),
1472 nCollectingModeSolvers(0),
1473 nNodesSolvedInSolvers(0),
1474 nTotalNodesSolved(0),
1476 collectingMode(false),
1477 breakingFirstSubtree(false),
1478 beforeInitialCollect(true),
1479 beforeFinishingFirstCollect(true),
1481 collectingModeSolverHeap(0),
1482 switchOutTime(-1.0),
1483 mCollectingNodes(1),
1484 mMaxCollectingNodes(1),
1485 nDualBoundGainTesting(0)
1490 pool =
new BbParaSolverPoolElementPtr[
nSolvers];
1491 for(
unsigned int i = 0; i <
nSolvers; i++ )
1495 inactiveSolvers.insert(std::make_pair((originRank+i),pool[i]));
1499 nMaxCollectingModeSolvers = std::min(
1504 nMaxCollectingModeSolvers = std::max(nSolvers / 2, (std::size_t)1);
1508 nMaxCollectingModeSolvers =
nSolvers;
1514 breakingFirstSubtree =
true;
1524 for(
unsigned int i = 0; i < (
unsigned int)
nSolvers; i++ )
1528 if( pool )
delete[] pool;
1583 if( this->isSolverActive(rank) )
1585 inactivateSolver(rank, -1, 0);
1593 std::map<int, BbParaSolverPoolElementPtr>::iterator p;
1594 p = activeSolvers.find(rank);
1595 if( p != activeSolvers.end() )
1597 activeSolvers.erase(p);
1620 collectingMode =
false;
1621 nCollectingModeSolvers = 0;
1622 switchOutTime = -1.0;
1623 mCollectingNodes = 1;
1662 return nNodesSolvedInSolvers;
1671 return nTotalNodesSolved;
1678 unsigned long long num
1681 nTotalNodesSolved += num;
1690 return nNodesInSolvers;
1700 return activeSolvers.size();
1710 return inactiveSolvers.size();
1742 return (nLimitCollectingModeSolvers < nMaxCollectingModeSolvers);
1752 return nLimitCollectingModeSolvers;
1794 if( this->isSolverActive(rank) )
1796 inactivateSolver(rank, -1, paraNodePool);
1847 assert(isSolverActive(rank) || isTerminateRequested(rank) || isInterruptRequested(rank));
1859 assert(isSolverActive(rank));
1906 for(
int i = 1; i <= (int)selectionHeap->
getHeapSize(); i++ )
1909 if( getCurrentTask(rank) &&
1910 !(getCurrentTask(rank)->getAncestor()) )
1931 assert(isSolverActive(rank));
1963 for(
int i = 1; i < paraComm->getSize(); i++ )
1965 if( getCurrentTask(i) && getCurrentTask(i)->getAncestor() == 0 )
1967 dynamic_cast<BbParaNode *
>(getCurrentTask(i))->updateInitialDualBoundToSubtreeDualBound();
1978 virtual int writeParaNodesToCheckpointFile(
1979 gzstream::ogzstream &out
1983 for(
int i = 1; i < paraComm->getSize(); i++ )
1986 if( getCurrentTask(i) )
2008 virtual int writeSolverStatisticsToCheckpointFile(
2009 gzstream::ogzstream &out
2013 for(
int i = 1; i < paraComm->getSize(); i++ )
2032 nLimitCollectingModeSolvers = std::min(nLimitCollectingModeSolvers+1,
2033 std::min(nMaxCollectingModeSolvers,
nSolvers));
2053 std::map<int, BbParaSolverPoolElementPtr>::iterator p;
2054 p = inactiveSolvers.begin();
2055 if( p == inactiveSolvers.end() )
2059 return p->second->getRank();
2065 virtual void activateSolver(
2068 int nGoodNodesInNodePool,
2069 double averageDualBoundGain
2078 virtual void activateSolver(
2088 virtual int activateSolver(
2093 int nGoodNodesInNodePool,
2094 double averageDualBoundGain
2100 virtual void addNewSubtreeRootNode(
2108 virtual void makeSubtreeRootNodeCurrent(
2116 virtual void removeSubtreeRootNode(
2133 virtual BbParaNode *extractSelfSplitSubtreeRootNode(
2141 virtual BbParaNode *getSelfSplitSubtreeRootNodes(
2148 virtual BbParaNode *extractSelfSplitSubtreeRootNodes(
2155 virtual void deleteCurrentSubtreeRootNode(
2162 virtual void inactivateSolver(
2171 virtual void resetCountersInSolver(
2173 long long numOfNodesSolved,
2174 int numOfSelfSplitNodesLeft,
2189 virtual void switchOutCollectingMode(
2195 virtual void enforcedSwitchOutCollectingMode(
2202 virtual void sendSwitchOutCollectingModeIfNecessary(
2210 virtual double getGlobalBestDualBoundValue(
2216 virtual void switchInCollectingMode(
2223 virtual void updateSolverStatus(
2225 long long numNodesSolved,
2227 double solverLocalBestBound,
2238 return mCollectingNodes;
2248 return mMaxCollectingNodes;
2262 return switchOutTime;
2272 switchOutTime = time;
2309 :
BbParaSolverPool(inMp, inBgap, inMBgap, inOriginRank, inParaComm, inParaParams, inParaTimer)
2315 std::min( nMaxCollectingModeSolvers * 2,
nSolvers ) );
2332 :
BbParaSolverPool(inMp, inBgap, inMBgap, inNSolvers, inOriginRank, inParaComm, inParaParams, inParaTimer)
2338 std::min( nMaxCollectingModeSolvers * 2,
nSolvers ) );
2348 if( selectionHeap )
delete selectionHeap;
2349 if( collectingModeSolverHeap )
delete collectingModeSolverHeap;
2359 if( selectionHeap->getHeapSize() > 0 )
2361 return selectionHeap->top()->getBestDualBoundValue();
2372 virtual void switchInCollectingMode(
2379 virtual void updateSolverStatus(
2381 long long numNodesSolved,
2383 double solverLocalBestBound,
2392 int removeBoundedNodes(
2393 double incumbentValue ///< incumbent value
2397 for( int rank = originRank; rank < (originRank + static_cast<int>(nSolvers)); rank++ )
2399 if( pool[SOLVER_POOL_INDEX( rank )]->getSelfSplitNodes() )
2401 n += pool[SOLVER_POOL_INDEX( rank )]->removeBoundedNodes(incumbentValue);
2443 nEvaluationStage(0),
2444 nNodesSolvedInBestSolver(0),
2445 nNodesInBestSolver(0),
2447 nInactiveSolvers(0),
2448 bestDualBound(-DBL_MAX),
2449 bestDualBoundInSolvers(-DBL_MAX),
2453 pool =
new BbParaSolverPoolElementPtr[
nSolvers];
2454 for(
int i = 0; i <
nSolvers; i++ )
2473 nEvaluationStage(0),
2474 nNodesSolvedInBestSolver(0),
2475 nNodesInBestSolver(0),
2477 nInactiveSolvers(0),
2478 bestDualBound(-DBL_MAX),
2479 bestDualBoundInSolvers(-DBL_MAX),
2484 pool =
new BbParaSolverPoolElementPtr[
nSolvers];
2485 for(
int i = 0; i <
nSolvers; i++ )
2498 if( selectionHeap )
delete selectionHeap;
2499 for(
int i = 0; i <
nSolvers; i++ )
2503 if( pool )
delete[] pool;
2504 if( rootNode )
delete rootNode;
2559 assert( !this->isSolverActive(rank) );
2583 nEvaluationStage = 0;
2584 nNodesSolvedInBestSolver = 0;
2585 nNodesInBestSolver = 0;
2587 nInactiveSolvers = 0;
2588 bestDualBound = -DBL_MAX;
2589 bestDualBoundInSolvers = -DBL_MAX;
2591 if( selectionHeap )
delete selectionHeap;
2592 for(
int i = 0; i <
nSolvers; i++ )
2596 if( pool )
delete[] pool;
2597 if( rootNode )
delete rootNode;
2598 pool =
new BbParaSolverPoolElementPtr[
nSolvers];
2599 for(
int i = 0; i <
nSolvers; i++ )
2614 return rootNode->
clone(paraComm);
2669 return bestDualBound;
2695 return nNodesSolvedInBestSolver;
2705 return nNodesInBestSolver;
2715 return bestDualBoundInSolvers;
2737 nInactiveSolvers = 0;
2738 nNodesInBestSolver = 1;
2763 virtual void updateSolverStatus(
2765 long long numNodesSolved,
2767 double solverLocalBestBound
2773 virtual bool isWinnerDecided(
2808 return nActiveSolvers;
2818 return nInactiveSolvers;
2839 std::ostringstream oss;
2841 for(
int rank = originRank; rank < (originRank +
nSolvers); rank++ )
2856 #endif // __BB_PARA_SOLVER_POOL_H__ virtual std::string getStrActiveSolerNumbers()
get active Solver number string
virtual void reinitToRestart()
reinitialize to restart
bool beforeFinishingFirstCollect
before finishing first collecting mode
virtual bool isSolverActive(int rank)
check if the specified Solver is active or not
std::size_t heapSize
current used heap size
double bestDualBoundValue
best dual bound value of the Solver
virtual void terminated(int rank)
set the Solver specified by rank is terminated
#define SOLVER_POOL_INDEX(rank)
virtual bool currentSolvingNodehaeDescendant(int rank)
extract current solving BbParaNode in the Solver specified by rank and inactivate the Solver ...
virtual void terminateRequested(int rank)
set the Solver specified by rank is terminate requested
virtual int getMMaxCollectingNodes()
get maximum multiplier for the number of collecting BbParaNodes
void prohibitCollectingMode()
prohibits to be in collecting mode
virtual int getBestSolver()
get rank of the Solver which has top priority in selection criteria
bool generator
this Solver can generate subproblems
double mp
multiplier of the threshold value p
bool isOutCollectingMode()
check if this Solver is out of collecting mode or not
BbParaNode * selfSplitNodes
list of nodes generated by self-split ramp-up
void switchIntoEvaluation()
switch into evaluation stage
void terminateRequested()
set TerminateRequseted on Solver status
std::size_t nCollectingModeSolvers
number of collecting mode Solvers
virtual std::size_t getNSolvers()
get number of Solvers in this Solver pool
void setNumOfNodesLeft(int inNumOfNodesLeft)
set number of nodes left
virtual void updateDualBoundsForSavingNodes()
update dual bound values of saving BbParaNodes by their dual bound values for subtrees ...
virtual long long getNumOfNodesSolved(int rank)
get number of nodes solved in the Solver specified by rank
class ParaRacingSolverPool (Racing Solver Pool)
double bgap
threshold value of gap
unsigned long long nTotalNodesSolved
number of nodes solved : updated at termination of subtree computation
bool collectingMode
indicate that this system is in collecting mode or not
void removeSubtreeRoot(BbParaNode *inNode)
remove subtree root node in self-split nodes list
int getRank()
get rank of the Solver
virtual double getDualBoundValue(int rank)
get dual bound value of solving BbParaNode in the Solver specified by rank
std::size_t nLimitCollectingModeSolvers
limit number of Solvers that can be in collecting mode
bool isActive()
check if this Solver is active or not
unsigned long long nNodesSolvedInSolvers
number of nodes solved in current running Solvers
std::size_t getMaxHeapSize() const
get max heap size
bool breakingFirstSubtree
breaking the first subtree
virtual bool isInCollectingMode()
check if this system is in collecting mode or not
bool active
indicate if this pool is active or not
virtual ~DescendingCollectingModeSolverHeap()
destructor
void setCollectingMode(bool b)
set collecting mode
BbParaSolverPoolElementPtr * getSelectionHeapElement()
extract current solving BbParaNode
long long nNodesInBestSolver
number of nodes in the best Solver
BbParaSolverPoolElementPtr * getCollectingModeSolverHeapElement()
get collecting mode Solver heap element
~BbParaRacingSolverPool()
destructor
std::size_t getHeapSize() const
get current used heap size
void setNumOfNodesSolved(long long inNumOfNodesSolved)
set number of nodes solved
bool collectingIsProhibited
collecting is temporary prohibited
int numOfDiffNodesLeft
number of nodes left difference between current number and that in the previous notification time ...
bool isRootTask()
check if root task or not
ResultOfInsert
results of insert
void setCollectingModeSolverHeapElement(BbParaSolverPoolElementPtr *inCollectingModeSolverHeapElement)
set collecting mode Solver heap element
virtual ParaTask * getCurrentTask(int rank)
get root BbParaNode object of the Solver specified
SelectionHeap * selectionHeap
pointers to active Solvers in ascending or descending order
Base class for deterministic timer.
void setSelectionHeapElement(BbParaSolverPoolElementPtr *inSelectionHeapElement)
set selection heap element
static const int SolverOrderInCollectingMode
virtual std::size_t getNumActiveSolvers()
get number of active Solvers
double bestDualBound
current best dual bound value
long long nNodesSolvedInBestSolver
number of nodes solved in the best Solver
virtual void terminateRequested(int rank)
set the Solver specified by rank is terminate requested
virtual ~DescendingSelectionHeap()
destructor
void switchOutEvaluation()
switch out of evaluation stage
void interruptRequested()
set TerminateRequseted on Solver status
int numOfDiffNodesSolved
number of nodes solved difference between current number and that in the previous notification time ...
class BbParaRacingSolverPool (Racing Solver Pool)
class CollectingModeSolverHeap
int getNumOfDiffNodesSolved()
get number of nodes left difference between current number and that in the previous notification time...
int getNumOfDiffNodesLeft()
get number of nodes left difference between current number and that in the previous notification time...
class for deterministic timer
virtual bool isActive()
check if this Solver pool is active or not
void inactivate()
inactivate this Solver
BbParaNode * extractCurrentNode()
extract current solving BbParaNode
class DescendingSelectionHeap
virtual unsigned long long getNnodesInSolvers()
get number of nodes in all Solvers
class BbParaSolverPool (Solver Pool base class)
virtual void addTotalNodesSolved(unsigned long long num)
add number of nodes solved in all Solvers
BbParaSolverPool(double inMp, double inBgap, double inMBgap, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
constructor
virtual bool isSolverActive(int rank)
check if the Solver specified by rank is active or not
double switchOutTime
switch out time
ParaTask * getCurrentNode()
get current solving BbParaNode
virtual ~AscendingCollectingModeSolverHeap()
destructor
BbParaNode * next
this pointer is used in case of self-split ramp-up in LC this field is not transferred ...
BbParaSolverPoolElementPtr * collectingModeSolverHeapElement
pointer to collecting mode heap element the following values are used to make decision for load balan...
void terminated()
set Terminated on Solver status
virtual double getGlobalBestDualBoundValue()
get global best dual bound value
std::size_t heapSize
current used heap size
int mCollectingNodes
multiplier for the number of collecting BbParaNodes
BbParaSolverPoolElementPtr top() const
obtain top priority BbParaSolverPoolElementPtr
void setDualBoundValue(double dualBoundValue)
set dual bound value on paraNode
BbParaSolverPoolElementPtr * pool
Solver pool indexed by Solver's rank.
virtual void incNLimitCollectingModeSolvers()
increase the limit number of Solvers getting into collecting mode
virtual double getDualBoundValue(int rank)
get dual bound value of solving BbParaNode by the Solver specified
static const int MinNumberOfCollectingModeSolvers
virtual void reset()
reset racing solver pool
virtual void activate(BbParaNode *node)
activate racing ramp-up Solver pool with root BbParaNode object
virtual bool canIncreaseLimitNLimitCollectingModeSolvers()
check if the number of Solvers in collecting mode can be increased or not
BbParaNode * died()
kill this Solver
virtual std::size_t getNumInactiveSolvers()
get number of inactive Solvers
SolverStatus status
status of the Solver
BbParaNode * extractSubtreeRoot(BbParaNode *inNode)
extract subtree root node
int nDualBoundGainTesting
the number of dual bound gain testing Solvers
class BbParaSolverPoolElement (This class includes information about a Solver status) ...
bool isCandidateOfCollecting()
check if this Solver is candidate of collecting mode Solver
BbParaNode * getSelfSplitNodes()
get a list of nodes which are generated by self-split ramp-up
virtual void interruptRequested(int rank)
set the Solver specified by rank is terminate requested
virtual long long getNumOfNodesSolved(int rank)
get the number of nodes solved by the Solver specified
int mMaxCollectingNodes
maximum multiplier for the number of collecting BbParaNodes
long long numOfNodesSolved
number of nodes solved. -1 is the special value which means never updated in racing ...
CollectingModeSolverHeap * collectingModeSolverHeap
pointers to collecting mode Solvers in ascending or descending order
virtual bool isInterruptRequested(int rank)
check if the Solver specified by rank is interrupt requested or not
virtual unsigned long long getTotalNodesSolved()
get number of nodes solved in all Solvers: updated at termination of subtree computation ...
std::multimap< double, BbParaSolverPoolElementPtr > candidatesOfCollectingModeSolvers
pointers to candidates of collecting mode Solvers
#define THROW_LOGICAL_ERROR1(msg1)
virtual bool isTerminateRequested(int rank)
check if the Solver specified by rank is terminate requested or not
double bestDualBoundInSolvers
best dual bound value in Solvers
virtual void setSwichOutTime(double time)
set time of switching out collecting mode
void setCollectingIsAllowed()
allows to be in collecting mode
virtual bool isSolverInCollectingMode(int rank)
get collecting mode of the Solver specified by rank
void makeSubtreeRootCurrent(BbParaNode *inNode)
make subtree root node current
void addSubtreeRoot(BbParaNode *inNode)
add subtree root node
int numOfNodesLeft
number of nodes left
static const int ABgapForSwitchingToBestSolver
virtual void setTermState(int rank, ParaSolverTerminationState *inTermState)
set SolverTerminationState to the Solver specified
class ParaSolverTerminationState (Solver termination state in a ParaSolver)
Base class for racing ramp-up parameter set.
double absoluteGap
allowable absolute dual bound gap to the best Solver
void setTermState(ParaSolverTerminationState *inTermState)
set termination state
void racingActivate()
activate this Solver as a racing Solver
BbParaNode * rootNode
root BbParaNode
void setDualBoundGainTesting(bool value)
set dual bound gain is testing value
SolverStatus getStatus()
get Solver status
std::size_t getMaxHeapSize() const
get max heap size
BbParaSolverPoolElement * BbParaSolverPoolElementPtr
bool isDualBoundGainTesting()
check if dual bound gain is testing in this Solver or not
void deleteCurrentNode()
delete current solving BbParaNode
int getNumOfNodesLeft()
get number of nodes left
ParaSolverTerminationState * termState
Solver termination statistics: for checkpoint.
virtual void interruptRequested(int rank)
set the Solver specified by rank is terminate requested
bool beforeInitialCollect
before initial collecting mode
virtual ~AscendingSelectionHeap()
destructor
#define THROW_LOGICAL_ERROR2(msg1, msg2)
BbParaSolverPoolElementPtr * selectionHeapElement
pointer to selection heap element
std::map< int, BbParaSolverPoolElementPtr > inactiveSolvers
pointers to inactive Solvers
int nEvaluationStage
number of Solvers that are in evaluation stage
virtual bool isTerminateRequested(int rank)
check if the Solver specified by rank is terminate requested or not
virtual int getNumNodesLeft(int rank)
get number of nodes left in the Solver specified by rank
virtual ParaTask * getCurrentTask(int rank)
get current solving BbParaNode in the Solver specified by rank */
virtual void activate()
activate this Solver pool
SelectionHeap * selectionHeap
pointers to active Solvers in ascending or descending order
BbParaSolverPool(double inMp, double inBgap, double inMBgap, int inNSolvers, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
constructor
BbParaSolverPoolElementPtr get(int i) const
obtain i-th in heap BbParaSolverPoolElementPtr
virtual bool isTerminated(int rank)
check if the Solver specified by rank is terminated or not
virtual ParaSolverTerminationState * getTermState(int rank)
get SolverTermination state of the Solver specified
void setNumOfDiffNodesSolved(int inNumOfDiff)
set number of nodes left difference between current number and that in the previous notification time...
bool collectingMode
indicate if current Solver is in collecting mode or not
void setDualBoundValue(double inDualBoundValue)
setter of dual bound value
virtual std::size_t getNumInactiveSolvers()
get number of inactive Solvers
BbParaRacingSolverPool(int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer, ParaDeterministicTimer *inParaDetTimer)
constructor
bool candidateOfCollecting
indicate that this Solver is a candidate of collecting mode Solver
class ParaSolverPool (Solver Pool base class)
virtual int getNumOfNodesLeftInBestSolver()
get the number of nodes left in the Solver which has the best dual bound value
ResultOfInsert
results of insert
virtual ~BbParaSolverPool()
destructor
double getDualBoundValue()
getter of dual bound value
BbParaNode * extractSelfSplitNodes()
extract a list of nodes which are generated by self-split ramp-up
ResultOfInsert insert(BbParaSolverPoolElementPtr solver)
insert BbParaSolverPoolElementPtr to Selection Heap
virtual BbParaNode * clone(ParaComm *comm)=0
clone this BbParaNode
virtual std::size_t getNumActiveSolvers()
get number of active Solvers
std::size_t maxHeapSize
maximum size of this heap
virtual int getInactiveSolverRank()
get an inactive Solver rank
class DescendingCollectingModeSolverHeap
size_t nInactiveSolvers
number of inactive Solvers
virtual bool isDualBounGainTesting(int rank)
check if dual bound gain testing is proceeding or not in the Solver specified
std::size_t maxHeapSize
maximum size of this heap
void setNoGenerator()
make this Solver No generator
bool isCollectingProhibited()
check if this Solver cannot be allowed in collecting mode
std::size_t nMaxCollectingModeSolvers
maximum number of Solvers that can be in collecting mode
BbParaSolverPoolElementPtr * pool
Solver pool indexed by Solver's rank.
virtual long long getNnodesLeftInBestSolver()
get number of nodes left in the best Solver
virtual BbParaNode * extractNode()
extract racing root BbParaNode
size_t nActiveSolvers
number of active Solvers
bool dualBoundGainTesting
indicate that dual bound gain is testing or not
bool hasDescendant()
check if this task has descendant or not
bool isEvaluationStage()
check if this Solver is in evaluation stage
void setBestDualBoundValue(double inBestDualBoundValue)
set best dual bound value
virtual BbParaNode * extractCurrentNodeAndInactivate(int rank, BbParaNodePool *paraNodePool)
extract current solving BbParaNode in the Solver specified by rank and inactivate the Solver ...
virtual void inactivateSolver(int rank)
inactivate the Solver specified by rank
void activate(BbParaNode *inNode)
activate this Solver
virtual double getSwichOutTime()
the following functions are to omit rebooting collecting mode process
BbParaSolverPoolElementPtr top() const
obtain top priority BbParaSolverPoolElementPtr
virtual std::size_t getNLimitCollectingModeSolvers()
get limit number of Solvers that can be in collecting mode
std::size_t nGenerator
number of generators
virtual void terminated(int rank)
set the Solver specified by rank is terminated
double getBestDualBoundValue()
get best dual bound value
bool isSameNodeIdAs(const BbParaNode &inNode)
check if this node's id is the same as that of argument ParaNode's task id
virtual unsigned long long getNnodesSolvedInSolvers()
get number of nodes solved in current running Solvers
BbParaRacingSolverPool(int inNSolvers, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer, ParaDeterministicTimer *inParaDetTimer)
constructor
virtual int getMCollectingNodes()
get multiplier of collecting BbParaNodes
static const int BreakFirstSubtree
int rank
rank of the Solver
std::map< int, BbParaSolverPoolElementPtr > deadSolvers
pointers to dead Solvers
virtual bool isEvaluationStage(int rank)
check if the Solver specified in an argument is evaluation stage or not
ParaSolverTerminationState * getTermState()
get termination state
bool isRacingStage()
check if this Solver is in racing stage
std::size_t getHeapSize() const
get current used heap size
~BbParaSolverPoolElement()
destractor
virtual void setCollectingIsAllowed(int rank)
set collecting mode is allowed to the Solver specified by rank
class AscendingSelectionHeap
void setInitialDualBoundValue(double inTrueDualBoundValue)
setter of initial dual bound value
virtual int getNumOfNodesLeft(int rank)
get the number of nodes left by the Solver specified
bool isGenerator()
check if this Solver is generator or not */
long long getNumOfNodesSolved()
get number of nodes solved
bool isInCollectingMode()
check if this Solver is in collecting mode or not
virtual void addNumNodesSolved(long long numOfNodesSolved)
add number of nodes solved
virtual bool isInterruptRequested(int rank)
check if the Solver specified by rank is interrupt requested or not
BbParaSolverPoolElementPtr * heap
heap : contents are BbParaSolverPoolElementPtr
void setNumOfDiffNodesLeft(int inNumOfDiff)
set number of nodes left difference between current number and that in the previous notification time...
Base class of communicator object.
void setCandidateOfCollecting(bool b)
set candidate of collecting mode Solver
unsigned long long nNodesInSolvers
number of nodes in all Solvers
BbParaSolverPoolElementPtr * heap
heap : contents are BbParaSolverPoolElementPtr
static const int MaxNumberOfCollectingModeSolvers
BbParaNode * currentNode
solving node
virtual double getBestDualBoundInInactivatedSolvers()
get best dual bound value in inactivated Solvers
virtual bool isTerminated(int rank)
check if the Solver specified by rank is terminated or not
double mBgap
multiplier of the bgap value
BbParaSolverPoolElement(int inRank)
constructor
ParaTaskGenealogicalPtr * getAncestor()
getter of ancestor
std::map< int, BbParaSolverPoolElementPtr > activeSolvers
pointers to active Solvers
virtual long long getNnodesSolvedInBestSolver()
get winner Solver rank
virtual int getGoodSolverSolvingEssentialNode()
get rank of the Solver which has top priority in selection criteria