Scippy

UG

Ubiquity Generator framework

BbParaRacingSolverPool Class Reference

class BbParaRacingSolverPool (Racing Solver Pool) More...

#include <bbParaSolverPool.h>

Inheritance diagram for BbParaRacingSolverPool:
ParaRacingSolverPool

Public Member Functions

 BbParaRacingSolverPool (int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer, ParaDeterministicTimer *inParaDetTimer)
 constructor More...
 
 BbParaRacingSolverPool (int inNSolvers, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer, ParaDeterministicTimer *inParaDetTimer)
 constructor More...
 
 ~BbParaRacingSolverPool ()
 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 reset ()
 reset racing solver pool More...
 
virtual BbParaNodeextractNode ()
 extract racing root BbParaNode More...
 
virtual ParaTaskgetCurrentTask (int rank)
 get root BbParaNode object of the Solver specified More...
 
virtual double getDualBoundValue (int rank)
 get dual bound value of solving BbParaNode in the Solver specified by rank More...
 
virtual long long getNumOfNodesSolved (int rank)
 get number of nodes solved in the Solver specified by rank More...
 
virtual int getNumNodesLeft (int rank)
 get number of nodes left in the Solver specified by rank More...
 
virtual double getGlobalBestDualBoundValue ()
 get global best dual bound value More...
 
virtual long long getNnodesSolvedInBestSolver ()
 get winner Solver rank More...
 
virtual long long getNnodesLeftInBestSolver ()
 get number of nodes left in the best Solver More...
 
virtual double getBestDualBoundInInactivatedSolvers ()
 get best dual bound value in inactivated Solvers More...
 
virtual void activate (BbParaNode *node)
 activate racing ramp-up Solver pool with root BbParaNode object More...
 
virtual bool isSolverActive (int rank)
 check if the specified Solver is active or not More...
 
virtual void updateSolverStatus (int rank, long long numNodesSolved, int numNodesLeft, double solverLocalBestBound)
 update Solver status More...
 
virtual bool isWinnerDecided (bool feasibleSol)
 check racing termination criteria More...
 
virtual void inactivateSolver (int rank)
 inactivate the Solver specified by rank 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 isEvaluationStage (int rank)
 check if the Solver specified in an argument is evaluation stage or not More...
 
virtual std::string getStrActiveSolerNumbers ()
 get active Solver number string More...
 
- Public Member Functions inherited from ParaRacingSolverPool
 ParaRacingSolverPool (int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer, ParaDeterministicTimer *inParaDetTimer)
 constructor More...
 
virtual ~ParaRacingSolverPool ()
 destructor More...
 
virtual ParaTaskgetCurrentTask (int rank)=0
 get root ParaTask object of the Solver specified 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 specified Solver is active or not More...
 
int getWinner ()
 get winner Solver rank More...
 
std::size_t getNSolvers ()
 get number of Solvers in this Solver pool More...
 

Protected Attributes

int nEvaluationStage
 number of Solvers that are in evaluation stage More...
 
long long nNodesSolvedInBestSolver
 number of nodes solved in the best Solver More...
 
long long nNodesInBestSolver
 number of nodes in the best Solver More...
 
size_t nActiveSolvers
 number of active Solvers More...
 
size_t nInactiveSolvers
 number of inactive Solvers More...
 
double bestDualBound
 current best dual bound value More...
 
double bestDualBoundInSolvers
 best dual bound value in Solvers More...
 
BbParaSolverPoolElementPtrpool
 Solver pool indexed by Solver's rank. More...
 
SelectionHeapselectionHeap
 pointers to active Solvers in ascending or descending order More...
 
BbParaNoderootNode
 root BbParaNode More...
 
- Protected Attributes inherited from ParaRacingSolverPool
int winnerRank
 winner rank of racing ramp-up, -1: not decided yet More...
 
int originRank
 origin rank of Solvers managed by this Solver pool More...
 
int nSolvers
 number of Solvers More...
 
