37 #ifndef __PARA_TASK_H__ 38 #define __PARA_TASK_H__ 73 globalSubtaskIdInLc(-1),
85 lcId = subtreeId.
lcId;
95 int inGlobalSubtreeIdInLc,
99 globalSubtaskIdInLc(inGlobalSubtreeIdInLc),
120 lcId = subTreeId.
lcId;
134 if( lcId == inSid.
lcId &&
150 if( lcId != inSid.
lcId ||
166 if( lcId < inSid.
lcId )
213 std::ostringstream s;
214 s <<
"(" << lcId <<
"," << globalSubtaskIdInLc <<
"," << solverId <<
")";
258 : subtaskId(inSubtreeId),
322 if( subtaskId < inNid.
subtaskId )
return true;
356 std::ostringstream s;
358 s <<
"[" << (subtaskId.
toString()) <<
":" << seqNum <<
"]";
381 : genealogicalTaskId(taskId)
397 virtual int getType() = 0;
406 return genealogicalTaskId;
502 transferringLcId(lcId)
531 return transferringLcId;
568 generatorTaskId(
TaskId()),
571 diffSubproblemInfo(0),
597 double inEstimatedValue,
601 generatorTaskId(inGeneratorTaskId),
603 estimatedValue(inEstimatedValue),
604 diffSubproblem(inDiffSubproblem)
607 if( diffSubproblem ) diffSubproblemInfo = 1;
608 else diffSubproblemInfo = 0;
617 if( diffSubproblem )
delete diffSubproblem;
631 taskId.
seqNum == -1 )
return true;
643 if( taskId == inTask.
taskId )
return true;
817 return generatorTaskId;
827 generatorTaskId = inGeneratorTaskId;
837 return estimatedValue;
844 double inEstimatedValue
847 estimatedValue = inEstimatedValue;
857 assert( ((!diffSubproblem) && (!diffSubproblemInfo)) || (diffSubproblem && diffSubproblemInfo) );
858 return diffSubproblem;
868 diffSubproblem = inDiffSubproblem;
869 diffSubproblemInfo = 1;
889 if( ancestor )
delete ancestor;
890 ancestor = inAncestor;
900 std::map< TaskId, ParaTaskGenealogicalPtrPtr >::iterator pos;
901 pos = descendants.find(removeTaskId);
902 if( pos != descendants.end() )
905 descendants.erase(pos);
909 for( pos = descendants.begin(); pos != descendants.end(); )
914 std::cout <<
"Descendant TaskId = " << localPtrDescendant->
getTaskId().
toString() << std::endl;
933 return !(descendants.empty());
943 descendants.insert(std::make_pair(inDescendant->
getTaskId(),inDescendant));
987 gzstream::ogzstream &out
999 std::ostringstream s;
1000 s <<
"ParaTaskId = " << (taskId.
toString()) <<
", GeneratorTaskId = " << (generatorTaskId.
toString())
1003 <<
", estimated value = " << estimatedValue << std::endl;
1004 if( diffSubproblem )
1018 std::ostringstream s;
1031 #endif // __PARA_TASK_H__ ParaTaskGenealogicalRemotePtr()
default constructor
static const int ParaTaskLocalPtr
double estimatedValue
estimate value
TaskId & operator=(const UG::TaskId &taskId)
= operator definition
ParaTaskGenealogicalRemotePtr(TaskId taskId, int lcId)
constructor
SubtaskId()
default constructor
int getSolverId() const
getter of Solver id
void setDiffSubproblem(ParaDiffSubproblem *inDiffSubproblem)
setter of diffSubproblem */
int getGlobalSubtaskIdInLc()
getter of global subtask id in Solvers managed by LoadCoordinator
static ScipParaCommTh * comm
Base class for a container which has difference between instance and subproblem.
bool isSameParetntTaskIdAs(const ParaTask &inTask)
check if this task's parent id is the same as that of argument ParaTask's task id ...
long long getSeqNum() const
getter of sequence number
ParaTaskGenealogicalPtr * ancestor
pointer to ancestor ParaTask : This field is not transferred
ParaTaskGenealogicalPtr * getAncestor()
getter of ancestor
SubtaskId subtaskId
subtree id
bool isRootTask()
check if root task or not
TaskId(const TaskId &taskId)
copy constructor
void setSolverId(int id)
setter of Solver id
bool isSameParetntTaskSubtaskIdAs(const TaskId &inTaskId)
check if this task's parent subtree id is the same as that of argument ParaTask's task id ...
virtual const std::string toSimpleString()
stringfy ParaTask as simple string
Defines for UG Framework.
bool operator<(const SubtaskId &inSid) const
< operator definition
ParaTaskGenealogicalLocalPtr()
default constructor
ParaTask(TaskId inTaskId, TaskId inGeneratorTaskId, double inEstimatedValue, ParaDiffSubproblem *inDiffSubproblem)
constructor
int lcId
LoadCoordinator ID.
int transferringLcId
LoadCoordinator id that transfers to or is transferred from.
~ParaTaskGenealogicalLocalPtr()
destructor
bool isSameLcIdAs(const int lcId)
check if this task's global subtask LC id is the same as LC id of argument
int diffSubproblemInfo
1: with diffSubproblem, 0: no diffSubproblem
bool isSameTaskIdAs(const ParaTask &inTask)
check if this task id is the same as argument ParaTask's task id
ParaDiffSubproblem * getDiffSubproblem()
getter of diffSubproblem
bool isSameGlobalSubtaskIdInLcAs(const int globalSubtaskIdInLc)
check if this task's global subtask id in LC is the same as that of argument
void setGlobalSubtaskId(int lcId, int subtaskId)
setter of global subtask id
std::string toString()
stringfy task id
TaskId generatorTaskId
subtree root task id of generator
class of pointer to indicate a ParaTask genealogical relation
int globalSubtaskIdInLc
Global Subtask ID in Solvers managed by LoadCoordinator.
ParaTaskGenealogicalPtr(TaskId taskId)
constructor
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 ...
TaskId getTaskId()
getter of task id
double getEstimatedValue()
getter of estimated value
int getSolverId()
getter of Solver id
ParaTask * getPointerValue()
getter for ParaTask pointer
bool isSameSubtaskIdAs(const ParaTask &inTask)
check if this task's subtask id is the same as that of argument ParaTask's task id ...
ParaDiffSubproblem * diffSubproblem
difference between solving instance data and subproblem data
#define THROW_LOGICAL_ERROR1(msg1)
SubtaskId & operator=(const UG::SubtaskId &subTreeId)
= operator definition
Base class of communicator for UG Framework.
TaskId genealogicalTaskId
descendant TaskId or ascendant TaskId
SubtaskId(const SubtaskId &subtreeId)
copy constructor
bool operator!=(const SubtaskId &inSid) const
!= operator definition
virtual const std::string toString()
stringfy ParaTask
SubtaskId(int inLcId, int inGlobalSubtreeIdInLc, int inSolverId)
constructor
static const int ParaTaskRemotePtr
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 ...
int getType()
getter of pointer type
virtual ~ParaTask()
destructor
Class for the difference between instance and subproblem.
void setEstimatedValue(double inEstimatedValue)
setter of estimated value
class ParaTaskGenealogicalLocalPtr
TaskId(SubtaskId inSubtreeId, int inSeqNum)
constructor
virtual ~ParaTaskGenealogicalPtr()
destructor
int getLcId()
getter of LoadCoordinator id
int getLcId() const
getter of LoadCoordinator id
ParaTask * paraTaskPtr
pointer to ParaTask
void setGeneratorTaskId(TaskId inGeneratorTaskId)
setter of generator task id
virtual const std::string toString()=0
stringfy ParaDiffSubproblem object ( for debugging )
ParaTaskGenealogicalPtr * ParaTaskGenealogicalPtrPtr
int getType()
getter of pointer type
int getPointerValue()
getter of the pointer value
void setAncestor(ParaTaskGenealogicalPtr *inAncestor)
setter of ancestor
void addDescendant(ParaTaskGenealogicalPtr *inDescendant)
add a descendant
void setTaskId(TaskId inTaskId)
setter of task id
SubtaskId getSubtaskId() const
getter of subtask id
~ParaTaskGenealogicalRemotePtr()
destructor
TaskId getGeneratorTaskId()
getter of generator task id
long long seqNum
sequential number in the subtree
bool hasDescendant()
check if this task has descendant or not
int getGlobalSubtreeIdInLc() const
getter of global subtree id in Solvers managed by the LoadCoordinator
ParaTask()
default constructor
std::string toString()
Stringfy SubtreeId.
TaskId getTaskId()
getter of genealogicaltaskId
TaskId()
default constructor
std::map< TaskId, ParaTaskGenealogicalPtrPtr > descendants
collection of pointers to descendants : This filed is not transferred
void removeDescendant(TaskId removeTaskId)
remove a descendant
ParaTask(const ParaTask ¶Task)
copy constructor
TaskId taskId
solving task information
bool operator==(const SubtaskId &inSid) const
== operator definition
class ParaTaskGenealogicalRemotePtr
ParaTaskGenealogicalLocalPtr(TaskId taskId, ParaTask *ptr)
constructor
Base class of communicator object.