Scippy

UG

Ubiquity Generator framework

paraTask.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and software framework */
4/* UG --- Ubquity Generator Framework */
5/* */
6/* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7/* Copyright (C) 2021-2024 by Zuse Institute Berlin, */
8/* licensed under LGPL version 3 or later. */
9/* Commercial licenses are available through <licenses@zib.de> */
10/* */
11/* This code is free software; you can redistribute it and/or */
12/* modify it under the terms of the GNU Lesser General Public License */
13/* as published by the Free Software Foundation; either version 3 */
14/* of the License, or (at your option) any later version. */
15/* */
16/* This program is distributed in the hope that it will be useful, */
17/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19/* GNU Lesser General Public License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23/* */
24/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25
26/**@file paraTask.h
27 * @brief Base class for ParaTask.
28 * @author Yuji Shinano
29 *
30 *
31 *
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36
37#ifndef __PARA_TASK_H__
38#define __PARA_TASK_H__
39
40#include <cassert>
41#include <iostream>
42#include <fstream>
43#include <map>
44#include "paraDef.h"
45#include "paraComm.h"
46#ifdef UG_WITH_ZLIB
47#include "gzstream.h"
48#endif
49#include "paraDiffSubproblem.h"
50
51namespace UG
52{
53
54static const int ParaTaskLocalPtr = 0;
55static const int ParaTaskRemotePtr = 1;
56
57///
58/// SubtaskId class
59///
61{
62public:
63 int lcId; ///< LoadCoordinator ID
64 int globalSubtaskIdInLc; ///< Global Subtask ID in Solvers managed by LoadCoordinator
65 int solverId; ///< Solver ID
66
67 ///
68 /// default constructor
69 ///
71 )
72 : lcId(-1),
74 solverId(-1)
75 {
76 }
77
78 ///
79 /// copy constructor
80 ///
82 const SubtaskId& subtreeId
83 )
84 {
85 lcId = subtreeId.lcId;
87 solverId = subtreeId.solverId;
88 }
89
90 ///
91 /// constructor
92 ///
94 int inLcId,
95 int inGlobalSubtreeIdInLc,
96 int inSolverId
97 )
98 : lcId(inLcId),
99 globalSubtaskIdInLc(inGlobalSubtreeIdInLc),
100 solverId(inSolverId)
101 {
102 }
103
104 ///
105 /// destructor
106 ///
108 )
109 {
110 }
111
112 ///
113 /// = operator definition
114 /// @return reference to SubtreeId
115 ///
117 const UG::SubtaskId& subTreeId
118 )
119 {
120 lcId = subTreeId.lcId;
122 solverId = subTreeId.solverId;
123 return *this;
124 }
125
126 ///
127 /// == operator definition
128 /// @return true if this task subtree id is equla to that given by argument
129 ///
131 const SubtaskId& inSid ///< subtree id
132 ) const
133 {
134 if( lcId == inSid.lcId &&
136 solverId == inSid.solverId )
137 return true;
138 else
139 return false;
140 }
141
142 ///
143 /// != operator definition
144 /// @return true if this task subtree id is not that given by argument
145 ///
147 const SubtaskId& inSid ///< subtree id
148 ) const
149 {
150 if( lcId != inSid.lcId ||
152 solverId != inSid.solverId )
153 return true;
154 else
155 return false;
156 }
157
158 ///
159 /// < operator definition
160 /// @return true if this task subtree id is less than that given by argument
161 ///
163 const SubtaskId& inSid ///< subtree id
164 ) const
165 {
166 if( lcId < inSid.lcId )
167 return false;
168 if( lcId == inSid.lcId && globalSubtaskIdInLc < inSid.globalSubtaskIdInLc )
169 return true;
170 if( lcId == inSid.lcId && globalSubtaskIdInLc == inSid.globalSubtaskIdInLc && solverId < inSid.solverId )
171 return true;
172 else
173 return false;
174 }
175
176 ///
177 /// getter of LoadCoordinator id
178 /// @return LoadCoordinator id
179 ///
181 ) const
182 {
183 return lcId;
184 }
185
186 ///
187 /// getter of global subtree id in Solvers managed by the LoadCoordinator
188 /// @return global subtree id in LC
189 ///
191 ) const
192 {
193 return globalSubtaskIdInLc;
194 }
195
196 ///
197 /// getter of Solver id
198 /// @return Solver id
199 ///
201 ) const
202 {
203 return solverId;
204 }
205
206 ///
207 /// Stringfy SubtreeId
208 /// @return sting to show inside of this object
209 ///
210 std::string toString(
211 )
212 {
213 std::ostringstream s;
214 s << "(" << lcId << "," << globalSubtaskIdInLc << "," << solverId << ")";
215 return s.str();
216 }
217};
218
219///
220/// TaskId class
221///
223{
224
225public:
226
227 SubtaskId subtaskId; ///< subtree id
228 long long seqNum; ///< sequential number in the subtree
229
230 ///
231 /// default constructor
232 ///
234 )
235 : subtaskId(SubtaskId()),
236 seqNum(-1)
237 {
238 }
239
240 ///
241 /// copy constructor
242 ///
244 const TaskId& taskId
245 )
246 {
247 subtaskId = taskId.subtaskId;
248 seqNum = taskId.seqNum;
249 }
250
251 ///
252 /// constructor
253 ///
255 SubtaskId inSubtreeId, ///< subtree id
256 int inSeqNum ///< sequential number in the subtree
257 )
258 : subtaskId(inSubtreeId),
259 seqNum(inSeqNum)
260 {
261 }
262
263 ///
264 /// destructor
265 ///
267 )
268 {
269 }
270
271 ///
272 /// = operator definition
273 /// @return reference to TaskId
274 ///
276 const UG::TaskId& taskId
277 )
278 {
279 subtaskId = taskId.subtaskId;
280 seqNum = taskId.seqNum;
281 return *this;
282 }
283
284 ///
285 /// == operator definition
286 /// @return true if task id is equal to that given by argument
287 ///
289 const TaskId& inNid ///< task id
290 ) const
291 {
292 if( subtaskId == inNid.subtaskId &&
293 seqNum == inNid.seqNum )
294 return true;
295 else
296 return false;
297 }
298
299 ///
300 /// != operator definition
301 /// @return true if task id is not equal to that given by argument
302 ///
304 const TaskId& inNid
305 ) const
306 {
307 if( subtaskId != inNid.subtaskId ||
308 seqNum != inNid.seqNum )
309 return true;
310 else
311 return false;
312 }
313
314 ///
315 /// < operator definition
316 /// @return true if task is less than that given by argument
317 ///
319 const TaskId& inNid
320 ) const
321 {
322 if( subtaskId < inNid.subtaskId ) return true;
323 if( subtaskId == inNid.subtaskId && seqNum < inNid.seqNum )
324 return true;
325 else
326 return false;
327 }
328
329 ///
330 /// getter of subtask id
331 /// @return the subtask id
332 ///
334 ) const
335 {
336 return subtaskId;
337 }
338
339 ///
340 /// getter of sequence number
341 /// @return the sequence number
342 ///
343 long long getSeqNum(
344 ) const
345 {
346 return seqNum;
347 }
348
349 ///
350 /// stringfy task id
351 /// @return string to show the task id
352 ///
353 std::string toString(
354 )
355 {
356 std::ostringstream s;
357 // for debug
358 s << "[" << (subtaskId.toString()) << ":" << seqNum << "]";
359 return s.str();
360 }
361};
362
363
364class ParaTask;
365
366///
367/// class of pointer to indicate a ParaTask genealogical relation
368///
370{
371 TaskId genealogicalTaskId; ///< descendant TaskId or ascendant TaskId
372
373public:
374
375 ///
376 /// constructor
377 ///
379 TaskId taskId ///< task id
380 )
381 : genealogicalTaskId(taskId)
382 {
383 }
384
385 ///
386 /// destructor
387 ///
389 )
390 {
391 }
392
393 ///
394 /// getter type which indicate the pointer is local or remote
395 /// @return type, 0: local, 1: remote
396 ///
397 virtual int getType() = 0;
398
399 ///
400 /// getter of genealogicaltaskId
401 /// @return the genealogicalTaskId
402 ///
404 )
405 {
406 return genealogicalTaskId;
407 }
408
409};
410
411///
412/// class ParaTaskGenealogicalLocalPtr
413///
415{
416
417 ParaTask *paraTaskPtr; ///< pointer to ParaTask
418
419public:
420
421 ///
422 /// default constructor
423 ///
425 )
427 paraTaskPtr(0)
428 {
429 }
430
431 ///
432 /// constructor
433 ///
435 TaskId taskId, ///< task id
436 ParaTask *ptr ///< pointer to ParaTask
437 )
438 : ParaTaskGenealogicalPtr(taskId),
439 paraTaskPtr(ptr)
440 {
441 }
442
443 ///
444 /// destructor
445 ///
447 )
448 {
449 }
450
451 ///
452 /// getter of pointer type
453 /// @return 0: local task pointer
454 ///
456 )
457 {
458 return ParaTaskLocalPtr;
459 }
460
461 ///
462 /// getter for ParaTask pointer
463 /// @return the task pointer
464 ///
466 )
467 {
468 return paraTaskPtr;
469 }
470
471};
472
473///
474/// class ParaTaskGenealogicalRemotePtr
475/// @note this class would not be used currently. This class is for future extension
476///
478{
479
480 int transferringLcId; ///< LoadCoordinator id that transfers to or is transferred from
481
482public:
483
484 ///
485 /// default constructor
486 ///
488 )
491 {
492 }
493
494 ///
495 /// constructor
496 ///
498 TaskId taskId,
499 int lcId
500 )
501 : ParaTaskGenealogicalPtr(taskId),
502 transferringLcId(lcId)
503 {
504 }
505
506 ///
507 /// destructor
508 ///
510 )
511 {
512 }
513
514 ///
515 /// getter of pointer type
516 /// @return 1: remote
517 ///
519 )
520 {
521 return ParaTaskRemotePtr;
522 }
523
524 ///
525 /// getter of the pointer value
526 /// @return LC id
527 ///
529 )
530 {
531 return transferringLcId;
532 }
533
534};
535
537
538///
539/// class ParaTask
540///
542{
543
544public:
545
546 ///
547 /// solving task information
548 ///
549 TaskId taskId; ///< solving task id
550 TaskId generatorTaskId; ///< subtree root task id of generator
551 ParaTaskGenealogicalPtr *ancestor; ///< pointer to ancestor ParaTask : This field is not transferred
552 std::map< TaskId, ParaTaskGenealogicalPtrPtr > descendants; ///< collection of pointers to descendants : This filed is not transferred
553
554protected:
555
556 double estimatedValue; ///< estimate value
557 int diffSubproblemInfo; ///< 1: with diffSubproblem, 0: no diffSubproblem
558 ParaDiffSubproblem *diffSubproblem; ///< difference between solving instance data and subproblem data
559
560public:
561
562 ///
563 /// default constructor
564 ///
566 )
567 : taskId(TaskId()),
569 ancestor(0),
570 estimatedValue(0.0),
573 {
574 }
575
576 ///
577 /// copy constructor
578 ///
580 const ParaTask& paraTask
581 )
582 {
583 taskId = paraTask.taskId;
585 ancestor = paraTask.ancestor;
589 }
590
591 ///
592 /// constructor
593 ///
595 TaskId inTaskId, ///< task id
596 TaskId inGeneratorTaskId, ///< generator task id
597 double inEstimatedValue, ///< estimated value
598 ParaDiffSubproblem *inDiffSubproblem ///< pointer to ParaDiffSubproblem object
599 )
600 : taskId(inTaskId),
601 generatorTaskId(inGeneratorTaskId),
602 ancestor(0),
603 estimatedValue(inEstimatedValue),
604 diffSubproblem(inDiffSubproblem)
605
606 {
608 else diffSubproblemInfo = 0;
609 }
610
611 ///
612 /// destructor
613 ///
614 virtual ~ParaTask(
615 )
616 {
617 if( diffSubproblem ) delete diffSubproblem;
618 }
619
620 ///
621 /// check if root task or not
622 /// @return true if this task is the root task
623 ///
625 )
626 {
627 // we want to know on which solver on which LC is managed is to generate the root
628 if( taskId.subtaskId.lcId == -1 &&
630 taskId.subtaskId.solverId == -1 &&
631 taskId.seqNum == -1 ) return true;
632 else return false;
633 }
634
635 ///
636 /// check if this task id is the same as argument ParaTask's task id
637 /// @return true if the both are the same
638 ///
640 const ParaTask& inTask ///< ParaTask
641 )
642 {
643 if( taskId == inTask.taskId ) return true;
644 else return false;
645 }
646
647 ///
648 /// check if this task's parent id is the same as that of argument ParaTask's task id
649 /// @return true if the both are the same
650 ///
652 const ParaTask& inTask ///< ParaTask
653 )
654 {
655 if( generatorTaskId == inTask.generatorTaskId ) return true;
656 else return false;
657 }
658
659 ///
660 /// check if this task's parent subtree id is the same as that of argument ParaTask's task id
661 /// @return true if the both are the same
662 ///
664 const TaskId& inTaskId ///< ParaTask id
665 )
666 {
667 if( generatorTaskId.subtaskId == inTaskId.subtaskId ) return true;
668 else return false;
669 }
670
671 ///
672 /// check if this task's subtask id is the same as that of argument ParaTask's task id
673 /// @return true if the both are the same
674 ///
676 const ParaTask& inTask ///< ParaTask
677 )
678 {
679 if( taskId.subtaskId == inTask.taskId.subtaskId )
680 return true;
681 else return false;
682 }
683
684 ///
685 /// check if this task's global subtask id in LC is the same as that of argument ParaTask's task id
686 /// @return true if the both are the same
687 ///
689 const ParaTask& inTask ///< ParaTask
690 )
691 {
693 == inTask.taskId.subtaskId.lcId )
694 return true;
695 else return false;
696 }
697
698 ///
699 /// check if this task's global subtask LC id is the same as LC id of argument
700 /// @return true if the both are the same
701 ///
703 const int lcId ///< LC id
704 )
705 {
706 if( taskId.subtaskId.lcId == lcId )
707 return true;
708 else return false;
709 }
710
711 ///
712 /// check if this task's global subtask id in LC is the same as that of argument ParaTask's task id
713 /// @return true if the both are the same
714 ///
716 const ParaTask& inTask ///< ParaTask
717 )
718 {
721 return true;
722 else return false;
723 }
724
725 ///
726 /// check if this task's global subtask id in LC is the same as that of argument
727 /// @return true if the both are the same
728 ///
730 const int globalSubtaskIdInLc ///< global subtask id in LC
731 )
732 {
733 if( taskId.subtaskId.globalSubtaskIdInLc == globalSubtaskIdInLc )
734 return true;
735 else return false;
736 }
737
738 ///
739 /// getter of LoadCoordinator id
740 /// @return LoadCoordinator id
741 ///
743 )
744 {
745 return taskId.subtaskId.lcId;
746 }
747
748 ///
749 /// getter of global subtask id in Solvers managed by LoadCoordinator
750 /// @return global subtask id
751 ///
753 )
754 {
756 }
757
758 ///
759 /// setter of global subtask id
760 ///
762 int lcId, ///< LoadCorrdinaor id
763 int subtaskId ///< subtask id
764 )
765 {
766 taskId.subtaskId.lcId = lcId;
768 }
769
770 ///
771 /// getter of Solver id
772 /// @return Solver id
773 ///
775 )
776 {
778 }
779
780 ///
781 /// setter of Solver id
782 ///
784 int id ///< solver id
785 )
786 {
788 }
789
790 ///
791 /// getter of task id
792 /// @return task id
793 ///
795 )
796 {
797 return taskId;
798 }
799
800 ///
801 /// setter of task id
802 ///
804 TaskId inTaskId ///< task id
805 )
806 {
807 taskId = inTaskId;
808 }
809
810 ///
811 /// getter of generator task id
812 /// @return generator task id
813 ///
815 )
816 {
817 return generatorTaskId;
818 }
819
820 ///
821 /// setter of generator task id
822 ///
824 TaskId inGeneratorTaskId ///< generator task id
825 )
826 {
827 generatorTaskId = inGeneratorTaskId;
828 }
829
830 ///
831 /// getter of estimated value
832 /// @return estimated value
833 ///
835 )
836 {
837 return estimatedValue;
838 }
839
840 ///
841 /// setter of estimated value
842 ///
844 double inEstimatedValue ///< estimated value
845 )
846 {
847 estimatedValue = inEstimatedValue;
848 }
849
850 ///
851 /// getter of diffSubproblem
852 /// @return pointer to ParaDiffSubproblem object
853 ///
855 )
856 {
858 return diffSubproblem;
859 }
860
861 ///
862 /// setter of diffSubproblem */
863 ///
865 ParaDiffSubproblem *inDiffSubproblem ///< pointer to ParaDiffSubproblem object
866 )
867 {
868 diffSubproblem = inDiffSubproblem;
870 }
871
872 ///
873 /// getter of ancestor
874 /// @return ancestor ParaTaskGenealogicalPtr
875 ///
877 )
878 {
879 return ancestor;
880 }
881
882 ///
883 /// setter of ancestor
884 ///
886 ParaTaskGenealogicalPtr *inAncestor ///< ancestor ParaTaskGenealogicalPtr
887 )
888 {
889 if( ancestor ) delete ancestor;
890 ancestor = inAncestor;
891 }
892
893 ///
894 /// remove a descendant
895 ///
897 TaskId removeTaskId ///< task id to remove
898 )
899 {
900 std::map< TaskId, ParaTaskGenealogicalPtrPtr >::iterator pos;
901 pos = descendants.find(removeTaskId);
902 if( pos != descendants.end() )
903 {
904 delete pos->second;
905 descendants.erase(pos);
906 }
907 else
908 {
909 for( pos = descendants.begin(); pos != descendants.end(); )
910 {
911 if( pos->second->getType() == ParaTaskLocalPtr )
912 {
913 ParaTaskGenealogicalLocalPtr *localPtrDescendant = dynamic_cast< ParaTaskGenealogicalLocalPtr * >(pos->second);
914 std::cout << "Descendant TaskId = " << localPtrDescendant->getTaskId().toString() << std::endl;
915 }
916 else
917 {
918 /** not implemented yet */
919 }
920 pos++;
921 }
922 THROW_LOGICAL_ERROR1("invalid TaskId removed!");
923 }
924 }
925
926 ///
927 /// check if this task has descendant or not
928 /// @return true if it has descendant
929 ///
931 )
932 {
933 return !(descendants.empty());
934 }
935
936 ///
937 /// add a descendant
938 ///
940 ParaTaskGenealogicalPtr *inDescendant ///< descendant ParaTaskGenealogicalPtr
941 )
942 {
943 descendants.insert(std::make_pair(inDescendant->getTaskId(),inDescendant));
944 }
945
946 ///
947 /// clone this ParaTask
948 /// @return pointer to cloned ParaTask object
949 ///
950 virtual ParaTask* clone(
951 ParaComm *comm ///< communicator used
952 ) = 0;
953
954 ///
955 /// broadcast this object
956 /// @return always 0 (for future extensions)
957 ///
958 virtual int bcast(
959 ParaComm *comm, ///< communicator used
960 int root ///< root rank of broadcast
961 ) = 0;
962
963 ///
964 /// send this object
965 /// @return always 0 (for future extensions)
966 ///
967 virtual int send(
968 ParaComm *comm, ///< communicator used
969 int destination ///< destination rank
970 ) = 0;
971
972 ///
973 /// receive this object
974 /// @return always 0 (for future extensions)
975 ///
976 virtual int receive(
977 ParaComm *comm, ///< communicator used
978 int source ///< source rank
979 ) = 0;
980
981#ifdef UG_WITH_ZLIB
982
983 ///
984 /// write to checkpoint file
985 ///
986 virtual void write(
987 gzstream::ogzstream &out ///< gzstream for output
988 ) = 0;
989
990#endif
991
992 ///
993 /// stringfy ParaTask
994 /// @return string to show inside of this object
995 ///
996 virtual const std::string toString(
997 )
998 {
999 std::ostringstream s;
1000 s << "ParaTaskId = " << (taskId.toString()) << ", GeneratorTaskId = " << (generatorTaskId.toString())
1001 // << ", depth = " << depth << ", dual bound value = " << dualBoundValue
1002 // << ", initialDualBoundValue = " << initialDualBoundValue
1003 << ", estimated value = " << estimatedValue << std::endl;
1004 if( diffSubproblem )
1005 {
1006 s << diffSubproblem->toString();
1007 }
1008 return s.str();
1009 }
1010
1011 ///
1012 /// stringfy ParaTask as simple string
1013 /// @return string to show inside of this object
1014 ///
1015 virtual const std::string toSimpleString(
1016 )
1017 {
1018 std::ostringstream s;
1019 s << taskId.toString()
1020 << ", "
1022 return s.str();
1023 }
1024
1025};
1026
1028
1029}
1030
1031#endif // __PARA_TASK_H__
1032
Base class of communicator object.
Definition: paraComm.h:102
Class for the difference between instance and subproblem.
virtual const std::string toString()=0
stringfy ParaDiffSubproblem object ( for debugging )
class ParaTaskGenealogicalLocalPtr
Definition: paraTask.h:415
ParaTask * paraTaskPtr
pointer to ParaTask
Definition: paraTask.h:417
ParaTaskGenealogicalLocalPtr()
default constructor
Definition: paraTask.h:424
~ParaTaskGenealogicalLocalPtr()
destructor
Definition: paraTask.h:446
ParaTask * getPointerValue()
getter for ParaTask pointer
Definition: paraTask.h:465
int getType()
getter of pointer type
Definition: paraTask.h:455
ParaTaskGenealogicalLocalPtr(TaskId taskId, ParaTask *ptr)
constructor
Definition: paraTask.h:434
class of pointer to indicate a ParaTask genealogical relation
Definition: paraTask.h:370
virtual int getType()=0
getter type which indicate the pointer is local or remote
ParaTaskGenealogicalPtr(TaskId taskId)
constructor
Definition: paraTask.h:378
TaskId genealogicalTaskId
descendant TaskId or ascendant TaskId
Definition: paraTask.h:371
TaskId getTaskId()
getter of genealogicaltaskId
Definition: paraTask.h:403
virtual ~ParaTaskGenealogicalPtr()
destructor
Definition: paraTask.h:388
class ParaTaskGenealogicalRemotePtr
Definition: paraTask.h:478
ParaTaskGenealogicalRemotePtr()
default constructor
Definition: paraTask.h:487
int transferringLcId
LoadCoordinator id that transfers to or is transferred from.
Definition: paraTask.h:480
~ParaTaskGenealogicalRemotePtr()
destructor
Definition: paraTask.h:509
int getPointerValue()
getter of the pointer value
Definition: paraTask.h:528
ParaTaskGenealogicalRemotePtr(TaskId taskId, int lcId)
constructor
Definition: paraTask.h:497
int getType()
getter of pointer type
Definition: paraTask.h:518
class ParaTask
Definition: paraTask.h:542
ParaTask(TaskId inTaskId, TaskId inGeneratorTaskId, double inEstimatedValue, ParaDiffSubproblem *inDiffSubproblem)
constructor
Definition: paraTask.h:594
bool isRootTask()
check if root task or not
Definition: paraTask.h:624
void setEstimatedValue(double inEstimatedValue)
setter of estimated value
Definition: paraTask.h:843
virtual int bcast(ParaComm *comm, int root)=0
broadcast this object
bool isSameParetntTaskSubtaskIdAs(const TaskId &inTaskId)
check if this task's parent subtree id is the same as that of argument ParaTask's task id
Definition: paraTask.h:663
void setGeneratorTaskId(TaskId inGeneratorTaskId)
setter of generator task id
Definition: paraTask.h:823
ParaTask(const ParaTask &paraTask)
copy constructor
Definition: paraTask.h:579
bool isSameGlobalSubtaskIdInLcAs(const int globalSubtaskIdInLc)
check if this task's global subtask id in LC is the same as that of argument
Definition: paraTask.h:729
TaskId getGeneratorTaskId()
getter of generator task id
Definition: paraTask.h:814
void setTaskId(TaskId inTaskId)
setter of task id
Definition: paraTask.h:803
int diffSubproblemInfo
1: with diffSubproblem, 0: no diffSubproblem
Definition: paraTask.h:557
void setSolverId(int id)
setter of Solver id
Definition: paraTask.h:783
ParaDiffSubproblem * diffSubproblem
difference between solving instance data and subproblem data
Definition: paraTask.h:558
bool isSameTaskIdAs(const ParaTask &inTask)
check if this task id is the same as argument ParaTask's task id
Definition: paraTask.h:639
std::map< TaskId, ParaTaskGenealogicalPtrPtr > descendants
collection of pointers to descendants : This filed is not transferred
Definition: paraTask.h:552
TaskId taskId
solving task information
Definition: paraTask.h:549
bool hasDescendant()
check if this task has descendant or not
Definition: paraTask.h:930
virtual void write(gzstream::ogzstream &out)=0
write to checkpoint file
ParaTaskGenealogicalPtr * ancestor
pointer to ancestor ParaTask : This field is not transferred
Definition: paraTask.h:551
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
Definition: paraTask.h:688
void setDiffSubproblem(ParaDiffSubproblem *inDiffSubproblem)
setter of diffSubproblem *‍/
Definition: paraTask.h:864
void removeDescendant(TaskId removeTaskId)
remove a descendant
Definition: paraTask.h:896
virtual int send(ParaComm *comm, int destination)=0
send this object
double estimatedValue
estimate value
Definition: paraTask.h:556
void addDescendant(ParaTaskGenealogicalPtr *inDescendant)
add a descendant
Definition: paraTask.h:939
virtual int receive(ParaComm *comm, int source)=0
receive this object
virtual ~ParaTask()
destructor
Definition: paraTask.h:614
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
Definition: paraTask.h:715
int getGlobalSubtaskIdInLc()
getter of global subtask id in Solvers managed by LoadCoordinator
Definition: paraTask.h:752
void setAncestor(ParaTaskGenealogicalPtr *inAncestor)
setter of ancestor
Definition: paraTask.h:885
int getLcId()
getter of LoadCoordinator id
Definition: paraTask.h:742
virtual ParaTask * clone(ParaComm *comm)=0
clone this ParaTask
bool isSameLcIdAs(const int lcId)
check if this task's global subtask LC id is the same as LC id of argument
Definition: paraTask.h:702
TaskId generatorTaskId
subtree root task id of generator
Definition: paraTask.h:550
int getSolverId()
getter of Solver id
Definition: paraTask.h:774
bool isSameParetntTaskIdAs(const ParaTask &inTask)
check if this task's parent id is the same as that of argument ParaTask's task id
Definition: paraTask.h:651
virtual const std::string toString()
stringfy ParaTask
Definition: paraTask.h:996
void setGlobalSubtaskId(int lcId, int subtaskId)
setter of global subtask id
Definition: paraTask.h:761
TaskId getTaskId()
getter of task id
Definition: paraTask.h:794
ParaTaskGenealogicalPtr * getAncestor()
getter of ancestor
Definition: paraTask.h:876
bool isSameSubtaskIdAs(const ParaTask &inTask)
check if this task's subtask id is the same as that of argument ParaTask's task id
Definition: paraTask.h:675
virtual const std::string toSimpleString()
stringfy ParaTask as simple string
Definition: paraTask.h:1015
ParaDiffSubproblem * getDiffSubproblem()
getter of diffSubproblem
Definition: paraTask.h:854
double getEstimatedValue()
getter of estimated value
Definition: paraTask.h:834
ParaTask()
default constructor
Definition: paraTask.h:565
SubtaskId class.
Definition: paraTask.h:61
SubtaskId(const SubtaskId &subtreeId)
copy constructor
Definition: paraTask.h:81
int getGlobalSubtreeIdInLc() const
getter of global subtree id in Solvers managed by the LoadCoordinator
Definition: paraTask.h:190
int globalSubtaskIdInLc
Global Subtask ID in Solvers managed by LoadCoordinator.
Definition: paraTask.h:64
SubtaskId(int inLcId, int inGlobalSubtreeIdInLc, int inSolverId)
constructor
Definition: paraTask.h:93
bool operator==(const SubtaskId &inSid) const
== operator definition
Definition: paraTask.h:130
int lcId
LoadCoordinator ID.
Definition: paraTask.h:63
bool operator<(const SubtaskId &inSid) const
< operator definition
Definition: paraTask.h:162
int solverId
Solver ID.
Definition: paraTask.h:65
int getSolverId() const
getter of Solver id
Definition: paraTask.h:200
bool operator!=(const SubtaskId &inSid) const
!= operator definition
Definition: paraTask.h:146
SubtaskId & operator=(const UG::SubtaskId &subTreeId)
= operator definition
Definition: paraTask.h:116
int getLcId() const
getter of LoadCoordinator id
Definition: paraTask.h:180
std::string toString()
Stringfy SubtreeId.
Definition: paraTask.h:210
~SubtaskId()
destructor
Definition: paraTask.h:107
SubtaskId()
default constructor
Definition: paraTask.h:70
TaskId class.
Definition: paraTask.h:223
long long seqNum
sequential number in the subtree
Definition: paraTask.h:228
TaskId(const TaskId &taskId)
copy constructor
Definition: paraTask.h:243
TaskId(SubtaskId inSubtreeId, int inSeqNum)
constructor
Definition: paraTask.h:254
~TaskId()
destructor
Definition: paraTask.h:266
SubtaskId getSubtaskId() const
getter of subtask id
Definition: paraTask.h:333
TaskId & operator=(const UG::TaskId &taskId)
= operator definition
Definition: paraTask.h:275
TaskId()
default constructor
Definition: paraTask.h:233
SubtaskId subtaskId
subtree id
Definition: paraTask.h:227
bool operator!=(const TaskId &inNid) const
!= operator definition
Definition: paraTask.h:303
std::string toString()
stringfy task id
Definition: paraTask.h:353
long long getSeqNum() const
getter of sequence number
Definition: paraTask.h:343
bool operator<(const TaskId &inNid) const
< operator definition
Definition: paraTask.h:318
bool operator==(const TaskId &inNid) const
== operator definition
Definition: paraTask.h:288
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Utilities for handling gzipped input and output streams.
ParaTaskGenealogicalPtr * ParaTaskGenealogicalPtrPtr
Definition: paraTask.h:536
static const int ParaTaskLocalPtr
Definition: paraTask.h:54
ParaTask * ParaTaskPtr
Definition: paraTask.h:1027
static const int ParaTaskRemotePtr
Definition: paraTask.h:55
Base class of communicator for UG Framework.
Defines for UG Framework.
#define THROW_LOGICAL_ERROR1(msg1)
Definition: paraDef.h:52
Base class for a container which has difference between instance and subproblem.