ParaCommparaComm
 communicator More...
 
ParaParamSetparaParams
 runtime parameters for parallelization More...
 
ParaTimerparaTimer
 timer used More...
 
ParaDeterministicTimerparaDetTimer
 deterministic timer used More...
 

Detailed Description

class BbParaRacingSolverPool (Racing Solver Pool)

Definition at line 2413 of file bbParaSolverPool.h.

Constructor & Destructor Documentation

◆ BbParaRacingSolverPool() [1/2]

BbParaRacingSolverPool ( int  inOriginRank,
ParaComm inParaComm,
ParaParamSet inParaParams,
ParaTimer inParaTimer,
ParaDeterministicTimer inParaDetTimer 
)

constructor

Parameters
inOriginRankorigin rank of Solvers managed by this Solver pool
inParaCommcommunicator used
inParaParamsparaParamSet used
inParaTimertimer used
inParaDetTimerdeterministic timer used

Definition at line 2434 of file bbParaSolverPool.h.

References ParaRacingSolverPool::nSolvers, ParaRacingSolverPool::originRank, BbParaRacingSolverPool::pool, and BbParaRacingSolverPool::selectionHeap.

◆ BbParaRacingSolverPool() [2/2]

BbParaRacingSolverPool ( int  inNSolvers,
int  inOriginRank,
ParaComm inParaComm,
ParaParamSet inParaParams,
ParaTimer inParaTimer,
ParaDeterministicTimer inParaDetTimer 
)

constructor

Parameters
inNSolversthe number of racing solvers
inOriginRankorigin rank of Solvers managed by this Solver pool
inParaCommcommunicator used
inParaParamsparaParamSet used
inParaTimertimer used
inParaDetTimerdeterministic timer used

Definition at line 2463 of file bbParaSolverPool.h.

References ParaRacingSolverPool::nSolvers, ParaRacingSolverPool::originRank, BbParaRacingSolverPool::pool, and BbParaRacingSolverPool::selectionHeap.

◆ ~BbParaRacingSolverPool()

Member Function Documentation

◆ activate()

◆ extractNode()

◆ getBestDualBoundInInactivatedSolvers()

virtual double getBestDualBoundInInactivatedSolvers ( )
virtual

get best dual bound value in inactivated Solvers

Returns
best dual bound value in inactivated Solvers

Definition at line 2711 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::bestDualBoundInSolvers.

◆ getCurrentTask()

virtual ParaTask * getCurrentTask ( int  rank)
virtual

get root BbParaNode object of the Solver specified

Parameters
rankrank of the Solver

Implements ParaRacingSolverPool.

Definition at line 2619 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::rootNode.

◆ getDualBoundValue()

virtual double getDualBoundValue ( int  rank)
virtual

get dual bound value of solving BbParaNode in the Solver specified by rank

Returns
dual bound value
Parameters
rankrank of the Solver

Definition at line 2630 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getBestDualBoundValue(), BbParaRacingSolverPool::pool, and SOLVER_POOL_INDEX.

◆ getGlobalBestDualBoundValue()

virtual double getGlobalBestDualBoundValue ( )
virtual

get global best dual bound value

Returns
global best dual bound value

Definition at line 2663 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::bestDualBound, SelectionHeap::getHeapSize(), and BbParaRacingSolverPool::selectionHeap.

Referenced by BbParaRacingSolverPool::extractNode().

◆ getNnodesLeftInBestSolver()

virtual long long getNnodesLeftInBestSolver ( )
virtual

get number of nodes left in the best Solver

Returns
number of nodes left in the best Solver

Definition at line 2701 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::nNodesInBestSolver.

◆ getNnodesSolvedInBestSolver()

virtual long long getNnodesSolvedInBestSolver ( )
virtual

get winner Solver rank

Returns
rank of the winner Solver get number of nodes solved in the best Solver
number of nodes solved in the best Solver

Definition at line 2691 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::nNodesSolvedInBestSolver.

