Scippy

UG

Ubiquity Generator framework

BbParaNode Class Referenceabstract

class BbParaNode More...

#include <bbParaNode.h>

+ Inheritance diagram for BbParaNode:

Public Member Functions

 BbParaNode ()
 default constructor More...
 
 BbParaNode (TaskId inNodeId, TaskId inGeneratorNodeId, int inDepth, double inDualBoundValue, double inOriginalDualBoundValue, double inEstimatedValue, ParaDiffSubproblem *inDiffSubproblem)
 constructor More...
 
virtual ~BbParaNode ()
 destructor More...
 
int getDepth ()
 getter of depth More...
 
void setDepth (int inDepth)
 setter of depth More...
 
double getDualBoundValue ()
 getter of dual bound value More...
 
double getInitialDualBoundValue ()
 getter of initial dual bound value More...
 
void setDualBoundValue (double inDualBoundValue)
 setter of dual bound value More...
 
void setInitialDualBoundValue (double inTrueDualBoundValue)
 setter of initial dual bound value More...
 
void resetDualBoundValue ()
 reset dual bound value More...
 
BbParaDiffSubproblemgetDiffSubproblem ()
 getter of diffSubproblem More...
 
void setDiffSubproblem (BbParaDiffSubproblem *inDiffSubproblem)
 setter of diffSubproblem */ More...
 
ParaTaskGenealogicalPtrgetAncestor ()
 getter of ancestor More...
 
void setAncestor (ParaTaskGenealogicalPtr *inAncestor)
 setter of ancestor More...
 
void removeDescendant (TaskId removeNodeId)
 remove a descendant More...
 
bool hasDescendant ()
 check if this node has descendant or not More...
 
void addDescendant (ParaTaskGenealogicalPtr *inDescendant)
 add a descendant More...
 
void updateInitialDualBoundToSubtreeDualBound ()
 update initial dual bound value by checking descendant dual bound values More...
 
double getMinimumDualBoundInDesendants (double value)
 get minimum dual bound value in descendants More...
 
virtual BbParaNodeclone (ParaComm *comm)=0
 clone this BbParaNode More...
 
virtual int bcast (ParaComm *comm, int root)=0
 broadcast this object More...
 
virtual int send (ParaComm *comm, int destination)=0
 send this object More...
 
virtual int receive (ParaComm *comm, int source)=0
 receive this object More...
 
virtual int sendNewSubtreeRoot (ParaComm *comm, int destination)=0
 send new subtree root node More...
 
virtual int sendSubtreeRootNodeId (ParaComm *comm, int destination, int tag)=0
 send subtree root to be removed More...
 
virtual int receiveNewSubtreeRoot (ParaComm *comm, int source)=0
 receive this object More...
 
virtual int receiveSubtreeRootNodeId (ParaComm *comm, int source, int tag)=0
 receive this object node Id More...
 
const std::string toString ()
 stringfy BbParaNode More...
 
const std::string toSimpleString ()
 stringfy BbParaNode as simple string More...
 
void setMergeNodeInfo (BbParaMergeNodeInfo *mNode)
 set merge node information to this BbParaNode object More...
 
BbParaMergeNodeInfogetMergeNodeInfo ()
 get merge node information struct More...
 
void setMergingStatus (int status)
 set merging status More...
 
int getMergingStatus ()
 get merging status More...
 
bool areNodesCollected ()
 check if nodes are collected or not More...
 
void collectsNodes ()
 set all nodes are collected TODO: this function has to be investigated More...
 
bool isSameNodeIdAs (const BbParaNode &inNode)
 check if this node's id is the same as that of argument ParaNode's task id More...
 
- Public Member Functions inherited from ParaTask
 ParaTask ()
 default constructor More...
 
 ParaTask (const ParaTask &paraTask)
 copy constructor More...
 
 ParaTask (TaskId inTaskId, TaskId inGeneratorTaskId, double inEstimatedValue, ParaDiffSubproblem *inDiffSubproblem)
 constructor More...
 
