Scippy

UG

Ubiquity Generator framework

BbParaRacingSolverPool Class Reference

class BbParaRacingSolverPool (Racing Solver Pool) More...

#include <bbParaSolverPool.h>

+ Inheritance diagram for BbParaRacingSolverPool:

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...
 
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 2414 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 2435 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::BbParaSolverPoolElement(), and nSolvers.

◆ 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 2464 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::BbParaSolverPoolElement(), and nSolvers.

◆ ~BbParaRacingSolverPool()

destructor

Definition at line 2495 of file bbParaSolverPool.h.

References nSolvers.

Member Function Documentation

◆ activate()

virtual void activate ( BbParaNode node)
virtual

activate racing ramp-up Solver pool with root BbParaNode object

Parameters
nodepointer to root BbParaNode object

Definition at line 2721 of file bbParaSolverPool.h.

References SelectionHeap::insert(), nSolvers, BbParaSolverPoolElement::racingActivate(), BbParaSolverPoolElement::rank, and SOLVER_POOL_INDEX.

Referenced by BbParaLoadCoordinator::run().

◆ extractNode()

virtual BbParaNode* extractNode ( )
virtual

◆ getBestDualBoundInInactivatedSolvers()

virtual double getBestDualBoundInInactivatedSolvers ( )
virtual

get best dual bound value in inactivated Solvers

Returns
best dual bound value in inactivated Solvers

Definition at line 2712 of file bbParaSolverPool.h.

◆ 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 2620 of file bbParaSolverPool.h.

◆ 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 2631 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getBestDualBoundValue(), and SOLVER_POOL_INDEX.

◆ getGlobalBestDualBoundValue()

virtual double getGlobalBestDualBoundValue ( )
virtual

get global best dual bound value

Returns
global best dual bound value

Definition at line 2664 of file bbParaSolverPool.h.

References SelectionHeap::getHeapSize().

◆ 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 2702 of file bbParaSolverPool.h.

◆ 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 2692 of file bbParaSolverPool.h.

◆ getNumActiveSolvers()

virtual std::size_t getNumActiveSolvers ( )
virtual

get number of active Solvers

Returns
number of active Solvers

Implements ParaRacingSolverPool.

Definition at line 2805 of file bbParaSolverPool.h.

◆ getNumInactiveSolvers()

virtual std::size_t getNumInactiveSolvers ( )
virtual

get number of inactive Solvers

Returns
number of inactive Solvers

Implements ParaRacingSolverPool.

Definition at line 2815 of file bbParaSolverPool.h.

◆ 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 2653 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getNumOfNodesLeft(), 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 2642 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getNumOfNodesSolved(), and SOLVER_POOL_INDEX.

◆ getStrActiveSolerNumbers()

virtual std::string getStrActiveSolerNumbers ( )
virtual

get active Solver number string

Returns
string to show active Solver rank

Definition at line 2836 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::isRacingStage(), nSolvers, and SOLVER_POOL_INDEX.

◆ inactivateSolver()

virtual void inactivateSolver ( int  rank)
virtual

◆ interruptRequested()

virtual void interruptRequested ( int  rank)
virtual

set the Solver specified by rank is terminate requested

Parameters
rankrank of the Solver

Definition at line 2510 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getRank(), BbParaSolverPoolElement::interruptRequested(), 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 2825 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::isEvaluationStage(), and SOLVER_POOL_INDEX.

◆ 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 2533 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getStatus(), UG::InterruptRequested, 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 2745 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::isEvaluationStage(), BbParaSolverPoolElement::isRacingStage(), BbParaSolverPoolElement::rank, and SOLVER_POOL_INDEX.

Referenced by BbParaSolverPool::activateSolver().

◆ 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 2570 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getStatus(), 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 2544 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getStatus(), 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, UG::KeepRacingUntilToFindFirstSolution, UG::NEvaluationSolversToStopRacing, nSolvers, UG::RacingRampUpTerminationCriteria, UG::StopRacingNumberOfNodesLeft, UG::StopRacingNumberOfNodesLeftMultiplier, UG::StopRacingTimeLimit, UG::StopRacingTimeLimitMultiplier, and THROW_LOGICAL_ERROR1.

Referenced by BbParaLoadCoordinator::run().

◆ reset()

virtual void reset ( )
virtual

reset racing solver pool

Definition at line 2580 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::BbParaSolverPoolElement(), and nSolvers.

Referenced by BbParaLoadCoordinator::newRacing().

◆ terminated()

virtual void terminated ( int  rank)
virtual

set the Solver specified by rank is terminated

Parameters
rankrank of the Solver

Definition at line 2554 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getRank(), BbParaSolverPoolElement::getStatus(), UG::Inactive, UG::InterruptRequested, 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 2521 of file bbParaSolverPool.h.

References BbParaSolverPoolElement::getRank(), SOLVER_POOL_INDEX, and BbParaSolverPoolElement::terminateRequested().

◆ updateSolverStatus()

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

update Solver status

Parameters
rankrank of the Solver
numNodesSolvednumber of nodes solved
numNodesLeftnumber of nodes left
solverLocalBestBoundbest bound value in the Solver

Definition at line 2331 of file bbParaSolverPool.cpp.

References UG::Racing, UG::RacingEvaluation, UG::RacingRampUpTerminationCriteria, SOLVER_POOL_INDEX, and UG::StopRacingNumberOfNodesLeft.

Member Data Documentation

◆ bestDualBound

double bestDualBound
protected

current best dual bound value

Definition at line 2424 of file bbParaSolverPool.h.

◆ bestDualBoundInSolvers

double bestDualBoundInSolvers
protected

best dual bound value in Solvers

Definition at line 2425 of file bbParaSolverPool.h.

◆ nActiveSolvers

size_t nActiveSolvers
protected

number of active Solvers

Definition at line 2422 of file bbParaSolverPool.h.

◆ nEvaluationStage

int nEvaluationStage
protected

number of Solvers that are in evaluation stage

Definition at line 2419 of file bbParaSolverPool.h.

◆ nInactiveSolvers

size_t nInactiveSolvers
protected

number of inactive Solvers

Definition at line 2423 of file bbParaSolverPool.h.

◆ nNodesInBestSolver

long long nNodesInBestSolver
protected

number of nodes in the best Solver

Definition at line 2421 of file bbParaSolverPool.h.

◆ nNodesSolvedInBestSolver

long long nNodesSolvedInBestSolver
protected

number of nodes solved in the best Solver

Definition at line 2420 of file bbParaSolverPool.h.

◆ pool

BbParaSolverPoolElementPtr* pool
protected

Solver pool indexed by Solver's rank.

Definition at line 2426 of file bbParaSolverPool.h.

◆ rootNode

BbParaNode* rootNode
protected

root BbParaNode

Definition at line 2428 of file bbParaSolverPool.h.

◆ selectionHeap

SelectionHeap* selectionHeap
protected

pointers to active Solvers in ascending or descending order

Definition at line 2427 of file bbParaSolverPool.h.