Referenced by BbParaLoadCoordinator::~BbParaLoadCoordinator().

◆ getNumActiveSolvers()

virtual std::size_t getNumActiveSolvers ( )
virtual

get number of active Solvers

Returns
number of active Solvers

Implements ParaRacingSolverPool.

Definition at line 2804 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::nActiveSolvers.

◆ getNumInactiveSolvers()

virtual std::size_t getNumInactiveSolvers ( )
virtual

get number of inactive Solvers

Returns
number of inactive Solvers

Implements ParaRacingSolverPool.

Definition at line 2814 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::nInactiveSolvers.

Referenced by BbParaLoadCoordinator::processTagCompletionOfCalculation().

◆ getNumNodesLeft()

virtual int getNumNodesLeft ( int  rank)
virtual

get number of nodes left in the Solver specified by rank

Returns
number of nodes left
Parameters
rankrank of the Solver

Definition at line 2652 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getNumOfNodesLeft(), BbParaRacingSolverPool::pool, and SOLVER_POOL_INDEX.

Referenced by BbParaLoadCoordinator::run().

◆ getNumOfNodesSolved()

virtual long long getNumOfNodesSolved ( int  rank)
virtual

get number of nodes solved in the Solver specified by rank

Returns
number of nodes solved
Parameters
rankrank of the Solver

Definition at line 2641 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getNumOfNodesSolved(), BbParaRacingSolverPool::pool, and SOLVER_POOL_INDEX.

Referenced by BbParaRacingSolverPool::updateSolverStatus().

◆ getStrActiveSolerNumbers()

virtual std::string getStrActiveSolerNumbers ( )
virtual

get active Solver number string

Returns
string to show active Solver rank

Definition at line 2835 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::isRacingStage(), ParaRacingSolverPool::nSolvers, ParaRacingSolverPool::originRank, BbParaRacingSolverPool::pool, and SOLVER_POOL_INDEX.

◆ inactivateSolver()

◆ interruptRequested()

virtual void interruptRequested ( int  rank)
virtual

set the Solver specified by rank is terminate requested

Parameters
rankrank of the Solver

Definition at line 2509 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::interruptRequested(), BbParaRacingSolverPool::pool, and SOLVER_POOL_INDEX.

◆ isEvaluationStage()

virtual bool isEvaluationStage ( int  rank)
virtual

check if the Solver specified in an argument is evaluation stage or not

Returns
true if the Solver is evaluation stage, false otherwise

Definition at line 2824 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::isEvaluationStage(), BbParaRacingSolverPool::pool, and SOLVER_POOL_INDEX.

Referenced by BbParaRacingSolverPool::inactivateSolver(), BbParaRacingSolverPool::isEvaluationStage(), BbParaRacingSolverPool::isSolverActive(), and BbParaRacingSolverPool::updateSolverStatus().

◆ isInterruptRequested()

virtual bool isInterruptRequested ( int  rank)
virtual

check if the Solver specified by rank is interrupt requested or not

Returns
return true if the Solver is interrupt requested, false otherwise
Parameters
rankrank of the Solver

Definition at line 2532 of file bbParaSolverPool.h.

References UG::InterruptRequested, BbParaRacingSolverPool::pool, and SOLVER_POOL_INDEX.

◆ isSolverActive()

virtual bool isSolverActive ( int  rank)
virtual

check if the specified Solver is active or not

Returns
true if the specified Solver is active, false otherwise
Parameters
rankrank of the Solver

Implements ParaRacingSolverPool.

Definition at line 2744 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::isEvaluationStage(), BbParaRacingSolverPool::pool, and SOLVER_POOL_INDEX.

Referenced by BbParaSolverPool::activateSolver(), and BbParaRacingSolverPool::terminated().

◆ isTerminated()

virtual bool isTerminated ( int  rank)
virtual

check if the Solver specified by rank is terminated or not

Returns
return true if the Solver is terminated, false otherwise
Parameters
rankrank of the Solver