virtual ~ParaTask ()
 destructor More...
 
bool isRootTask ()
 check if root task or not More...
 
bool isSameTaskIdAs (const ParaTask &inTask)
 check if this task id is the same as argument ParaTask's task id More...
 
bool isSameParetntTaskIdAs (const ParaTask &inTask)
 check if this task's parent id is the same as that of argument ParaTask's task id More...
 
bool isSameParetntTaskSubtaskIdAs (const TaskId &inTaskId)
 check if this task's parent subtree id is the same as that of argument ParaTask's task id More...
 
bool isSameSubtaskIdAs (const ParaTask &inTask)
 check if this task's subtask id is the same as that of argument ParaTask's task id More...
 
bool isSameLcIdAs (const ParaTask &inTask)
 check if this task's global subtask id in LC is the same as that of argument ParaTask's task id More...
 
bool isSameLcIdAs (const int lcId)
 check if this task's global subtask LC id is the same as LC id of argument More...
 
bool isSameGlobalSubtaskIdInLcAs (const ParaTask &inTask)
 check if this task's global subtask id in LC is the same as that of argument ParaTask's task id More...
 
bool isSameGlobalSubtaskIdInLcAs (const int globalSubtaskIdInLc)
 check if this task's global subtask id in LC is the same as that of argument More...
 
int getLcId ()
 getter of LoadCoordinator id More...
 
int getGlobalSubtaskIdInLc ()
 getter of global subtask id in Solvers managed by LoadCoordinator More...
 
void setGlobalSubtaskId (int lcId, int subtaskId)
 setter of global subtask id More...
 
int getSolverId ()
 getter of Solver id More...
 
void setSolverId (int id)
 setter of Solver id More...
 
TaskId getTaskId ()
 getter of task id More...
 
void setTaskId (TaskId inTaskId)
 setter of task id More...
 
TaskId getGeneratorTaskId ()
 getter of generator task id More...
 
void setGeneratorTaskId (TaskId inGeneratorTaskId)
 setter of generator task id More...
 
double getEstimatedValue ()
 getter of estimated value More...
 
void setEstimatedValue (double inEstimatedValue)
 setter of estimated value More...
 
ParaDiffSubproblemgetDiffSubproblem ()
 getter of diffSubproblem More...
 
void setDiffSubproblem (ParaDiffSubproblem *inDiffSubproblem)
 setter of diffSubproblem */ More...
 
ParaTaskGenealogicalPtrgetAncestor ()
 getter of ancestor More...
 
void setAncestor (ParaTaskGenealogicalPtr *inAncestor)
 setter of ancestor More...
 
void removeDescendant (TaskId removeTaskId)
 remove a descendant More...
 
bool hasDescendant ()
 check if this task has descendant or not More...
 
void addDescendant (ParaTaskGenealogicalPtr *inDescendant)
 add a descendant More...
 

Public Attributes

BbParaNodenext
 this pointer is used in case of self-split ramp-up in LC this field is not transferred More...
 
- Public Attributes inherited from ParaTask
TaskId taskId
 solving task information More...
 
TaskId generatorTaskId
 subtree root task id of generator More...
 
ParaTaskGenealogicalPtrancestor
 pointer to ancestor ParaTask : This field is not transferred More...
 
std::map< TaskId, ParaTaskGenealogicalPtrPtrdescendants
 collection of pointers to descendants : This filed is not transferred More...
 

Protected Attributes

int depth
 depth from the root node of original tree More...
 
double dualBoundValue
 dual bound value More...
 
double initialDualBoundValue
 dual bound value when this node is created This value is updated to precise one when there is guarantee More...
 
int basisInfo
 indicate if basis information is including or not More...
 
int mergingStatus
 merging status: -1 - no merging node, 0 - checking, 1 - merged (representative) 2 - merged to the other node 3 - cannot be merged 4 - merging representative was deleted More...
 
BbParaMergeNodeInfomergeNodeInfo
 pointer to mergeNodeInfo. Not zero means merging More...
 
