Scippy

UG

Ubiquity Generator framework

bbParaSolverPool.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 bbParaSolverPool.h
27 * @brief Solver pool.
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 __BB_PARA_SOLVER_POOL_H__
38#define __BB_PARA_SOLVER_POOL_H__
39#include <cstdlib>
40#include <map>
41#include "ug/paraTask.h"
42#include "ug/paraTimer.h"
45#include "ug/paraSolverPool.h"
47#include "bbParaNodePool.h"
48
49namespace UG
50{
51
52class BbParaSolverPoolElement;
54
55// enum SolverStatus {Inactive, Racing, RacingEvaluation, Active, Dead};
56
57// #define SOLVER_POOL_INDEX( rank ) ( rank - originRank )
58
59///
60/// class BbParaSolverPoolElement
61/// (This class includes information about a Solver status)
62///
64{
65
66 int rank; ///< rank of the Solver
67 SolverStatus status; ///< status of the Solver
68 bool collectingMode; ///< indicate if current Solver is in collecting mode or not
69 bool candidateOfCollecting; ///< indicate that this Solver is a candidate of collecting mode Solver
70 bool generator; ///< this Solver can generate subproblems
71 bool collectingIsProhibited; ///< collecting is temporary prohibited
72 bool dualBoundGainTesting; ///< indicate that dual bound gain is testing or not
73 BbParaNode *currentNode; ///< solving node
74 BbParaNode *selfSplitNodes; ///< list of nodes generated by self-split ramp-up
75 BbParaSolverPoolElementPtr *selectionHeapElement; ///< pointer to selection heap element
76 BbParaSolverPoolElementPtr *collectingModeSolverHeapElement; ///< pointer to collecting mode heap element
77 ///------------------------------------------------------------------
78 /// the following values are used to make decision for load balancing
79 ///------------------------------------------------------------------
80 long long numOfNodesSolved; ///< number of nodes solved.
81 ///< -1 is the special value which means never updated in racing
82 int numOfDiffNodesSolved; ///< number of nodes solved difference between current number and
83 ///< that in the previous notification time
84 int numOfNodesLeft; ///< number of nodes left
85 int numOfDiffNodesLeft; ///< number of nodes left difference between current number
86 ///< and that in the previous notification time
87 double bestDualBoundValue; ///< best dual bound value of the Solver
88 ParaSolverTerminationState *termState; ///< Solver termination statistics: for checkpoint
89
90public :
91
92 ///
93 /// constructor
94 ///
96 int inRank
97 )
98 : rank(inRank),
100 collectingMode(false),
102 generator(true),
105 currentNode(0),
114 // racingRampUpParamSet(0),
115 termState(0)
116 {
117 }
118
119 ///
120 /// destractor
121 ///
123 )
124 {
125 if( currentNode ) delete currentNode;
126 if( selfSplitNodes )
127 {
128 while( selfSplitNodes )
129 {
132 delete temp;
133 }
134 }
135 if( termState ) delete termState;
136 }
137
138 ///
139 /// get rank of the Solver
140 /// @return rank of Solver
141 ///
143 )
144 {
145 return rank;
146 }
147
148 ///
149 /// get current solving BbParaNode
150 /// @return pointer to BbParaNode object
151 ///
153 )
154 {
155 return currentNode;
156 }
157
158 ///
159 /// get a list of nodes which are generated by self-split ramp-up
160 /// @return pointer to BbParaNode object
161 ///
163 )
164 {
165 return selfSplitNodes;
166 }
167
168 ///
169 /// extract a list of nodes which are generated by self-split ramp-up
170 /// @return pointer to BbParaNode object
171 ///
173 )
174 {
175 BbParaNode *nodes = selfSplitNodes;
176 selfSplitNodes = 0;
177 return nodes;
178 }
179
180 /*
181 ///
182 /// remove bounded BbParaNodes by given incumbnet value
183 /// @return the number of bounded BbParaNodes
184 ///
185 int removeBoundedNodes(
186 double incumbentValue ///< incumbent value
187 )
188 {
189 int n;
190 BbParaNode *preNode = selfSplitNodes;
191 BbParaNode *node = selfSplitNodes;
192 while( node )
193 {
194 if( node->getDualBoundValue() > incumbentValue )
195 {
196 if( preNode == selfSplitNodes ) // head
197 {
198 selfSplitNodes = node->next;
199 preNode = selfSplitNodes;
200 delete node;
201 node = selfSplitNodes;
202 }
203 else
204 {
205 preNode->next = node->next;
206 delete node;
207 node = preNode->next;
208 }
209 n++;
210 }
211 }
212 return n;
213 }
214 */
215
216 ///
217 /// add subtree root node
218 ///
220 BbParaNode *inNode ///< BbParaNode to be added
221 )
222 {
223 assert( !inNode->isRootTask() );
224 if( selfSplitNodes )
225 {
226 /// add the end, since it would be most like to be solved in this order
228 while( node->next )
229 {
230 node = node->next;
231 }
232 node->next = inNode;
233 }
234 else
235 {
236 selfSplitNodes = inNode;
237 }
238 }
239
240 ///
241 /// make subtree root node current
242 ///
244 BbParaNode *inNode ///< BbParaNode to become current
245 )
246 {
247 if( selfSplitNodes )
248 {
249 // assert( currentNode->next ); // can be next = 0
250 if( selfSplitNodes->isSameNodeIdAs( *inNode ) )
251 {
254 currentNode->next = 0;
255 }
256 else
257 {
258 if( selfSplitNodes->next )
259 {
262 while( node && ! node->isSameNodeIdAs( *inNode ) )
263 {
264 prev = node;
265 node = node->next;
266 }
267 assert( node );
268 prev->next = node->next;
269 currentNode = node;
270 currentNode->next = 0;
271 }
272 else
273 {
274 THROW_LOGICAL_ERROR1("Should not be called. If whole subtrees are removed, TagComleation should be sent and should be inactivated.");
275 }
276 }
277 }
278 else
279 {
280 THROW_LOGICAL_ERROR1("Tried to make invalid BbParaNode to become current");
281 }
282 }
283
284 ///
285 /// remove subtree root node in self-split nodes list
286 ///
288 BbParaNode *inNode ///< BbParaNode to be removed
289 )
290 {
291 assert( selfSplitNodes );
292
293 if( selfSplitNodes->isSameNodeIdAs( *inNode ) )
294 {
297 delete node;
298 return;
299 }
300 else
301 {
302 if( selfSplitNodes->next )
303 {
306 while( node && ! node->isSameNodeIdAs( *inNode ) )
307 {
308 prev = node;
309 node = node->next;
310 }
311 assert( node );
312 prev->next = node->next;
313 delete node;
314 return;
315 }
316 else
317 {
318 THROW_LOGICAL_ERROR1("Should not be called. If whole subtrees are removed, TagComleation should be sent and should be inactivated.");
319 }
320 }
321 }
322
323 ///
324 /// extract subtree root node
325 ///
327 BbParaNode *inNode ///< BbParaNode to be removed
328 )
329 {
330 if( selfSplitNodes )
331 {
332 // assert( currentNode->next ); // can be next = 0
333 if( selfSplitNodes->isSameNodeIdAs( *inNode ) )
334 {
337 node->next = 0;
338 return node;
339 }
340 else
341 {
342 if( selfSplitNodes->next )
343 {
346 while( node && ! node->isSameNodeIdAs( *inNode ) )
347 {
348 prev = node;
349 node = node->next;
350 }
351 assert( node );
352 prev->next = node->next;
353 node->next = 0;
354 return node;
355 }
356 else
357 {
358 THROW_LOGICAL_ERROR1("Should not be called. If whole subtrees are removed, TagComleation should be sent and should be inactivated.");
359 }
360 }
361 }
362 else
363 {
364 THROW_LOGICAL_ERROR1("Tried to remove invalid BbParaNode as a subtree root node");
365 }
366 }
367
368 ///
369 /// extract current solving BbParaNode
370 /// @return pointer to BbParaNode object
371 ///
373 )
374 {
375 assert( !currentNode->next );
376 BbParaNode *node = currentNode;
377 currentNode = 0;
378 return node;
379 }
380
381 ///
382 /// delete current solving BbParaNode
383 ///
385 )
386 {
387 assert( !currentNode->next );
388 delete currentNode;
389 currentNode = 0;
390 }
391
392
393 ///
394 /// extract current solving BbParaNode
395 /// @return pointer to BbParaNode object
396 ///
397// BbParaNode *extractCurrentNodeGeneratedBySelfSplit(
398// )
399// {
400// // assert( currentNode->next ); /// can be next == 0
401// BbParaNode *node = currentNode;
402// currentNode = 0;
403// return node;
404// }
405
406 ///
407 /// get selection heap element
408 /// @return pointer to BbParaSolverPoolElementPtr
409 ///
411 )
412 {
414 }
415
416 ///
417 /// set selection heap element
418 ///
420 BbParaSolverPoolElementPtr *inSelectionHeapElement ///< selection heap element
421 )
422 {
423 selectionHeapElement = inSelectionHeapElement;
424 }
425
426 ///
427 /// get collecting mode Solver heap element
428 /// @return pointer to BbParaSolverPoolElementPtr
429 ///
431 )
432 {
434 }
435
436 ///
437 /// set collecting mode Solver heap element
438 ///
440 BbParaSolverPoolElementPtr *inCollectingModeSolverHeapElement ///< collecting mode Solver heap element
441 )
442 {
443 collectingModeSolverHeapElement = inCollectingModeSolverHeapElement;
444 }
445
446 ///
447 /// get number of nodes solved
448 /// @return number of nodes solved
449 ///
451 )
452 {
453 return numOfNodesSolved;
454 }
455
456 ///
457 /// get number of nodes left
458 /// @return number of nodes left
459 ///
461 )
462 {
463 return numOfNodesLeft;
464 }
465
466 ///
467 /// set number of nodes solved
468 ///
470 long long inNumOfNodesSolved ///< number of nodes solved
471 )
472 {
473 numOfNodesSolved = inNumOfNodesSolved;
474 }
475
476 ///
477 /// get number of nodes left difference between current number and that in the previous notification time
478 /// @return number of nodes left difference between current number and that in the previous notification time
479 ///
481 )
482 {
484 }
485
486 ///
487 /// set number of nodes left difference between current number and that in the previous notification time
488 ///
490 int inNumOfDiff ///< number of nodes left difference between current number
491 ///< and that in the previous notification time
492 )
493 {
494 numOfDiffNodesSolved = inNumOfDiff;
495 }
496
497 ///
498 /// set number of nodes left
499 ///
501 int inNumOfNodesLeft ///< number of nodes left
502 )
503 {
504 numOfNodesLeft = inNumOfNodesLeft;
505 }
506
507 ///
508 /// set dual bound value on paraNode
509 ///
511 double dualBoundValue ///< dual bound value
512 )
513 {
514 dynamic_cast<BbParaNode *>(currentNode)->setDualBoundValue(dualBoundValue);
515 }
516
517 ///
518 /// get number of nodes left difference between current number and that in the previous notification time
519 /// @return number of nodes left difference between current number and that in the previous notification time
520 ///
522 )
523 {
524 return numOfDiffNodesLeft;
525 }
526
527 ///
528 /// set number of nodes left difference between current number and that in the previous notification time
529 ///
531 int inNumOfDiff ///< set number of nodes left difference between current number
532 ///< and that in the previous notification time
533 )
534 {
535 numOfDiffNodesLeft = inNumOfDiff;
536 }
537
538 ///
539 /// get best dual bound value
540 /// @return best dual bound value
541 ///
543 )
544 {
545 return bestDualBoundValue;
546 }
547
548 ///
549 /// set best dual bound value
550 ///
552 double inBestDualBoundValue ///< best dual bound value
553 )
554 {
555 bestDualBoundValue = inBestDualBoundValue;
556 }
557
558 ///
559 /// activate this Solver
560 ///
562 BbParaNode *inNode ///< pointer to BbParaNode object to activate Solver
563 )
564 {
565 status = Active;
566 currentNode = inNode;
567 if( currentNode )
569 else
570 bestDualBoundValue = -DBL_MAX;
572 numOfNodesLeft = 1; // at least 1 node should be left
573 }
574
575 ///
576 /// activate this Solver as a racing Solver
577 ///
579 )
580 {
581 status = Racing;
582 currentNode = 0;
583 numOfNodesSolved = -1;
584 bestDualBoundValue = -DBL_MAX;
585 numOfNodesLeft = 1; // at least 1 node should be left
586 }
587
588 ///
589 /// inactivate this Solver
590 ///
592 )
593 {
595 if( currentNode )
596 {
597 delete currentNode;
598 currentNode = 0;
599 }
600 collectingMode = false;
601 candidateOfCollecting = false;
603 dualBoundGainTesting = false;
604 /** do not touch "generator" **/
606 numOfNodesLeft = 0;
608 bestDualBoundValue = 0.0;
609 }
610
611 ///
612 /// kill this Solver
613 /// @return pointer to BbParaNode object assigned to this Solver
614 ///
616 )
617 {
618 status = Dead;
619 collectingMode = false;
620 candidateOfCollecting = false;
622 dualBoundGainTesting = false;
624 numOfNodesLeft = 0;
626 bestDualBoundValue = 0.0;
627 BbParaNode* node = currentNode;
628 currentNode = 0;
629 return node;
630 }
631
632 ///
633 /// get Solver status
634 /// @return Solver status
635 ///
637 )
638 {
639 return status;
640 }
641
642 ///
643 /// set TerminateRequseted on Solver status
644 ///
646 )
647 {
648 // assert( status == Inactive );
650 }
651
652 ///
653 /// set TerminateRequseted on Solver status
654 ///
656 )
657 {
658 // assert( status == Inactive );
660 }
661
662 ///
663 /// set Terminated on Solver status
664 ///
666 )
667 {
670 }
671
672 ///
673 /// check if this Solver is active or not
674 /// @return true if this Solver is active, false otherwise
675 ///
677 )
678 {
679 return ( status == Active );
680 }
681
682 ///
683 /// check if this Solver is out of collecting mode or not
684 /// @return true if this Solver is out of collecting mode, false otherwise
685 ///
687 )
688 {
689 return (!collectingMode);
690 }
691
692 ///
693 /// check if this Solver is in collecting mode or not
694 /// @return true if this Solver is in collecting mode, false otherwise
695 ///
697 )
698 {
699 return collectingMode;
700 }
701
702 ///
703 /// set collecting mode
704 ///
706 bool b ///< true or false to be set on collecting mode
707 )
708 {
709 collectingMode = b;
710 }
711
712 ///
713 /// check if this Solver is candidate of collecting mode Solver
714 /// @return true if this Solver is candidate, false otherwise
715 ///
717 )
718 {
720 }
721
722 ///
723 /// set candidate of collecting mode Solver
724 ///
726 bool b ///< true or false to be set on candidate flag
727 )
728 {
730 }
731
732 ///
733 /// set termination state
734 ///
736 ParaSolverTerminationState *inTermState ///< termination state to be set
737 )
738 {
739 if( termState ) delete termState;
740 termState = inTermState;
741 }
742
743 ///
744 /// get termination state
745 /// @return pointer to ParaSolverTerminationState object
746 ///
748 )
749 {
750 return termState;
751 }
752
753 ///
754 /// switch into evaluation stage
755 ///
757 )
758 {
759 assert( status == Racing );
761 }
762
763 ///
764 /// switch out of evaluation stage
765 ///
767 )
768 {
769 assert( status == RacingEvaluation );
770 status = Racing;
771 }
772
773 ///
774 /// check if this Solver is in racing stage
775 /// @return true if this Solver is in racing stage, false otherwise
776 ///
778 )
779 {
780 return ( status == Racing );
781 }
782
783 ///
784 /// check if this Solver is in evaluation stage
785 /// @return true if this Solver is in evaluation stage, false otherwise
786 ///
788 )
789 {
790 return ( status == RacingEvaluation );
791 }
792
793 ///
794 /// make this Solver No generator
795 ///
797 )
798 {
799 generator = false;
800 }
801
802 ///
803 /// check if this Solver is generator or not */
804 /// @return true if this Solver is generator, false otherwise
805 ///
807 )
808 {
809 return generator;
810 }
811
812 ///
813 /// prohibits to be in collecting mode
814 ///
816 )
817 {
819 }
820
821 ///
822 /// allows to be in collecting mode
823 ///
825 )
826 {
828 }
829
830 ///
831 /// check if this Solver cannot be allowed in collecting mode
832 /// @return true if this Solver cannot be allowed in collecting mode, false otherwise
833 ///
835 )
836 {
838 }
839
840 ///
841 /// check if dual bound gain is testing in this Solver or not
842 /// @return true if dual bound gain is testing, false otherwise
843 ///
845 )
846 {
848 }
849
850 ///
851 /// set dual bound gain is testing value
852 ///
854 bool value ///< dual bound gain
855 )
856 {
857 dualBoundGainTesting = value;
858 }
859
860};
861
862///
863/// class Selection Heap
864///
866{
867
868public:
869
870 ///
871 /// results of insert
872 ///
874 {
875 SUCCEEDED, ///< SUCCEEDED
876 FAILED_BY_FULL ///< FAILED_BY_FULL
877 };
878
879 ///
880 /// constructor
881 ///
883 std::size_t size ///< heap size
884 );
885
886 ///
887 /// destructor
888 ///
889 virtual ~SelectionHeap(
890 );
891
892 ///
893 /// insert BbParaSolverPoolElementPtr to Selection Heap
894 /// @return succeeded or fail because of full
895 ///
897 BbParaSolverPoolElementPtr solver ///< Solver pool element to be inserted
898 );
899
900 ///
901 /// obtain top priority BbParaSolverPoolElementPtr
902 /// @return top priority BbParaSolverPoolElementPtr
903 ///
905 ) const
906 {
907 return heap[1];
908 }
909
910 ///
911 /// obtain i-th in heap BbParaSolverPoolElementPtr
912 /// @return ith in heap BbParaSolverPoolElementPtr
913 ///
915 int i
916 ) const
917 {
918 return heap[i];
919 }
920
921 ///
922 /// remove top priority BbParaSolverPoolElementPtr from Selection Heap
923 /// @return removed top priority BbParaSolverPoolElementPtr
924 ///
926 );
927
928 ///
929 /// resize Selection Heap
930 ///
931 void resize(
932 std::size_t size ///< new size
933 );
934
935 ///
936 /// get current used heap size
937 /// @return used heap size
938 ///
939 inline std::size_t getHeapSize(
940 ) const
941 {
942 return heapSize;
943 }
944
945 ///
946 /// get max heap size
947 /// @return max heap size
948 ///
949 inline std::size_t getMaxHeapSize(
950 ) const
951 {
952 return maxHeapSize;
953 }
954
955 ///
956 /// update selection heap by a new dual bound value of this Solver
957 ///
959 BbParaSolverPoolElementPtr solver, ///< Solver pool element to be updated
960 double value ///< dual bound value
961 ) = 0;
962
963 ///
964 /// delete BbParaSolverPoolElementPtr from Selection Heap
965 ///
966 virtual void deleteElement(
967 BbParaSolverPoolElementPtr solver ///< Solver pool element to be deleted
968 ) = 0;
969
970 ///
971 /// up heap
972 ///
973 virtual void upHeap(
974 std::size_t pos ///< start position to up heap
975 ) = 0;
976
977 ///
978 /// down heap
979 ///
980 virtual void downHeap(
981 std::size_t pos ///< start position to down heap
982 ) = 0;
983
984 //------------
985 // for debug
986 //------------
987 ///
988 /// stringfy of this object for debugging
989 /// @return string to show inside of this object
990 ///
991 const std::string toString(
992 );
993
994protected:
995
996 std::size_t maxHeapSize; ///< maximum size of this heap
997 std::size_t heapSize; ///< current used heap size
998 // long long currentSequenceNumber; ///< current sequence number
999 BbParaSolverPoolElementPtr *heap; ///< heap : contents are BbParaSolverPoolElementPtr
1000
1001};
1002
1003///
1004/// class DescendingSelectionHeap
1005///
1007
1008public:
1009
1010 ///
1011 /// constructor
1012 ///
1014 std::size_t size ///< heap size
1015 );
1016
1017 ///
1018 /// destructor
1019 ///
1021 )
1022 {
1023 }
1024
1025 ///
1026 /// update selection heap by a new dual bound value of this Solver
1027 ///
1028 virtual void updateDualBoundValue(
1029 BbParaSolverPoolElementPtr solver, ///< Solver pool element to be updated
1030 double value ///< dual bound value
1031 );
1032
1033 ///
1034 /// delete BbParaSolverPoolElementPtr from Selection Heap
1035 ///
1036 virtual void deleteElement(
1037 BbParaSolverPoolElementPtr solver ///< Solver pool element to be deleted
1038 );
1039
1040 ///
1041 /// up heap
1042 ///
1043 virtual void upHeap(
1044 std::size_t pos ///< start position to up heap
1045 );
1046 ///
1047 /// down heap
1048 ///
1049 virtual void downHeap(
1050 std::size_t pos ///< start position to down heap
1051 );
1052
1053};
1054
1055///
1056/// class AscendingSelectionHeap
1057///
1059public:
1060
1061 ///
1062 /// constructor
1063 ///
1065 std::size_t size ///< heap size
1066 );
1067
1068 ///
1069 /// destructor
1070 ///
1072 )
1073 {
1074 }
1075
1076 ///
1077 /// update selection heap by a new dual bound value of this Solver
1078 ///
1079 virtual void updateDualBoundValue(
1080 BbParaSolverPoolElementPtr solver, ///< Solver pool element to be updated
1081 double value ///< dual bound value
1082 );
1083
1084 ///
1085 /// delete BbParaSolverPoolElementPtr from Selection Heap
1086 ///
1087 virtual void deleteElement(
1088 BbParaSolverPoolElementPtr solver ///< Solver pool element to be deleted
1089 );
1090
1091 ///
1092 /// up heap
1093 ///
1094 virtual void upHeap(
1095 std::size_t pos ///< start position to up heap
1096 );
1097 ///
1098 /// down heap
1099 ///
1100 virtual void downHeap(
1101 std::size_t pos ///< start position to down heap
1102 );
1103
1104};
1105
1106///
1107/// class CollectingModeSolverHeap
1108///
1110{
1111
1112public:
1113
1114 ///
1115 /// results of insert
1116 ///
1118 {
1119 SUCCEEDED, ///< SUCCEEDED
1120 FAILED_BY_FULL ///< FAILED_BY_FULL
1122
1123 ///
1124 /// constructor
1125 ///
1127 std::size_t size ///< heap size
1128 );
1129
1130 ///
1131 /// destructor
1132 ///
1134 );
1135
1136 ///
1137 /// insert BbParaSolverPoolElementPtr to CollectingModeSolver Heap
1138 /// @return succeeded or fail because of full
1139 ///
1141 BbParaSolverPoolElementPtr solver ///< Solver pool element to be inserted
1142 );
1143
1144
1145
1146 ///
1147 /// obtain top priority BbParaSolverPoolElementPtr
1148 /// @return top priority BbParaSolverPoolElementPtr
1149 ///
1151 ) const
1152 {
1153 return heap[1];
1154 }
1155
1156 ///
1157 /// remove top priority BbParaSolverPoolElementPtr from CollectingModeSolver Heap */
1158 /// @return top priority BbParaSolverPoolElementPtr
1159 ///
1161 );
1162
1163 ///
1164 /// resize CollectingModeSolver Heap
1165 ///
1166 void resize(
1167 std::size_t size ///< new size
1168 );
1169
1170 ///
1171 /// get current used heap size
1172 /// @return used heap size
1173 ///
1174 inline std::size_t getHeapSize(
1175 ) const
1176 {
1177 return heapSize;
1178 }
1179
1180 ///
1181 /// get max heap size
1182 /// @return max heap size
1183 ///
1184 inline std::size_t getMaxHeapSize(
1185 ) const
1186 {
1187 return maxHeapSize;
1188 }
1189
1190 ///
1191 /// update CollectingModeSolver heap by a new dual bound value of this Solver
1192 ///
1194 BbParaSolverPoolElementPtr solver, ///< Solver pool element to be updated
1195 double value ///< dual bound value
1196 ) = 0;
1197
1198 ///
1199 /// delete BbParaSolverPoolElementPtr from CollectingModeSolver Heap
1200 ///
1201 virtual void deleteElement(
1202 BbParaSolverPoolElementPtr solver ///< Solver pool element to be deleted
1203 ) = 0;
1204
1205 ///
1206 /// up heap
1207 ///
1208 virtual void upHeap(
1209 std::size_t pos ///< start position to up heap
1210 ) = 0;
1211
1212 ///
1213 /// down heap
1214 ///
1215 virtual void downHeap(
1216 std::size_t pos ///< start position to down heap
1217 ) = 0;
1218
1219 //------------
1220 // for debug
1221 //------------
1222 ///
1223 /// stringfy of this object for debugging
1224 /// @return string to show inside of this object
1225 ///
1226 const std::string toString();
1227
1228protected:
1229
1230 std::size_t maxHeapSize; ///< maximum size of this heap
1231 std::size_t heapSize; ///< current used heap size
1232 // long long currentSequenceNumber; ///< current sequence number
1233 BbParaSolverPoolElementPtr *heap; ///< heap : contents are BbParaSolverPoolElementPtr
1234
1235};
1236
1237///
1238/// class DescendingCollectingModeSolverHeap
1239///
1241
1242public:
1243
1244 ///
1245 /// constructor
1246 ///
1248 std::size_t size ///< heap size
1249 );
1250
1251 ///
1252 /// destructor
1253 ///
1255 )
1256 {
1257 }
1258
1259 ///
1260 /// update CollectingModeSolver heap by a new dual bound value of this Solver
1261 ///
1262 virtual void updateDualBoundValue(
1263 BbParaSolverPoolElementPtr solver, ///< Solver pool element to be updated
1264 double value ///< dual bound value
1265 );
1266
1267 ///
1268 /// delete BbParaSolverPoolElementPtr from CollectingModeSolver Heap
1269 ///
1270 virtual void deleteElement(
1271 BbParaSolverPoolElementPtr solver ///< Solver pool element to be deleted
1272 );
1273
1274 ///
1275 /// up heap
1276 ///
1277 virtual void upHeap(
1278 std::size_t pos ///< start position to up heap
1279 );
1280
1281 ///
1282 /// down heap
1283 ///
1284 virtual void downHeap(
1285 std::size_t pos ///< start position to down heap
1286 );
1287
1288};
1289
1291
1292public:
1293
1294 ///
1295 /// constructor
1296 ///
1298 std::size_t size ///< heap size
1299 );
1300
1301 ///
1302 /// destructor
1303 ///
1305 )
1306 {
1307 }
1308
1309 ///
1310 /// update CollectingModeSolver heap by a new dual bound value of this Solver
1311 ///
1312 virtual void updateDualBoundValue(
1313 BbParaSolverPoolElementPtr solver, ///< Solver pool element to be updated
1314 double value ///< dual bound value
1315 );
1316
1317 ///
1318 /// delete BbParaSolverPoolElementPtr from CollectingModeSolver Heap
1319 ///
1320 virtual void deleteElement(
1321 BbParaSolverPoolElementPtr solver ///< Solver pool element to be deleted
1322 );
1323
1324 ///
1325 /// up heap
1326 ///
1327 virtual void upHeap(
1328 std::size_t pos ///< start position to up heap
1329 );
1330
1331 ///
1332 /// down heap
1333 ///
1334 virtual void downHeap(
1335 std::size_t pos ///< start position to down heap
1336 );
1337
1338};
1339
1340class BbParaRacingSolverPool;
1341
1342///
1343/// class BbParaSolverPool
1344/// (Solver Pool base class)
1345///
1347{
1348
1349protected:
1350
1351 bool active; ///< indicate if this pool is active or not
1352 double bgap; ///< threshold value of gap
1353 double mp; ///< multiplier of the threshold value p
1354 double mBgap; ///< multiplier of the bgap value
1355 double absoluteGap; ///< allowable absolute dual bound gap to the best Solver
1356 std::size_t nGenerator; ///< number of generators
1357 std::size_t nCollectingModeSolvers; ///< number of collecting mode Solvers
1358 std::size_t nMaxCollectingModeSolvers; ///< maximum number of Solvers that can be in collecting mode
1359 std::size_t nLimitCollectingModeSolvers; ///< limit number of Solvers that can be in collecting mode
1360 unsigned long long nNodesSolvedInSolvers; ///< number of nodes solved in current running Solvers
1361 unsigned long long nTotalNodesSolved; ///< number of nodes solved : updated at termination of subtree computation
1362 unsigned long long nNodesInSolvers; ///< number of nodes in all Solvers
1363 bool collectingMode; ///< indicate that this system is in collecting mode or not
1364 bool breakingFirstSubtree; ///< breaking the first subtree
1365 bool beforeInitialCollect; ///< before initial collecting mode
1366 bool beforeFinishingFirstCollect; ///< before finishing first collecting mode
1367 std::map< int, BbParaSolverPoolElementPtr > inactiveSolvers; ///< pointers to inactive Solvers
1368 std::map< int, BbParaSolverPoolElementPtr > activeSolvers; ///< pointers to active Solvers
1369 std::map< int, BbParaSolverPoolElementPtr > deadSolvers; ///< pointers to dead Solvers
1370 std::multimap< double, BbParaSolverPoolElementPtr > candidatesOfCollectingModeSolvers;
1371 ///< pointers to candidates of collecting mode Solvers
1372 BbParaSolverPoolElementPtr *pool; ///< Solver pool indexed by Solver's rank
1373 SelectionHeap *selectionHeap; ///< pointers to active Solvers in ascending or descending order
1374 CollectingModeSolverHeap *collectingModeSolverHeap; ///< pointers to collecting mode Solvers in ascending or descending order
1375 double switchOutTime; ///< switch out time
1376 int mCollectingNodes; ///< multiplier for the number of collecting BbParaNodes
1377 int mMaxCollectingNodes; ///< maximum multiplier for the number of collecting BbParaNodes
1378 int nDualBoundGainTesting; ///< the number of dual bound gain testing Solvers
1379
1380 ///
1381 /// switch a Solver to be in collecting mode
1382 ///
1383 virtual void switchInCollectingToSolver(
1384 int rank, ///< Solver rank to be in collecting mode
1385 BbParaNodePool *paraNodePool ///< pointer to BbParaNodePool object
1386 );
1387
1388public:
1389
1390 ///
1391 /// constructor
1392 ///
1394 double inMp, ///< multiplier of the threshold value p
1395 double inBgap, ///< threshold value of gap
1396 double inMBgap, ///< multiplier of the bgap value
1397 int inOriginRank, ///< origin rank of Solvers managed by this Solver pool
1398 ParaComm *inParaComm, ///< communicator used
1399 ParaParamSet *inParaParams, ///< paraParamSet used
1400 ParaTimer *inParaTimer ///< timer used
1401 )
1402 : ParaSolverPool(inOriginRank, inParaComm, inParaParams, inParaTimer),
1403 active(false),
1404 bgap(inBgap),
1405 mp(inMp),
1406 mBgap(inMBgap),
1410 nNodesInSolvers(0), // rampUpPhase(false),
1411 collectingMode(false),
1412 breakingFirstSubtree(false),
1415 selectionHeap(0),
1417 switchOutTime(-1.0),
1421 {
1422 nSolvers = paraComm->getSize() - inOriginRank;
1424
1426 for( unsigned int i = 0; i < nSolvers; i++ )
1427 {
1429 if( i >= nGenerator ) pool[i]->setNoGenerator();
1430 inactiveSolvers.insert(std::make_pair((originRank+i),pool[i]));
1431 }
1433 {
1434 nMaxCollectingModeSolvers = std::min(
1436 }
1438 {
1439 nMaxCollectingModeSolvers = std::max(nSolvers / 2, (std::size_t)1); // at least one Solver has to be in collecting mode
1440 }
1441 else
1442 {
1444 }
1448 {
1449 breakingFirstSubtree = true;
1450 }
1451 }
1452
1453 ///
1454 /// constructor
1455 ///
1457 double inMp, ///< multiplier of the threshold value p
1458 double inBgap, ///< threshold value of gap
1459 double inMBgap, ///< multiplier of the bgap value
1460 int inNSolvers, ///< number of solvers
1461 int inOriginRank, ///< origin rank of Solvers managed by this Solver pool
1462 ParaComm *inParaComm, ///< communicator used
1463 ParaParamSet *inParaParams, ///< paraParamSet used
1464 ParaTimer *inParaTimer ///< timer used
1465 )
1466 : ParaSolverPool(inOriginRank, inParaComm, inParaParams, inParaTimer),
1467 active(false),
1468 bgap(inBgap),
1469 mp(inMp),
1470 mBgap(inMBgap),
1474 nNodesInSolvers(0), // rampUpPhase(false),
1475 collectingMode(false),
1476 breakingFirstSubtree(false),
1479 selectionHeap(0),
1481 switchOutTime(-1.0),
1485 {
1486 nSolvers = inNSolvers;
1488
1490 for( unsigned int i = 0; i < nSolvers; i++ )
1491 {
1493 if( i >= nGenerator ) pool[i]->setNoGenerator();
1494 inactiveSolvers.insert(std::make_pair((originRank+i),pool[i]));
1495 }
1497 {
1498 nMaxCollectingModeSolvers = std::min(
1500 }
1502 {
1503 nMaxCollectingModeSolvers = std::max(nSolvers / 2, (std::size_t)1); // at least one Solver has to be in collecting mode
1504 }
1505 else
1506 {
1508 }
1512 {
1513 breakingFirstSubtree = true;
1514 }
1515 }
1516
1517 ///
1518 /// destructor
1519 ///
1521 )
1522 {
1523 for( unsigned int i = 0; i < (unsigned int)nSolvers; i++ )
1524 {
1525 delete pool[i];
1526 }
1527 if( pool ) delete[] pool;
1528 }
1529
1530 ///
1531 /// set the Solver specified by rank is terminate requested
1532 ///
1534 int rank ///< rank of the Solver
1535 )
1536 {
1537 assert(pool[SOLVER_POOL_INDEX( rank )]->getRank() == rank);
1539 }
1540
1541 ///
1542 /// set the Solver specified by rank is terminate requested
1543 ///
1545 int rank ///< rank of the Solver
1546 )
1547 {
1548 assert(pool[SOLVER_POOL_INDEX( rank )]->getRank() == rank);
1550 }
1551
1552 ///
1553 /// check if the Solver specified by rank is interrupt requested or not
1554 /// @return return true if the Solver is interrupt requested, false otherwise
1555 ///
1557 int rank ///< rank of the Solver
1558 )
1559 {
1560 return (pool[SOLVER_POOL_INDEX( rank )]->getStatus() == InterruptRequested);
1561 }
1562
1563 ///
1564 /// check if the Solver specified by rank is terminate requested or not
1565 /// @return return true if the Solver is terminate requested, false otherwise
1566 ///
1568 int rank ///< rank of the Solver
1569 )
1570 {
1571 return (pool[SOLVER_POOL_INDEX( rank )]->getStatus() == TerminateRequested);
1572 }
1573
1574 ///
1575 /// set the Solver specified by rank is terminated
1576 ///
1577 virtual void terminated(
1578 int rank ///< rank of the Solver
1579 )
1580 {
1581 assert(pool[SOLVER_POOL_INDEX( rank )]->getRank() == rank);
1582 if( this->isSolverActive(rank) ) // it looks that node != NULL and inactive could be occurred with timing issue when TimeLimit is specified
1583 {
1584 inactivateSolver(rank, -1, 0); // number of nodes solved should be added when LC receives termination message */
1585 }
1586 assert(pool[SOLVER_POOL_INDEX( rank )]->getStatus() == TerminateRequested ||
1587 pool[SOLVER_POOL_INDEX( rank )]->getStatus() == InterruptRequested ||
1588 pool[SOLVER_POOL_INDEX( rank )]->getStatus() == Inactive );
1589 //
1590 // The following situation could happen, whne terminate or interrupt is requested
1591 //
1592 std::map<int, BbParaSolverPoolElementPtr>::iterator p;
1593 p = activeSolvers.find(rank);
1594 if( p != activeSolvers.end() )
1595 {
1596 activeSolvers.erase(p);
1597 // inactiveSolvers.insert(std::make_pair(rank,pool[SOLVER_POOL_INDEX( rank )])); // in order not to assign new Task to this rank of solver
1598 }
1599 pool[SOLVER_POOL_INDEX( rank )]->terminated();
1600 }
1601
1602 ///
1603 /// check if the Solver specified by rank is terminated or not
1604 /// @return return true if the Solver is terminated, false otherwise
1605 ///
1606 virtual bool isTerminated(
1607 int rank ///< rank of the Solver
1608 )
1609 {
1610 return (pool[SOLVER_POOL_INDEX( rank )]->getStatus() == Terminated);
1611 }
1612
1613 ///
1614 /// reinitialize to restart
1615 ///
1616 virtual void reinitToRestart(
1617 )
1618 {
1619 collectingMode = false;
1621 switchOutTime = -1.0;
1622 mCollectingNodes = 1;
1624 }
1625
1626 ///
1627 /// activate this Solver pool
1628 ///
1629 virtual void activate(
1630 )
1631 {
1632 active = true;
1633 }
1634
1635 ///
1636 /// check if this Solver pool is active or not
1637 /// @return true if this Solver pool is active, false otherwise
1638 ///
1639 virtual bool isActive(
1640 )
1641 {
1642 return active;
1643 }
1644
1645 ///
1646 /// get number of Solvers in this Solver pool
1647 /// @return number of Solvers
1648 ///
1649 virtual std::size_t getNSolvers(
1650 )
1651 {
1652 return nSolvers;
1653 }
1654
1655 ///
1656 /// get number of nodes solved in current running Solvers
1657 ///
1658 virtual unsigned long long getNnodesSolvedInSolvers(
1659 )
1660 {
1661 return nNodesSolvedInSolvers;
1662 }
1663
1664 ///
1665 /// get number of nodes solved in all Solvers: updated at termination of subtree computation
1666 ///
1667 virtual unsigned long long getTotalNodesSolved(
1668 )
1669 {
1670 return nTotalNodesSolved;
1671 }
1672
1673 ///
1674 /// add number of nodes solved in all Solvers
1675 ///
1677 unsigned long long num ///< number of nodes solved
1678 )
1679 {
1680 nTotalNodesSolved += num;
1681 }
1682
1683 ///
1684 /// get number of nodes in all Solvers
1685 ///
1686 virtual unsigned long long getNnodesInSolvers(
1687 )
1688 {
1689 return nNodesInSolvers;
1690 }
1691
1692 ///
1693 /// get number of active Solvers
1694 /// @return number of active Solvers
1695 ///
1696 virtual std::size_t getNumActiveSolvers(
1697 )
1698 {
1699 return activeSolvers.size();
1700 }
1701
1702 ///
1703 /// get number of inactive Solvers
1704 /// @return number of inactive Solvers
1705 ///
1706 virtual std::size_t getNumInactiveSolvers(
1707 )
1708 {
1709 return inactiveSolvers.size();
1710 }
1711
1712 ///
1713 /// check if the Solver specified by rank is active or not
1714 /// @return true if the Solver is active, false otherwise
1715 ///
1716 virtual bool isSolverActive(
1717 int rank ///< rank of the Solver to be checked
1718 )
1719 {
1720 return pool[SOLVER_POOL_INDEX(rank)]->isActive();
1721 }
1722
1723 ///
1724 /// get current solving BbParaNode in the Solver specified by rank */
1725 /// @return pointer to BbParaNode object
1726 ///
1728 int rank ///< rank of the Solver
1729 )
1730 {
1731 return pool[SOLVER_POOL_INDEX(rank)]->getCurrentNode();
1732 }
1733
1734 ///
1735 /// check if the number of Solvers in collecting mode can be increased or not
1736 /// @return true if the number can be increased, false otherwise
1737 ///
1739 )
1740 {
1742 }
1743
1744 ///
1745 /// get limit number of Solvers that can be in collecting mode
1746 /// @return limit number of Solvers that can be in collecting mode
1747 ///
1749 )
1750 {
1752 }
1753
1754 // Node *getCurrentNode(int rank){ return pool[rank-1]->getCurrentNode(); }
1755
1756 ///
1757 /// check if this system is in collecting mode or not
1758 /// @return true if this system is in collecting mode, false otherwise
1759 ///
1761 )
1762 {
1763 return collectingMode;
1764 }
1765
1766 ///
1767 /// get collecting mode of the Solver specified by rank
1768 /// @return true if the Solver is in collecting mode, false otherwise
1769 ///
1771 int rank ///< rank of the Solver to be checked
1772 )
1773 {
1774 return pool[SOLVER_POOL_INDEX(rank)]->isInCollectingMode();
1775 }
1776
1777
1778
1779 ///
1780 /// extract current solving BbParaNode in the Solver specified by rank
1781 /// and inactivate the Solver
1782 /// @return pointer to BbParaNode object
1783 ///
1785 int rank, ///< rank of the Solver to be inactivated
1786 BbParaNodePool *paraNodePool ///< pointer to BbParaNodePool to pass it to inactivateSolver routine
1787 )
1788 {
1790 // for checkpointing, it should be updated always.
1791 // node->setDualBoundValue( getDualBoundValue(rank) );
1792 // if( node ) // after racing, could be inactive with timing issue
1793 if( this->isSolverActive(rank) ) // it looks that node != NULL and inactive could be occurred with timing issue when TimeLimit is specified
1794 {
1795 inactivateSolver(rank, -1, paraNodePool); // number of nodes solved should be added when LC receives termination message */
1796 }
1797 return node;
1798 }
1799
1800 ///
1801 /// extract current solving BbParaNode in the Solver specified by rank
1802 /// and inactivate the Solver
1803 /// @return pointer to BbParaNode object
1804 ///
1805// BbParaNode *extractCurrentNodeGeneratedBySelfSplitAndInactivate(
1806// int rank, ///< rank of the Solver to be inactivated
1807// BbParaNodePool *paraNodePool ///< pointer to BbParaNodePool to pass it to inactivateSolver routine
1808// )
1809// {
1810// BbParaNode *node = pool[SOLVER_POOL_INDEX(rank)]->extractCurrentNode();
1811// // for checkpointing, it should be updated always.
1812// // node->setDualBoundValue( getDualBoundValue(rank) );
1813// inactivateSolver(rank, -1, paraNodePool); // number of nodes solved should be added when LC recives termination message */
1814// return node;
1815// }
1816
1817 ///
1818 /// check if solving BbParaNode in the Solver specified has descendant or not
1819 /// @return true if the Solver has descendant, false otherwise
1820 ///
1822 int rank ///< solver rank to be checked
1823 )
1824 {
1826 }
1827
1828 ///
1829 /// add number of nodes solved
1830 ///
1831 virtual void addNumNodesSolved(
1832 long long numOfNodesSolved ///< number of nodes solved
1833 )
1834 {
1835 nNodesSolvedInSolvers += numOfNodesSolved;
1836 }
1837
1838 ///
1839 /// get the number of nodes solved by the Solver specified
1840 /// @return the number of nodes solved
1841 ///
1842 virtual long long getNumOfNodesSolved(
1843 int rank ///< rank of the Solver
1844 )
1845 {
1846 assert(isSolverActive(rank) || isTerminateRequested(rank) || isInterruptRequested(rank));
1848 }
1849
1850 ///
1851 /// get the number of nodes left by the Solver specified
1852 /// @return the number of nodes left
1853 ///
1855 int rank ///< rank of the Solver
1856 )
1857 {
1858 assert(isSolverActive(rank));
1859 return pool[SOLVER_POOL_INDEX(rank)]->getNumOfNodesLeft();
1860 }
1861
1862 ///
1863 /// get the number of nodes left in the Solver which has the best dual bound value
1864 /// @return the number of nodes left
1865 ///
1867 )
1868 {
1869 if( selectionHeap->getHeapSize() > 0 )
1870 {
1871 return selectionHeap->top()->getNumOfNodesLeft();
1872 }
1873 else
1874 {
1875 return 0; // no nodes exist
1876 }
1877 }
1878
1879 ///
1880 /// get rank of the Solver which has top priority in selection criteria
1881 /// @return rank of the Solver
1882 ///
1883 virtual int getBestSolver(
1884 )
1885 {
1886 if( selectionHeap->getHeapSize() > 0 )
1887 {
1888 return selectionHeap->top()->getRank();
1889 }
1890 else
1891 {
1892 return -1; // no nodes exist
1893 }
1894 }
1895
1896 ///
1897 /// get rank of the Solver which has top priority in selection criteria
1898 /// @return rank of the Solver
1899 ///
1901 )
1902 {
1903 if( selectionHeap->getHeapSize() > 0 )
1904 {
1905 for(int i = 1; i <= (int)selectionHeap->getHeapSize(); i++ )
1906 {
1907 int rank = selectionHeap->get(i)->getRank();
1908 if( getCurrentTask(rank) &&
1909 !(getCurrentTask(rank)->getAncestor()) )
1910 {
1911 return rank;
1912 }
1913 }
1914 return -1; // no nodes exist
1915 }
1916 else
1917 {
1918 return -1; // no nodes exist
1919 }
1920 }
1921
1922 ///
1923 /// get dual bound value of solving BbParaNode by the Solver specified
1924 /// @return dual bound value
1925 ///
1926 virtual double getDualBoundValue(
1927 int rank ///< rank of the Solver
1928 )
1929 {
1930 assert(isSolverActive(rank));
1932 }
1933
1934 ///
1935 /// set SolverTerminationState to the Solver specified
1936 ///
1937 virtual void setTermState(
1938 int rank, ///< rank of the Solver
1939 ParaSolverTerminationState *inTermState ///< pointer to ParaSolverTerminationState object
1940 )
1941 {
1942 pool[SOLVER_POOL_INDEX(rank)]->setTermState(inTermState);
1943 }
1944
1945 ///
1946 /// get SolverTermination state of the Solver specified
1947 /// @return pointer to SolverTermination object
1948 ///
1950 int rank ///< rank of the Solver
1951 )
1952 {
1953 return pool[SOLVER_POOL_INDEX(rank)]->getTermState();
1954 }
1955
1956 ///
1957 /// update dual bound values of saving BbParaNodes by their dual bound values for subtrees
1958 ///
1960 )
1961 {
1962 for( int i = 1; i < paraComm->getSize(); i++ )
1963 {
1964 if( getCurrentTask(i) && getCurrentTask(i)->getAncestor() == 0 )
1965 {
1966 dynamic_cast<BbParaNode *>(getCurrentTask(i))->updateInitialDualBoundToSubtreeDualBound();
1967 }
1968 }
1969 }
1970
1971#ifdef UG_WITH_ZLIB
1972
1973 ///
1974 /// write BbParaNodes to checkpoint file
1975 /// @return the number of BbParaNodes saved
1976 ///
1978 gzstream::ogzstream &out ///< ogzstream to output
1979 )
1980 {
1981 int n = 0;
1982 for( int i = 1; i < paraComm->getSize(); i++ )
1983 {
1984 // if( getCurrentTask(i) && getCurrentTask(i)->getAncestor() == 0 )
1985 if( getCurrentTask(i) )
1986 {
1987 BbParaNode *node = dynamic_cast<BbParaNode *>(getCurrentTask(i));
1988 while( node )
1989 {
1990 if( node->getAncestor() == 0 )
1991 {
1992 // std::cout << "CHECKPOINT: " << node->toSimpleString() << std::endl;
1993 node->write(out);
1994 n++;
1995 }
1996 node = node->next;
1997 }
1998 }
1999 }
2000 return n;
2001 }
2002
2003 ///
2004 /// write Solver statistics to checkpoint file
2005 /// @return the number of Solvers whose statistics were written
2006 ///
2008 gzstream::ogzstream &out ///< ogzstream to output
2009 )
2010 {
2011 int n = 0;
2012 for( int i = 1; i < paraComm->getSize(); i++ )
2013 {
2015 {
2017 n++;
2018 }
2019 }
2020 return n;
2021 }
2022
2023#endif
2024
2025 ///
2026 /// increase the limit number of Solvers getting into collecting mode
2027 ///
2029 )
2030 {
2033 }
2034
2035 ///
2036 /// set collecting mode is allowed to the Solver specified by rank
2037 ///
2039 int rank
2040 )
2041 {
2043 }
2044
2045 ///
2046 /// get an inactive Solver rank
2047 /// @return rank of inactivate Solver
2048 ///
2050 )
2051 {
2052 std::map<int, BbParaSolverPoolElementPtr>::iterator p;
2053 p = inactiveSolvers.begin();
2054 if( p == inactiveSolvers.end() )
2055 {
2056 return -1; // no inactive Solver
2057 }
2058 return p->second->getRank();
2059 }
2060
2061 ///
2062 /// activate the Solver specified by rank with specified node which has been sent
2063 ///
2064 virtual void activateSolver(
2065 int rank, ///< rank of the Solver to be activated
2066 BbParaNode *node, ///< pointer to BbParaNode object to be sent to the Solver
2067 int nGoodNodesInNodePool, ///< number of good nodes in BbParaNodePool object
2068 double averageDualBoundGain ///< current average dual bound gain
2069 );
2070
2071
2072 ///
2073 /// activate the Solver specified by rank with specified node which has been sent and nNodesLeft
2074 /// (This method is for the racing winner)
2075 /// TODO: Need to check how this function is used
2076 ///
2077 virtual void activateSolver(
2078 int rank, ///< rank of the Solver to be activated
2079 BbParaNode *node, ///< pointer to BbParaNode object to be sent to the Solver
2080 int nNodesLeft ///< the number of nodes left in the Solver
2081 );
2082
2083 ///
2084 /// activate a Solver with specified BbParaNode which is sent within this Solver pool
2085 /// @return rank of Solver which is activated
2086 ///
2087 virtual int activateSolver(
2088 BbParaNode *node, ///< pointer to BbParaNode object to be sent to a Solver
2089 BbParaRacingSolverPool *paraRacingSolverPool, ///< pointer to paraRacingSolverPool object
2090 ///< to check if the Solver is not solving root node
2091 bool rampUpPhase, ///< indicate if ramp-up phase or not
2092 int nGoodNodesInNodePool, ///< number of good BbParaNodes in BbParaNodePool
2093 double averageDualBoundGain ///< current average bound gain
2094 );
2095
2096 ///
2097 /// add new subtree root node to the active solver with the specified rank
2098 ///
2099 virtual void addNewSubtreeRootNode(
2100 int rank, ///< the active solver rank
2101 BbParaNode *node ///< new subtree root node
2102 );
2103
2104 ///
2105 /// make subtree root node as current task for the specified rank
2106 ///
2107 virtual void makeSubtreeRootNodeCurrent(
2108 int rank, ///< the active solver rank
2109 BbParaNode *node ///< subtree root node to make it current
2110 );
2111
2112 ///
2113 /// remove subtree root node from the active solver with the specified rank
2114 ///
2115 virtual void removeSubtreeRootNode(
2116 int rank, ///< the active solver rank
2117 BbParaNode *node ///< subtree root node to be removed
2118 );
2119
2120// ///
2121// /// remove all subtree root node from the active solver with the specified rank
2122// /// @return list of all unprocessed nodes
2123// ///
2124// BbParaNode *removeAllSubtreeRootNode(
2125// int rank, ///< the active solver rank
2126// BbParaNode *node ///< subtree root node to be removed
2127// );
2128
2129 ///
2130 /// extract self-split subtree root node from the active solver with the specified rank
2131 ///
2133 int rank, ///< the active solver rank
2134 BbParaNode *node ///< subtree root node to be removed
2135 );
2136
2137 ///
2138 /// get self-split subtree root node from the active solver with the specified rank
2139 ///
2141 int rank ///< the active solver rank
2142 );
2143
2144 ///
2145 /// extract self-split subtree root node from the active solver with the specified rank
2146 ///
2148 int rank ///< the active solver rank
2149 );
2150
2151 ///
2152 /// delete current self-split subtree root node from the active solver with the specified rank
2153 ///
2154 virtual void deleteCurrentSubtreeRootNode(
2155 int rank ///< the active solver rank
2156 );
2157
2158 ///
2159 /// inactivate the Solver specified by rank
2160 ///
2161 virtual void inactivateSolver(
2162 int rank, ///< rank of the Solver to be inactivated
2163 long long numOfNodesSolved, ///< number of nodes solved
2164 BbParaNodePool *paraNodePool ///< pointer to BbParaNodePool to change into collecting mode
2165 );
2166
2167 ///
2168 /// reset counters in the Solver specified by rank
2169 ///
2170 virtual void resetCountersInSolver(
2171 int rank, ///< rank of the Solver to reset counters
2172 long long numOfNodesSolved, ///< number of nodes solved
2173 int numOfSelfSplitNodesLeft, ///< number of self-split nodes left
2174 BbParaNodePool *paraNodePool ///< pointer to BbParaNodePool to change into collecting mode
2175 );
2176
2177 ///
2178 /// kill the Solver specified by rank
2179 /// @return pointer to BbParaNode object assigned to the Solver
2180 ///
2181 virtual BbParaNode *solverDied(
2182 int rank ///< rank of the Solver
2183 );
2184
2185 ///
2186 /// switch out collecting mode
2187 ///
2188 virtual void switchOutCollectingMode(
2189 );
2190
2191 ///
2192 /// enforced to switch out collecting mode of the Solver specified by rank if it is necessary
2193 ///
2195 int rank ///< rank of the Solver
2196 );
2197
2198 ///
2199 /// switch out collecting mode of the Solver specified by rank if it is necessary
2200 ///
2202 int rank ///< rank of the Solver
2203 );
2204
2205 ///
2206 /// get global best dual bound value
2207 /// @return global best dual bound value
2208 ///
2210 ) = 0;
2211
2212 ///
2213 /// switch in collecting mode
2214 ///
2216 BbParaNodePool *paraNodePool ///< pointer to BbParaNodePool object
2217 ) = 0;
2218
2219 ///
2220 /// update Solver status
2221 ///
2223 int rank, ///< rank of the Solver
2224 long long numNodesSolved, ///< number of nodes solved
2225 int numNodesLeft, ///< number of nodes left
2226 double solverLocalBestBound, ///< best bound value in the Solver
2227 BbParaNodePool *paraNodePool ///< pointer to BbParaNodePool object
2228 ) = 0;
2229
2230 ///
2231 /// get multiplier of collecting BbParaNodes
2232 /// @return multiplier of collecting BbParaNodes
2233 ///
2235 )
2236 {
2237 return mCollectingNodes;
2238 }
2239
2240 ///
2241 /// get maximum multiplier for the number of collecting BbParaNodes
2242 /// @return maximum multiplier for the number of collecting BbParaNodes
2243 ///
2245 )
2246 {
2247 return mMaxCollectingNodes;
2248 }
2249
2250 ///
2251 /// the following functions are to omit rebooting collecting mode process
2252 ///
2253
2254 ///
2255 /// get time of switching out collecting mode
2256 /// @return time of switching out collecting mode
2257 ///
2258 virtual double getSwichOutTime(
2259 )
2260 {
2261 return switchOutTime;
2262 }
2263
2264 ///
2265 /// set time of switching out collecting mode
2266 ///
2267 virtual void setSwichOutTime(
2268 double time ///< time of switching out collecting mode
2269 )
2270 {
2271 switchOutTime = time;
2272 }
2273
2274 ///
2275 /// check if dual bound gain testing is proceeding or not in the Solver specified
2276 /// @return true if dual bound gain testing is proceeding, false otherwise
2277 ///
2279 int rank ///< rank of the Solver
2280 )
2281 {
2283 }
2284
2285};
2286
2287///
2288/// class BbParaSolverPoolForMinimization
2289/// (Solver Pool for Minimization Problems)
2290///
2292{
2293
2294public:
2295
2296 ///
2297 /// constructor
2298 ///
2300 double inMp, ///< multiplier of the threshold value p
2301 double inBgap, ///< threshold value of gap
2302 double inMBgap, ///< multiplier of the bgap value
2303 int inOriginRank, ///< origin rank of Solvers managed by this Solver pool
2304 ParaComm *inParaComm, ///< communicator used
2305 ParaParamSet *inParaParams, ///< paraParamSet used
2306 ParaTimer *inParaTimer ///< timer used
2307 )
2308 : BbParaSolverPool(inMp, inBgap, inMBgap, inOriginRank, inParaComm, inParaParams, inParaTimer)
2309 {
2311 if( paraParams->getIntParamValue(SolverOrderInCollectingMode) == 0) // ordered by dual bound value
2312 {
2314 std::min( nMaxCollectingModeSolvers * 2, nSolvers ) ); // can be more than nMaxCollectingModeSolvers
2315 }
2316 }
2317
2318 ///
2319 /// constructor
2320 ///
2322 double inMp, ///< multiplier of the threshold value p
2323 double inBgap, ///< threshold value of gap
2324 double inMBgap, ///< multiplier of the bgap value
2325 int inNSolvers, ///< number of solvers
2326 int inOriginRank, ///< origin rank of Solvers managed by this Solver pool
2327 ParaComm *inParaComm, ///< communicator used
2328 ParaParamSet *inParaParams, ///< paraParamSet used
2329 ParaTimer *inParaTimer ///< timer used
2330 )
2331 : BbParaSolverPool(inMp, inBgap, inMBgap, inNSolvers, inOriginRank, inParaComm, inParaParams, inParaTimer)
2332 {
2334 if( paraParams->getIntParamValue(SolverOrderInCollectingMode) == 0) // ordered by dual bound value
2335 {
2337 std::min( nMaxCollectingModeSolvers * 2, nSolvers ) ); // can be more than nMaxCollectingModeSolvers
2338 }
2339 }
2340
2341 ///
2342 /// destructor
2343 ///
2345 )
2346 {
2347 if( selectionHeap ) delete selectionHeap;
2349 }
2350
2351 ///
2352 /// get global best dual bound value
2353 /// @return global best dual bound value
2354 ///
2356 )
2357 {
2358 if( selectionHeap->getHeapSize() > 0 )
2359 {
2361 }
2362 else
2363 {
2364 return DBL_MAX; // no nodes exist
2365 }
2366 }
2367
2368 ///
2369 /// switch in collecting mode
2370 ///
2371 virtual void switchInCollectingMode(
2372 BbParaNodePool *paraNodePool ///< pointer to BbParaNodePool object
2373 );
2374
2375 ///
2376 /// update Solver status
2377 ///
2378 virtual void updateSolverStatus(
2379 int rank, ///< rank of the Solver
2380 long long numNodesSolved, ///< number of nodes solved
2381 int numNodesLeft, ///< number of nodes left
2382 double solverLocalBestBound, ///< best bound value in the Solver
2383 BbParaNodePool *paraNodePool ///< pointer to BbParaNodePool object
2384 );
2385
2386 /*
2387 ///
2388 /// remove bounded BbParaNodes by given incumbnet value
2389 /// @return the number of bounded BbParaNodes
2390 ///
2391 int removeBoundedNodes(
2392 double incumbentValue ///< incumbent value
2393 )
2394 {
2395 int n = 0;
2396 for( int rank = originRank; rank < (originRank + static_cast<int>(nSolvers)); rank++ )
2397 {
2398 if( pool[SOLVER_POOL_INDEX( rank )]->getSelfSplitNodes() )
2399 {
2400 n += pool[SOLVER_POOL_INDEX( rank )]->removeBoundedNodes(incumbentValue);
2401 }
2402 }
2403 return n;
2404 }
2405 */
2406
2407};
2408
2409///
2410/// class BbParaRacingSolverPool
2411/// (Racing Solver Pool)
2412///
2414{
2415
2416protected:
2417
2418 int nEvaluationStage; ///< number of Solvers that are in evaluation stage
2419 long long nNodesSolvedInBestSolver; ///< number of nodes solved in the best Solver
2420 long long nNodesInBestSolver; ///< number of nodes in the best Solver
2421 size_t nActiveSolvers; ///< number of active Solvers
2422 size_t nInactiveSolvers; ///< number of inactive Solvers
2423 double bestDualBound; ///< current best dual bound value
2424 double bestDualBoundInSolvers; ///< best dual bound value in Solvers
2425 BbParaSolverPoolElementPtr *pool; ///< Solver pool indexed by Solver's rank
2426 SelectionHeap *selectionHeap; ///< pointers to active Solvers in ascending or descending order
2427 BbParaNode *rootNode; ///< root BbParaNode
2428
2429public:
2430
2431 ///
2432 /// constructor
2433 ///
2435 int inOriginRank, ///< origin rank of Solvers managed by this Solver pool
2436 ParaComm *inParaComm, ///< communicator used
2437 ParaParamSet *inParaParams, ///< paraParamSet used
2438 ParaTimer *inParaTimer, ///< timer used
2439 ParaDeterministicTimer *inParaDetTimer ///< deterministic timer used
2440 )
2441 : ParaRacingSolverPool(inOriginRank,inParaComm,inParaParams, inParaTimer, inParaDetTimer),
2445 nActiveSolvers(0),
2447 bestDualBound(-DBL_MAX),
2448 bestDualBoundInSolvers(-DBL_MAX),
2449 rootNode(0)
2450 {
2451 // nSolvers = paraComm->getSize() - inOriginRank;
2453 for( int i = 0; i < nSolvers; i++ )
2454 {
2456 }
2457 selectionHeap = new DescendingSelectionHeap(static_cast<std::size_t>(nSolvers));
2458 }
2459
2460 ///
2461 /// constructor
2462 ///
2464 int inNSolvers, ///< the number of racing solvers
2465 int inOriginRank, ///< origin rank of Solvers managed by this Solver pool
2466 ParaComm *inParaComm, ///< communicator used
2467 ParaParamSet *inParaParams, ///< paraParamSet used
2468 ParaTimer *inParaTimer, ///< timer used
2469 ParaDeterministicTimer *inParaDetTimer ///< deterministic timer used
2470 )
2471 : ParaRacingSolverPool(inOriginRank,inParaComm,inParaParams, inParaTimer, inParaDetTimer),
2475 nActiveSolvers(0),
2477 bestDualBound(-DBL_MAX),
2478 bestDualBoundInSolvers(-DBL_MAX),
2479 rootNode(0)
2480 {
2481 // nSolvers = paraComm->getSize() - inOriginRank;
2482 nSolvers = inNSolvers;
2484 for( int i = 0; i < nSolvers; i++ )
2485 {
2487 }
2488 selectionHeap = new DescendingSelectionHeap(static_cast<std::size_t>(nSolvers));
2489 }
2490
2491 ///
2492 /// destructor
2493 ///
2495 )
2496 {
2497 if( selectionHeap ) delete selectionHeap;
2498 for( int i = 0; i < nSolvers; i++ )
2499 {
2500 delete pool[i];
2501 }
2502 if( pool ) delete[] pool;
2503 if( rootNode ) delete rootNode;
2504 }
2505
2506 ///
2507 /// set the Solver specified by rank is terminate requested
2508 ///
2510 int rank ///< rank of the Solver
2511 )
2512 {
2513 assert(pool[SOLVER_POOL_INDEX( rank )]->getRank() == rank);
2515 }
2516
2517 ///
2518 /// set the Solver specified by rank is terminate requested
2519 ///
2521 int rank ///< rank of the Solver
2522 )
2523 {
2524 assert(pool[SOLVER_POOL_INDEX( rank )]->getRank() == rank);
2526 }
2527
2528 ///
2529 /// check if the Solver specified by rank is interrupt requested or not
2530 /// @return return true if the Solver is interrupt requested, false otherwise
2531 ///
2533 int rank ///< rank of the Solver
2534 )
2535 {
2536 return (pool[SOLVER_POOL_INDEX( rank )]->getStatus() == InterruptRequested);
2537 }
2538
2539 ///
2540 /// check if the Solver specified by rank is terminate requested or not
2541 /// @return return true if the Solver is terminate requested, false otherwise
2542 ///
2544 int rank ///< rank of the Solver
2545 )
2546 {
2547 return (pool[SOLVER_POOL_INDEX( rank )]->getStatus() == TerminateRequested);
2548 }
2549
2550 ///
2551 /// set the Solver specified by rank is terminated
2552 ///
2553 virtual void terminated(
2554 int rank ///< rank of the Solver
2555 )
2556 {
2557 assert(pool[SOLVER_POOL_INDEX( rank )]->getRank() == rank);
2558 assert( !this->isSolverActive(rank) ); // it looks that node != NULL and inactive could be occurred with timing issue when TimeLimit is specified
2559 assert(pool[SOLVER_POOL_INDEX( rank )]->getStatus() == TerminateRequested ||
2560 pool[SOLVER_POOL_INDEX( rank )]->getStatus() == InterruptRequested ||
2561 pool[SOLVER_POOL_INDEX( rank )]->getStatus() == Inactive );
2562 pool[SOLVER_POOL_INDEX( rank )]->terminated();
2563 }
2564
2565 ///
2566 /// check if the Solver specified by rank is terminated or not
2567 /// @return return true if the Solver is terminated, false otherwise
2568 ///
2569 virtual bool isTerminated(
2570 int rank ///< rank of the Solver
2571 )
2572 {
2573 return (pool[SOLVER_POOL_INDEX( rank )]->getStatus() == Terminated);
2574 }
2575
2576 ///
2577 /// reset racing solver pool
2578 ///
2579 virtual void reset(
2580 )
2581 {
2582 nEvaluationStage = 0;
2585 nActiveSolvers = 0;
2586 nInactiveSolvers = 0;
2587 bestDualBound = -DBL_MAX;
2588 bestDualBoundInSolvers = -DBL_MAX;
2589 rootNode = 0;
2590 if( selectionHeap ) delete selectionHeap;
2591 for( int i = 0; i < nSolvers; i++ )
2592 {
2593 delete pool[i];
2594 }
2595 if( pool ) delete[] pool;
2596 if( rootNode ) delete rootNode;
2598 for( int i = 0; i < nSolvers; i++ )
2599 {
2601 }
2602 selectionHeap = new DescendingSelectionHeap(static_cast<std::size_t>(nSolvers));
2603 }
2604
2605 ///
2606 /// extract racing root BbParaNode
2607 ///
2609 )
2610 {
2613 return rootNode->clone(paraComm);
2614 }
2615
2616 ///
2617 /// get root BbParaNode object of the Solver specified
2618 ///
2620 int rank ///< rank of the Solver
2621 )
2622 {
2623 return rootNode;
2624 }
2625
2626 ///
2627 /// get dual bound value of solving BbParaNode in the Solver specified by rank
2628 /// @return dual bound value
2629 ///
2630 virtual double getDualBoundValue(
2631 int rank ///< rank of the Solver
2632 )
2633 {
2635 }
2636
2637 ///
2638 /// get number of nodes solved in the Solver specified by rank
2639 /// @return number of nodes solved
2640 ///
2641 virtual long long getNumOfNodesSolved(
2642 int rank ///< rank of the Solver
2643 )
2644 {
2646 }
2647
2648 ///
2649 /// get number of nodes left in the Solver specified by rank
2650 /// @return number of nodes left
2651 ///
2652 virtual int getNumNodesLeft(
2653 int rank ///< rank of the Solver
2654 )
2655 {
2656 return pool[SOLVER_POOL_INDEX(rank)]->getNumOfNodesLeft();
2657 }
2658
2659 ///
2660 /// get global best dual bound value
2661 /// @return global best dual bound value
2662 ///
2664 )
2665 {
2666 if( selectionHeap->getHeapSize() > 0 )
2667 {
2668 return bestDualBound;
2669 }
2670 else
2671 {
2672 return -DBL_MAX; // no nodes exist
2673 }
2674 }
2675
2676 ///
2677 /// get winner Solver rank
2678 /// @return rank of the winner Solver
2679 ///
2680// int getWinner(
2681// )
2682// {
2683// // assert( winnerRank > 0 );
2684// return winnerRank; // -1 means that winner is not decided
2685// }
2686
2687 ///
2688 /// get number of nodes solved in the best Solver
2689 /// @return number of nodes solved in the best Solver
2690 ///
2692 )
2693 {
2695 }
2696
2697 ///
2698 /// get number of nodes left in the best Solver
2699 /// @return number of nodes left in the best Solver
2700 ///
2701 virtual long long getNnodesLeftInBestSolver(
2702 )
2703 {
2704 return nNodesInBestSolver;
2705 }
2706
2707 ///
2708 /// get best dual bound value in inactivated Solvers
2709 /// @return best dual bound value in inactivated Solvers
2710 ///
2712 )
2713 {
2715 }
2716
2717 ///
2718 /// activate racing ramp-up Solver pool with root BbParaNode object
2719 ///
2720 virtual void activate(
2721 BbParaNode *node ///< pointer to root BbParaNode object
2722 )
2723 {
2724 rootNode = node;
2725 for( int rank = originRank; rank < (originRank + nSolvers); rank++ )
2726 {
2728// if( rank != originRank ||
2729// ( paraParams->getIntParamValue(UgCplexRunningMode) != 1 ) )
2730// if( rank != originRank )
2731// {
2732 selectionHeap->insert(pool[SOLVER_POOL_INDEX( rank )]); // this should be called after activate: dual bound value need to be set
2733// }
2735 }
2736 nInactiveSolvers = 0;
2738 }
2739
2740 ///
2741 /// check if the specified Solver is active or not
2742 /// @return true if the specified Solver is active, false otherwise
2743 ///
2744 virtual bool isSolverActive(
2745 int rank ///< rank of the Solver
2746 )
2747 {
2748 if(pool[SOLVER_POOL_INDEX( rank )]->isRacingStage() ||
2750 {
2751 return true;
2752 }
2753 else
2754 {
2755 return false;
2756 }
2757 }
2758
2759 ///
2760 /// update Solver status
2761 ///
2762 virtual void updateSolverStatus(
2763 int rank, ///< rank of the Solver
2764 long long numNodesSolved, ///< number of nodes solved
2765 int numNodesLeft, ///< number of nodes left
2766 double solverLocalBestBound ///< best bound value in the Solver
2767 );
2768
2769 ///
2770 /// check racing termination criteria
2771 ///
2772 virtual bool isWinnerDecided(
2773 bool feasibleSol ///< indicate if a feasible solution was generagted or not
2774 );
2775
2776 ///
2777 /// inactivate the Solver specified by rank
2778 ///
2779 virtual void inactivateSolver(
2780 int rank ///< rank of the Solver
2781 )
2782 {
2783 if(pool[SOLVER_POOL_INDEX( rank )]->isRacingStage() ||
2785 {
2786 if( pool[SOLVER_POOL_INDEX( rank )]->getBestDualBoundValue() > bestDualBoundInSolvers )
2787 {
2789 }
2790 pool[SOLVER_POOL_INDEX( rank )]->inactivate();
2793 }
2794 else
2795 {
2796 THROW_LOGICAL_ERROR2("Rank = ", rank);
2797 }
2798 }
2799
2800 ///
2801 /// get number of active Solvers
2802 /// @return number of active Solvers
2803 ///
2804 virtual std::size_t getNumActiveSolvers(
2805 )
2806 {
2807 return nActiveSolvers;
2808 }
2809
2810 ///
2811 /// get number of inactive Solvers
2812 /// @return number of inactive Solvers
2813 ///
2814 virtual std::size_t getNumInactiveSolvers(
2815 )
2816 {
2817 return nInactiveSolvers;
2818 }
2819
2820 ///
2821 /// check if the Solver specified in an argument is evaluation stage or not
2822 /// @return true if the Solver is evaluation stage, false otherwise
2823 ///
2824 virtual bool isEvaluationStage(
2825 int rank
2826 )
2827 {
2828 return ( pool[SOLVER_POOL_INDEX( rank )]->isEvaluationStage() );
2829 }
2830
2831 ///
2832 /// get active Solver number string
2833 /// @return string to show active Solver rank
2834 ///
2835 virtual std::string getStrActiveSolerNumbers(
2836 )
2837 {
2838 std::ostringstream oss;
2839 oss << " ";
2840 for( int rank = originRank; rank < (originRank + nSolvers); rank++ )
2841 {
2842 if( pool[SOLVER_POOL_INDEX( rank )]->isRacingStage() )
2843 {
2844 oss << rank << " ";
2845
2846 }
2847 }
2848 return oss.str();
2849 }
2850
2851};
2852
2853}
2854
2855#endif // __BB_PARA_SOLVER_POOL_H__
2856
BbParaNode Pool.
This class contains solver termination state which is transferred form Solver to LC.
virtual void updateDualBoundValue(BbParaSolverPoolElementPtr solver, double value)
update CollectingModeSolver heap by a new dual bound value of this Solver
AscendingCollectingModeSolverHeap(std::size_t size)
constructor
virtual ~AscendingCollectingModeSolverHeap()
destructor
virtual void deleteElement(BbParaSolverPoolElementPtr solver)
delete BbParaSolverPoolElementPtr from CollectingModeSolver Heap
virtual void downHeap(std::size_t pos)
down heap
virtual void upHeap(std::size_t pos)
up heap
class AscendingSelectionHeap
virtual void updateDualBoundValue(BbParaSolverPoolElementPtr solver, double value)
update selection heap by a new dual bound value of this Solver
AscendingSelectionHeap(std::size_t size)
constructor
virtual void deleteElement(BbParaSolverPoolElementPtr solver)
delete BbParaSolverPoolElementPtr from Selection Heap
virtual void downHeap(std::size_t pos)
down heap
virtual ~AscendingSelectionHeap()
destructor
virtual void upHeap(std::size_t pos)
up heap
class BbParaNodePool
class BbParaNode
Definition: bbParaNode.h:62
bool isSameNodeIdAs(const BbParaNode &inNode)
check if this node's id is the same as that of argument ParaNode's task id
Definition: bbParaNode.h:708
void setDualBoundValue(double inDualBoundValue)
setter of dual bound value
Definition: bbParaNode.h:323
void write(gzstream::ogzstream &out)
write to checkpoint file
Definition: bbParaNode.cpp:44
ParaTaskGenealogicalPtr * getAncestor()
getter of ancestor
Definition: bbParaNode.h:373
virtual BbParaNode * clone(ParaComm *comm)=0
clone this BbParaNode
BbParaNode * next
this pointer is used in case of self-split ramp-up in LC this field is not transferred
Definition: bbParaNode.h:83
double getDualBoundValue()
getter of dual bound value
Definition: bbParaNode.h:303
void setInitialDualBoundValue(double inTrueDualBoundValue)
setter of initial dual bound value
Definition: bbParaNode.h:333
class BbParaRacingSolverPool (Racing Solver Pool)
virtual std::string getStrActiveSolerNumbers()
get active Solver number string
virtual std::size_t getNumInactiveSolvers()
get number of inactive Solvers
double bestDualBoundInSolvers
best dual bound value in Solvers
virtual double getGlobalBestDualBoundValue()
get global best dual bound value
long long nNodesSolvedInBestSolver
number of nodes solved in the best Solver
BbParaSolverPoolElementPtr * pool
Solver pool indexed by Solver's rank.
long long nNodesInBestSolver
number of nodes in the best Solver
BbParaNode * rootNode
root BbParaNode
virtual bool isSolverActive(int rank)
check if the specified Solver is active or not
virtual long long getNnodesSolvedInBestSolver()
get winner Solver rank
virtual long long getNnodesLeftInBestSolver()
get number of nodes left in the best Solver
size_t nInactiveSolvers
number of inactive Solvers
int nEvaluationStage
number of Solvers that are in evaluation stage
double bestDualBound
current best dual bound value
virtual void terminated(int rank)
set the Solver specified by rank is terminated
virtual int getNumNodesLeft(int rank)
get number of nodes left in the Solver specified by rank
virtual void reset()
reset racing solver pool
virtual void activate(BbParaNode *node)
activate racing ramp-up Solver pool with root BbParaNode object
BbParaRacingSolverPool(int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer, ParaDeterministicTimer *inParaDetTimer)
constructor
size_t nActiveSolvers
number of active Solvers
virtual bool isTerminateRequested(int rank)
check if the Solver specified by rank is terminate requested or not
virtual BbParaNode * extractNode()
extract racing root BbParaNode
virtual void updateSolverStatus(int rank, long long numNodesSolved, int numNodesLeft, double solverLocalBestBound)
update Solver status
BbParaRacingSolverPool(int inNSolvers, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer, ParaDeterministicTimer *inParaDetTimer)
constructor
virtual void terminateRequested(int rank)
set the Solver specified by rank is terminate requested
virtual ParaTask * getCurrentTask(int rank)
get root BbParaNode object of the Solver specified
virtual double getBestDualBoundInInactivatedSolvers()
get best dual bound value in inactivated Solvers
virtual double getDualBoundValue(int rank)
get dual bound value of solving BbParaNode in the Solver specified by rank
virtual std::size_t getNumActiveSolvers()
get number of active Solvers
virtual bool isInterruptRequested(int rank)
check if the Solver specified by rank is interrupt requested or not
virtual void interruptRequested(int rank)
set the Solver specified by rank is terminate requested
virtual long long getNumOfNodesSolved(int rank)
get number of nodes solved in the Solver specified by rank
SelectionHeap * selectionHeap
pointers to active Solvers in ascending or descending order
virtual bool isWinnerDecided(bool feasibleSol)
check racing termination criteria
virtual void inactivateSolver(int rank)
inactivate the Solver specified by rank
virtual bool isEvaluationStage(int rank)
check if the Solver specified in an argument is evaluation stage or not
virtual bool isTerminated(int rank)
check if the Solver specified by rank is terminated or not
class BbParaSolverPoolElement (This class includes information about a Solver status)
BbParaSolverPoolElementPtr * selectionHeapElement
pointer to selection heap element
void setTermState(ParaSolverTerminationState *inTermState)
set termination state
long long getNumOfNodesSolved()
get number of nodes solved
void setDualBoundGainTesting(bool value)
set dual bound gain is testing value
bool isEvaluationStage()
check if this Solver is in evaluation stage
bool generator
this Solver can generate subproblems
void activate(BbParaNode *inNode)
activate this Solver
void setCollectingModeSolverHeapElement(BbParaSolverPoolElementPtr *inCollectingModeSolverHeapElement)
set collecting mode Solver heap element
int getNumOfNodesLeft()
get number of nodes left
BbParaSolverPoolElementPtr * collectingModeSolverHeapElement
bool isOutCollectingMode()
check if this Solver is out of collecting mode or not
void setCollectingMode(bool b)
set collecting mode
void setSelectionHeapElement(BbParaSolverPoolElementPtr *inSelectionHeapElement)
set selection heap element
bool isCandidateOfCollecting()
check if this Solver is candidate of collecting mode Solver
BbParaSolverPoolElementPtr * getSelectionHeapElement()
extract current solving BbParaNode
void interruptRequested()
set TerminateRequseted on Solver status
void setCollectingIsAllowed()
allows to be in collecting mode
void setNumOfDiffNodesSolved(int inNumOfDiff)
set number of nodes left difference between current number and that in the previous notification time
ParaTask * getCurrentNode()
get current solving BbParaNode
bool candidateOfCollecting
indicate that this Solver is a candidate of collecting mode Solver
BbParaSolverPoolElement(int inRank)
constructor
void switchIntoEvaluation()
switch into evaluation stage
void setBestDualBoundValue(double inBestDualBoundValue)
set best dual bound value
void racingActivate()
activate this Solver as a racing Solver
void setNumOfNodesSolved(long long inNumOfNodesSolved)
set number of nodes solved
BbParaNode * selfSplitNodes
list of nodes generated by self-split ramp-up
int numOfDiffNodesLeft
number of nodes left difference between current number and that in the previous notification time
void setDualBoundValue(double dualBoundValue)
set dual bound value on paraNode
void addSubtreeRoot(BbParaNode *inNode)
add subtree root node
void setNumOfNodesLeft(int inNumOfNodesLeft)
set number of nodes left
void deleteCurrentNode()
delete current solving BbParaNode
void switchOutEvaluation()
switch out of evaluation stage
int rank
rank of the Solver
void makeSubtreeRootCurrent(BbParaNode *inNode)
make subtree root node current
int numOfNodesLeft
number of nodes left
BbParaNode * currentNode
solving node
double bestDualBoundValue
best dual bound value of the Solver
BbParaNode * extractCurrentNode()
extract current solving BbParaNode
bool isGenerator()
check if this Solver is generator or not *‍/
int numOfDiffNodesSolved
number of nodes solved difference between current number and that in the previous notification time
bool isDualBoundGainTesting()
check if dual bound gain is testing in this Solver or not
int getNumOfDiffNodesSolved()
get number of nodes left difference between current number and that in the previous notification time
void terminated()
set Terminated on Solver status
void terminateRequested()
set TerminateRequseted on Solver status
void removeSubtreeRoot(BbParaNode *inNode)
remove subtree root node in self-split nodes list
BbParaNode * died()
kill this Solver
bool collectingMode
indicate if current Solver is in collecting mode or not
int getRank()
get rank of the Solver
void setCandidateOfCollecting(bool b)
set candidate of collecting mode Solver
BbParaNode * extractSubtreeRoot(BbParaNode *inNode)
extract subtree root node
bool isActive()
check if this Solver is active or not
SolverStatus getStatus()
get Solver status
BbParaNode * getSelfSplitNodes()
get a list of nodes which are generated by self-split ramp-up
bool isCollectingProhibited()
check if this Solver cannot be allowed in collecting mode
long long numOfNodesSolved
number of nodes solved. -1 is the special value which means never updated in racing
bool dualBoundGainTesting
indicate that dual bound gain is testing or not
void setNumOfDiffNodesLeft(int inNumOfDiff)
set number of nodes left difference between current number and that in the previous notification time
bool isInCollectingMode()
check if this Solver is in collecting mode or not
ParaSolverTerminationState * termState
Solver termination statistics: for checkpoint.
double getBestDualBoundValue()
get best dual bound value
bool isRacingStage()
check if this Solver is in racing stage
void prohibitCollectingMode()
prohibits to be in collecting mode
BbParaNode * extractSelfSplitNodes()
extract a list of nodes which are generated by self-split ramp-up
void inactivate()
inactivate this Solver
ParaSolverTerminationState * getTermState()
get termination state
bool collectingIsProhibited
collecting is temporary prohibited
void setNoGenerator()
make this Solver No generator
BbParaSolverPoolElementPtr * getCollectingModeSolverHeapElement()
get collecting mode Solver heap element
int getNumOfDiffNodesLeft()
get number of nodes left difference between current number and that in the previous notification time
SolverStatus status
status of the Solver
class BbParaSolverPoolForMinimization (Solver Pool for Minimization Problems)
virtual double getGlobalBestDualBoundValue()
get global best dual bound value
virtual void updateSolverStatus(int rank, long long numNodesSolved, int numNodesLeft, double solverLocalBestBound, BbParaNodePool *paraNodePool)
update Solver status
BbParaSolverPoolForMinimization(double inMp, double inBgap, double inMBgap, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
constructor
virtual void switchInCollectingMode(BbParaNodePool *paraNodePool)
switch in collecting mode
virtual ~BbParaSolverPoolForMinimization()
destructor
BbParaSolverPoolForMinimization(double inMp, double inBgap, double inMBgap, int inNSolvers, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
constructor
class BbParaSolverPool (Solver Pool base class)
virtual void activateSolver(int rank, BbParaNode *node, int nGoodNodesInNodePool, double averageDualBoundGain)
activate the Solver specified by rank with specified node which has been sent
virtual void switchInCollectingMode(BbParaNodePool *paraNodePool)=0
switch in collecting mode
bool active
indicate if this pool is active or not
virtual void updateSolverStatus(int rank, long long numNodesSolved, int numNodesLeft, double solverLocalBestBound, BbParaNodePool *paraNodePool)=0
update Solver status
BbParaSolverPool(double inMp, double inBgap, double inMBgap, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
constructor
int mCollectingNodes
multiplier for the number of collecting BbParaNodes
virtual std::size_t getNumInactiveSolvers()
get number of inactive Solvers
virtual void deleteCurrentSubtreeRootNode(int rank)
delete current self-split subtree root node from the active solver with the specified rank
virtual void switchInCollectingToSolver(int rank, BbParaNodePool *paraNodePool)
switch a Solver to be in collecting mode
virtual BbParaNode * extractSelfSplitSubtreeRootNode(int rank, BbParaNode *node)
extract self-split subtree root node from the active solver with the specified rank
std::size_t nLimitCollectingModeSolvers
limit number of Solvers that can be in collecting mode
double bgap
threshold value of gap
virtual int getMCollectingNodes()
get multiplier of collecting BbParaNodes
virtual int getGoodSolverSolvingEssentialNode()
get rank of the Solver which has top priority in selection criteria
int mMaxCollectingNodes
maximum multiplier for the number of collecting BbParaNodes
virtual void switchOutCollectingMode()
switch out collecting mode
BbParaSolverPoolElementPtr * pool
Solver pool indexed by Solver's rank.
unsigned long long nNodesSolvedInSolvers
number of nodes solved in current running Solvers
std::size_t nGenerator
number of generators
virtual int getBestSolver()
get rank of the Solver which has top priority in selection criteria
virtual bool isSolverActive(int rank)
check if the Solver specified by rank is active or not
BbParaSolverPool(double inMp, double inBgap, double inMBgap, int inNSolvers, int inOriginRank, ParaComm *inParaComm, ParaParamSet *inParaParams, ParaTimer *inParaTimer)
constructor
bool breakingFirstSubtree
breaking the first subtree
virtual void activate()
activate this Solver pool
virtual unsigned long long getNnodesInSolvers()
get number of nodes in all Solvers
unsigned long long nTotalNodesSolved
number of nodes solved : updated at termination of subtree computation
double switchOutTime
switch out time
virtual bool isDualBounGainTesting(int rank)
check if dual bound gain testing is proceeding or not in the Solver specified
virtual bool isInCollectingMode()
check if this system is in collecting mode or not
virtual void setSwichOutTime(double time)
set time of switching out collecting mode
virtual void sendSwitchOutCollectingModeIfNecessary(int rank)
switch out collecting mode of the Solver specified by rank if it is necessary
virtual void terminated(int rank)
set the Solver specified by rank is terminated
virtual int writeSolverStatisticsToCheckpointFile(gzstream::ogzstream &out)
write Solver statistics to checkpoint file
virtual bool isActive()
check if this Solver pool is active or not
virtual std::size_t getNLimitCollectingModeSolvers()
get limit number of Solvers that can be in collecting mode
std::map< int, BbParaSolverPoolElementPtr > deadSolvers
pointers to dead Solvers
bool beforeFinishingFirstCollect
before finishing first collecting mode
virtual ParaSolverTerminationState * getTermState(int rank)
get SolverTermination state of the Solver specified
virtual void reinitToRestart()
reinitialize to restart
virtual double getGlobalBestDualBoundValue()=0
get global best dual bound value
virtual bool isSolverInCollectingMode(int rank)
get collecting mode of the Solver specified by rank
double absoluteGap
allowable absolute dual bound gap to the best Solver
virtual void updateDualBoundsForSavingNodes()
update dual bound values of saving BbParaNodes by their dual bound values for subtrees
virtual void makeSubtreeRootNodeCurrent(int rank, BbParaNode *node)
make subtree root node as current task for the specified rank
virtual void setTermState(int rank, ParaSolverTerminationState *inTermState)
set SolverTerminationState to the Solver specified
virtual bool canIncreaseLimitNLimitCollectingModeSolvers()
check if the number of Solvers in collecting mode can be increased or not
virtual bool isTerminateRequested(int rank)
check if the Solver specified by rank is terminate requested or not
virtual BbParaNode * extractSelfSplitSubtreeRootNodes(int rank)
extract self-split subtree root node from the active solver with the specified rank
virtual int getInactiveSolverRank()
get an inactive Solver rank
virtual void resetCountersInSolver(int rank, long long numOfNodesSolved, int numOfSelfSplitNodesLeft, BbParaNodePool *paraNodePool)
reset counters in the Solver specified by rank
bool collectingMode
indicate that this system is in collecting mode or not
virtual BbParaNode * getSelfSplitSubtreeRootNodes(int rank)
get self-split subtree root node from the active solver with the specified rank
virtual void terminateRequested(int rank)
set the Solver specified by rank is terminate requested
virtual int getNumOfNodesLeftInBestSolver()
get the number of nodes left in the Solver which has the best dual bound value
virtual ParaTask * getCurrentTask(int rank)
get current solving BbParaNode in the Solver specified by rank *‍/
virtual int writeParaNodesToCheckpointFile(gzstream::ogzstream &out)
write BbParaNodes to checkpoint file
virtual unsigned long long getTotalNodesSolved()
get number of nodes solved in all Solvers: updated at termination of subtree computation
virtual double getSwichOutTime()
the following functions are to omit rebooting collecting mode process
virtual void addTotalNodesSolved(unsigned long long num)
add number of nodes solved in all Solvers
virtual void enforcedSwitchOutCollectingMode(int rank)
enforced to switch out collecting mode of the Solver specified by rank if it is necessary
virtual void inactivateSolver(int rank, long long numOfNodesSolved, BbParaNodePool *paraNodePool)
inactivate the Solver specified by rank
virtual BbParaNode * extractCurrentNodeAndInactivate(int rank, BbParaNodePool *paraNodePool)
extract current solving BbParaNode in the Solver specified by rank and inactivate the Solver
virtual double getDualBoundValue(int rank)
get dual bound value of solving BbParaNode by the Solver specified
virtual ~BbParaSolverPool()
destructor
unsigned long long nNodesInSolvers
number of nodes in all Solvers
bool beforeInitialCollect
before initial collecting mode
virtual bool currentSolvingNodehaeDescendant(int rank)
extract current solving BbParaNode in the Solver specified by rank and inactivate the Solver
virtual std::size_t getNumActiveSolvers()
get number of active Solvers
double mBgap
multiplier of the bgap value
virtual std::size_t getNSolvers()
get number of Solvers in this Solver pool
virtual void setCollectingIsAllowed(int rank)
set collecting mode is allowed to the Solver specified by rank
virtual bool isInterruptRequested(int rank)
check if the Solver specified by rank is interrupt requested or not
virtual int getMMaxCollectingNodes()
get maximum multiplier for the number of collecting BbParaNodes
std::map< int, BbParaSolverPoolElementPtr > inactiveSolvers
pointers to inactive Solvers
virtual void interruptRequested(int rank)
set the Solver specified by rank is terminate requested
virtual unsigned long long getNnodesSolvedInSolvers()
get number of nodes solved in current running Solvers
virtual int getNumOfNodesLeft(int rank)
get the number of nodes left by the Solver specified
virtual BbParaNode * solverDied(int rank)
kill the Solver specified by rank
virtual long long getNumOfNodesSolved(int rank)
get the number of nodes solved by the Solver specified
SelectionHeap * selectionHeap
pointers to active Solvers in ascending or descending order
std::map< int, BbParaSolverPoolElementPtr > activeSolvers
pointers to active Solvers
std::multimap< double, BbParaSolverPoolElementPtr > candidatesOfCollectingModeSolvers
pointers to candidates of collecting mode Solvers
virtual void addNumNodesSolved(long long numOfNodesSolved)
add number of nodes solved
virtual void addNewSubtreeRootNode(int rank, BbParaNode *node)
add new subtree root node to the active solver with the specified rank
int nDualBoundGainTesting
the number of dual bound gain testing Solvers
double mp
multiplier of the threshold value p
virtual void removeSubtreeRootNode(int rank, BbParaNode *node)
remove subtree root node from the active solver with the specified rank
CollectingModeSolverHeap * collectingModeSolverHeap
pointers to collecting mode Solvers in ascending or descending order
std::size_t nCollectingModeSolvers
number of collecting mode Solvers
std::size_t nMaxCollectingModeSolvers
maximum number of Solvers that can be in collecting mode
virtual void incNLimitCollectingModeSolvers()
increase the limit number of Solvers getting into collecting mode
virtual bool isTerminated(int rank)
check if the Solver specified by rank is terminated or not
class CollectingModeSolverHeap
virtual void upHeap(std::size_t pos)=0
up heap
const std::string toString()
stringfy of this object for debugging
virtual ~CollectingModeSolverHeap()
destructor
CollectingModeSolverHeap(std::size_t size)
constructor
BbParaSolverPoolElementPtr remove()
remove top priority BbParaSolverPoolElementPtr from CollectingModeSolver Heap *‍/
virtual void deleteElement(BbParaSolverPoolElementPtr solver)=0
delete BbParaSolverPoolElementPtr from CollectingModeSolver Heap
std::size_t maxHeapSize
maximum size of this heap
virtual void updateDualBoundValue(BbParaSolverPoolElementPtr solver, double value)=0
update CollectingModeSolver heap by a new dual bound value of this Solver
std::size_t heapSize
current used heap size
ResultOfInsert insert(BbParaSolverPoolElementPtr solver)
insert BbParaSolverPoolElementPtr to CollectingModeSolver Heap
void resize(std::size_t size)
resize CollectingModeSolver Heap
std::size_t getHeapSize() const
get current used heap size
virtual void downHeap(std::size_t pos)=0
down heap
BbParaSolverPoolElementPtr * heap
heap : contents are BbParaSolverPoolElementPtr
BbParaSolverPoolElementPtr top() const
obtain top priority BbParaSolverPoolElementPtr
std::size_t getMaxHeapSize() const
get max heap size
class DescendingCollectingModeSolverHeap
virtual void updateDualBoundValue(BbParaSolverPoolElementPtr solver, double value)
update CollectingModeSolver heap by a new dual bound value of this Solver
virtual void deleteElement(BbParaSolverPoolElementPtr solver)
delete BbParaSolverPoolElementPtr from CollectingModeSolver Heap
virtual ~DescendingCollectingModeSolverHeap()
destructor
virtual void downHeap(std::size_t pos)
down heap
DescendingCollectingModeSolverHeap(std::size_t size)
constructor
virtual void upHeap(std::size_t pos)
up heap
class DescendingSelectionHeap
virtual void updateDualBoundValue(BbParaSolverPoolElementPtr solver, double value)
update selection heap by a new dual bound value of this Solver
DescendingSelectionHeap(std::size_t size)
constructor
virtual void deleteElement(BbParaSolverPoolElementPtr solver)
delete BbParaSolverPoolElementPtr from Selection Heap
virtual ~DescendingSelectionHeap()
destructor
virtual void downHeap(std::size_t pos)
down heap
virtual void upHeap(std::size_t pos)
up heap
Base class of communicator object.
Definition: paraComm.h:102
virtual int getSize()=0
get number of UG processes or UG threads depending on run-time environment
class for deterministic timer
class ParaParamSet
Definition: paraParamSet.h:850
bool getBoolParamValue(int param)
get bool parameter value
double getRealParamValue(int param)
get real parameter value
int getIntParamValue(int param)
get int parameter value
class ParaRacingSolverPool (Racing Solver Pool)
int originRank
origin rank of Solvers managed by this Solver pool
ParaComm * paraComm
communicator
int nSolvers
number of Solvers
class ParaSolverPool (Solver Pool base class)
int originRank
origin rank of Solvers managed by this Solver pool
ParaParamSet * paraParams
runtime parameters for parallelization
ParaComm * paraComm
communicator
std::size_t nSolvers
number of Solvers
class ParaSolverTerminationState (Solver termination state in a ParaSolver)
virtual void write(gzstream::ogzstream &out)=0
write ParaSolverTerminationState to checkpoint file
class ParaTask
Definition: paraTask.h:542
bool isRootTask()
check if root task or not
Definition: paraTask.h:624
bool hasDescendant()
check if this task has descendant or not
Definition: paraTask.h:930
ParaTaskGenealogicalPtr * getAncestor()
getter of ancestor
Definition: paraTask.h:876
class ParaTimer
Definition: paraTimer.h:49
class Selection Heap
virtual void upHeap(std::size_t pos)=0
up heap
const std::string toString()
stringfy of this object for debugging
BbParaSolverPoolElementPtr remove()
remove top priority BbParaSolverPoolElementPtr from Selection Heap
SelectionHeap(std::size_t size)
constructor
ResultOfInsert
results of insert
@ FAILED_BY_FULL
FAILED_BY_FULL.
BbParaSolverPoolElementPtr get(int i) const
obtain i-th in heap BbParaSolverPoolElementPtr
virtual void deleteElement(BbParaSolverPoolElementPtr solver)=0
delete BbParaSolverPoolElementPtr from Selection Heap
std::size_t maxHeapSize
maximum size of this heap
virtual void updateDualBoundValue(BbParaSolverPoolElementPtr solver, double value)=0
update selection heap by a new dual bound value of this Solver
std::size_t heapSize
current used heap size
void resize(std::size_t size)
resize Selection Heap
ResultOfInsert insert(BbParaSolverPoolElementPtr solver)
insert BbParaSolverPoolElementPtr to Selection Heap
std::size_t getHeapSize() const
get current used heap size
virtual void downHeap(std::size_t pos)=0
down heap
BbParaSolverPoolElementPtr * heap
heap : contents are BbParaSolverPoolElementPtr
BbParaSolverPoolElementPtr top() const
obtain top priority BbParaSolverPoolElementPtr
virtual ~SelectionHeap()
destructor
std::size_t getMaxHeapSize() const
get max heap size
static const int BreakFirstSubtree
static const int SolverOrderInCollectingMode
static const int MaxNumberOfCollectingModeSolvers
static const int MinNumberOfCollectingModeSolvers
static const int ABgapForSwitchingToBestSolver
SolverStatus
@ Terminated
@ Active
@ Dead
@ TerminateRequested
@ Inactive
@ InterruptRequested
@ Racing
@ RacingEvaluation
BbParaSolverPoolElement * BbParaSolverPoolElementPtr
#define THROW_LOGICAL_ERROR1(msg1)
Definition: paraDef.h:52
#define THROW_LOGICAL_ERROR2(msg1, msg2)
Definition: paraDef.h:69
Base class for deterministic timer.
Base class for racing ramp-up parameter set.
Solver pool.
#define SOLVER_POOL_INDEX(rank)
Base class for ParaTask.
Base class for Timer.