Scippy

UG

Ubiquity Generator framework

ScipParaCommTh Class Reference

#include <scipParaCommTh.h>

Inheritance diagram for ScipParaCommTh:
BbParaCommCPP11 ParaCommCPP11 ParaComm

Public Member Functions

 ScipParaCommTh ()
 
 ~ScipParaCommTh ()
 
void lockInterruptMsg ()
 lock interrupt message monitor to synchronize with the monitor thread More...
 
void unlockInterruptMsg ()
 unlock interrupt message monitor to synchronize with the monitor thread More...
 
UG::ParaDiffSubproblemcreateParaDiffSubproblem ()
 
UG::ParaInitialStatcreateParaInitialStat ()
 
UG::ParaRacingRampUpParamSetcreateParaRacingRampUpParamSet ()
 
UG::ParaInstancecreateParaInstance ()
 
UG::ParaSolutioncreateParaSolution ()
 
UG::ParaParamSetcreateParaParamSet ()
 
ScipParaInstancecreateScipParaInstance (SCIP *scip, int method)
 
ScipParaSolutioncreateScipParaSolution (ScipParaSolver *solver, SCIP_Real objval, int inNvars, SCIP_VAR **vars, SCIP_Real *vals)
 
ScipParaSolutioncreateScipParaSolution (SCIP_Real objval, int inNvars, int *inIndicesAmongSolvers, SCIP_Real *vals)
 
ScipParaDiffSubproblemcreateScipParaDiffSubproblem (SCIP *scip, ScipParaSolver *scipParaSolver, int nNewBranchVars, SCIP_VAR **newBranchVars, SCIP_Real *newBranchBounds, SCIP_BOUNDTYPE *newBoundTypes, int nAddedConss, SCIP_CONS **addedConss)
 
ScipParaInitialStatcreateScipParaInitialStat (SCIP *scip)
 
ScipParaInitialStatcreateScipParaInitialStat (int inMaxDepth, int inMaxTotalDepth, int inNVarBranchStatsDown, int inNVarBranchStatsUp, int *inIdxLBranchStatsVarsDown, int *inNVarBranchingDown, int *inIdxLBranchStatsVarsUp, int *inNVarBranchingUp, SCIP_Real *inDownpscost, SCIP_Real *inDownvsids, SCIP_Real *inDownconflen, SCIP_Real *inDowninfer, SCIP_Real *inDowncutoff, SCIP_Real *inUppscost, SCIP_Real *inUpvsids, SCIP_Real *inUpconflen, SCIP_Real *inUpinfer, SCIP_Real *inUpcutoff)
 
ScipParaRacingRampUpParamSetcreateScipParaRacingRampUpParamSet (int inTerminationCriteria, int inNNodesLeft, double inTimeLimit, int inScipRacingParamSeed, int inPermuteProbSeed, int inGenerateBranchOrderSeed, ScipDiffParamSet *inScipDiffParamSet)
 
ScipDiffParamSetcreateScipDiffParamSet ()
 
ScipDiffParamSetcreateScipDiffParamSet (SCIP *scip)
 
- Public Member Functions inherited from BbParaCommCPP11
 BbParaCommCPP11 ()
 constructor of ParaComCPP11 More...
 
virtual ~BbParaCommCPP11 ()
 destructor of this communicator More...
 
virtual ParaCalculationStatecreateParaCalculationState ()
 create ParaCalculationState object by default constructor More...
 
virtual ParaCalculationStatecreateParaCalculationState (double compTime, double rootTime, int nSolved, int nSent, int nImprovedIncumbent, int terminationState, int nSolvedWithNoPreprocesses, int nSimplexIterRoot, double averageSimplexIter, int nTransferredLocalCuts, int minTransferredLocalCuts, int maxTransferredLocalCuts, int nTransferredBendersCuts, int minTransferredBendersCuts, int maxTransferredBendersCuts, int nRestarts, double minIisum, double maxIisum, int minNii, int maxNii, double dualBound, int nSelfSplitNodesLeft)
 create ParaCalculationState object More...
 
virtual ParaTaskcreateParaTask ()
 create ParaNode object by default constructor More...
 
virtual ParaTaskcreateParaNode (TaskId inNodeId, TaskId inGeneratorNodeId, int inDepth, double inDualBoundValue, double inOriginalDualBoundValue, double inEstimatedValue, ParaDiffSubproblem *inDiffSubproblem)
 create ParaNode object More...
 
virtual ParaSolverStatecreateParaSolverState ()
 create ParaSolverState object by default constructor More...
 