Definition at line 2569 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::pool, SOLVER_POOL_INDEX, and UG::Terminated.

◆ isTerminateRequested()

virtual bool isTerminateRequested ( int  rank)
virtual

check if the Solver specified by rank is terminate requested or not

Returns
return true if the Solver is terminate requested, false otherwise
Parameters
rankrank of the Solver

Definition at line 2543 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::pool, SOLVER_POOL_INDEX, and UG::TerminateRequested.

◆ isWinnerDecided()

bool isWinnerDecided ( bool  feasibleSol)
virtual

check racing termination criteria

stop racing at the number of nodes left in a solver reached to the value

stop racing at time limit

stop racing at the Solver with the best bound value has a certain number of nodes left

node left first adaptive

time limit first adaptive

node left first adaptive - adaptive node left (Default settings): this is for FiberSCIP

time limit first adaptive - adaptive node left

time limit first adaptive and node limit also checked - adaptive node left

Parameters
feasibleSolindicate if a feasible solution was generagted or not

Definition at line 2401 of file bbParaSolverPool.cpp.

References UG::CountingSolverRatioInRacing, UG::Deterministic, ParaParamSet::getBoolParamValue(), ParaDeterministicTimer::getElapsedTime(), ParaTimer::getElapsedTime(), ParaParamSet::getIntParamValue(), BbParaSolverPoolElement::getNumOfNodesLeft(), BbParaSolverPoolElement::getRank(), ParaParamSet::getRealParamValue(), UG::KeepRacingUntilToFindFirstSolution, UG::NEvaluationSolversToStopRacing, BbParaRacingSolverPool::nEvaluationStage, ParaRacingSolverPool::nSolvers, ParaRacingSolverPool::paraDetTimer, ParaRacingSolverPool::paraParams, ParaRacingSolverPool::paraTimer, UG::RacingRampUpTerminationCriteria, BbParaRacingSolverPool::selectionHeap, UG::StopRacingNumberOfNodesLeft, UG::StopRacingNumberOfNodesLeftMultiplier, UG::StopRacingTimeLimit, UG::StopRacingTimeLimitMultiplier, THROW_LOGICAL_ERROR1, SelectionHeap::top(), and ParaRacingSolverPool::winnerRank.

Referenced by BbParaLoadCoordinator::run().

◆ reset()

◆ terminated()

virtual void terminated ( int  rank)
virtual

set the Solver specified by rank is terminated

Parameters
rankrank of the Solver

Definition at line 2553 of file bbParaSolverPool.h.

References UG::Inactive, UG::InterruptRequested, BbParaRacingSolverPool::isSolverActive(), BbParaRacingSolverPool::pool, SOLVER_POOL_INDEX, BbParaSolverPoolElement::terminated(), and UG::TerminateRequested.

◆ terminateRequested()

virtual void terminateRequested ( int  rank)
virtual

set the Solver specified by rank is terminate requested

Parameters
rankrank of the Solver

Definition at line 2520 of file bbParaSolverPool.h.

References BbParaRacingSolverPool::pool, SOLVER_POOL_INDEX, and BbParaSolverPoolElement::terminateRequested().

◆ updateSolverStatus()

Member Data Documentation

◆ bestDualBound

double bestDualBound
protected

◆ bestDualBoundInSolvers

◆ nActiveSolvers

◆ nEvaluationStage

int nEvaluationStage
protected

number of Solvers that are in evaluation stage

Definition at line 2418 of file bbParaSolverPool.h.

Referenced by BbParaRacingSolverPool::isWinnerDecided(), BbParaRacingSolverPool::reset(), and BbParaRacingSolverPool::updateSolverStatus().

◆ nInactiveSolvers

size_t nInactiveSolvers
protected

◆ nNodesInBestSolver

long long nNodesInBestSolver
protected

◆ nNodesSolvedInBestSolver

long long nNodesSolvedInBestSolver
protected

◆ pool

◆ rootNode

◆ selectionHeap