bool nodesAreCollected
 subproblems generated from this nodes are collected at interruption. this field is not transferred More...
 
- Protected Attributes inherited from ParaTask
double estimatedValue
 estimate value More...
 
int diffSubproblemInfo
 1: with diffSubproblem, 0: no diffSubproblem More...
 
ParaDiffSubproblemdiffSubproblem
 difference between solving instance data and subproblem data More...
 

Detailed Description

class BbParaNode

Definition at line 61 of file bbParaNode.h.

Constructor & Destructor Documentation

◆ BbParaNode() [1/2]

default constructor

Definition at line 89 of file bbParaNode.h.

◆ BbParaNode() [2/2]

BbParaNode ( TaskId  inNodeId,
TaskId  inGeneratorNodeId,
int  inDepth,
double  inDualBoundValue,
double  inOriginalDualBoundValue,
double  inEstimatedValue,
ParaDiffSubproblem inDiffSubproblem 
)

constructor

Parameters
inNodeIdnode id
inGeneratorNodeIdgenerator node id
inDepthdepth in global search tree
inDualBoundValuedual bound value
inOriginalDualBoundValueoriginal dual bound value when the node is generated
inEstimatedValueestimated value
inDiffSubproblempointer to BbParaDiffSubproblem object

Definition at line 106 of file bbParaNode.h.

◆ ~BbParaNode()

Member Function Documentation

◆ addDescendant()

void addDescendant ( ParaTaskGenealogicalPtr inDescendant)

add a descendant

Parameters
inDescendantdescendant BbParaNodeGenealogicalPtr

Definition at line 436 of file bbParaNode.h.

References ParaTask::descendants, and ParaTaskGenealogicalPtr::getTaskId().

◆ areNodesCollected()

bool areNodesCollected ( )

check if nodes are collected or not

Returns
true if they are collected

Definition at line 688 of file bbParaNode.h.

References BbParaNode::nodesAreCollected.

Referenced by BbParaLoadCoordinator::processTagCompletionOfCalculation(), and BbParaLoadCoordinator::processTagSelfSlpitNodeCalcuationState().

◆ bcast()

virtual int bcast ( ParaComm comm,
int  root 
)
pure virtual

broadcast this object

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
rootroot rank of broadcast

Implements ParaTask.

Implemented in BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaNode::getMinimumDualBoundInDesendants(), and BbParaLoadCoordinator::restartRacing().

◆ clone()

virtual BbParaNode* clone ( ParaComm comm)
pure virtual

clone this BbParaNode

Returns
pointer to cloned BbParaNode object
Parameters
commcommunicator used

Implements ParaTask.

Implemented in BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaRacingSolverPool::extractNode(), and BbParaNode::getMinimumDualBoundInDesendants().

◆ collectsNodes()

void collectsNodes ( )

set all nodes are collected TODO: this function has to be investigated

Definition at line 698 of file bbParaNode.h.

Referenced by BbParaLoadCoordinator::sendInterruptRequest().

◆ getAncestor()

◆ getDepth()

int getDepth ( )

getter of depth

Returns
depth of this node in global tree

Definition at line 283 of file bbParaNode.h.

References BbParaNode::depth.

Referenced by BbParaLoadCoordinator::processTagTask().

◆ getDiffSubproblem()

◆ getDualBoundValue()

◆ getInitialDualBoundValue()

double getInitialDualBoundValue ( )

getter of initial dual bound value

Returns
initial dual bound value

Definition at line 314 of file bbParaNode.h.

References BbParaNode::initialDualBoundValue.

Referenced by ScipParaSolver::createSubproblem(), BbParaLoadCoordinator::run(), and BbParaLoadCoordinator::sendParaTasksToIdleSolvers().

◆ getMergeNodeInfo()

◆ getMergingStatus()

int getMergingStatus ( )

get merging status

Returns
merging status

Definition at line 678 of file bbParaNode.h.

References BbParaNode::mergingStatus.

Referenced by BbParaSolverPool::activateSolver(), and BbParaNodesMerger::deleteMergeNodeInfo().