virtual ParaSolverStatecreateParaSolverState (int racingStage, unsigned int notificationId, int lcId, int globalSubtreeId, long long nodesSolved, int nodesLeft, double bestDualBoundValue, double globalBestPrimalBoundValue, double detTime, double averageDualBoundGain)
 create ParaSolverState object More...
 
virtual ParaSolverTerminationStatecreateParaSolverTerminationState ()
 create ParaSolverTerminationState object by default constructor More...
 
virtual ParaSolverTerminationStatecreateParaSolverTerminationState (int interrupted, int rank, int totalNSolved, int minNSolved, int maxNSolved, int totalNSent, int totalNImprovedIncumbent, int nParaNodesReceived, int nParaNodesSolved, int nParaNodesSolvedAtRoot, int nParaNodesSolvedAtPreCheck, int nTransferredLocalCutsFromSolver, int minTransferredLocalCutsFromSolver, int maxTransferredLocalCutsFromSolver, int nTransferredBendersCutsFromSolver, int minTransferredBendersCutsFromSolver, int maxTransferredBendersCutsFromSolver, int nTotalRestarts, int minRestarts, int maxRestarts, int nTightened, int nTightenedInt, int calcTerminationState, double runningTime, double idleTimeToFirstParaNode, double idleTimeBetweenParaNodes, double iddleTimeAfterLastParaNode, double idleTimeToWaitNotificationId, double idleTimeToWaitAckCompletion, double idleTimeToWaitToken, double totalRootNodeTime, double minRootNodeTime, double maxRootNodeTime, double detTime)
 create ParaSolverTerminationState object More...
 
virtual ParaRacingRampUpParamSetcreateParaRacingRampUpParamSet ()
 create ParaRacingRampUpParamSet object by default constructor More...
 
- Public Member Functions inherited from ParaCommCPP11
 ParaCommCPP11 ()
 constructor of ParaComCPP11 More...
 
virtual ~ParaCommCPP11 ()
 destructor of this communicator More...
 
virtual void init (int argc, char **argv)
 initializer of this communicator More...
 
virtual void setLocalRank (int inRank)
 
double getStartTime ()
 get start time of this communicator (should not be used) More...
 
int getRank ()
 get rank of caller's thread More...
 
int getSize ()
 get size of this communicator, which indicates how many threads in a UG process More...
 
int getNumOfMessagesWaitingToSend (int dest=-1)
 get size of the messageQueueTable More...
 
virtual void lcInit (ParaParamSet *paraParamSet)
 initializer for LoadCoordinator More...
 
virtual void solverInit (ParaParamSet *paraParamSet)
 initializer for Solvers More...
 
virtual void solverInit (int rank, ParaParamSet *paraParamSet)
 initializer for a specific Solver More...
 
virtual void solverReInit (int rank, ParaParamSet *paraParamSet)
 reinitializer of a specific Solver More...
 
virtual void solverDel (int rank)
 delete Solver from this communicator More...
 
void abort ()
 abort. How it works sometimes depends on communicator used More...
 
virtual bool waitTerminatedMessage ()
 function to wait Terminated message (This function is not used currently) More...
 
virtual bool waitToken (int rank)
 wait token when UG runs with deterministic mode More...
 
virtual void passToken (int rank)
 pass token to from the rank to the next More...
 
virtual bool passTermToken (int rank)
 pass termination token from the rank to the next More...
 
virtual void setToken (int rank, int *inToken)
 set received token to this communicator More...
 
std::ostream * getOstream ()
 get ostream pointer More...
 
void lockRank ()
 lock rank More...
 
void unlockRank ()
 unlock rank More...
 
virtual void lockApp ()
 lock UG application to synchronize with other threads More...
 
virtual void lockApp (char const *f, int l)
 lock UG application to synchronize with other threads (for debug) More...
 
virtual void unlockApp ()
 unlock UG application to synchronize with other threads More...
 
virtual void unlockApp (char const *f, int l)
 unlock UG application to synchronize with other threads (for debug) More...
 
void unlockRank (char const *f, int l)
 unlock rank (for debugging) More...
 
ParaTimercreateParaTimer ()
 create ParaTimer object More...
 
int bcast (void *buffer, int count, const int datatypeId, int root)
 broadcast function for standard ParaData types More...
 
int send (void *bufer, int count, const int datatypeId, int dest, const int tag)
 send function for standard ParaData types More...
 
int receive (void *bufer, int count, const int datatypeId, int source, const int tag)
 receive function for standard ParaData types More...
 
void waitSpecTagFromSpecSource (const int source, const int tag, int *receivedTag)
 wait function for a specific tag from a specific source coming from More...
 
