61BbParaLoadCoordinator::BbParaLoadCoordinator(
63 UGS::UgsParaCommMpi *inCommUgs,
69 bool *inRacingSolversExist,
85 initialNodesGenerated(false),
86 firstCollectingModeState(-1),
87 isCollectingModeRestarted(false),
89 nReplaceToBetterNode(0),
91 winnerSolverNodesCollected(false),
93 restartingRacing(false),
95 statEmptyNodePoolTime(DBL_MAX),
96 minDepthInWinnerSolverNodes(INT_MAX),
97 maxDepthInWinnerSolverNodes(-1),
99 nBoundChangesOfBestNode(0),
104 nCollectedSolvers(0),
105 previousTabularOutputTime(0.0),
106 averageDualBoundGain(0.0),
107 nAverageDualBoundGain(0),
108 averageLastSeveralDualBoundGains(0.0),
110 hugeImbalanceTime(-1.0),
111 paraNodePoolToRestart(0),
112 paraNodePoolBufferToRestart(0),
113 paraNodePoolBufferToGenerateCPF(0),
114 paraNodeToKeepCheckpointFileNodes(0),
115 unprocessedParaNodes(0),
116 selfSplitFinisedSolvers(0),
117 osTabularSolvingStatus(0),
119 allCompInfeasibleAfterSolution(false),
120 minmalDualBoundNormalTermSolvers(DBL_MAX),
121 warmStartNodeTransferring(false),
122 hugeImbalance(false),
123 isHeaderPrinted(false),
124 givenGapIsReached(false),
125 aSolverTerminatedWithOptimality(false),
191 std::cout <<
"EnhancedCheckpointStartTime mast be greater than 1.0. " << std::endl;
197 std::cout <<
"EnhancedCheckpointStartTime mast be less than FinalCheckpointGeneratingTime. " << std::endl;
204 std::cout <<
"FinalCheckpointNSolvers mast be less equal than the number of solvers. " << std::endl;
206 std::cout <<
"The number of solvers = " << (
paraComm->
getSize() - 1) << std::endl;
213 std::cout <<
"** FinalCheckpointGeneratingTime is specified, then TimeLimit is omitted. ** " << std::endl;
219 std::cout <<
"LC is working with normal ramp-up." << std::endl;
223 std::cout <<
"LC is working with racing ramp-up." << std::endl;
227 std::cout <<
"LC is working with racing ramp-up and with rebuilding tree after racing." << std::endl;
231 std::cout <<
"LC is working with self-split ramp-up." << std::endl;
238 <<
" LC" <<
" INITIAL_PRIMAL_VALUE "
247 std::ostringstream s;
252 << commUgs->getMySolverName() <<
"_"
267 std::cout <<
"Sub tree info. log file cannot open : file name = " << s.str() << std::endl;
282 std::ostringstream s;
287 << commUgs->getMySolverName() <<
"_"
302 std::cout <<
"Tabular solving status file cannot open : file name = " << s.str() << std::endl;
365 std::cout <<
"** GenerateReducedCheckpointFiles is specified, then this solver shuld be executed with"
366 <<
"-w option and MergeNodesAtRestart = TRUE and DualBoundGainTest = FALSE ** " << std::endl;
411 std::ostringstream s;
412 s <<
"[ERROR RETURN form termination message handler]:" << __FILE__ <<
"] func = "
413 << __func__ <<
", line = " << __LINE__ <<
" - "
414 <<
"process tag = " << tag << std::endl;
424 if( commUgs ) checkAndReadIncumbent();
464 int nKeepingNodes = 0;
465 int nNoProcessedNodes = 0;
490 << (nKeepingNodes + nNoProcessedNodes) <<
" nodes remained" << std::endl;
566 <<
" initially keeping nodes by the run-time parameter."
572 <<
" nodes." << std::endl;
681 ABORT_LOGICAL_ERROR1(
"Computation is interrupted in racing stage, but no paraRacingSolverPool");
706 *
osTabularSolvingStatus <<
"* Warning: the number of nodes (total) including nodes solved by interrupted Solvers is "
741 std::cout <<
lcts.
runningTime <<
" BbParaLoadCoordinator_TERMINATED" << std::endl;
765 <<
" active racing ramp-up solvers exist." << std::endl;
766 *osStatisticsFinalRun << dynamic_cast<BbParaRacingSolverPool *>(
paraRacingSolverPool)->getStrActiveSolerNumbers() << std::endl;
797 int exitSolverRequest = 0;
845#ifdef UG_DEBUG_SOLUTION
846#ifdef UG_DEBUG_SOLUTION_OPT_PATH
958 double globalBestDualBoundValueLocal =
982#ifdef UG_DEBUG_SOLUTION
985 throw "Optimal solution going to be killed.";
1022 <<
" S." << source <<
" R.SOL "
1045 <<
" S." << source <<
" I.SOL "
1052 <<
" S." << source <<
" I.SOL "
1054 paraInitiator->getGlobalBestIncumbentSolution()->getObjectiveFunctionValue()
1069 snprintf(solutionFileNameTemp,
MaxStrLen,
"%s%s_after_checkpointing_solution_t.gz",
1073 snprintf(solutionFileName,
MaxStrLen,
"%s%s_after_checkpointing_solution.gz",
1076 if ( rename(solutionFileNameTemp, solutionFileName) )
1078 std::cout <<
"after checkpointing solution file cannot be renamed: errno = " << strerror(errno) << std::endl;
1104 double globalBestDualBoundValue = -DBL_MAX;
1105 double globalBestDualBoundValueLocal = -DBL_MAX;
1121 globalBestDualBoundValueLocal = globalBestDualBoundValue =
1131 <<
" S." << source <<
" | "
1157 <<
" ) ] ** R" << std::endl;
1163 <<
" S." << source <<
" | "
1170 std::cout <<
" ( Inf )";
1177 globalBestDualBoundValue =
1179 std::cout <<
" ** G.B.: " <<
paraInitiator->convertToExternalValue(globalBestDualBoundValue);
1183 std::cout <<
" ( Inf ) ";
1187 std::cout <<
" ( " <<
paraInitiator->getGap(globalBestDualBoundValue) * 100 <<
"% ) ";
1191 <<
" ) ] ** RR" << std::endl;
1205 double solverDualBoundGain = 0.0;
1218 <<
", g:" << solverDualBoundGain;
1258 globalBestDualBoundValueLocal =
1268 globalBestDualBoundValue = globalBestDualBoundValueLocal =
1280 globalBestDualBoundValueLocal = globalBestDualBoundValue =
1291 globalBestDualBoundValueLocal = globalBestDualBoundValue =
1300 globalBestDualBoundValueLocal = globalBestDualBoundValue =
1312 <<
" S." << source <<
" | "
1365 *osLogSolvingStatus << dynamic_cast<BbParaSolverPoolForMinimization *>(
paraSolverPool)->getNnodesSolvedInSolvers()
1378 *osLogSolvingStatus << dynamic_cast<BbParaSolverPoolForMinimization *>(
paraSolverPool)->getNnodesSolvedInSolvers()
1402 <<
" S." << source <<
" | "
1409 std::cout <<
" ( Inf )";
1416 globalBestDualBoundValue =
1420 std::cout <<
" ** G.B.: " <<
paraInitiator->convertToExternalValue(globalBestDualBoundValue);
1424 std::cout <<
" ( Inf ) ";
1428 std::cout <<
" ( " <<
paraInitiator->getGap(globalBestDualBoundValue) * 100 <<
"% ) ";
1447 std::cout << std::endl;
1474 bbParaInitiator->
getGap(globalBestDualBoundValue) < bbParaInitiator->
getGapValue() )
1536 globalBestDualBoundValueLocal
1607 "Limit number of collecting mode solvers extends to " <<
1643 globalBestDualBoundValueLocal
1771 switch ( calcTerminationState )
1850 switch ( calcTerminationState )
1855 <<
" S." << source <<
" >";
1862 <<
" S." << source <<
" >(INTERRUPTED_BY_ANOTHER_NODE)";
1868 <<
" S." << source <<
" >(INTERRUPTED)";
1874 <<
" S." << source <<
" >(TERMINATED_IN_RACING_STAGE)";
1880 <<
" S." << source <<
" >(INTERRUPTED_IN_RACING_STAGE)";
1895 std::cout << std::endl;
1898 switch ( calcTerminationState )
1937 <<
" Nodes generated by S." << source <<
" from " << solvingNode->
toSimpleString() <<
" are collected to LC." << std::endl;
2104 <<
" Nodes generated by S." << source <<
" from " << solvingNode->
toSimpleString() <<
" are collected to LC." << std::endl;
2183 source <<
" is terminated in racing stage #########" << std::endl;
2200 minmalDualBoundNormalTermSolvers < calcState->getDualBoundValue() )
2265 <<
" Nodes generated by S." << source <<
" from " << solvingNode->
toSimpleString() <<
" are collected to LC." << std::endl;
2536#ifndef _COMM_MPI_WORLD
2575 double bestDualBoundValue;
2595 if( !paraNode )
break;
2604#ifdef UG_DEBUG_SOLUTION
2607 throw "Optimal solution going to be killed.";
2633 double globalBestDualBoundValueLocal =
2646 <<
" S." << source <<
" <(ANOTHER_NODE) "
2664 <<
" S." << source <<
" <(ANOTHER_NODE) "
2671 std::cout <<
" ( Inf )";
2678 std::cout << std::endl;
2724 double tightenedBound;
2739 if(
static_cast<int>(i) != source )
2764 double tightenedBound;
2779 if(
static_cast<int>(i) != source )
3012 switch ( calcTerminationState )
3079 switch ( calcTerminationState )
3185 <<
" Nodes generated by S." << source <<
" from " << solvingNode->
toSimpleString() <<
" are collected to LC." << std::endl;
3191 nodes = nodes->
next;
3239 nodes = nodes->
next;
3299 nodes = nodes->
next;
3329 nodes = nodes->
next;
3378 <<
" Nodes generated by S." << source <<
" from " << solvingNode->
toSimpleString() <<
" are collected to LC." << std::endl;
3384 nodes = nodes->
next;
3416 nodes = nodes->
next;
3476 nodes = nodes->
next;
3507 nodes = nodes->
next;
3554 nodes = nodes->
next;
3616 nodes = nodes->
next;
3647 nodes = nodes->
next;
3817 *osTabularSolvingStatus << std::setw(15) << std::right << dynamic_cast<BbParaRacingSolverPool *>(
paraRacingSolverPool)->getNnodesSolvedInBestSolver();
3827 *osTabularSolvingStatus << std::setw(12) << std::right << dynamic_cast<BbParaRacingSolverPool *>(
paraRacingSolverPool)->getNnodesLeftInBestSolver();
3929 *osTabularSolvingStatus << std::setw(15) << std::right << dynamic_cast<BbParaSolverPoolForMinimization *>(
paraSolverPool)->getNnodesSolvedInSolvers();
3932 *osTabularSolvingStatus << std::setw(12) << std::right << ( dynamic_cast<BbParaSolverPoolForMinimization *>(
paraSolverPool)->getNnodesInSolvers()
3938 *osTabularSolvingStatus << std::setw(12) << std::right << ( dynamic_cast<BbParaSolverPoolForMinimization *>(
paraSolverPool)->getNnodesInSolvers()
3944 *osTabularSolvingStatus << std::setw(12) << std::right << ( dynamic_cast<BbParaSolverPoolForMinimization *>(
paraSolverPool)->getNnodesInSolvers()
4054 bbParaInitiator->
getGap( globalBestDualBound ) * 100 <<
"%";
4219 std::cout <<
"### REACHED TO THE SPECIFIED NUMBER OF IDLER SOLVERS, then EXIT ###" << std::endl;
4278 std::ostringstream s;
4279 s <<
"[ERROR RETURN form Message Hander]:" << __FILE__ <<
"] func = "
4280 << __func__ <<
", line = " << __LINE__ <<
" - "
4281 <<
"process tag = " << tag << std::endl;
4291 if( commUgs ) checkAndReadIncumbent();
4366 double globalBestDualBoundValueLocal =
4406 double globalBestDualBoundValueLocal =
4586 <<
" Interrupt all solvers to restart"
4591 "Interrupt all solvers to restart after "
4629 std::ostringstream s;
4630 s <<
"[ERROR RETURN form Message Hander]:" << __FILE__ <<
"] func = "
4631 << __func__ <<
", line = " << __LINE__ <<
" - "
4632 <<
"process tag = " << tag << std::endl;
4642 if( commUgs ) checkAndReadIncumbent();
4654 std::cout <<
"Logical error occurred during restart in ramp-down phase." << std::endl;
4655 std::cout <<
"You can restart from the chakepoint file." << std::endl;
4721 bool sentNode =
false;
4742 if( !paraNode )
break;
4798#ifdef UG_DEBUG_SOLUTION
4801 throw "Optimal solution going to be killed.";
4830#ifdef UG_DEBUG_SOLUTION
4833 throw "Optimal solution going to be killed.";
4879 double globalBestDualBoundValueLocal =
4886 if( destination < 0 )
4914 <<
" S." << destination <<
" < "
4940 std::cout <<
"node id = " << (paraNode->
getTaskId()).toString() << std::endl;
4957 <<
" S." << destination <<
" < "
4964 std::cout <<
" ( Inf )";
4978 std::cout << std::endl;
5018 ctime_s(timeStr, bufsize, &timer);
5020 ctime_r(&timer, timeStr);
5022 for(
int i = 0; timeStr[i] !=
'\0' && i < 26; i++ )
5024 if( timeStr[i] ==
' ') timeStr[i] =
'_';
5025 if( timeStr[i] ==
'\n' ) timeStr[i] =
'\0';
5027 char *newCheckpointTimeStr = &timeStr[4];
5032 int l = strlen(newCheckpointTimeStr);
5033 newCheckpointTimeStr[l] =
'a';
5034 newCheckpointTimeStr[l+1] =
'\0';
5039 snprintf(nodesFileName,
MaxStrLen,
"%s%s_%s_nodes_LC%d.gz",
5042 gzstream::ogzstream checkpointNodesStream;
5043 checkpointNodesStream.open(nodesFileName, std::ios::out | std::ios::binary);
5044 if( !checkpointNodesStream )
5046 std::cout <<
"Checkpoint file for ParaNodes cannot open. file name = " << nodesFileName << std::endl;
5073 n += nUnprocessedNodes;
5075 checkpointNodesStream.close();
5079 <<
" Checkpoint: " << n <<
" ParaNodes were saved" << std::endl;
5083 <<
" Checkpoint: " << n <<
" ParaNodes were saved" << std::endl;
5089 "Storing check-point data after " <<
5091 n <<
" nodes were saved." << std::endl;
5098 snprintf(solutionFileName,
MaxStrLen,
"%s%s_%s_solution.gz",
5105 char solverStatisticsFileName[
MaxStrLen];
5106 snprintf(solverStatisticsFileName,
MaxStrLen,
"%s%s_%s_solverStatistics_LC%d.gz",
5109 gzstream::ogzstream checkpointSolverStatisticsStream;
5110 checkpointSolverStatisticsStream.open(solverStatisticsFileName, std::ios::out | std::ios::binary);
5111 if( !checkpointSolverStatisticsStream )
5113 std::cout <<
"Checkpoint file for SolverStatistics cannot open. file name = " << solverStatisticsFileName << std::endl;
5117 checkpointSolverStatisticsStream.close();
5120 char loadCoordinatorStatisticsFileName[
MaxStrLen];
5121 snprintf(loadCoordinatorStatisticsFileName,
MaxStrLen,
"%s%s_%s_loadCoordinatorStatistics_LC%d.gz",
5124 gzstream::ogzstream loadCoordinatorStatisticsStream;
5125 loadCoordinatorStatisticsStream.open(loadCoordinatorStatisticsFileName, std::ios::out | std::ios::binary);
5126 if( !loadCoordinatorStatisticsStream )
5128 std::cout <<
"Checkpoint file for SolverStatistics cannot open. file name = " << loadCoordinatorStatisticsFileName << std::endl;
5138 loadCoordinatorStatisticsStream.close();
5147 snprintf(racingWinnerParamsName,
MaxStrLen,
"%s%s_racing_winner_params.gz",
5150 gzstream::ogzstream racingWinnerParamsStream;
5151 racingWinnerParamsStream.open(racingWinnerParamsName, std::ios::out | std::ios::binary);
5152 if( !racingWinnerParamsStream )
5154 std::cout <<
"Racing winner parameter file cannot open. file name = " << racingWinnerParamsName << std::endl;
5158 racingWinnerParamsStream.close();
5164 snprintf(nodesFileName,
MaxStrLen,
"%s%s_%s_nodes_LC%d.gz",
5169 snprintf(solutionFileName,
MaxStrLen,
"%s%s_%s_solution.gz",
5173 snprintf(solverStatisticsFileName,
MaxStrLen,
"%s%s_%s_solverStatistics_LC%d.gz",
5176 snprintf(loadCoordinatorStatisticsFileName,
MaxStrLen,
"%s%s_%s_loadCoordinatorStatistics_LC%d.gz",
5179 if( remove(nodesFileName) )
5181 std::cout <<
"checkpoint nodes file cannot be removed: errno = " << strerror(errno) << std::endl;
5184 if ( remove(solutionFileName) )
5186 std::cout <<
"checkpoint solution file cannot be removed: errno = " << strerror(errno) << std::endl;
5189 if ( remove(solverStatisticsFileName) )
5191 std::cout <<
"checkpoint SolverStatistics file cannot be removed: errno = " << strerror(errno) << std::endl;
5194 if ( remove(loadCoordinatorStatisticsFileName) )
5196 std::cout <<
"checkpoint LoadCoordinatorStatistics file cannot be removed: errno = " << strerror(errno) << std::endl;
5201 char afterCheckpointingSolutionFileName[
MaxStrLen];
5202 snprintf(afterCheckpointingSolutionFileName,
MaxStrLen,
"%s%s_after_checkpointing_solution.gz",
5205 gzstream::igzstream afterCheckpointingSolutionStream;
5206 afterCheckpointingSolutionStream.open(afterCheckpointingSolutionFileName, std::ios::in | std::ios::binary);
5207 if( afterCheckpointingSolutionStream )
5210 afterCheckpointingSolutionStream.close();
5211 if ( remove(afterCheckpointingSolutionFileName) )
5213 std::cout <<
"after checkpointing solution file cannot be removed: errno = " << strerror(errno) << std::endl;
5224 gzstream::ogzstream &loadCoordinatorStatisticsStream,
5226 double globalBestDualBoundValue,
5227 double externalGlobalBestDualBoundValue
5230 loadCoordinatorStatisticsStream.write((
char *)&nSolverInfo,
sizeof(
int));
5253 lcts.
write(loadCoordinatorStatisticsStream);
5267 std::cout <<
"*** When warm start with racing is specified, you should specify CollectOnce = TRUE ***" << std::endl;
5270 std::cout <<
"*** When warm start with racing is specified, you cannot specify MergeNodesAtRestart = TRUE ***" << std::endl;
5276 std::cout <<
"*** When warm start with racing is specified, you cannot specify MergeNodesAtRestart = TRUE ***" << std::endl;
5279 std::cout <<
"*** Warm start with racing ramp-up ***" << std::endl;
5287 std::cout <<
"*** Warm start with normal ramp-up ***" << std::endl;
5299 snprintf(racingWinnerParamsName,
MaxStrLen,
"%s%s_racing_winner_params.gz",
5302 gzstream::igzstream racingWinnerParamsStream;
5303 racingWinnerParamsStream.open(racingWinnerParamsName, std::ios::in | std::ios::binary);
5304 if( racingWinnerParamsStream )
5309 racingWinnerParamsStream.close();
5317 std::cout <<
"*** winner parameter is read from " << racingWinnerParamsName <<
"***" << std::endl;
5324 char afterCheckpointingSolutionFileName[
MaxStrLen];
5325 snprintf(afterCheckpointingSolutionFileName,
MaxStrLen,
"%s%s_after_checkpointing_solution.gz",
5331 bbParaInitiator->
writeSolution(
"[Warm started from "+std::string(bbParaInitiator->
getPrefixWarm())+
" : the solution from the checkpoint file]");
5336 bool onlyBoundChanges =
false;
5339 onlyBoundChanges =
true;
5356#ifdef UG_DEBUG_SOLUTION
5357#ifdef UG_DEBUG_SOLUTION_OPT_PATH
5369 std::cout <<
"Checkpoint node has ancestor: " << paraNode->
toString() << std::endl;
5370 std::cout <<
"Something wrong for this checkpoint file." << std::endl;
5379 tempParaNodePool.
insert(paraNode);
5392 std::cout <<
"### NNodesToKeepInCheckpointFile is specified to "
5394 <<
" and also NEagerToSolveAtRestart is specified to "
5396 <<
". The both values should not greater than 0 together." << std::endl;
5401 std::cout <<
"### NNodesToKeepInCheckpointFile is specified to "
5403 <<
" and also MergeNodesAtRestart = TRUE is specified. This combination is not allowed." << std::endl;
5409 ", but the number of nodes in checkpoint file is " << tempParaNodePool.
getNumOfNodes() <<
". ###" << std::endl;
5414 std::cout <<
"### NEagerToSolveAtRestart is specified to "
5416 <<
", but RampUpPhaseProcess != 0 is specified. This combination is not allowed." << std::endl;
5430 std::cout <<
"### NNodesToKeepInCheckpointFile is specified to "
5432 <<
" ###" << std::endl;
5434 <<
" ###" << std::endl;
5436 <<
" ###" << std::endl;
5444 ", but the number of nodes in checkpoint file is " << tempParaNodePool.
getNumOfNodes() <<
". ###" << std::endl;
5449 std::cout <<
"### NEagerToSolveAtRestart is specified to "
5451 <<
" and also MergeNodesAtRestart = TRUE is specified. This combination is not allowed." << std::endl;
5456 std::cout <<
"### NEagerToSolveAtRestart is specified to "
5458 <<
", but RampUpPhaseProcess != 0 is specified. This combination is not allowed." << std::endl;
5472 std::cout <<
"### NEagerToSolveAtRestart is specified to "
5474 <<
" ###" << std::endl;
5476 <<
" ###" << std::endl;
5485 while( ( tempNode = tempParaNodePool.
extractNode() ) )
5521 <<
" Warm started from "
5523 <<
" : " << n <<
" ParaNodes read. Current incumbent value = "
5531 <<
" Warm started from "
5533 <<
" : " << n <<
" ParaNodes read. No solution is generated." << std::endl;
5538 <<
" Warm started from "
5540 <<
" : " << n <<
" ParaNodes read. Current incumbent value = "
5542 paraInitiator->getGlobalBestIncumbentSolution()->getObjectiveFunctionValue() )
5573 double globalBestDualBoundValueLocal =
5663 racingRampUpParams[i-1]->send(
paraComm, i)
5676 racingRampUpParams[i-1]->send(
paraComm, i)
5699 if( racingRampUpParams[i-1] )
delete racingRampUpParams[i-1];
5721 if( racingRampUpParams[i-1] )
delete racingRampUpParams[i-1];
5724 delete [] racingRampUpParams;
5735 char loadCoordinatorStatisticsFileName[
MaxStrLen];
5737 gzstream::igzstream loadCoordinatorStatisticsStream;
5738 loadCoordinatorStatisticsStream.open(loadCoordinatorStatisticsFileName, std::ios::in | std::ios::binary);
5739 if( !loadCoordinatorStatisticsStream )
5741 std::cout <<
"checkpoint LoadCoordinatorStatistics file cannot open: file name = " << loadCoordinatorStatisticsFileName << std::endl;
5744 int nSolverStatistics;
5745 loadCoordinatorStatisticsStream.read((
char *)&nSolverStatistics,
sizeof(
int));
5747 if( !prevLcts->
read(
paraComm, loadCoordinatorStatisticsStream) )
5749 std::cout <<
"checkpoint LoadCoordinatorStatistics file cannot read: file name = " << loadCoordinatorStatisticsFileName << std::endl;
5752 loadCoordinatorStatisticsStream.close();
5755 char solverStatisticsFileName[
MaxStrLen];
5757 gzstream::igzstream solverStatisticsStream;
5758 solverStatisticsStream.open(solverStatisticsFileName, std::ios::in | std::ios::binary);
5759 if( !solverStatisticsStream )
5761 std::cout <<
"checkpoint SolverStatistics file cannot open: file name = " << solverStatisticsFileName << std::endl;
5766 char previousStatisticsFileName[
MaxStrLen];
5767 snprintf(previousStatisticsFileName,
MaxStrLen,
"%s_statistics_w%05lld_LC0",
5770 std::ofstream ofsStatistics;
5771 ofsStatistics.open(previousStatisticsFileName);
5772 if( !ofsStatistics )
5774 std::cout <<
"previous statistics file cannot open : file name = " << previousStatisticsFileName << std::endl;
5779 for(
int i = 0; i < nSolverStatistics; i++ )
5784 std::cout <<
"checkpoint SolverStatistics file cannot read: file name = " << solverStatisticsFileName << std::endl;
5792 ofsStatistics << prevLcts->
toString();
5801 solverStatisticsStream.close();
5802 ofsStatistics.close();
5819 double globalBestDualBoundValueLocal =
5856 <<
" S." << destination <<
" < "
5881 <<
" S." << destination <<
" > "
5883 paraNode->getDualBoundValue() );
5888 std::cout <<
" ( Inf )";
5892 std::cout <<
" ( " <<
paraInitiator->getGap(paraNode->getDualBoundValue()) * 100 <<
"% )";
5902 std::cout << std::endl;
5912 paraNode = bbParaComm->createParaNode(
5926 <<
" S." << destination <<
" < "
5928 dynamic_cast<BbParaNode *
>(paraNode)->getDualBoundValue() );
5996 <<
" S." << source <<
" | "
6032 <<
" S." << source <<
" | "
6040 std::cout <<
" ( Inf )";
6048 std::cout <<
" ** G.B.: " <<
paraInitiator->convertToExternalValue(globalBestDualBoundValue);
6052 std::cout <<
" ( Inf ) ";
6056 std::cout <<
" ( " << bbParaInitiator->
getGap(globalBestDualBoundValue) * 100 <<
"% ) ";
6059 <<
" ] ** RR" << std::endl;
6193 <<
" S." << source <<
" >(TERMINATED_IN_RACING_STAGE)";
6200 <<
" S." << source <<
" >(INTERRUPTED_BY_TIME_LIMIT or INTERRUPTED_BY_SOME_SOLVER_TERMINATED_IN_RACING_STAGE)";
6206 std::cout << std::endl;
6216 source <<
" is terminated in racing stage #########" << std::endl;
6237 minmalDualBoundNormalTermSolvers < calcState->getDualBoundValue() )
6373#ifndef _COMM_MPI_WORLD
6445 <<
" All Solvers starts racing "
6453 <<
" All Solvers starts racing "
6455 paraNode->getDualBoundValue() )
6476 std::ostringstream s;
6477 s <<
"[ERROR RETURN form Racing Ramp-up Message Hander]:" << __FILE__ <<
"] func = "
6478 << __func__ <<
", line = " << __LINE__ <<
" - "
6479 <<
"process tag = " << tag << std::endl;
6489 if( commUgs ) checkAndReadIncumbent();
6586 std::cout <<
"** Program is still in racing stage. FinalCheckpointGeneratingTime is sppecifid, but the checkpoint files would not be generated." << std::endl;
6641 std::cout <<
"Warning: Ramp-Up Phase Process is switched to 1. CollectOnce, MergeNodesAtRestart and RacingStatBranching are switched to FALSE." << std::endl;
6642 std::cout <<
"You should check the following parameter values: StopRacingNumberOfNodesLeft, StopRacingNumberOfNodesLeftMultiplier, ProhibitCollectOnceMultiplier" << std::endl;
6678 if( racingRampUpParams[i - 1] )
6695 <<
"." << std::endl;
6701 <<
"." << std::endl;
6706 "Racing ramp-up finished after " <<
6753 int exitSolverRequest = 0;
6765 "Start collecting the final check-point data after " <<
6772 if( bestSolverRank > 0 )
6777 exitSolverRequest = 1;
6784 <<
" S." << bestSolverRank <<
" TagInterruptRequest with collecting is sent"
6793 <<
" S." << bestSolverRank <<
" TagInterruptRequest with collecting could not be sent (No best solvers)"
6803 <<
" S." << 0 <<
" TagInterruptRequest with collecting could not be sent (No active solvers)"
6945 if( i != receivedRank )
6976 if( i != receivedRank )
7109 <<
" Racing Ramp-up restarted." << std::endl;
7167 bbParaRacingSolverPool->
reset();
7168 bbParaRacingSolverPool->
activate(paraNode);
7191 <<
" All Solvers starts racing "
7199 <<
" All Solvers starts racing "
7242BbParaLoadCoordinator::checkAndReadIncumbent(
7250 while( commUgs->iProbe(&source, &tag) )
7252 if( source == 0 && tag == UGS::TagUpdateIncumbent )
7254 if(
paraInitiator->readUgsIncumbentSolution(commUgs, source) )
7256 double globalBestIncumbentValue =
paraInitiator->getGlobalBestIncumbentSolution()->getObjectiveFunctionValue();
7287 <<
" S." << source <<
" I.SOL "
7289 paraInitiator->getGlobalBestIncumbentSolution()->getObjectiveFunctionValue()
7294 <<
" S." << source <<
" I.SOL "
7296 paraInitiator->getGlobalBestIncumbentSolution()->getObjectiveFunctionValue()
7311 snprintf(solutionFileNameTemp,
MaxStrLen,
"%s%s_after_checkpointing_solution_t.gz",
7315 snprintf(solutionFileName,
MaxStrLen,
"%s%s_after_checkpointing_solution.gz",
7318 if ( rename(solutionFileNameTemp, solutionFileName) )
7320 std::cout <<
"after checkpointing solution file cannot be renamed: errno = " << strerror(errno) << std::endl;
#define DEF_BB_PARA_COMM(para_comm, comm)
Base class for BbParaNode.
Structs used for merging nodes.
Base class of Calculation state in a ParaSolver.
int getNSent()
getter of the number of nodes transferred from the subproblem solving
double getRootTime()
getter of root node computing time
int getNSolvedWithNoPreprocesses()
getter of the number of solved nodes in the case that a node is solved without presolving....
double getAverageNodeCompTimeExcpetRoot()
getter of average computing time of a node except root node
int getNRestarts()
getter of the number of restart occurred in solving a subproblem
double getDualBoundValue()
getter of the final dual bound value
double getNSelfSplitNodesLeft()
getter of the number of self-split nodes left
int getTerminationState()
getter of the termination state for solving the subproblem
Class for the difference between instance and subproblem.
virtual void setFinalSolverStatus(FinalSolverState status)=0
set final solver status
virtual int getNSolutions()=0
get the number of incumbent solutions
virtual double getGap(double dualBoundValue)=0
get relative gap of dual bound value
virtual bool tryToSetIncumbentSolution(BbParaSolution *sol, bool checksol)=0
try to set incumbent solution
virtual double getAbsgap(double dualBoundValue)=0
get absolute gap of dual bound value
virtual double getAbsgapValue()=0
get absgap value specified
virtual void setNumberOfNodesSolved(long long n)=0
set number of nodes solved
virtual void setDualBound(double bound)=0
set final dual bound
virtual bool isObjIntegral()
check if objective function value is always integral or not
virtual double getGapValue()=0
get gap value specified
virtual BbParaDiffSubproblem * makeRootNodeDiffSubproblem()=0
make DiffSubproblem object for root node
BbParaNode * readParaNodeFromCheckpointFile(bool onlyBoundChanges)
read a ParaNode from checkpoint file
virtual double convertToExternalValue(double internalValue)=0
convert objective function value to external value TODO: this function may be in inherited class
virtual bool canGenerateSpecialCutOffValue()
check if solver can generate special cut off value or not
virtual void setInitialStatOnDiffSubproblem(int minDepth, int maxDepth, BbParaDiffSubproblem *diffSubproblem)
set initial status on DiffSubproblem
virtual BbParaSolution * getGlobalBestIncumbentSolution()=0
get global best incumbent solution
virtual int getVarIndexRange()=0
get variable index range TODO: this function should be in inherited class
Class for LoadCoordinator termination state which contains calculation state in a ParaLoadCoordinator...
double mergeNodeTime
time when ParaNode is merged
bool read(ParaComm *comm, gzstream::igzstream &in)
read from checkpoint file
double generateMergeNodesCandidatesTime
time when merge ParaNode candidates are generated
unsigned long long nNodesInNodePool
number of nodes in ParaNodePool
unsigned long long nNodesLeftInAllSolvers
number of nodes left in all Solvers
double runningTime
this ParaLoadCoordinator running time
unsigned long long nFailedToSendBackAnotherNode
number of ParaNodes failed to send back after AnotherNode request
unsigned long long nNodesOutputLog
count for next logging of the number of transferred ParaNodes
double idleTime
idle time of this LoadCoordinator
double regenerateMergeNodesCandidatesTime
time when merge ParaNode candidates are regenerated
unsigned long long mMaxCollectingNodes
maximum multiplier for the number of collecting nodes
unsigned long long nFailedToSendBack
number of ParaNodes failed to send back
unsigned long long nDeletedInLc
number of ParaNodes deleted in LC
double tNodesOutputLog
keep time for next logging of the number of transferred ParaNodes
double externalGlobalBestDualBoundValue
global best dual bound value (external value)
unsigned long long nMaxUsageOfNodePool
maximum number of ParaNodes in ParaNodePool
unsigned long long nSentBackImmediately
Counters related to this ParaLoadCoordinator TODO: The numbers should be classified depending on solv...
void write(gzstream::ogzstream &out)
write to checkpoint file
std::string toString()
stringfy ParaCalculationState
unsigned long long nInitialP
initial p value, which indicates the number of good ParaNodes try to keep in LC
double addingNodeToMergeStructTime
time when a ParaNode is added to merge struct
double globalBestDualBoundValue
global best dual bound value (internal value)
unsigned long long nSentBackImmediatelyAnotherNode
number of ParaNodes sent back immediately after AnotherNode request from LC
bool winnerSolverNodesCollected
indicate that all winner solver nodes has been collected
bool hugeImbalance
indicate that a huge imbalance in solvers is detected
bool givenGapIsReached
shows if specified gap is reached or not
bool merging
for merging nodes
std::ofstream ofsTabularSolvingStatus
ofstream for solving status in tabular form
virtual int processTagSolution(int source, int tag)
function to process TagSolution message
bool restartingRacing
indicate that racing ramp-up is restarting
virtual int processRacingRampUpTagCompletionOfCalculation(int source, int tag)
function to process TagCompletionOfCalculation message in racing ramp-up stage
virtual void run()
run function to start main process
bool isBreakingFinised
indicate that breaking is finished or not if bootstrap ramp-up is not specified, this flag should be ...
BbParaNodesMerger * nodesMerger
pointer to nodes merger object, which merges nodes
virtual int processTagCompletionOfCalculation(int source, int tag)
function to process TagCompletionOfCalculation message
void terminateAllSolvers()
terminate all solvers
size_t nCollectedSolvers
counter to check if all solvers are terminated or not
int nBoundChangesOfBestNode
the number of fixed variables of the best node The followings are used temporary to generate merge no...
bool logSubtreeInfoFlag
indicate if subtree info. is logged or not
virtual int processTagSubtreeRootNodeStartComputation(int source, int tag)
function to process TagSubtreeRootNodeStartComputation message
bool warmStartNodeTransferring
indicate that the first node transferring at warm start (restart)
virtual void sendRetryRampUpToAllSolvers()
notify retry ramp-up to all solvers
std::ostream * osLogSubtreeInfo
ostram for subtree info. to switch output location
double minmalDualBoundNormalTermSolvers
minimal dual bound for normal termination solvers
bool aSolverTerminatedWithOptimality
indicate if a solver terminated with proving optimality of the problem
virtual int processTagSelfSplitFinished(int source, int tag)
function to process TagSelfSplitFinished message
virtual void inactivateRacingSolverPool(int rank)
inactivate racing solver pool
int nRestartedRacing
number of racing stages restarted
virtual int processTagAnotherNodeRequest(int source, int tag)
function to process TagAnotherNodeRequest message
BbParaNodePool * paraNodeToKeepCheckpointFileNodes
The first n nodes may always keep in checkpoint file, that is, the n nodes are not processed in this ...
virtual int processTagReassignSelfSplitSubtreeRootNode(int source, int tag)
function to process TagReassignSelfSplitSubtreeRootNode message
virtual void warmStart()
warm start (restart)
virtual int processTagNewSubtreeRootNode(int source, int tag)
function to process TagNewSubtreeRootNode message
bool outputTabularSolvingStatusFlag
output streams and flags which indicate the output is specified or not
virtual int restartRacing()
restart racing
BbParaNodePool * paraNodePoolBufferToGenerateCPF
This is used for GenerateReducedCheckpointFiles.
BbParaNodePool * unprocessedParaNodes
The last n nodes may always keep in checkpoint file, that is, the n nodes are not processed in this r...
virtual void sendCutOffValue(int receivedRank)
send cut off value
BbParaNodePool * paraNodePoolBufferToRestart
ParaNode pool for buffering ParaNodes in huge imbalance situation.
virtual bool sendParaTasksToIdleSolvers()
send ParaNodes to idle solvers
std::ostream * osTabularSolvingStatus
ostream for solving status in tabular form to switch output location
bool allCompInfeasibleAfterSolution
indicate that all computations are infeasible after a feasible solution
virtual void writeLoadCoordinatorStatisticsToCheckpointFile(gzstream::ogzstream &loadCoordinatorStatisticsStream, int nSolverInfo, double globalBestDualBoundValue, double externalGlobalBestDualBoundValue)
write LoadCorrdinator statistics to checkpoint file
virtual int processTagUbBoundTightened(int source, int tag)
function to process TagUbBoundTightened message
int minDepthInWinnerSolverNodes
racing winner information
virtual int processTagAllowToBeInCollectingMode(int source, int tag)
function to process TagAllowToBeInCollectingMode message
double statEmptyNodePoolTime
To measure how long does node pool stay in empty situation.
virtual void updateCheckpointFiles()
function to update checkpoint files
virtual int processTagSelfSplitTermStateForInterruption(int source, int tag)
function to process TagSelfSplitTermStateForInterruption message
virtual void changeSearchStrategyOfAllSolversToOriginalSearch()
change search strategy of all solvers to original search strategy
bool initialNodesGenerated
indicates that initial nodes have been generated
virtual int processTagLbBoundTightened(int source, int tag)
function to process TagLbBoundTightened message
virtual void writePreviousStatisticsInformation()
write previous run's statistics information
virtual bool isRacingStage()
check if current stage is in racing or not
virtual int processTagSolverState(int source, int tag)
function to process TagSolverState message
virtual void changeSearchStrategyOfAllSolversToBestBoundSearch()
change search strategy of all solvers to best bound bound search strategy
virtual void outputTabularSolvingStatusHeader()
output tabular solving status header
virtual void sendIncumbentValue(int receivedRank)
send incumbent value
double starvingTime
start time of starving active solvers
virtual int processTagTermStateForInterruption(int source, int tag)
function to process TagTermStateForInterruption message
double averageLastSeveralDualBoundGains
average dual bound gains of last several ones
int(UG::BbParaLoadCoordinator::* BbMessageHandlerFunctionPointer)(int, int)
virtual void writeSubtreeInfo(int source, ParaCalculationState *calcState)
write subtree info.
int nNormalSelection
number of normal node selection to a random node selection
double previousTabularOutputTime
to keep tabular solving status output time
std::ofstream ofsLogSubtreeInfo
ofstream for subtree info.
virtual int processTagTask(int source, int tag)
Message handlers.
double hugeImbalanceTime
start time of huge imbalance situation
int breakingSolverId
all nodes collecting solver Id: -1: no collecting
virtual void outputTabularSolvingStatus(char incumbent)
output solving status in tabular form
bool isCollectingModeRestarted
this flag indicate if a collecting mode is restarted or not
virtual void restartInRampDownPhase()
restart in ramp-down phase
virtual ~BbParaLoadCoordinator()
destructor
int maxDepthInWinnerSolverNodes
maximum depth of open nodes in the winner solver tree
BbParaNodePool * paraNodePoolToRestart
ParaNode pool to restart in ramp-down phase.
virtual int processRacingRampUpTagSolverState(int source, int tag)
message handlers specialized for racing ramp-up
double averageDualBoundGain
average dual bound gain: could be negative value at restart
virtual void newRacing()
start a new racing
virtual int processTagSubtreeRootNodeToBeRemoved(int source, int tag)
function to process TagSubtreeRootNodeToBeRemoved message
std::set< int > * selfSplitFinisedSolvers
indicate selfSplit finished solvers
std::deque< double > lastSeveralDualBoundGains
keep last several dual bound gains
int firstCollectingModeState
status of first collecting mode -1 : have not been in collecting mode 0 : once in collecting mode 1 :...
virtual bool updateSolution(BbParaSolution *)
update incumbent solution
virtual void sendInterruptRequest()
send interrupt request to all solvers
int nAverageDualBoundGain
number of nodes whose dual bound gain are counted
virtual int processTagSelfSlpitNodeCalcuationState(int source, int tag)
function to process TagSelfSlpitNodeCalcuationState message
BbParaLoadCoordinatorTerminationState lcts
LoadCoordinatorTerminationState: counters and times.
bool isHeaderPrinted
indicate if heeader is printed or not
bool primalUpdated
indicate that primal solution was updated or not
BbParaNodePool * paraNodePool
Pools in LoadCorrdinator.
class BbParaNodePoolForCleanUp
virtual void insert(BbParaNodePtr node)=0
insert BbParaNode to this pool
virtual BbParaNodePtr extractNode()=0
extract a BbParaNode object from this pool
virtual double getBestDualBoundValue()=0
get best dual bound value of BbParaNode object in this pool
virtual bool isEmpty()=0
check if this pool is empty or not
size_t getMaxUsageOfPool()
get maximum usage of this pool
virtual int removeBoundedNodes(double incumbentValue)=0
remove bounded BbParaNodes by given incumbnet value
virtual int writeBbParaNodesToCheckpointFile(gzstream::ogzstream &out)=0
write BbParaNodes to checkpoint file
virtual void updateDualBoundsForSavingNodes()=0
update dual bound values for saving BbParaNodes to checkpoint file
virtual BbParaNodePtr extractNodeRandomly()=0
extract a BbParaNode object randomly from this pool
virtual size_t getNumOfNodes()=0
get number of BbParaNodes in this pool
virtual unsigned int getNumOfGoodNodes(double globalBestBound)=0
get number of good (heavy) BbParaNodes in this pool
virtual int bcast(ParaComm *comm, int root)=0
broadcast this object
virtual int receiveSubtreeRootNodeId(ParaComm *comm, int source, int tag)=0
receive this object node Id
const std::string toString()
stringfy BbParaNode
double getInitialDualBoundValue()
getter of initial dual bound value
virtual int receiveNewSubtreeRoot(ParaComm *comm, int source)=0
receive this object
BbParaMergeNodeInfo * getMergeNodeInfo()
get merge node information struct
void setDiffSubproblem(BbParaDiffSubproblem *inDiffSubproblem)
setter of diffSubproblem */
BbParaDiffSubproblem * getDiffSubproblem()
getter of diffSubproblem
void setDualBoundValue(double inDualBoundValue)
setter of dual bound value
int getDepth()
getter of depth
virtual int send(ParaComm *comm, int destination)=0
send this object
const std::string toSimpleString()
stringfy BbParaNode as simple string
void collectsNodes()
set all nodes are collected TODO: this function has to be investigated
virtual int receive(ParaComm *comm, int source)=0
receive this object
void setMergeNodeInfo(BbParaMergeNodeInfo *mNode)
set merge node information to this BbParaNode object
void setAncestor(ParaTaskGenealogicalPtr *inAncestor)
setter of ancestor
bool areNodesCollected()
check if nodes are collected or not
ParaTaskGenealogicalPtr * getAncestor()
getter of ancestor
void setMergingStatus(int status)
set merging status
BbParaNode * next
this pointer is used in case of self-split ramp-up in LC this field is not transferred
double getDualBoundValue()
getter of dual bound value
void setInitialDualBoundValue(double inTrueDualBoundValue)
setter of initial dual bound value
double getMergeNodeTime()
getter of mergeNodeTime
double getGenerateMergeNodesCandidatesTime()
getter of generateMergeNodesCandidatesTime
double getAddingNodeToMergeStructTime()
getter of addingNodeToMergeStructTime
void deleteMergeNodeInfo(BbParaMergeNodeInfo *mNode)
delete merge node info
int mergeNodes(BbParaNode *node, BbParaNodePool *paraNodePool)
make a merge node
void generateMergeNodesCandidates(ParaComm *paraComm, ParaInitiator *paraInitiator)
generate merge nodes candidates
double getRegenerateMergeNodesCandidatesTime()
getter of regenerateMergeNodesCandidatesTime
void regenerateMergeNodesCandidates(BbParaNode *node, ParaComm *paraComm, ParaInitiator *paraInitiator)
regenerate merge nodes candidates
void addNodeToMergeNodeStructs(BbParaNode *node)
add a node to nodes merger
class BbParaRacingSolverPool (Racing Solver Pool)
virtual std::size_t getNumInactiveSolvers()
get number of inactive Solvers
virtual long long getNnodesSolvedInBestSolver()
get winner Solver rank
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
virtual BbParaNode * extractNode()
extract racing root BbParaNode
virtual bool isWinnerDecided(bool feasibleSol)
check racing termination criteria
virtual void inactivateSolver(int rank)
inactivate the Solver specified by rank
virtual double getCutOffValue()
get cutoff value
virtual double getObjectiveFunctionValue()=0
get objective function value
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
virtual void deleteCurrentSubtreeRootNode(int rank)
delete current self-split subtree root node from the active solver with the specified rank
virtual int getMCollectingNodes()
get multiplier of collecting BbParaNodes
virtual void switchOutCollectingMode()
switch out collecting mode
virtual bool isSolverActive(int rank)
check if the Solver specified by rank is active or not
virtual unsigned long long getNnodesInSolvers()
get number of nodes in all Solvers
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 bool isActive()
check if this Solver pool is active or not
virtual bool isSolverInCollectingMode(int rank)
get collecting mode of the Solver specified by rank
virtual bool isTerminateRequested(int rank)
check if the Solver specified by rank is terminate requested or not
virtual void resetCountersInSolver(int rank, long long numOfNodesSolved, int numOfSelfSplitNodesLeft, BbParaNodePool *paraNodePool)
reset counters in the Solver specified by rank
virtual BbParaNode * getSelfSplitSubtreeRootNodes(int rank)
get self-split subtree root node from the active solver with the specified rank
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 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 unsigned long long getNnodesSolvedInSolvers()
get number of nodes solved in current running Solvers
virtual long long getNumOfNodesSolved(int rank)
get the number of nodes solved by the Solver specified
class BbParaSolverState (ParaSolver state object for notification message)
int getNNodesLeft()
getter of number of nodes left by the notification Solver
unsigned int getNotificaionId()
getter of notification id
double getSolverLocalBestDualBoundValue()
gettter of best dual bound value
double getGlobalBestPrimalBoundValue()
get global best primal bound value that the notification Solver has
double getDeterministicTime()
getter of deterministic time
double getAverageDualBoundGain()
getter of average dual bound gain received
bool isRacingStage()
getter of isRacingStage
long long getNNodesSolved()
getter of number of nodes solved by the notification Solver
class BbParaSolverTerminationState (Solver termination state in a ParaSolver)
int getCalcTerminationState()
getter of calcTermination state
Base class of Calculation state in a ParaSolver.
virtual std::string toSimpleString()=0
stringfy ParaCalculationState (simple string version)
int getNSolved()
geeter of the number of tasks solved in a subproblem
double getCompTime()
getter of computing time of a subproblem
virtual void receive(ParaComm *comm, int source, int tag)=0
send this object to destination
Base class of communicator object.
virtual ParaRacingRampUpParamSet * createParaRacingRampUpParamSet()=0
create ParaRacingRampUpParamSet object
virtual ParaSolverState * createParaSolverState()=0
create ParaSolverState object by default constructor
virtual ParaSolution * createParaSolution()=0
create ParaSolution object by default constructor
virtual int getSize()=0
get number of UG processes or UG threads depending on run-time environment
virtual bool probe(int *source, int *tag)=0
No need to take action for fault tolerant, when the functions return. So, they do not rerun status va...
virtual ParaTask * createParaTask()=0
create ParaTask object by default constructor
virtual int send(void *bufer, int count, const int datatypeId, int dest, const int tag)=0
send function for standard ParaData types
virtual ParaSolverTerminationState * createParaSolverTerminationState()=0
create ParaSolverTerminationState object by default constructor
virtual int receive(void *bufer, int count, const int datatypeId, int source, const int tag)=0
receive function for standard ParaData types
virtual int getRank()=0
get rank of this process or this thread depending on run-time environment
virtual ParaCalculationState * createParaCalculationState()=0
transfer object factory
class for deterministic timer
virtual void update(double value)=0
update function of the deterministic time. the deterministic time is a kind of counter
virtual double getElapsedTime()=0
getter of the deterministic time
virtual int reInit(int nRestartedRacing)=0
reinitizalie initiator TODO: this function should be in inherited class
virtual double readSolutionFromCheckpointFile(char *afterCheckpointingSolutionFileName)=0
read solution from checkpoint file
virtual void writeCheckpointSolution(const std::string &filename)=0
write checkpoint solution
virtual void writeSolution(const std::string &message)=0
write solution
virtual void generateRacingRampUpParameterSets(int nParamSets, ParaRacingRampUpParamSet **racingRampUpParamSets)=0
generate racing ramp-up parameter sets TODO: this function may be in inherited class
const char * getPrefixWarm()
get prefix of warm start (restart) files
virtual ParaInstance * getParaInstance()=0
get instance object
virtual double getEpsilon()=0
get epsilon specified
virtual void outputFinalSolverStatistics(std::ostream *os, double time)=0
output final solver statistics
virtual int bcast(ParaComm *comm, int rank, int method)=0
broadcast function to all solvers
virtual const char * getProbName()=0
get problem name
bool isCheckpointState
indicate if this state is at checkpoint or not
unsigned long long nWarmStart
number of warm starts (restarts)
unsigned long long nSent
number of ParaTasks sent from LC
unsigned long long nReceived
number of ParaTasks received from Solvers
Class for LoadCoordinator.
ParaParamSet * paraParams
UG parameter set.
bool hardTimeLimitIsReached
indicate that hard time limit is reached or not
ParaComm * paraComm
communicator used
char lastCheckpointTimeStr[26]
lastCheckpointTimeStr[0] == ' ' means no checkpoint
virtual int processTagTerminated(int source, int tag)
function to process TagTerminated message
MessageHandlerFunctionPointer * racingRampUpMessageHandler
message handlers table for racing stage
bool restarted
indicates that this run is restarted from checkpoint files
long long nTasksLeftInInterruptedRacingSolvers
number of of tasks remains of the the winner solver in the racing solvers
bool * racingSolversExist
indicate if racing solver exits or not, true: exists
bool terminationIssued
indicate termination request is issued
std::ostream * osLogTasksTransfer
ostream for task transfer info. to switch output location
virtual void writeTransferLog(int rank, ParaCalculationState *state)
write transfer log
size_t nTerminated
counter to check if all solvers are terminated or not
ParaSolverPool * paraSolverPool
Pools in LoadCorrdinator.
int nSolvedRacingTermination
number of tasks solved at the racing termination solver
virtual void sendRampUpToAllSolvers()
notify ramp-up to all solvers
bool memoryLimitIsReached
indicate if memory limit is reached or not in a solver, when base solver has memory management featur...
ParaRacingSolverPool * paraRacingSolverPool
racing solver pool
long long nSolvedInInterruptedRacingSolvers
number of tasks solved of the winner solver in the racing solvers
int(UG::ParaLoadCoordinator::* MessageHandlerFunctionPointer)(int, int)
double previousCheckpointTime
For checkpoint.
ParaInitiator * paraInitiator
initiator
int createNewGlobalSubtreeId()
create a new global subtree Id
int racingWinner
racing winner information
ParaTimer * paraTimer
Timers for LoadCoordinator.
RunningPhase runningPhase
status of LoadCoordinator
bool interruptIsRequested
indicate that all solver interrupt message is requested or not
std::ostream * osStatisticsFinalRun
ostream for statistics of the final run
bool interruptedFromControlTerminal
interrupted from control terminal
virtual int processTagToken(int source, int tag)
function to process TagToken message
std::ostream * osStatisticsRacingRampUp
ostream for statistics for racing solvers to switch output location
std::ostream * osLogSolvingStatus
ostram for solving status to switch output location
virtual void writeTransferLogInRacing(int rank, ParaCalculationState *state)
write transfer log in racing
bool logTasksTransferFlag
indicate if task transfer info. is logged or not
ParaDeterministicTimer * paraDetTimer
deterministic timer used in case of deterministic mode this timer need to be created in case of deter...
ParaRacingRampUpParamSet * racingWinnerParams
racing winner parameter set
virtual int processTagHardTimeLimit(int source, int tag)
function to process TagHardTimeLimit message
bool logSolvingStatusFlag
output streams and flags which indicate the output is specified or not
int nHandlers
number of valid handlers
MessageHandlerFunctionPointer * messageHandler
message handlers table for primary phase
bool computationIsInterrupted
indicate that current computation is interrupted or not
bool racingTermination
racing termination information
bool getBoolParamValue(int param)
get bool parameter value
void setBoolParamValue(int param, bool value)
set bool parameter value
void setIntParamValue(int param, int value)
set int parameter value
double getRealParamValue(int param)
get real parameter value
int getIntParamValue(int param)
get int parameter value
const char * getStringParamValue(int param)
get string parameter value
void setRealParamValue(int param, double value)
set real parameter value
class ParaRacingRampUpParamSet (parameter set for racing ramp-up)
virtual bool read(ParaComm *comm, gzstream::igzstream &in)=0
read from checkpoint file
virtual void write(gzstream::ogzstream &out)=0
write to checkpoint file
virtual int send(ParaComm *comm, int destination)=0
send ParaRacingRampUpParamSet
virtual int getStrategy()=0
get strategy
int getWinner()
get winner Solver rank
virtual bool isSolverActive(int rank)=0
check if the specified Solver is active or not
std::size_t getNSolvers()
get number of Solvers in this Solver pool
virtual std::size_t getNumInactiveSolvers()=0
get number of inactive Solvers
virtual std::size_t getNumActiveSolvers()=0
get number of active Solvers
virtual ParaSolution * clone(ParaComm *comm)=0
create clone of this object
virtual void send(ParaComm *comm, int destination)=0
send solution data
virtual void receive(ParaComm *comm, int source)=0
receive solution data
virtual ParaTask * getCurrentTask(int rank)=0
get current solving ParaTask in the Solver specified by rank
virtual void interruptRequested(int rank)=0
set the Solver specified by rank is interrupt requested
virtual bool isInterruptRequested(int rank)=0
check if the Solver specified by rank is interrupt requested or not
virtual bool isTerminateRequested(int rank)=0
check if the Solver specified by rank is terminate requested or not
virtual void terminateRequested(int rank)=0
set the Solver specified by rank is terminate requested
virtual bool isSolverActive(int rank)=0
check if the Solver specified by rank is active or not
std::size_t getNSolvers()
get number of Solvers in this Solver pool
virtual std::size_t getNumInactiveSolvers()=0
get number of inactive Solvers
virtual std::size_t getNumActiveSolvers()=0
get number of active Solvers
virtual void receive(ParaComm *comm, int source, int tag)=0
receive this object
class ParaSolverTerminationState (Solver termination state in a ParaSolver)
virtual bool read(ParaComm *comm, gzstream::igzstream &in)=0
read ParaSolverTerminationState from checkpoint file
int getInterruptedMode()
getter of interrupted flag
double getDeterministicTime()
getter of deterministic time
virtual std::string toString(ParaInitiator *initiator)=0
stringfy ParaSolverTerminationState object
virtual void receive(ParaComm *comm, int source, int tag)=0
receive this object
class ParaTaskGenealogicalLocalPtr
bool isRootTask()
check if root task or not
void setEstimatedValue(double inEstimatedValue)
setter of estimated value
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
void addDescendant(ParaTaskGenealogicalPtr *inDescendant)
add a descendant
void setGlobalSubtaskId(int lcId, int subtaskId)
setter of global subtask id
TaskId getTaskId()
getter of task id
virtual const std::string toSimpleString()
stringfy ParaTask as simple string
virtual double getElapsedTime()=0
get elapsed time
Utilities for handling gzipped input and output streams.
static const int TagLCBestBoundValue
static const int TagAckCompletion
static const int ProhibitCollectOnceMultiplier
static const int NEagerToSolveAtRestart
static const int DualBoundGainTest
static const int TagAnotherNodeRequest
static const int TagCompletionOfCalculation
static const int CompTerminatedByInterruptRequest
static const int TagCutOffValue
static const int MaxStrLen
static const int TagWinner
static const int LightWeightRootNodeProcess
static const int TagLbBoundTightenedBound
static const int CompInterruptedInRacingStage
static const int NTransferLimitForBreaking
static const int CompTerminatedByAnotherTask
static const int MergeNodesAtRestart
static const int TagAllowToBeInCollectingMode
static const int TagTerminateSolvingToRestart
static const int NStopBreaking
static const int CheckpointInterval
static const int NSolverNodesStartBreaking
static const int TagSolution
static const int FinalCheckpointGeneratingTime
static const int TagToken
static const double displayInfOverThisValue
if gap is over this value, Inf is displayed at gap TODO: this would move to inherited class
static const int TagTaskReceived
static const int NoUpperBoundTransferInRacing
static const int CompTerminatedByMemoryLimit
static const int TagInterruptRequest
static const int TagSelfSplitFinished
static const int InitialNodesGeneration
static const int TNodesTransferLogging
static const int TagNotificationId
@ MemoryLimitIsReached
memory limit is reached in a solver
@ ComputingWasInterrupted
computing was interrupted
@ GivenGapIsReached
given gap is reached for the computation
@ ProblemWasSolved
problem was solved
@ HardTimeLimitIsReached
hard time limit is reached
@ RequestedSubProblemsWereSolved
requested subproblem was solved
@ InitialNodesGenerated
initial nodes were generated
static const int LogSubtreeInfo
static const int HugeImbalanceThresholdTime
static const int EnhancedCheckpointStartTime
static const int ABgapForSwitchingToBestSolver
static const int TagIncumbentValue
static const int MultiplierForBreakingTargetBound
static const int FinalCheckpointNSolvers
static const int TagLbBoundTightenedIndex
static const int TagCollectAllNodes
static const int NNodesToKeepInCheckpointFile
static const int TagRestart
static const int InstanceTransferMethod
static const int CollectOnce
static const int TagGivenGapIsReached
static const int TagTerminated
static const int NBoundChangesOfMergeNode
static const int TagGlobalBestDualBoundValueAtWarmStart
static const int CheckpointFilePath
static const int TagUbBoundTightenedIndex
static const int TagSubtreeRootNodeToBeRemoved
static const int TransferConflictCuts
static const int LogSolvingStatusFilePath
static const int CheckEffectOfRootNodePreprocesses
static const int RatioToApplyLightWeightRootProcess
static const int NChangeIntoCollectingModeNSolvers
static const int TagTerminateRequest
static const int RestartInRampDownThresholdTime
static const int RandomNodeSelectionRatio
static const int TransferLocalCuts
static const int TimeLimit
static const int CompTerminatedByTimeLimit
static const int ParaBYTE
static const int GenerateReducedCheckpointFiles
static const int ParaUNSIGNED
static const int OmitInfeasibleTerminationInRacing
static const int TagSolverState
static const int TagTermStateForInterruption
static const int Checkpoint
static const int TimeToIncreaseCMS
static const int TagHardTimeLimit
static const int Deterministic
static const int EnhancedCheckpointInterval
static const int RampUpPhaseProcess
static const int TagReassignSelfSplitSubtreeRootNode
static const int RestartRacing
static const int NNodesTransferLogging
static const int BgapStopSolvingMode
static const int BgapCollectingMode
static const int CompTerminatedNormally
static const int CompInterruptedInMerging
static const int LightWeightNodePenartyInCollecting
static const int NCollectOnce
@ TerminationPhase
termination phase, includes interrupting phase
@ RampUpPhase
ramp-up phase
@ NormalRunningPhase
normal running phase (primary phase)
static const int TagUbBoundTightenedBound
static const int StopRacingNumberOfNodesLeftMultiplier
static const int TagBreaking
static const int RacingStatBranching
static const int RestartInRampDownActiveSolverRatio
static const int DualBoundGainBranchRatio
static const int TagSelfSplitTermStateForInterruption
static const int NIdleSolversToTerminate
static const int NChangeIntoCollectingMode
static const int HugeImbalanceActiveSolverRatio
static const int CompTerminatedInRacingStage
static const int DeterministicTabularSolvingStatus
static const int TagRetryRampUp
static const int OutputTabularSolvingStatus
static const int TagKeepRacing
static const int OmitTerminationNSolutionsInRacing
static const int EnhancedFinalCheckpoint
static const int TagSubtreeRootNodeStartComputation
static const int TabularSolvingStatusInterval
static const int NumberOfInitialNodes
static const int WaitTerminationOfThreads
static const int DistributeBestPrimalSolution
static const int NMergingNodesAtRestart
static const int StopRacingNumberOfNodesLeft
static const int MultiplierForBgapCollectingMode
static const int TagSelfSlpitNodeCalcuationState
static const int TagNoNodes
static const int ParaDOUBLE
static const int MultiplierForCollectingMode
static const int TagNewSubtreeRootNode
static const int StatisticsToStdout
static const int CommunicateTighterBoundsInRacing
#define PARA_COMM_CALL(paracommcall)
#define THROW_LOGICAL_ERROR5(msg1, msg2, msg3, msg4, msg5)
#define THROW_LOGICAL_ERROR2(msg1, msg2)
#define ABORT_LOGICAL_ERROR3(msg1, msg2, msg3)
#define DEFAULT_NUM_EPSILON
#define ABORT_LOGICAL_ERROR1(msg1)
#define THROW_LOGICAL_ERROR4(msg1, msg2, msg3, msg4)
#define THROW_LOGICAL_ERROR3(msg1, msg2, msg3)
Base class for initial statistics collecting class.
Merge node information struct.
@ PARA_MERGED_RPRESENTATIVE
representative node for merging
BbParaDiffSubproblem * mergedDiffSubproblem
merged DiffSubproblem, in case this node is merged and this is the head */
BbParaMergeNodeInfo * mergedTo
pointer to merge node info to which this node is merged */
int nMergedNodes
the number of merged nodes with this node.
BbParaDiffSubproblem * origDiffSubproblem
original DiffSubproblem */
enum UG::BbParaMergeNodeInfo_::@0 status
status of this ParaMargeNodeInfo