◆ getMinimumDualBoundInDesendants()

◆ hasDescendant()

bool hasDescendant ( )

check if this node has descendant or not

Returns
true if it has descendant

Definition at line 427 of file bbParaNode.h.

References ParaTask::descendants.

◆ isSameNodeIdAs()

bool isSameNodeIdAs ( const BbParaNode inNode)

check if this node's id is the same as that of argument ParaNode's task id

Returns
true if the both are the same
Parameters
inNodeParaNode

Definition at line 708 of file bbParaNode.h.

References ParaTask::generatorTaskId, TaskId::subtaskId, and ParaTask::taskId.

Referenced by BbParaSolverPoolElement::extractSubtreeRoot(), BbParaSolverPoolElement::makeSubtreeRootCurrent(), and BbParaSolverPoolElement::removeSubtreeRoot().

◆ receive()

virtual int receive ( ParaComm comm,
int  source 
)
pure virtual

receive this object

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
sourcesource rank

Implements ParaTask.

Implemented in BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaNode::getMinimumDualBoundInDesendants(), and BbParaLoadCoordinator::processTagTask().

◆ receiveNewSubtreeRoot()

virtual int receiveNewSubtreeRoot ( ParaComm comm,
int  source 
)
pure virtual

receive this object

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
sourcesource rank

Implemented in BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaNode::getMinimumDualBoundInDesendants(), and BbParaLoadCoordinator::processTagNewSubtreeRootNode().

◆ receiveSubtreeRootNodeId()

virtual int receiveSubtreeRootNodeId ( ParaComm comm,
int  source,
int  tag 
)
pure virtual

receive this object node Id

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
sourcesource rank
tagtag of message

Implemented in BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaNode::getMinimumDualBoundInDesendants(), BbParaLoadCoordinator::processTagReassignSelfSplitSubtreeRootNode(), BbParaLoadCoordinator::processTagSubtreeRootNodeStartComputation(), and BbParaLoadCoordinator::processTagSubtreeRootNodeToBeRemoved().

◆ removeDescendant()

void removeDescendant ( TaskId  removeNodeId)

remove a descendant

not implemented yet

Parameters
removeNodeIdnode id to remove

Definition at line 393 of file bbParaNode.h.

References ParaTask::descendants, ParaTaskGenealogicalPtr::getTaskId(), UG::ParaTaskLocalPtr, THROW_LOGICAL_ERROR1, and TaskId::toString().

◆ resetDualBoundValue()

void resetDualBoundValue ( )

reset dual bound value

Definition at line 343 of file bbParaNode.h.

References BbParaNode::initialDualBoundValue.

◆ send()

virtual int send ( ParaComm comm,
int  destination 
)
pure virtual

send this object

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
destinationdestination rank

Implements ParaTask.

Implemented in BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaSolverPool::activateSolver(), BbParaNode::getMinimumDualBoundInDesendants(), BbParaLoadCoordinator::newRacing(), and BbParaSolver::sendParaNode().

◆ sendNewSubtreeRoot()

virtual int sendNewSubtreeRoot ( ParaComm comm,
int  destination 
)
pure virtual

send new subtree root node

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
destinationdestination rank

Implemented in BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaNode::getMinimumDualBoundInDesendants(), and BbParaSolver::keepParaNode().

◆ sendSubtreeRootNodeId()

virtual int sendSubtreeRootNodeId ( ParaComm comm,
int  destination,
int  tag 
)
pure virtual

send subtree root to be removed

Returns
always 0 (for future extensions)
Parameters
commcommunicator used
destinationdestination rank
tagtag of message

Implemented in BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaNode::getMinimumDualBoundInDesendants(), BbParaSolver::processTagInCollectingMode(), and BbParaSolver::run().

◆ setAncestor()

void setAncestor ( ParaTaskGenealogicalPtr inAncestor)

setter of ancestor

Parameters
inAncestorancestor BbParaNodeGenealogicalPtr