bool probe (int *source, int *tag)
 probe function which waits a new message More...
 
bool iProbe (int *source, int *tag)
 iProbe function which checks if a new message is arrived or not More...
 
int uTypeSend (void *bufer, const int datatypeId, int dest, int tag)
 User type send for created data type. More...
 
int uTypeReceive (void **bufer, const int datatypeId, int source, int tag)
 User type receive for created data type. More...
 
virtual const char * getTagString (int tag)
 get Tag string for debugging More...
 
- Public Member Functions inherited from ParaComm
 ParaComm ()
 default constructor of ParaComm More...
 
virtual ~ParaComm ()
 destructor of ParaComm More...
 
virtual void init (int argc, char **argv)=0
 initializer of this object More...
 
virtual int getRank ()=0
 get rank of this process or this thread depending on run-time environment More...
 
virtual int getSize ()=0
 get number of UG processes or UG threads depending on run-time environment More...
 
virtual int getNumOfMessagesWaitingToSend (int dest)=0
 get size of the messageQueueTable More...
 
virtual void lcInit (ParaParamSet *paraParamSet)=0
 special initializer when this object is used in LoadCoordinator More...
 
virtual void solverInit (ParaParamSet *paraParamSet)=0
 special initializer when this object is used in Solver More...
 
virtual void setLocalRank (int inRank)
 
virtual void abort ()=0
 abort function for this communicator (how to abort depends on which library used for communication) More...
 
virtual bool waitTerminatedMessage ()=0
 function to wait Terminated message (This function is not used currently) More...
 
virtual bool waitToken (int rank)
 wait token when UG runs with deterministic mode More...
 
virtual void passToken (int rank)
 pass token to from the rank to the next More...
 
virtual bool passTermToken (int rank)
 pass termination token from the rank to the next More...
 
virtual void setToken (int rank, int *token)
 set received token to this communicator More...
 
virtual void lockApp ()=0
 lock UG application to synchronize with other threads More...
 
virtual void lockApp (char const *f, int l)
 lock UG application to synchronize with other threads (for debug) More...
 
virtual void unlockApp ()=0
 unlock UG application to synchronize with other threads More...
 
virtual void unlockApp (char const *f, int l)
 unlock UG application to synchronize with other threads (for debug) More...
 
virtual ParaCalculationStatecreateParaCalculationState ()=0
 transfer object factory More...
 
virtual ParaRacingRampUpParamSetcreateParaRacingRampUpParamSet ()=0
 create ParaRacingRampUpParamSet object More...
 
virtual ParaTaskcreateParaTask ()=0
 create ParaTask object by default constructor More...
 
virtual ParaParamSetcreateParaParamSet ()=0
 create ParaParamSet object More...
 
virtual ParaSolverStatecreateParaSolverState ()=0
 create ParaSolverState object by default constructor More...
 
virtual ParaSolverTerminationStatecreateParaSolverTerminationState ()=0
 create ParaSolverTerminationState object by default constructor More...
 
virtual ParaTimercreateParaTimer ()=0
 create ParaTimer object More...
 
virtual ParaInstancecreateParaInstance ()=0
 create ParaInstance object by default constructor More...
 
virtual ParaSolutioncreateParaSolution ()=0
 create ParaSolution object by default constructor More...
 
virtual ParaDiffSubproblemcreateParaDiffSubproblem ()
 create ParaDiffSubproblem object by default constructor More...
 
virtual int bcast (void *buffer, int count, const int datatypeId, int root)=0
 Some action need to be taken for fault tolerant, when the functions return. So, they rerun status value. More...
 
virtual int send (void *bufer, int count, const int datatypeId, int dest, const int tag)=0
 send function for standard ParaData types More...
 
virtual int receive (void *bufer, int count, const int datatypeId, int source, const int tag)=0
 receive function for standard ParaData types More...
 
virtual void waitSpecTagFromSpecSource (const int source, const int tag, int *receivedTag)=0
 wait function for a specific tag from a specific source coming from More...
 
virtual bool probe (int *source, int *tag)=0
 No need to take action for fault tolerant, when the functions return. So, they do not rerun status value. More...
 
virtual bool iProbe (int *source, int *tag)=0
 iProbe function which checks if a new message is arrived or not More...
 
virtual const char * getTagString (int tag)=0
 get Tag string for debugging More...
 

Protected Member Functions

bool tagStringTableIsSetUpCoorectly ()
 check if tag string table (for debugging) set up correctly More...
 
const char * getTagString (int tag)
 get Tag string for debugging More...
 
virtual bool tagStringTableIsSetUpCoorectly ()
 check if tag string table (for debugging) set up correctly More...
 
