Scippy

UG

Ubiquity Generator framework

ParaTask Class Referenceabstract

class ParaTask More...

#include <paraTask.h>

+ Inheritance diagram for ParaTask:

Public Member Functions

 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...
 
virtual ParaTaskclone (ParaComm *comm)=0
 clone this ParaTask 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 const std::string toString ()
 stringfy ParaTask More...
 
virtual const std::string toSimpleString ()
 stringfy ParaTask as simple string More...
 

Public Attributes

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

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 ParaTask

Definition at line 541 of file paraTask.h.

Constructor & Destructor Documentation

◆ ParaTask() [1/3]

ParaTask ( )

default constructor

Definition at line 565 of file paraTask.h.

◆ ParaTask() [2/3]

◆ ParaTask() [3/3]

ParaTask ( TaskId  inTaskId,
TaskId  inGeneratorTaskId,
double  inEstimatedValue,
ParaDiffSubproblem inDiffSubproblem 
)

constructor

Parameters
inTaskIdtask id
inGeneratorTaskIdgenerator task id
inEstimatedValueestimated value
inDiffSubproblempointer to ParaDiffSubproblem object

Definition at line 594 of file paraTask.h.

◆ ~ParaTask()

virtual ~ParaTask ( )
virtual

destructor

Definition at line 614 of file paraTask.h.

Member Function Documentation

◆ addDescendant()

void addDescendant ( ParaTaskGenealogicalPtr inDescendant)

add a descendant

Parameters
inDescendantdescendant ParaTaskGenealogicalPtr

Definition at line 939 of file paraTask.h.

References comm, and ParaTaskGenealogicalPtr::getTaskId().

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

◆ 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

Implemented in BbParaNode, BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaSolver::restartRacing(), BbParaLoadCoordinator::run(), and BbParaSolver::run().

◆ clone()

virtual ParaTask* clone ( ParaComm comm)
pure virtual

clone this ParaTask

Returns
pointer to cloned ParaTask object
Parameters
commcommunicator used

Implemented in BbParaNode, BbParaNodeMpi, and BbParaNodeTh.

◆ getAncestor()

ParaTaskGenealogicalPtr* getAncestor ( )

getter of ancestor

Returns
ancestor ParaTaskGenealogicalPtr

Definition at line 876 of file paraTask.h.

◆ getDiffSubproblem()

ParaDiffSubproblem* getDiffSubproblem ( )

getter of diffSubproblem

Returns
pointer to ParaDiffSubproblem object

Definition at line 854 of file paraTask.h.

Referenced by ScipParaSolver::createSubproblem(), ScipParaSolver::freeSubproblem(), ScipParaSolver::solve(), and ScipParaSolver::writeSubproblem().

◆ getEstimatedValue()

double getEstimatedValue ( )

getter of estimated value

Returns
estimated value

Definition at line 834 of file paraTask.h.

◆ getGeneratorTaskId()

TaskId getGeneratorTaskId ( )

getter of generator task id

Returns
generator task id

Definition at line 814 of file paraTask.h.

Referenced by ScipParaSolver::setBakSettings().

◆ getGlobalSubtaskIdInLc()

int getGlobalSubtaskIdInLc ( )

getter of global subtask id in Solvers managed by LoadCoordinator

Returns
global subtask id

Definition at line 752 of file paraTask.h.

References SubtaskId::globalSubtaskIdInLc, and TaskId::subtaskId.

Referenced by BbParaSolver::sendSolverState().

◆ getLcId()

int getLcId ( )

getter of LoadCoordinator id

Returns
LoadCoordinator id

Definition at line 742 of file paraTask.h.

References SubtaskId::lcId, and TaskId::subtaskId.

Referenced by BbParaSolver::sendSolverState().

◆ getSolverId()

int getSolverId ( )

getter of Solver id

Returns
Solver id

Definition at line 774 of file paraTask.h.

References SubtaskId::solverId, and TaskId::subtaskId.

◆ getTaskId()

TaskId getTaskId ( )

◆ hasDescendant()

bool hasDescendant ( )

check if this task has descendant or not

Returns
true if it has descendant

Definition at line 930 of file paraTask.h.

Referenced by BbParaSolverPool::currentSolvingNodehaeDescendant().

◆ isRootTask()

◆ isSameGlobalSubtaskIdInLcAs() [1/2]

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

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 715 of file paraTask.h.

References SubtaskId::globalSubtaskIdInLc, TaskId::subtaskId, and ParaTask::taskId.

◆ isSameGlobalSubtaskIdInLcAs() [2/2]

bool isSameGlobalSubtaskIdInLcAs ( const int  globalSubtaskIdInLc)

check if this task's global subtask id in LC is the same as that of argument

Returns
true if the both are the same
Parameters
globalSubtaskIdInLcglobal subtask id in LC

Definition at line 729 of file paraTask.h.

References SubtaskId::globalSubtaskIdInLc, and TaskId::subtaskId.

◆ isSameLcIdAs() [1/2]

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

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 688 of file paraTask.h.

References SubtaskId::lcId, TaskId::subtaskId, and ParaTask::taskId.

◆ isSameLcIdAs() [2/2]

bool isSameLcIdAs ( const int  lcId)

check if this task's global subtask LC id is the same as LC id of argument

Returns
true if the both are the same
Parameters
lcIdLC id

