Scippy

UG

Ubiquity Generator framework

BbParaSolverPoolForMinimization Class Reference

class BbParaSolverPoolForMinimization (Solver Pool for Minimization Problems) More...

#include <bbParaSolverPool.h>

Inheritance diagram for BbParaSolverPoolForMinimization:
BbParaSolverPool ParaSolverPool

Public Member Functions

 BbParaSolverPoolForMinimization (double inMp, double inBgap, double inMBgap, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
 constructor More...
 
 BbParaSolverPoolForMinimization (double inMp, double inBgap, double inMBgap, int inNSolvers, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
 constructor More...
 
virtual ~BbParaSolverPoolForMinimization ()
 destructor More...
 
virtual double getGlobalBestDualBoundValue ()
 get global best dual bound value More...
 
virtual void switchInCollectingMode (BbParaNodePool *paraNodePool)
 switch in collecting mode More...
 
virtual void updateSolverStatus (int rank, long long numNodesSolved, int numNodesLeft, double solverLocalBestBound, BbParaNodePool *paraNodePool)
 update Solver status More...
 
- Public Member Functions inherited from BbParaSolverPool
 BbParaSolverPool (double inMp, double inBgap, double inMBgap, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
 constructor More...
 
 BbParaSolverPool (double inMp, double inBgap, double inMBgap, int inNSolvers, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
 constructor More...
 
virtual ~BbParaSolverPool ()
 destructor More...
 
virtual void interruptRequested (int rank)
 set the Solver specified by rank is terminate requested More...
 
virtual void terminateRequested (int rank)
 set the Solver specified by rank is terminate requested More...
 
virtual bool isInterruptRequested (int rank)
 check if the Solver specified by rank is interrupt requested or not More...
 
virtual bool isTerminateRequested (int rank)
 check if the Solver specified by rank is terminate requested or not More...
 
virtual void terminated (int rank)
 set the Solver specified by rank is terminated More...
 
virtual bool isTerminated (int rank)
 check if the Solver specified by rank is terminated or not More...
 
virtual void reinitToRestart ()
 reinitialize to restart More...
 
virtual void activate ()
 activate this Solver pool More...
 
virtual bool isActive ()
 check if this Solver pool is active or not More...
 
virtual std::size_t getNSolvers ()
 get number of Solvers in this Solver pool More...
 
virtual unsigned long long getNnodesSolvedInSolvers ()
 get number of nodes solved in current running Solvers More...
 
virtual unsigned long long getTotalNodesSolved ()
 get number of nodes solved in all Solvers: updated at termination of subtree computation More...
 
virtual void addTotalNodesSolved (unsigned long long num)
 add number of nodes solved in all Solvers More...
 
virtual unsigned long long getNnodesInSolvers ()
 get number of nodes in all Solvers More...
 
virtual std::size_t getNumActiveSolvers ()
 get number of active Solvers More...
 
virtual std::size_t getNumInactiveSolvers ()
 get number of inactive Solvers More...
 
virtual bool isSolverActive (int rank)
 check if the Solver specified by rank is active or not More...
 
virtual ParaTaskgetCurrentTask (int rank)
 get current solving BbParaNode in the Solver specified by rank *‍/ More...
 
virtual bool canIncreaseLimitNLimitCollectingModeSolvers ()
 check if the number of Solvers in collecting mode can be increased or not More...
 
virtual std::size_t getNLimitCollectingModeSolvers ()
 get limit number of Solvers that can be in collecting mode More...
 
virtual bool isInCollectingMode ()
 check if this system is in collecting mode or not More...
 
virtual bool isSolverInCollectingMode (int rank)
 get collecting mode of the Solver specified by rank More...
 
virtual BbParaNodeextractCurrentNodeAndInactivate (int rank, BbParaNodePool *paraNodePool)
 extract current solving BbParaNode in the Solver specified by rank and inactivate the Solver More...
 
virtual bool currentSolvingNodehaeDescendant (int rank)
 extract current solving BbParaNode in the Solver specified by rank and inactivate the Solver More...
 
virtual void addNumNodesSolved (long long numOfNodesSolved)
 add number of nodes solved More...
 
virtual long long getNumOfNodesSolved (int rank)
 get the number of nodes solved by the Solver specified More...
 
virtual int getNumOfNodesLeft (int rank)
 get the number of nodes left by the Solver specified More...
 
virtual int getNumOfNodesLeftInBestSolver ()
 get the number of nodes left in the Solver which has the best dual bound value More...
 
virtual int getBestSolver ()
 get rank of the Solver which has top priority in selection criteria More...
 
virtual int getGoodSolverSolvingEssentialNode ()
 get rank of the Solver which has top priority in selection criteria More...
 
virtual double getDualBoundValue (int rank)
 get dual bound value of solving BbParaNode by the Solver specified More...
 
virtual void setTermState (int rank, ParaSolverTerminationState *inTermState)
 set SolverTerminationState to the Solver specified More...
 
virtual ParaSolverTerminationStategetTermState (int rank)
 get SolverTermination state of the Solver specified More...
 
virtual void updateDualBoundsForSavingNodes ()
 update dual bound values of saving BbParaNodes by their dual bound values for subtrees More...
 
virtual int writeParaNodesToCheckpointFile (gzstream::ogzstream &out)
 write BbParaNodes to checkpoint file More...
 
virtual int writeSolverStatisticsToCheckpointFile (gzstream::ogzstream &out)
 write Solver statistics to checkpoint file More...
 
virtual void incNLimitCollectingModeSolvers ()
 increase the limit number of Solvers getting into collecting mode More...
 
virtual void setCollectingIsAllowed (int rank)
 set collecting mode is allowed to the Solver specified by rank More...
 
virtual int getInactiveSolverRank ()
 get an inactive Solver rank More...
 
virtual void activateSolver (int rank, BbParaNode *node, int nGoodNodesInNodePool, double averageDualBoundGain)
 activate the Solver specified by rank with specified node which has been sent More...
 
virtual void activateSolver (int rank, BbParaNode *node, int nNodesLeft)
 activate the Solver specified by rank with specified node which has been sent and nNodesLeft (This method is for the racing winner) TODO: Need to check how this function is used More...
 
virtual int activateSolver (BbParaNode *node, BbParaRacingSolverPool *paraRacingSolverPool, bool rampUpPhase, int nGoodNodesInNodePool, double averageDualBoundGain)
 activate a Solver with specified BbParaNode which is sent within this Solver pool More...
 
virtual void addNewSubtreeRootNode (int rank, BbParaNode *node)
 add new subtree root node to the active solver with the specified rank More...
 
virtual void makeSubtreeRootNodeCurrent (int rank, BbParaNode *node)
 make subtree root node as current task for the specified rank More...
 
virtual void removeSubtreeRootNode (int rank, BbParaNode *node)
 remove subtree root node from the active solver with the specified rank More...
 
virtual BbParaNodeextractSelfSplitSubtreeRootNode (int rank, BbParaNode *node)
 extract self-split subtree root node from the active solver with the specified rank More...
 
virtual BbParaNodegetSelfSplitSubtreeRootNodes (int rank)
 get self-split subtree root node from the active solver with the specified rank More...
 
virtual BbParaNodeextractSelfSplitSubtreeRootNodes (int rank)
 extract self-split subtree root node from the active solver with the specified rank More...
 
virtual void deleteCurrentSubtreeRootNode (int rank)
 delete current self-split subtree root node from the active solver with the specified rank More...
 
virtual void inactivateSolver (int rank, long long numOfNodesSolved, BbParaNodePool *paraNodePool)
 inactivate the Solver specified by rank More...
 
virtual void resetCountersInSolver (int rank, long long numOfNodesSolved, int numOfSelfSplitNodesLeft, BbParaNodePool *paraNodePool)
 reset counters in the Solver specified by rank More...
 
virtual BbParaNodesolverDied (int rank)
 kill the Solver specified by rank More...
 
virtual void switchOutCollectingMode ()
 switch out collecting mode More...
 
virtual void enforcedSwitchOutCollectingMode (int rank)
 enforced to switch out collecting mode of the Solver specified by rank if it is necessary More...
 
virtual void sendSwitchOutCollectingModeIfNecessary (int rank)
 switch out collecting mode of the Solver specified by rank if it is necessary More...
 
virtual double getGlobalBestDualBoundValue ()=0
 get global best dual bound value More...
 
virtual void switchInCollectingMode (BbParaNodePool *paraNodePool)=0
 switch in collecting mode More...
 
virtual void updateSolverStatus (int rank, long long numNodesSolved, int numNodesLeft, double solverLocalBestBound, BbParaNodePool *paraNodePool)=0
 update Solver status More...
 
virtual int getMCollectingNodes ()
 get multiplier of collecting BbParaNodes More...
 
virtual int getMMaxCollectingNodes ()
 get maximum multiplier for the number of collecting BbParaNodes More...
 
virtual double getSwichOutTime ()
 the following functions are to omit rebooting collecting mode process More...
 
virtual void setSwichOutTime (double time)
 set time of switching out collecting mode More...
 
virtual bool isDualBounGainTesting (int rank)
 check if dual bound gain testing is proceeding or not in the Solver specified More...
 
- Public Member Functions inherited from ParaSolverPool
 ParaSolverPool (int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
 constructor More...
 
virtual ~ParaSolverPool ()
 destructor More...
 
std::size_t getNSolvers ()
 get number of Solvers in this Solver pool More...
 
virtual std::size_t getNumActiveSolvers ()=0
 get number of active Solvers More...
 
virtual std::size_t getNumInactiveSolvers ()=0
 get number of inactive Solvers More...
 
virtual bool isSolverActive (int rank)=0
 check if the Solver specified by rank is active or not More...
 
virtual ParaTaskgetCurrentTask (int rank)=0
 get current solving ParaTask in the Solver specified by rank More...
 
virtual void interruptRequested (int rank)=0
 set the Solver specified by rank is interrupt requested More...
 
virtual bool isInterruptRequested (int rank)=0
 check if the Solver specified by rank is interrupt requested or not More...
 
virtual void terminateRequested (int rank)=0
 set the Solver specified by rank is terminate requested More...
 
virtual bool isTerminateRequested (int rank)=0
 check if the Solver specified by rank is terminate requested or not More...
 
virtual void terminated (int rank)=0
 set the Solver specified by rank is terminated More...
 
virtual bool isTerminated (int rank)=0
 check if the Solver specified by rank is terminated or not More...
 

Additional Inherited Members

- Protected Member Functions inherited from BbParaSolverPool
virtual void switchInCollectingToSolver (int rank, BbParaNodePool *paraNodePool)
 switch a Solver to be in collecting mode More...
 
- Protected Attributes inherited from BbParaSolverPool
bool active
 indicate if this pool is active or not More...
 
double bgap
 threshold value of gap More...
 
double mp
 multiplier of the threshold value p More...
 
double mBgap
 multiplier of the bgap value More...
 
double absoluteGap
 allowable absolute dual bound gap to the best Solver More...
 
std::size_t nGenerator
 number of generators More...
 
std::size_t nCollectingModeSolvers
 number of collecting mode Solvers More...
 
std::size_t nMaxCollectingModeSolvers
 maximum number of Solvers that can be in collecting mode More...
 
std::size_t nLimitCollectingModeSolvers
 limit number of Solvers that can be in collecting mode More...
 
unsigned long long nNodesSolvedInSolvers
 number of nodes solved in current running Solvers More...
 
unsigned long long nTotalNodesSolved
 number of nodes solved : updated at termination of subtree computation More...
 
unsigned long long nNodesInSolvers
 number of nodes in all Solvers More...
 
bool collectingMode
 indicate that this system is in collecting mode or not More...
 
bool breakingFirstSubtree
 breaking the first subtree More...
 
bool beforeInitialCollect
 before initial collecting mode More...
 
bool beforeFinishingFirstCollect
 before finishing first collecting mode More...
 
std::map< int, BbParaSolverPoolElementPtrinactiveSolvers
 pointers to inactive Solvers More...
 
std::map< int, BbParaSolverPoolElementPtractiveSolvers
 pointers to active Solvers More...
 
std::map< int, BbParaSolverPoolElementPtrdeadSolvers
 pointers to dead Solvers More...
 
std::multimap< double, BbParaSolverPoolElementPtrcandidatesOfCollectingModeSolvers
 pointers to candidates of collecting mode Solvers More...
 
BbParaSolverPoolElementPtrpool
 Solver pool indexed by Solver's rank. More...
 
SelectionHeapselectionHeap
 pointers to active Solvers in ascending or descending order More...
 
CollectingModeSolverHeapcollectingModeSolverHeap
 pointers to collecting mode Solvers in ascending or descending order More...
 
double switchOutTime
 switch out time More...
 
int mCollectingNodes
 multiplier for the number of collecting BbParaNodes More...
 
int mMaxCollectingNodes
 maximum multiplier for the number of collecting BbParaNodes More...
 
int nDualBoundGainTesting
 the number of dual bound gain testing Solvers More...
 
- Protected Attributes inherited from ParaSolverPool
int originRank
 origin rank of Solvers managed by this Solver pool More...
 
std::size_t nSolvers
 number of Solvers More...
 
ParaCommparaComm
 communicator More...
 
ParaParamSetparaParams
 runtime parameters for parallelization More...
 
ParaTimerparaTimer
 timer More...
 

Detailed Description

class BbParaSolverPoolForMinimization (Solver Pool for Minimization Problems)

Definition at line 2291 of file bbParaSolverPool.h.

Constructor & Destructor Documentation

◆ BbParaSolverPoolForMinimization() [1/2]

BbParaSolverPoolForMinimization ( double  inMp,
double  inBgap,
double  inMBgap,
int  inOriginRank,
ParaComm inParaComm,
ParaParamSet inParaParams,
ParaTimer inParaTimer 
)

constructor

Parameters
inMpmultiplier of the threshold value p
inBgapthreshold value of gap
inMBgapmultiplier of the bgap value
inOriginRankorigin rank of Solvers managed by this Solver pool
inParaCommcommunicator used
inParaParamsparaParamSet used
inParaTimertimer used

Definition at line 2299 of file bbParaSolverPool.h.

References BbParaSolverPool::collectingModeSolverHeap, ParaParamSet::getIntParamValue(), BbParaSolverPool::nMaxCollectingModeSolvers, ParaSolverPool::nSolvers, ParaSolverPool::paraParams, BbParaSolverPool::selectionHeap, and UG::SolverOrderInCollectingMode.

◆ BbParaSolverPoolForMinimization() [2/2]

BbParaSolverPoolForMinimization ( double  inMp,
double  inBgap,
double  inMBgap,
int  inNSolvers,
int  inOriginRank,
ParaComm inParaComm,
ParaParamSet inParaParams,
ParaTimer inParaTimer 
)

constructor

Parameters
inMpmultiplier of the threshold value p
inBgapthreshold value of gap
inMBgapmultiplier of the bgap value
inNSolversnumber of solvers
inOriginRankorigin rank of Solvers managed by this Solver pool
inParaCommcommunicator used
inParaParamsparaParamSet used
inParaTimertimer used

Definition at line 2321 of file bbParaSolverPool.h.

References BbParaSolverPool::collectingModeSolverHeap, ParaParamSet::getIntParamValue(), BbParaSolverPool::nMaxCollectingModeSolvers, ParaSolverPool::nSolvers, ParaSolverPool::paraParams, BbParaSolverPool::selectionHeap, and UG::SolverOrderInCollectingMode.

◆ ~BbParaSolverPoolForMinimization()

Member Function Documentation

◆ getGlobalBestDualBoundValue()

◆ switchInCollectingMode()

void switchInCollectingMode ( BbParaNodePool paraNodePool)
virtual

switch in collecting mode

send switch in-collecting mode

Parameters
paraNodePoolpointer to BbParaNodePool object

Implements BbParaSolverPool.

Definition at line 1563 of file bbParaSolverPool.cpp.

References BbParaSolverPool::activeSolvers, BbParaSolverPool::beforeFinishingFirstCollect, BbParaSolverPool::beforeInitialCollect, BbParaSolverPool::bgap, BbParaSolverPool::breakingFirstSubtree, BbParaSolverPool::candidatesOfCollectingModeSolvers, BbParaSolverPool::collectingMode, UG::CollectingModeInterval, BbParaSolverPool::collectingModeSolverHeap, UG::DualBoundGainTest, BbParaSolverPoolElement::getBestDualBoundValue(), ParaParamSet::getBoolParamValue(), ParaTimer::getElapsedTime(), BbParaSolverPoolForMinimization::getGlobalBestDualBoundValue(), ParaParamSet::getIntParamValue(), BbParaSolverPool::getNumInactiveSolvers(), BbParaNodePool::getNumOfGoodNodes(), BbParaSolverPool::getNumOfNodesLeft(), ParaParamSet::getRealParamValue(), CollectingModeSolverHeap::insert(), BbParaNodePool::isEmpty(), BbParaSolverPool::mBgap, BbParaSolverPool::mCollectingNodes, BbParaSolverPool::mMaxCollectingNodes, UG::MultiplierForCollectingMode, UG::NChangeIntoCollectingMode, BbParaSolverPool::nCollectingModeSolvers, BbParaSolverPool::nLimitCollectingModeSolvers, UG::NMaxCanditatesForCollecting, PARA_COMM_CALL, UG::ParaBYTE, ParaSolverPool::paraComm, UG::ParaINT, ParaSolverPool::paraParams, ParaSolverPool::paraTimer, BbParaSolverPool::pool, BbParaSolverPool::selectionHeap, ParaComm::send(), BbParaSolverPool::sendSwitchOutCollectingModeIfNecessary(), BbParaSolverPoolElement::setCandidateOfCollecting(), BbParaSolverPoolElement::setCollectingMode(), SOLVER_POOL_INDEX, UG::SolverOrderInCollectingMode, BbParaSolverPool::switchOutTime, UG::TagInCollectingMode, UG::TagNoWaitModeSend, THROW_LOGICAL_ERROR2, and SelectionHeap::top().

Referenced by BbParaSolverPoolForMinimization::updateSolverStatus().

◆ updateSolverStatus()

void updateSolverStatus ( int  rank,
long long  numNodesSolved,
int  numNodesLeft,
double  solverLocalBestBound,
BbParaNodePool paraNodePool 
)
virtual

update Solver status

Parameters
rankrank of the Solver
numNodesSolvednumber of nodes solved
numNodesLeftnumber of nodes left
solverLocalBestBoundbest bound value in the Solver
paraNodePoolpointer to BbParaNodePool object

Implements BbParaSolverPool.

Definition at line 1964 of file bbParaSolverPool.cpp.

References BbParaSolverPool::absoluteGap, BbParaSolverPool::activeSolvers, BbParaSolverPool::bgap, BbParaSolverPool::breakingFirstSubtree, BbParaSolverPool::candidatesOfCollectingModeSolvers, BbParaSolverPool::collectingMode, BbParaSolverPool::collectingModeSolverHeap, BbParaSolverPoolElement::getBestDualBoundValue(), BbParaSolverPoolForMinimization::getGlobalBestDualBoundValue(), CollectingModeSolverHeap::getHeapSize(), ParaParamSet::getIntParamValue(), BbParaSolverPool::getNumInactiveSolvers(), BbParaNodePool::getNumOfGoodNodes(), BbParaSolverPoolElement::getNumOfNodesLeft(), BbParaSolverPoolElement::getRank(), ParaParamSet::getRealParamValue(), CollectingModeSolverHeap::insert(), BbParaSolverPoolElement::isCollectingProhibited(), BbParaNodePool::isEmpty(), BbParaSolverPoolElement::isGenerator(), BbParaSolverPoolElement::isInCollectingMode(), BbParaSolverPool::isInCollectingMode(), BbParaSolverPoolElement::isOutCollectingMode(), BbParaSolverPool::mBgap, BbParaSolverPool::mCollectingNodes, UG::MultiplierForCollectingMode, UG::NChangeIntoCollectingMode, BbParaSolverPool::nCollectingModeSolvers, BbParaSolverPool::nDualBoundGainTesting, BbParaSolverPool::nLimitCollectingModeSolvers, UG::NMaxCanditatesForCollecting, BbParaSolverPool::nNodesInSolvers, BbParaSolverPool::nNodesSolvedInSolvers, ParaSolverPool::nSolvers, PARA_COMM_CALL, UG::ParaBYTE, ParaSolverPool::paraComm, UG::ParaINT, ParaSolverPool::paraParams, BbParaSolverPool::pool, BbParaSolverPool::selectionHeap, ParaComm::send(), BbParaSolverPool::sendSwitchOutCollectingModeIfNecessary(), BbParaSolverPoolElement::setDualBoundGainTesting(), SOLVER_POOL_INDEX, BbParaSolverPoolForMinimization::switchInCollectingMode(), BbParaSolverPool::switchInCollectingToSolver(), BbParaSolverPool::switchOutCollectingMode(), BbParaSolverPool::switchOutTime, UG::TagInCollectingMode, UG::TagNoWaitModeSend, THROW_LOGICAL_ERROR2, THROW_LOGICAL_ERROR3, THROW_LOGICAL_ERROR4, SelectionHeap::top(), CollectingModeSolverHeap::top(), SelectionHeap::toString(), CollectingModeSolverHeap::toString(), SelectionHeap::updateDualBoundValue(), and CollectingModeSolverHeap::updateDualBoundValue().