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