Scippy

SCIP

Solving Constraint Integer Programs

scip_timing.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2022 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file scip_timing.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for timing
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Thorsten Koch
22  * @author Alexander Martin
23  * @author Marc Pfetsch
24  * @author Kati Wolter
25  * @author Gregor Hendel
26  * @author Leona Gottwald
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_SCIP_TIMING_H__
32 #define __SCIP_SCIP_TIMING_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_clock.h"
37 #include "scip/type_retcode.h"
38 #include "scip/type_scip.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**@addtogroup PublicTimingMethods
45  *
46  * @{
47  */
48 
49 /** gets current time of day in seconds (standard time zone)
50  *
51  * @return the current time of day in seconds (standard time zone).
52  */
53 SCIP_EXPORT
55  SCIP* scip /**< SCIP data structure */
56  );
57 
58 /** creates a clock using the default clock type
59  *
60  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
61  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
62  */
63 SCIP_EXPORT
65  SCIP* scip, /**< SCIP data structure */
66  SCIP_CLOCK** clck /**< pointer to clock timer */
67  );
68 
69 /** creates a clock counting the CPU user seconds
70  *
71  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
72  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
73  */
74 SCIP_EXPORT
76  SCIP* scip, /**< SCIP data structure */
77  SCIP_CLOCK** clck /**< pointer to clock timer */
78  );
79 
80 /** creates a clock counting the wall clock seconds
81  *
82  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
83  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
84  */
85 SCIP_EXPORT
87  SCIP* scip, /**< SCIP data structure */
88  SCIP_CLOCK** clck /**< pointer to clock timer */
89  );
90 
91 /** frees a clock
92  *
93  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
94  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
95  */
96 SCIP_EXPORT
98  SCIP* scip, /**< SCIP data structure */
99  SCIP_CLOCK** clck /**< pointer to clock timer */
100  );
101 
102 /** resets the time measurement of a clock to zero and completely stops the clock
103  *
104  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
105  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
106  */
107 SCIP_EXPORT
109  SCIP* scip, /**< SCIP data structure */
110  SCIP_CLOCK* clck /**< clock timer */
111  );
112 
113 /** starts the time measurement of a clock
114  *
115  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
116  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
117  */
118 SCIP_EXPORT
120  SCIP* scip, /**< SCIP data structure */
121  SCIP_CLOCK* clck /**< clock timer */
122  );
123 
124 /** stops the time measurement of a clock
125  *
126  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
127  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
128  */
129 SCIP_EXPORT
131  SCIP* scip, /**< SCIP data structure */
132  SCIP_CLOCK* clck /**< clock timer */
133  );
134 
135 /** enables or disables \p clck */
136 SCIP_EXPORT
138  SCIP_CLOCK* clck, /**< the clock to be disabled/enabled */
139  SCIP_Bool enable /**< should the clock be enabled or disabled? */
140  );
141 
142 /** enables or disables all statistic clocks of SCIP concerning plugin statistics,
143  * LP execution time, strong branching time, etc.
144  *
145  * Method reads the value of the parameter timing/statistictiming. In order to disable statistic timing,
146  * set the parameter to FALSE.
147  *
148  * @note: The (pre-)solving time clocks which are relevant for the output during (pre-)solving
149  * are not affected by this method
150  *
151  * @see: For completely disabling all timing of SCIP, consider setting the parameter timing/enabled to FALSE
152  *
153  * @pre This method can be called if SCIP is in one of the following stages:
154  * - \ref SCIP_STAGE_PROBLEM
155  * - \ref SCIP_STAGE_TRANSFORMING
156  * - \ref SCIP_STAGE_TRANSFORMED
157  * - \ref SCIP_STAGE_INITPRESOLVE
158  * - \ref SCIP_STAGE_PRESOLVING
159  * - \ref SCIP_STAGE_EXITPRESOLVE
160  * - \ref SCIP_STAGE_PRESOLVED
161  * - \ref SCIP_STAGE_INITSOLVE
162  * - \ref SCIP_STAGE_SOLVING
163  * - \ref SCIP_STAGE_SOLVED
164  * - \ref SCIP_STAGE_EXITSOLVE
165  * - \ref SCIP_STAGE_FREETRANS
166  *
167  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
168  */
169 SCIP_EXPORT
171  SCIP* scip /**< SCIP data structure */
172  );
173 
174 /** starts the current solving time
175  *
176  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
177  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
178  *
179  * @pre This method can be called if SCIP is in one of the following stages:
180  * - \ref SCIP_STAGE_PROBLEM
181  * - \ref SCIP_STAGE_TRANSFORMING
182  * - \ref SCIP_STAGE_TRANSFORMED
183  * - \ref SCIP_STAGE_INITPRESOLVE
184  * - \ref SCIP_STAGE_PRESOLVING
185  * - \ref SCIP_STAGE_EXITPRESOLVE
186  * - \ref SCIP_STAGE_PRESOLVED
187  * - \ref SCIP_STAGE_INITSOLVE
188  * - \ref SCIP_STAGE_SOLVING
189  * - \ref SCIP_STAGE_SOLVED
190  * - \ref SCIP_STAGE_EXITSOLVE
191  * - \ref SCIP_STAGE_FREETRANS
192  *
193  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
194  */
195 SCIP_EXPORT
197  SCIP* scip /**< SCIP data structure */
198  );
199 
200 /** stops the current solving time in seconds
201  *
202  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
203  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
204  *
205  * @pre This method can be called if SCIP is in one of the following stages:
206  * - \ref SCIP_STAGE_PROBLEM
207  * - \ref SCIP_STAGE_TRANSFORMING
208  * - \ref SCIP_STAGE_TRANSFORMED
209  * - \ref SCIP_STAGE_INITPRESOLVE
210  * - \ref SCIP_STAGE_PRESOLVING
211  * - \ref SCIP_STAGE_EXITPRESOLVE
212  * - \ref SCIP_STAGE_PRESOLVED
213  * - \ref SCIP_STAGE_INITSOLVE
214  * - \ref SCIP_STAGE_SOLVING
215  * - \ref SCIP_STAGE_SOLVED
216  * - \ref SCIP_STAGE_EXITSOLVE
217  * - \ref SCIP_STAGE_FREETRANS
218  *
219  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
220  */
221 SCIP_EXPORT
223  SCIP* scip /**< SCIP data structure */
224  );
225 
226 /** gets the measured time of a clock in seconds
227  *
228  * @return the measured time of a clock in seconds.
229  */
230 SCIP_EXPORT
232  SCIP* scip, /**< SCIP data structure */
233  SCIP_CLOCK* clck /**< clock timer */
234  );
235 
236 /** sets the measured time of a clock to the given value in seconds
237  *
238  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
239  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
240  */
241 SCIP_EXPORT
243  SCIP* scip, /**< SCIP data structure */
244  SCIP_CLOCK* clck, /**< clock timer */
245  SCIP_Real sec /**< time in seconds to set the clock's timer to */
246  );
247 
248 /** gets the current total SCIP time in seconds, possibly accumulated over several problems.
249  *
250  * @return the current total SCIP time in seconds, ie. the total time since the SCIP instance has been created
251  */
252 SCIP_EXPORT
254  SCIP* scip /**< SCIP data structure */
255  );
256 
257 /** gets the current solving time in seconds
258  *
259  * @return the current solving time in seconds.
260  *
261  * @pre This method can be called if SCIP is in one of the following stages:
262  * - \ref SCIP_STAGE_PROBLEM
263  * - \ref SCIP_STAGE_TRANSFORMING
264  * - \ref SCIP_STAGE_TRANSFORMED
265  * - \ref SCIP_STAGE_INITPRESOLVE
266  * - \ref SCIP_STAGE_PRESOLVING
267  * - \ref SCIP_STAGE_EXITPRESOLVE
268  * - \ref SCIP_STAGE_PRESOLVED
269  * - \ref SCIP_STAGE_INITSOLVE
270  * - \ref SCIP_STAGE_SOLVING
271  * - \ref SCIP_STAGE_SOLVED
272  *
273  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
274  */
275 SCIP_EXPORT
277  SCIP* scip /**< SCIP data structure */
278  );
279 
280 /** gets the current reading time in seconds
281  *
282  * @return the current reading time in seconds.
283  *
284  * @pre This method can be called if SCIP is in one of the following stages:
285  * - \ref SCIP_STAGE_PROBLEM
286  * - \ref SCIP_STAGE_TRANSFORMING
287  * - \ref SCIP_STAGE_TRANSFORMED
288  * - \ref SCIP_STAGE_INITPRESOLVE
289  * - \ref SCIP_STAGE_PRESOLVING
290  * - \ref SCIP_STAGE_EXITPRESOLVE
291  * - \ref SCIP_STAGE_PRESOLVED
292  * - \ref SCIP_STAGE_INITSOLVE
293  * - \ref SCIP_STAGE_SOLVING
294  * - \ref SCIP_STAGE_SOLVED
295  *
296  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
297  */
298 SCIP_EXPORT
300  SCIP* scip /**< SCIP data structure */
301  );
302 
303 /** gets the current presolving time in seconds
304  *
305  * @return the current presolving time in seconds.
306  *
307  * @pre This method can be called if SCIP is in one of the following stages:
308  * - \ref SCIP_STAGE_INITPRESOLVE
309  * - \ref SCIP_STAGE_PRESOLVING
310  * - \ref SCIP_STAGE_EXITPRESOLVE
311  * - \ref SCIP_STAGE_PRESOLVED
312  * - \ref SCIP_STAGE_INITSOLVE
313  * - \ref SCIP_STAGE_SOLVING
314  * - \ref SCIP_STAGE_SOLVED
315  *
316  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
317  */
318 SCIP_EXPORT
320  SCIP* scip /**< SCIP data structure */
321  );
322 
323 /** gets the time need to solve the first LP in the root node
324  *
325  * @return the solving time for the first LP in the root node in seconds.
326  *
327  * @pre This method can be called if SCIP is in one of the following stages:
328  * - \ref SCIP_STAGE_TRANSFORMING
329  * - \ref SCIP_STAGE_TRANSFORMED
330  * - \ref SCIP_STAGE_INITPRESOLVE
331  * - \ref SCIP_STAGE_PRESOLVING
332  * - \ref SCIP_STAGE_EXITPRESOLVE
333  * - \ref SCIP_STAGE_PRESOLVED
334  * - \ref SCIP_STAGE_INITSOLVE
335  * - \ref SCIP_STAGE_SOLVING
336  * - \ref SCIP_STAGE_SOLVED
337  *
338  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
339  */
340 SCIP_EXPORT
342  SCIP* scip /**< SCIP data structure */
343  );
344 
345 /**@} */
346 
347 #ifdef __cplusplus
348 }
349 #endif
350 
351 #endif
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
Definition: scip_timing.c:369
SCIP_RETCODE SCIPsetClockTime(SCIP *scip, SCIP_CLOCK *clck, SCIP_Real sec)
Definition: scip_timing.c:325
SCIP_Real SCIPgetReadingTime(SCIP *scip)
Definition: scip_timing.c:396
SCIP_RETCODE SCIPcreateCPUClock(SCIP *scip, SCIP_CLOCK **clck)
Definition: scip_timing.c:84
SCIP_RETCODE SCIPstopClock(SCIP *scip, SCIP_CLOCK *clck)
Definition: scip_timing.c:169
void SCIPsetClockEnabled(SCIP_CLOCK *clck, SCIP_Bool enable)
Definition: scip_timing.c:182
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_RETCODE SCIPenableOrDisableStatisticTiming(SCIP *scip)
Definition: scip_timing.c:218
type definitions for return codes for SCIP methods
SCIP_RETCODE SCIPfreeClock(SCIP *scip, SCIP_CLOCK **clck)
Definition: scip_timing.c:118
SCIP_Real SCIPgetPresolvingTime(SCIP *scip)
Definition: scip_timing.c:433
SCIP_RETCODE SCIPcreateWallClock(SCIP *scip, SCIP_CLOCK **clck)
Definition: scip_timing.c:101
SCIP_RETCODE SCIPcreateClock(SCIP *scip, SCIP_CLOCK **clck)
Definition: scip_timing.c:67
type definitions for SCIP&#39;s main datastructure
SCIP_RETCODE SCIPstopSolvingTime(SCIP *scip)
Definition: scip_timing.c:294
#define SCIP_Bool
Definition: def.h:84
SCIP_Real SCIPgetClockTime(SCIP *scip, SCIP_CLOCK *clck)
Definition: scip_timing.c:310
SCIP_RETCODE SCIPstartSolvingTime(SCIP *scip)
Definition: scip_timing.c:261
SCIP_Real SCIPgetTimeOfDay(SCIP *scip)
Definition: scip_timing.c:53
type definitions for clocks and timing issues
SCIP_RETCODE SCIPresetClock(SCIP *scip, SCIP_CLOCK *clck)
Definition: scip_timing.c:135
#define SCIP_Real
Definition: def.h:177
SCIP_Real SCIPgetTotalTime(SCIP *scip)
Definition: scip_timing.c:342
common defines and data types used in all packages of SCIP
SCIP_RETCODE SCIPstartClock(SCIP *scip, SCIP_CLOCK *clck)
Definition: scip_timing.c:152
SCIP_Real SCIPgetFirstLPTime(SCIP *scip)
Definition: scip_timing.c:459