Scippy

UG

Ubiquity Generator framework

bbParaSolverTerminationState.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 bbParaSolverTerminationState.h
27 * @brief This class contains solver termination state which is transferred form Solver to LC.
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_TERMINATION_STATE_H__
38#define __BB_PARA_SOLVER_TERMINATION_STATE_H__
39
40#include "ug/paraComm.h"
41#include "ug/paraInitiator.h"
43#ifdef UG_WITH_ZLIB
44#include "ug/gzstream.h"
45#endif
46
47namespace UG
48{
49
50///
51/// class BbParaSolverTerminationState
52/// (Solver termination state in a ParaSolver)
53///
55{
56protected:
57 ///-------------------------------------
58 /// Counters related to this ParaSolver
59 ///-------------------------------------
60 int totalNSolved; ///< accumulated number of nodes solved in this ParaSolver
61 int minNSolved; ///< minimum number of subtree nodes rooted from ParaNode
62 int maxNSolved; ///< maximum number of subtree nodes rooted from ParaNode
63 int totalNSent; ///< accumulated number of nodes sent from this ParaSolver
64 int totalNImprovedIncumbent; ///< accumulated number of improvements of incumbent value in this ParaSolver
65 int nParaNodesSolvedAtRoot; ///< number of ParaNodes solved at root node before sending
66 int nParaNodesSolvedAtPreCheck; ///< number of ParaNodes solved at pre-checking of root node solvability
67 int nTransferredLocalCutsFromSolver; ///< number of local cuts transferred from this Solver
68 int minTransferredLocalCutsFromSolver; ///< minimum number of local cuts transferred from this Solver
69 int maxTransferredLocalCutsFromSolver; ///< maximum number of local cuts transferred from this Solver
70 int nTransferredBendersCutsFromSolver; ///< number of benders cuts transferred from this Solver
71 int minTransferredBendersCutsFromSolver; ///< minimum number of benders cuts transferred from this Solver
72 int maxTransferredBendersCutsFromSolver; ///< maximum number of benders cuts transferred from this Solver
73 int nTotalRestarts; ///< number of total restarts
74 int minRestarts; ///< minimum number of restarts
75 int maxRestarts; ///< maximum number of restarts
76 int nTightened; ///< number of tightened variable bounds during racing stage
77 int nTightenedInt; ///< number of tightened integral variable bounds during racing stage
78 int calcTerminationState; ///< termination sate of a calculation in a Solver
79 ///-----------------------------
80 /// times for root node process
81 ///-----------------------------
82 double totalRootNodeTime; ///< total time consumed by root node processes
83 double minRootNodeTime; ///< minimum time consumed by root node processes
84 double maxRootNodeTime; ///< maximum time consumed by root node processes
85
86public:
87
88 ///
89 /// default constructor
90 ///
92 )
94 totalNSolved(-1),
95 minNSolved(-1),
96 maxNSolved(-1),
97 totalNSent(-1),
108 minRestarts(0),
109 maxRestarts(0),
110 nTightened(0),
111 nTightenedInt(0),
114 minRootNodeTime(0.0),
115 maxRootNodeTime(0.0)
116 {
117 }
118
119 ///
120 /// constructor
121 ///
123 int inInterrupted, ///< indicate that this solver is interrupted or not.
124 ///< 0: not interrupted,
125 ///< 1: interrupted
126 ///< 2: checkpoint,
127 ///< 3: racing-ramp up
128 int inRank, ///< rank of this solver
129 int inTotalNSolved, ///< accumulated number of nodes solved in this ParaSolver
130 int inMinNSolved, ///< minimum number of subtree nodes rooted from ParaNode
131 int inMaxNSolved, ///< maximum number of subtree nodes rooted from ParaNode
132 int inTotalNSent, ///< accumulated number of nodes sent from this ParaSolver
133 int inTotalNImprovedIncumbent, ///< accumulated number of improvements of incumbent value in this ParaSolver
134 int inNParaNodesReceived, ///< number of ParaNodes received in this ParaSolver
135 int inNParaNodesSolved, ///< number of ParaNodes solved ( received ) in this ParaSolver
136 int inNParaNodesSolvedAtRoot, ///< number of ParaNodes solved at root node before sending
137 int inNParaNodesSolvedAtPreCheck, ///< number of ParaNodes solved at pre-checking of root node solvability
138 int inNTransferredLocalCutsFromSolver, ///< number of local cuts transferred from this Solver
139 int inMinTransferredLocalCutsFromSolver, ///< minimum number of local cuts transferred from this Solver
140 int inMaxTransferredLocalCutsFromSolver, ///< maximum number of local cuts transferred from this Solver
141 int inNTransferredBendersCutsFromSolver, ///< number of benders cuts transferred from this Solver
142 int inMinTransferredBendersCutsFromSolver, ///< minimum number of benders cuts transferred from this Solver
143 int inMaxTransferredBendersCutsFromSolver, ///< maximum number of benders cuts transferred from this Solver
144 int inNTotalRestarts, ///< number of total restarts
145 int inMinRestarts, ///< minimum number of restarts
146 int inMaxRestarts, ///< maximum number of restarts
147 int inNTightened, ///< number of tightened variable bounds during racing stage
148 int inNTightenedInt, ///< number of tightened integral variable bounds during racing stage
149 int inCalcTerminationState, ///< termination sate of a calculation in a Solver
150 double inRunningTime, ///< this solver running time
151 double inIdleTimeToFirstParaNode, ///< idle time to start solving the first ParaNode
152 double inIdleTimeBetweenParaNodes, ///< idle time between ParaNodes processing
153 double inIddleTimeAfterLastParaNode, ///< idle time after the last ParaNode was solved
154 double inIdleTimeToWaitNotificationId, ///< idle time to wait notification Id messages
155 double inIdleTimeToWaitAckCompletion, ///< idle time to wait ack completion message
156 double inIdleTimeToWaitToken, ///< idle time to wait token
157 double inTotalRootNodeTime, ///< total time consumed by root node processes
158 double inMinRootNodeTime, ///< minimum time consumed by root node processes
159 double inMaxRootNodeTime, ///< maximum time consumed by root node processes
160 double inDetTime ///< deterministic time, -1: should be non-deterministic
161 )
162 : ParaSolverTerminationState(inInterrupted, inRank, inNParaNodesReceived, inNParaNodesSolved,
163 inRunningTime, inIdleTimeToFirstParaNode, inIdleTimeBetweenParaNodes, inIddleTimeAfterLastParaNode,
164 inIdleTimeToWaitNotificationId, inIdleTimeToWaitAckCompletion, inIdleTimeToWaitToken, inDetTime),
165 totalNSolved(inTotalNSolved),
166 minNSolved(inMinNSolved),
167 maxNSolved(inMaxNSolved),
168 totalNSent(inTotalNSent),
169 totalNImprovedIncumbent(inTotalNImprovedIncumbent),
170 nParaNodesSolvedAtRoot(inNParaNodesSolvedAtRoot),
171 nParaNodesSolvedAtPreCheck(inNParaNodesSolvedAtPreCheck),
172 nTransferredLocalCutsFromSolver(inNTransferredLocalCutsFromSolver),
173 minTransferredLocalCutsFromSolver(inMinTransferredLocalCutsFromSolver),
174 maxTransferredLocalCutsFromSolver(inMaxTransferredLocalCutsFromSolver),
175 nTransferredBendersCutsFromSolver(inNTransferredBendersCutsFromSolver),
176 minTransferredBendersCutsFromSolver(inMinTransferredBendersCutsFromSolver),
177 maxTransferredBendersCutsFromSolver(inMaxTransferredBendersCutsFromSolver),
178 nTotalRestarts(inNTotalRestarts),
179 minRestarts(inMinRestarts),
180 maxRestarts(inMaxRestarts),
181 nTightened(inNTightened),
182 nTightenedInt(inNTightenedInt),
183 calcTerminationState(inCalcTerminationState),
184 totalRootNodeTime(inTotalRootNodeTime),
185 minRootNodeTime(inMinRootNodeTime),
186 maxRootNodeTime(inMaxRootNodeTime)
187 {
188 }
189
190 ///
191 /// destructor
192 ///
194 )
195 {
196 }
197
198 ///
199 /// getter of calcTermination state
200 /// @return termination sate of a calculation in a Solver
201 ///
203 )
204 {
206 }
207
208 ///
209 /// stringfy BbParaSolverTerminationState object
210 /// @return string to show inside of BbParaSolverTerminationState object
211 ///
212 std::string toString(
213 ParaInitiator *initiator ///< pointer to ParaInitiator object
214 );
215
216#ifdef UG_WITH_ZLIB
217
218 ///
219 /// write BbParaSolverTerminationState to checkpoint file
220 ///
221 void write(
222 gzstream::ogzstream &out ///< gzstream to output
223 );
224
225 ///
226 /// read BbParaSolverTerminationState from checkpoint file
227 ///
228 bool read(
229 ParaComm *comm, ///< communicator used
230 gzstream::igzstream &in ///< gzstream to input
231 );
232
233#endif
234
235};
236
237}
238
239#endif // __BB_PARA_SOLVER_TERMINATION_STATE_H__
240
class BbParaSolverTerminationState (Solver termination state in a ParaSolver)
bool read(ParaComm *comm, gzstream::igzstream &in)
read BbParaSolverTerminationState from checkpoint file
int minNSolved
minimum number of subtree nodes rooted from ParaNode
int maxNSolved
maximum number of subtree nodes rooted from ParaNode
int nTransferredLocalCutsFromSolver
number of local cuts transferred from this Solver
int nTightened
number of tightened variable bounds during racing stage
int maxRestarts
maximum number of restarts
int totalNSolved
accumulated number of nodes solved in this ParaSolver
int nParaNodesSolvedAtRoot
number of ParaNodes solved at root node before sending
double maxRootNodeTime
maximum time consumed by root node processes
int getCalcTerminationState()
getter of calcTermination state
std::string toString(ParaInitiator *initiator)
stringfy BbParaSolverTerminationState object
BbParaSolverTerminationState(int inInterrupted, int inRank, int inTotalNSolved, int inMinNSolved, int inMaxNSolved, int inTotalNSent, int inTotalNImprovedIncumbent, int inNParaNodesReceived, int inNParaNodesSolved, int inNParaNodesSolvedAtRoot, int inNParaNodesSolvedAtPreCheck, int inNTransferredLocalCutsFromSolver, int inMinTransferredLocalCutsFromSolver, int inMaxTransferredLocalCutsFromSolver, int inNTransferredBendersCutsFromSolver, int inMinTransferredBendersCutsFromSolver, int inMaxTransferredBendersCutsFromSolver, int inNTotalRestarts, int inMinRestarts, int inMaxRestarts, int inNTightened, int inNTightenedInt, int inCalcTerminationState, double inRunningTime, double inIdleTimeToFirstParaNode, double inIdleTimeBetweenParaNodes, double inIddleTimeAfterLastParaNode, double inIdleTimeToWaitNotificationId, double inIdleTimeToWaitAckCompletion, double inIdleTimeToWaitToken, double inTotalRootNodeTime, double inMinRootNodeTime, double inMaxRootNodeTime, double inDetTime)
constructor
int totalNSent
accumulated number of nodes sent from this ParaSolver
int minRestarts
minimum number of restarts
void write(gzstream::ogzstream &out)
write BbParaSolverTerminationState to checkpoint file
int nTightenedInt
number of tightened integral variable bounds during racing stage
int nTransferredBendersCutsFromSolver
number of benders cuts transferred from this Solver
double minRootNodeTime
minimum time consumed by root node processes
int minTransferredLocalCutsFromSolver
minimum number of local cuts transferred from this Solver
int minTransferredBendersCutsFromSolver
minimum number of benders cuts transferred from this Solver
int nParaNodesSolvedAtPreCheck
number of ParaNodes solved at pre-checking of root node solvability
int maxTransferredBendersCutsFromSolver
maximum number of benders cuts transferred from this Solver
int maxTransferredLocalCutsFromSolver
maximum number of local cuts transferred from this Solver
double totalRootNodeTime
total time consumed by root node processes
int totalNImprovedIncumbent
accumulated number of improvements of incumbent value in this ParaSolver
int nTotalRestarts
number of total restarts
Base class of communicator object.
Definition: paraComm.h:102
Class for initiator.
Definition: paraInitiator.h:63
class ParaSolverTerminationState (Solver termination state in a ParaSolver)
static ScipParaCommTh * comm
Definition: fscip.cpp:73
Utilities for handling gzipped input and output streams.
static const int CompTerminatedNormally
Definition: paraDef.h:182
Base class of communicator for UG Framework.
Base class of initiator that maintains original problem and incumbent solution.
This class contains solver termination state which is transferred form Solver to LC.