Definition at line 382 of file bbParaNode.h.

References ParaTask::ancestor.

Referenced by BbParaLoadCoordinator::processTagTask().

◆ setDepth()

void setDepth ( int  inDepth)

setter of depth

Parameters
inDepthdepth

Definition at line 292 of file bbParaNode.h.

◆ setDiffSubproblem()

◆ setDualBoundValue()

◆ setInitialDualBoundValue()

void setInitialDualBoundValue ( double  inTrueDualBoundValue)

setter of initial dual bound value

Parameters
inTrueDualBoundValueinital dual bound value

Definition at line 333 of file bbParaNode.h.

Referenced by BbParaRacingSolverPool::extractNode(), BbParaLoadCoordinator::processTagAnotherNodeRequest(), and BbParaLoadCoordinator::restartRacing().

◆ setMergeNodeInfo()

void setMergeNodeInfo ( BbParaMergeNodeInfo mNode)

set merge node information to this BbParaNode object

Parameters
mNodepointer to merge node information struct

Definition at line 646 of file bbParaNode.h.

Referenced by BbParaNodesMerger::addNodeToMergeNodeStructs(), BbParaNodesMerger::deleteMergeNodeInfo(), BbParaNodesMerger::generateMergeNodesCandidates(), and BbParaLoadCoordinator::sendParaTasksToIdleSolvers().

◆ setMergingStatus()

◆ toSimpleString()

◆ toString()

const std::string toString ( )
virtual

stringfy BbParaNode

Returns
string to show inside of this object

Reimplemented from ParaTask.

Definition at line 600 of file bbParaNode.h.

References ParaTask::diffSubproblem, ParaTask::estimatedValue, ParaTask::generatorTaskId, ParaTask::taskId, ParaDiffSubproblem::toString(), and TaskId::toString().

Referenced by BbParaLoadCoordinator::sendParaTasksToIdleSolvers().

◆ updateInitialDualBoundToSubtreeDualBound()

void updateInitialDualBoundToSubtreeDualBound ( )

update initial dual bound value by checking descendant dual bound values

More accurate dual bound of this node is obtained

Definition at line 446 of file bbParaNode.h.

References BbParaNode::getMinimumDualBoundInDesendants().

Member Data Documentation

◆ basisInfo

int basisInfo
protected

indicate if basis information is including or not

Definition at line 70 of file bbParaNode.h.

Referenced by BbParaNodeTh::bcast(), BbParaNodeMpi::createDatatype(), BbParaNodeTh::receive(), and BbParaNodeTh::receiveNewSubtreeRoot().

◆ depth

◆ dualBoundValue

◆ initialDualBoundValue

double initialDualBoundValue
protected

dual bound value when this node is created This value is updated to precise one when there is guarantee

Definition at line 68 of file bbParaNode.h.

Referenced by BbParaNodeTh::bcast(), BbParaNodeTh::clone(), BbParaNodeMpi::clone(), BbParaNodeMpi::createDatatype(), BbParaNode::getInitialDualBoundValue(), BbParaNodeTh::receive(), BbParaNodeTh::receiveNewSubtreeRoot(), and BbParaNode::resetDualBoundValue().

◆ mergeNodeInfo

BbParaMergeNodeInfo* mergeNodeInfo
protected

◆ mergingStatus

int mergingStatus
protected

merging status: -1 - no merging node, 0 - checking, 1 - merged (representative) 2 - merged to the other node 3 - cannot be merged 4 - merging representative was deleted

Definition at line 71 of file bbParaNode.h.

Referenced by BbParaNodeTh::bcast(), BbParaNodeMpi::createDatatype(), BbParaNode::getMergingStatus(), BbParaNodeTh::receive(), and BbParaNodeTh::receiveNewSubtreeRoot().

◆ next

◆ nodesAreCollected

bool nodesAreCollected
protected

subproblems generated from this nodes are collected at interruption. this field is not transferred

Definition at line 79 of file bbParaNode.h.

Referenced by BbParaNode::areNodesCollected().