virtual const char * getTagString (int tag)
 get Tag string for debugging More...
 
- Protected Member Functions inherited from ParaCommCPP11
void * allocateMemAndCopy (const void *buffer, int count, const int datatypeId)
 allocate memory and copy message More...
 
void copy (void *dest, const void *src, int count, int datatypeId)
 copy message More...
 
void freeMem (void *buffer, int count, const int datatypeId)
 free memory More...
 
bool freeStandardTypes (MessageQueueElement *elem)
 free memory More...
 
virtual bool tagStringTableIsSetUpCoorectly ()
 check if tag string table (for debugging) set up correctly More...
 

Static Protected Attributes

static const char * tagStringTable []
 tag name string table More...
 
- Static Protected Attributes inherited from BbParaCommCPP11
static const char * tagStringTable []
 tag name string table More...
 
- Static Protected Attributes inherited from ParaCommCPP11
static const char * tagStringTable []
 tag name string table More...
 
static ThreadsTableElementthreadsTable [ThreadTableSize]
 threads table: index is thread rank More...
 
static thread_local int localRank = -1
 local thread rank More...
 

Private Attributes

std::mutex interruptMsgMonitorLockMutex
 mutex for interrupt message monitor More...
 

Additional Inherited Members

- Protected Attributes inherited from ParaCommCPP11
int comSize
 communicator size : number of threads joined in this system More...
 
bool tagTraceFlag
 indicate if tags are traced or not More...
 
int ** token
 index 0: token index 1: token color -1: green > 0: yellow ( termination origin solver number ) -2: red ( means the solver can terminate ) More...
 
ParaSysTimer timer
 system timer More...
 
MessageQueueTableElement ** messageQueueTable
 message queue table More...
 
bool * sentMessage
 sent message flag for synchronization More...
 
std::mutex * queueLockMutex
 mutex for synchronization More...
 
std::condition_variable * sentMsg
 condition variable for synchronization More...
 
std::mutex * tokenAccessLockMutex
 mutex to access token More...
 
std::mutex rankLockMutex
 mutex to access rank More...
 
std::mutex applicationLockMutex
 mutex for applications More...
 

Detailed Description

Definition at line 64 of file scipParaCommTh.h.

Constructor & Destructor Documentation

◆ ScipParaCommTh()

Definition at line 90 of file scipParaCommTh.h.

◆ ~ScipParaCommTh()

Member Function Documentation

◆ createParaDiffSubproblem()

UG::ParaDiffSubproblem * createParaDiffSubproblem ( )
virtual

Reimplemented from ParaComm.

Definition at line 134 of file scipParaCommTh.cpp.

Referenced by ScipParaDiffSubproblem::createDiffSubproblem().

◆ createParaInitialStat()

UG::ParaInitialStat * createParaInitialStat ( )

Definition at line 141 of file scipParaCommTh.cpp.

◆ createParaInstance()

UG::ParaInstance * createParaInstance ( )
virtual

Implements ParaComm.

Definition at line 155 of file scipParaCommTh.cpp.

Referenced by main(), and runSolverThread().

◆ createParaParamSet()

UG::ParaParamSet * createParaParamSet ( )
virtual

Implements ParaComm.

Definition at line 169 of file scipParaCommTh.cpp.

Referenced by main().

◆ createParaRacingRampUpParamSet()

UG::ParaRacingRampUpParamSet * createParaRacingRampUpParamSet ( )
virtual

Reimplemented from BbParaCommCPP11.

Definition at line 148 of file scipParaCommTh.cpp.

Referenced by runSolverThread().

◆ createParaSolution()

UG::ParaSolution * createParaSolution ( )
virtual

Implements ParaComm.

Definition at line 162 of file scipParaCommTh.cpp.

◆ createScipDiffParamSet() [1/2]

ScipDiffParamSet * createScipDiffParamSet ( )

Definition at line 309 of file scipParaCommTh.cpp.

◆ createScipDiffParamSet() [2/2]

ScipDiffParamSet * createScipDiffParamSet ( SCIP *  scip)

Definition at line 315 of file scipParaCommTh.cpp.

◆ createScipParaDiffSubproblem()

ScipParaDiffSubproblem * createScipParaDiffSubproblem ( SCIP *  scip,
ScipParaSolver scipParaSolver,
int  nNewBranchVars,
SCIP_VAR **  newBranchVars,
SCIP_Real *  newBranchBounds,
SCIP_BOUNDTYPE *  newBoundTypes,
int  nAddedConss,
SCIP_CONS **  addedConss 
)

Definition at line 209 of file scipParaCommTh.cpp.