Definition at line 702 of file paraTask.h.

References SubtaskId::lcId, and TaskId::subtaskId.

◆ isSameParetntTaskIdAs()

bool isSameParetntTaskIdAs ( const ParaTask inTask)

check if this task's parent id is the same as that of argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 651 of file paraTask.h.

References ParaTask::generatorTaskId.

◆ isSameParetntTaskSubtaskIdAs()

bool isSameParetntTaskSubtaskIdAs ( const TaskId inTaskId)

check if this task's parent subtree id is the same as that of argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskIdParaTask id

Definition at line 663 of file paraTask.h.

References TaskId::subtaskId.

Referenced by BbParaLoadCoordinator::sendParaTasksToIdleSolvers().

◆ isSameSubtaskIdAs()

bool isSameSubtaskIdAs ( const ParaTask inTask)

check if this task's subtask id is the same as that of argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 675 of file paraTask.h.

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

◆ isSameTaskIdAs()

bool isSameTaskIdAs ( const ParaTask inTask)

check if this task id is the same as argument ParaTask's task id

Returns
true if the both are the same
Parameters
inTaskParaTask

Definition at line 639 of file paraTask.h.

References ParaTask::taskId.

◆ receive()

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

receive this object

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

Implemented in BbParaNode, BbParaNodeMpi, and BbParaNodeTh.

Referenced by BbParaSolver::processTagTask().

◆ removeDescendant()

void removeDescendant ( TaskId  removeTaskId)

remove a descendant

not implemented yet

Parameters
removeTaskIdtask id to remove

Definition at line 896 of file paraTask.h.

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

Referenced by BbParaNode::~BbParaNode().

◆ send()

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

send this object

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

Implemented in BbParaNode, BbParaNodeMpi, and BbParaNodeTh.

◆ setAncestor()

void setAncestor ( ParaTaskGenealogicalPtr inAncestor)

setter of ancestor

Parameters
inAncestorancestor ParaTaskGenealogicalPtr

Definition at line 885 of file paraTask.h.

Referenced by BbParaNode::~BbParaNode().

◆ setDiffSubproblem()

void setDiffSubproblem ( ParaDiffSubproblem inDiffSubproblem)

setter of diffSubproblem */

Parameters
inDiffSubproblempointer to ParaDiffSubproblem object

Definition at line 864 of file paraTask.h.

◆ setEstimatedValue()

void setEstimatedValue ( double  inEstimatedValue)

setter of estimated value

Parameters
inEstimatedValueestimated value

Definition at line 843 of file paraTask.h.

Referenced by BbParaLoadCoordinator::restartRacing().

◆ setGeneratorTaskId()

void setGeneratorTaskId ( TaskId  inGeneratorTaskId)

setter of generator task id

Parameters
inGeneratorTaskIdgenerator task id

Definition at line 823 of file paraTask.h.

◆ setGlobalSubtaskId()

void setGlobalSubtaskId ( int  lcId,
int  subtaskId 
)

setter of global subtask id

Parameters
lcIdLoadCorrdinaor id
subtaskIdsubtask id

Definition at line 761 of file paraTask.h.

References SubtaskId::globalSubtaskIdInLc, SubtaskId::lcId, and TaskId::subtaskId.

Referenced by BbParaLoadCoordinator::processTagTask().

◆ setSolverId()

void setSolverId ( int  id)

setter of Solver id

Parameters
idsolver id

Definition at line 783 of file paraTask.h.

References SubtaskId::solverId, and TaskId::subtaskId.

◆ setTaskId()

void setTaskId ( TaskId  inTaskId)

setter of task id

Parameters
inTaskIdtask id

Definition at line 803 of file paraTask.h.

◆ toSimpleString()

virtual const std::string toSimpleString ( )
virtual

stringfy ParaTask as simple string

Returns
string to show inside of this object

Reimplemented in BbParaNode.

Definition at line 1015 of file paraTask.h.

References TaskId::toString().

Referenced by BbParaLoadCoordinator::processTagSelfSlpitNodeCalcuationState(), BbParaLoadCoordinator::processTagSolverState(), and BbParaLoadCoordinator::writeSubtreeInfo().

◆ toString()

virtual const std::string toString ( )
virtual

stringfy ParaTask

Returns
string to show inside of this object

Reimplemented in BbParaNode.

Definition at line 996 of file paraTask.h.

References ParaDiffSubproblem::toString(), and TaskId::toString().

Member Data Documentation

◆ ancestor

pointer to ancestor ParaTask : This field is not transferred

Definition at line 551 of file paraTask.h.

Referenced by BbParaNode::getAncestor(), ParaTask::ParaTask(), BbParaNode::setAncestor(), and BbParaNode::~BbParaNode().

◆ descendants

std::map< TaskId, ParaTaskGenealogicalPtrPtr > descendants

collection of pointers to descendants : This filed is not transferred

Definition at line 552 of file paraTask.h.

Referenced by BbParaNode::addDescendant(), BbParaNode::getMinimumDualBoundInDesendants(), BbParaNode::hasDescendant(), BbParaNode::removeDescendant(), and BbParaNode::~BbParaNode().

◆ diffSubproblem

◆ diffSubproblemInfo

◆ estimatedValue

◆ generatorTaskId

◆ taskId