◆ createScipParaInitialStat() [1/2]

ScipParaInitialStat * createScipParaInitialStat ( int  inMaxDepth,
int  inMaxTotalDepth,
int  inNVarBranchStatsDown,
int  inNVarBranchStatsUp,
int *  inIdxLBranchStatsVarsDown,
int *  inNVarBranchingDown,
int *  inIdxLBranchStatsVarsUp,
int *  inNVarBranchingUp,
SCIP_Real *  inDownpscost,
SCIP_Real *  inDownvsids,
SCIP_Real *  inDownconflen,
SCIP_Real *  inDowninfer,
SCIP_Real *  inDowncutoff,
SCIP_Real *  inUppscost,
SCIP_Real *  inUpvsids,
SCIP_Real *  inUpconflen,
SCIP_Real *  inUpinfer,
SCIP_Real *  inUpcutoff 
)

Definition at line 243 of file scipParaCommTh.cpp.

◆ createScipParaInitialStat() [2/2]

ScipParaInitialStat * createScipParaInitialStat ( SCIP *  scip)

Definition at line 233 of file scipParaCommTh.cpp.

◆ createScipParaInstance()

ScipParaInstance * createScipParaInstance ( SCIP *  scip,
int  method 
)

Definition at line 177 of file scipParaCommTh.cpp.

◆ createScipParaRacingRampUpParamSet()

ScipParaRacingRampUpParamSet * createScipParaRacingRampUpParamSet ( int  inTerminationCriteria,
int  inNNodesLeft,
double  inTimeLimit,
int  inScipRacingParamSeed,
int  inPermuteProbSeed,
int  inGenerateBranchOrderSeed,
ScipDiffParamSet inScipDiffParamSet 
)

Definition at line 287 of file scipParaCommTh.cpp.

◆ createScipParaSolution() [1/2]

ScipParaSolution * createScipParaSolution ( SCIP_Real  objval,
int  inNvars,
int *  inIndicesAmongSolvers,
SCIP_Real *  vals 
)

Definition at line 198 of file scipParaCommTh.cpp.

◆ createScipParaSolution() [2/2]

ScipParaSolution * createScipParaSolution ( ScipParaSolver solver,
SCIP_Real  objval,
int  inNvars,
SCIP_VAR **  vars,
SCIP_Real *  vals 
)

Definition at line 186 of file scipParaCommTh.cpp.

◆ getTagString()

const char * getTagString ( int  tag)
protectedvirtual

get Tag string for debugging

Returns
string which shows Tag
Parameters
tagtag to be converted to string

Reimplemented from BbParaCommCPP11.

Definition at line 69 of file scipParaCommTh.cpp.

References ParaSCIP::N_SCIP_TH_TAGS, ParaSCIP::TAG_SCIP_FIRST, and ScipParaCommTh::tagStringTable.

◆ lockInterruptMsg()

void lockInterruptMsg ( )

lock interrupt message monitor to synchronize with the monitor thread

Definition at line 96 of file scipParaCommTh.h.

References ScipParaCommTh::interruptMsgMonitorLockMutex.

◆ tagStringTableIsSetUpCoorectly()

bool tagStringTableIsSetUpCoorectly ( )
protectedvirtual

check if tag string table (for debugging) set up correctly

Returns
true if tag string table is set up correctly, false otherwise

Reimplemented from BbParaCommCPP11.

Definition at line 55 of file scipParaCommTh.cpp.

References UG::N_BB_TH_TAGS, ParaSCIP::N_SCIP_TH_TAGS, ScipParaCommTh::tagStringTable, BbParaCommCPP11::tagStringTableIsSetUpCoorectly(), and BbParaCommPth::tagStringTableIsSetUpCoorectly().

◆ unlockInterruptMsg()

void unlockInterruptMsg ( )

unlock interrupt message monitor to synchronize with the monitor thread

Definition at line 105 of file scipParaCommTh.h.

References ScipParaCommTh::interruptMsgMonitorLockMutex.

Member Data Documentation

◆ interruptMsgMonitorLockMutex

std::mutex interruptMsgMonitorLockMutex
private

mutex for interrupt message monitor

Definition at line 68 of file scipParaCommTh.h.

Referenced by ScipParaCommTh::lockInterruptMsg(), and ScipParaCommTh::unlockInterruptMsg().

◆ tagStringTable

const char * tagStringTable
staticprotected
Initial value:
= {
}

tag name string table

Definition at line 72 of file scipParaCommTh.h.

Referenced by ScipParaCommTh::getTagString(), and ScipParaCommTh::tagStringTableIsSetUpCoorectly().