Scippy

SCIP

Solving Constraint Integer Programs

scip_numerics.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_numerics.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for numerical tolerances
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_NUMERICS_H__
32 #define __SCIP_SCIP_NUMERICS_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_retcode.h"
37 #include "scip/type_scip.h"
38 
39 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
40  * this structure except the interface methods in scip.c.
41  * In optimized mode, the structure is included in scip.h, because some of the methods
42  * are implemented as defines for performance reasons (e.g. the numerical comparisons).
43  * Additionally, the internal "set.h" is included, such that the defines in set.h are
44  * available in optimized mode.
45  */
46 #ifdef NDEBUG
47 #include "scip/struct_scip.h"
48 #include "scip/set.h"
49 #endif
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /**@addtogroup PublicToleranceMethods
56  *
57  * @{
58  */
59 
60 /** returns value treated as zero
61  *
62  * @return value treated as zero
63  */
64 SCIP_EXPORT
66  SCIP* scip /**< SCIP data structure */
67  );
68 
69 /** returns value treated as zero for sums of floating point values
70  *
71  * @return value treated as zero for sums of floating point values
72  */
73 SCIP_EXPORT
75  SCIP* scip /**< SCIP data structure */
76  );
77 
78 /** returns feasibility tolerance for constraints
79  *
80  * @return feasibility tolerance for constraints
81  */
82 SCIP_EXPORT
83 #ifdef __GNUC__
84 __attribute__ ((pure))
85 #endif
87  SCIP* scip /**< SCIP data structure */
88  );
89 
90 /** returns primal feasibility tolerance of LP solver
91  *
92  * @deprecated Please use SCIPgetLPFeastol().
93  *
94  * @return primal feasibility tolerance of LP solver
95  */
96 SCIP_EXPORT
98  SCIP* scip /**< SCIP data structure */
99  );
100 
101 /** returns feasibility tolerance for reduced costs
102  *
103  * @return feasibility tolerance for reduced costs
104  */
105 SCIP_EXPORT
106 #ifdef __GNUC__
107 __attribute__ ((pure))
108 #endif
110  SCIP* scip /**< SCIP data structure */
111  );
112 
113 /** returns convergence tolerance used in barrier algorithm
114  *
115  * @return convergence tolerance used in barrier algorithm
116  */
117 SCIP_EXPORT
119  SCIP* scip /**< SCIP data structure */
120  );
121 
122 /** return the cutoff bound delta
123  *
124  * @return cutoff bound data
125  */
126 SCIP_EXPORT
128  SCIP* scip /**< SCIP data structure */
129  );
130 
131 /** return the relaxation primal feasibility tolerance
132  *
133  * @see SCIPchgRelaxfeastol
134  * @return relaxfeastol
135  */
136 SCIP_EXPORT
138  SCIP* scip /**< SCIP data structure */
139  );
140 
141 /** sets the feasibility tolerance for constraints
142  *
143  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
144  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
145  */
146 SCIP_EXPORT
148  SCIP* scip, /**< SCIP data structure */
149  SCIP_Real feastol /**< new feasibility tolerance for constraints */
150  );
151 
152 /** sets the primal feasibility tolerance of LP solver
153  *
154  * @deprecated Please use SCIPsetLPFeastol().
155  *
156  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
157  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
158  */
159 SCIP_EXPORT
161  SCIP* scip, /**< SCIP data structure */
162  SCIP_Real lpfeastol, /**< new primal feasibility tolerance of LP solver */
163  SCIP_Bool printnewvalue /**< should "numerics/lpfeastol = ..." be printed? */
164  );
165 
166 /** sets the feasibility tolerance for reduced costs
167  *
168  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
169  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
170  */
171 SCIP_EXPORT
173  SCIP* scip, /**< SCIP data structure */
174  SCIP_Real dualfeastol /**< new feasibility tolerance for reduced costs */
175  );
176 
177 /** sets the convergence tolerance used in barrier algorithm
178  *
179  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
180  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
181  */
182 SCIP_EXPORT
184  SCIP* scip, /**< SCIP data structure */
185  SCIP_Real barrierconvtol /**< new convergence tolerance used in barrier algorithm */
186  );
187 
188 /** sets the primal feasibility tolerance of relaxations
189  *
190  * This tolerance value is used by the SCIP core and plugins to tighten then feasibility tolerance on relaxations
191  * (especially the LP relaxation) during a solve. It is set to SCIP_INVALID initially, which means that only the
192  * feasibility tolerance of the particular relaxation is taken into account. If set to a valid value, however,
193  * then this value should be used to reduce the primal feasibility tolerance of a relaxation (thus, use the
194  * minimum of relaxfeastol and the relaxations primal feastol).
195  *
196  * @pre The value of relaxfeastol is reset to SCIP_INVALID when initializing the solve (INITSOL).
197  * Therefore, this method can only be called in one of the following stages of the SCIP solving process:
198  * - \ref SCIP_STAGE_INITSOLVE
199  * - \ref SCIP_STAGE_SOLVING
200  *
201  * @return previous value of relaxfeastol
202  */
203 SCIP_EXPORT
205  SCIP* scip, /**< SCIP data structure */
206  SCIP_Real relaxfeastol /**< new primal feasibility tolerance of relaxations */
207  );
208 
209 /** marks that some limit parameter was changed */
210 SCIP_EXPORT
212  SCIP* scip /**< SCIP data structure */
213  );
214 
215 /** returns value treated as infinity */
216 SCIP_EXPORT
218  SCIP* scip /**< SCIP data structure */
219  );
220 
221 /** returns the minimum value that is regarded as huge and should be handled separately (e.g., in activity
222  * computation)
223  */
224 SCIP_EXPORT
226  SCIP* scip /**< SCIP data structure */
227  );
228 
229 /** checks, if values are in range of epsilon */
230 SCIP_EXPORT
232  SCIP* scip, /**< SCIP data structure */
233  SCIP_Real val1, /**< first value to be compared */
234  SCIP_Real val2 /**< second value to be compared */
235  );
236 
237 /** checks, if val1 is (more than epsilon) lower than val2 */
238 SCIP_EXPORT
240  SCIP* scip, /**< SCIP data structure */
241  SCIP_Real val1, /**< first value to be compared */
242  SCIP_Real val2 /**< second value to be compared */
243  );
244 
245 /** checks, if val1 is not (more than epsilon) greater than val2 */
246 SCIP_EXPORT
248  SCIP* scip, /**< SCIP data structure */
249  SCIP_Real val1, /**< first value to be compared */
250  SCIP_Real val2 /**< second value to be compared */
251  );
252 
253 /** checks, if val1 is (more than epsilon) greater than val2 */
254 SCIP_EXPORT
256  SCIP* scip, /**< SCIP data structure */
257  SCIP_Real val1, /**< first value to be compared */
258  SCIP_Real val2 /**< second value to be compared */
259  );
260 
261 /** checks, if val1 is not (more than epsilon) lower than val2 */
262 SCIP_EXPORT
264  SCIP* scip, /**< SCIP data structure */
265  SCIP_Real val1, /**< first value to be compared */
266  SCIP_Real val2 /**< second value to be compared */
267  );
268 
269 /** checks, if value is (positive) infinite */
270 SCIP_EXPORT
272  SCIP* scip, /**< SCIP data structure */
273  SCIP_Real val /**< value to be compared against infinity */
274  );
275 
276 /** checks, if value is huge and should be handled separately (e.g., in activity computation) */
277 SCIP_EXPORT
279  SCIP* scip, /**< SCIP data structure */
280  SCIP_Real val /**< value to be checked whether it is huge */
281  );
282 
283 /** checks, if value is in range epsilon of 0.0 */
284 SCIP_EXPORT
286  SCIP* scip, /**< SCIP data structure */
287  SCIP_Real val /**< value to process */
288  );
289 
290 /** checks, if value is greater than epsilon */
291 SCIP_EXPORT
293  SCIP* scip, /**< SCIP data structure */
294  SCIP_Real val /**< value to process */
295  );
296 
297 /** checks, if value is lower than -epsilon */
298 SCIP_EXPORT
300  SCIP* scip, /**< SCIP data structure */
301  SCIP_Real val /**< value to process */
302  );
303 
304 /** checks, if value is integral within epsilon */
305 SCIP_EXPORT
307  SCIP* scip, /**< SCIP data structure */
308  SCIP_Real val /**< value to process */
309  );
310 
311 /** checks whether the product val * scalar is integral in epsilon scaled by scalar */
312 SCIP_EXPORT
314  SCIP* scip, /**< SCIP data structure */
315  SCIP_Real val, /**< unscaled value to check for scaled integrality */
316  SCIP_Real scalar /**< value to scale val with for checking for integrality */
317  );
318 
319 /** checks, if given fractional part is smaller than epsilon */
320 SCIP_EXPORT
322  SCIP* scip, /**< SCIP data structure */
323  SCIP_Real val /**< value to process */
324  );
325 
326 /** rounds value + epsilon down to the next integer */
327 SCIP_EXPORT
329  SCIP* scip, /**< SCIP data structure */
330  SCIP_Real val /**< value to process */
331  );
332 
333 /** rounds value - epsilon up to the next integer */
334 SCIP_EXPORT
336  SCIP* scip, /**< SCIP data structure */
337  SCIP_Real val /**< value to process */
338  );
339 
340 /** rounds value to the nearest integer with epsilon tolerance */
341 SCIP_EXPORT
343  SCIP* scip, /**< SCIP data structure */
344  SCIP_Real val /**< value to process */
345  );
346 
347 /** returns fractional part of value, i.e. x - floor(x) in epsilon tolerance */
348 SCIP_EXPORT
350  SCIP* scip, /**< SCIP data structure */
351  SCIP_Real val /**< value to return fractional part for */
352  );
353 
354 /** checks, if values are in range of sumepsilon */
355 SCIP_EXPORT
357  SCIP* scip, /**< SCIP data structure */
358  SCIP_Real val1, /**< first value to be compared */
359  SCIP_Real val2 /**< second value to be compared */
360  );
361 
362 /** checks, if val1 is (more than sumepsilon) lower than val2 */
363 SCIP_EXPORT
365  SCIP* scip, /**< SCIP data structure */
366  SCIP_Real val1, /**< first value to be compared */
367  SCIP_Real val2 /**< second value to be compared */
368  );
369 
370 /** checks, if val1 is not (more than sumepsilon) greater than val2 */
371 SCIP_EXPORT
373  SCIP* scip, /**< SCIP data structure */
374  SCIP_Real val1, /**< first value to be compared */
375  SCIP_Real val2 /**< second value to be compared */
376  );
377 
378 /** checks, if val1 is (more than sumepsilon) greater than val2 */
379 SCIP_EXPORT
381  SCIP* scip, /**< SCIP data structure */
382  SCIP_Real val1, /**< first value to be compared */
383  SCIP_Real val2 /**< second value to be compared */
384  );
385 
386 /** checks, if val1 is not (more than sumepsilon) lower than val2 */
387 SCIP_EXPORT
389  SCIP* scip, /**< SCIP data structure */
390  SCIP_Real val1, /**< first value to be compared */
391  SCIP_Real val2 /**< second value to be compared */
392  );
393 
394 /** checks, if value is in range sumepsilon of 0.0 */
395 SCIP_EXPORT
397  SCIP* scip, /**< SCIP data structure */
398  SCIP_Real val /**< value to process */
399  );
400 
401 /** checks, if value is greater than sumepsilon */
402 SCIP_EXPORT
404  SCIP* scip, /**< SCIP data structure */
405  SCIP_Real val /**< value to process */
406  );
407 
408 /** checks, if value is lower than -sumepsilon */
409 SCIP_EXPORT
411  SCIP* scip, /**< SCIP data structure */
412  SCIP_Real val /**< value to process */
413  );
414 
415 /** checks, if relative difference of values is in range of feasibility tolerance */
416 SCIP_EXPORT
418  SCIP* scip, /**< SCIP data structure */
419  SCIP_Real val1, /**< first value to be compared */
420  SCIP_Real val2 /**< second value to be compared */
421  );
422 
423 /** checks, if relative difference val1 and val2 is lower than feasibility tolerance */
424 SCIP_EXPORT
426  SCIP* scip, /**< SCIP data structure */
427  SCIP_Real val1, /**< first value to be compared */
428  SCIP_Real val2 /**< second value to be compared */
429  );
430 
431 /** checks, if relative difference of val1 and val2 is not greater than feasibility tolerance */
432 SCIP_EXPORT
434  SCIP* scip, /**< SCIP data structure */
435  SCIP_Real val1, /**< first value to be compared */
436  SCIP_Real val2 /**< second value to be compared */
437  );
438 
439 /** checks, if relative difference of val1 and val2 is greater than feastol */
440 SCIP_EXPORT
442  SCIP* scip, /**< SCIP data structure */
443  SCIP_Real val1, /**< first value to be compared */
444  SCIP_Real val2 /**< second value to be compared */
445  );
446 
447 /** checks, if relative difference of val1 and val2 is not lower than -feastol */
448 SCIP_EXPORT
450  SCIP* scip, /**< SCIP data structure */
451  SCIP_Real val1, /**< first value to be compared */
452  SCIP_Real val2 /**< second value to be compared */
453  );
454 
455 /** checks, if value is in range feasibility tolerance of 0.0 */
456 SCIP_EXPORT
458  SCIP* scip, /**< SCIP data structure */
459  SCIP_Real val /**< value to process */
460  );
461 
462 /** checks, if value is greater than feasibility tolerance */
463 SCIP_EXPORT
465  SCIP* scip, /**< SCIP data structure */
466  SCIP_Real val /**< value to process */
467  );
468 
469 /** checks, if value is lower than -feasibility tolerance */
470 SCIP_EXPORT
472  SCIP* scip, /**< SCIP data structure */
473  SCIP_Real val /**< value to process */
474  );
475 
476 /** checks, if value is integral within the LP feasibility bounds */
477 SCIP_EXPORT
479  SCIP* scip, /**< SCIP data structure */
480  SCIP_Real val /**< value to process */
481  );
482 
483 /** checks, if given fractional part is smaller than feastol */
484 SCIP_EXPORT
486  SCIP* scip, /**< SCIP data structure */
487  SCIP_Real val /**< value to process */
488  );
489 
490 /** rounds value + feasibility tolerance down to the next integer */
491 SCIP_EXPORT
493  SCIP* scip, /**< SCIP data structure */
494  SCIP_Real val /**< value to process */
495  );
496 
497 /** rounds value - feasibility tolerance up to the next integer */
498 SCIP_EXPORT
500  SCIP* scip, /**< SCIP data structure */
501  SCIP_Real val /**< value to process */
502  );
503 
504 /** rounds value to the nearest integer in feasibility tolerance */
505 SCIP_EXPORT
507  SCIP* scip, /**< SCIP data structure */
508  SCIP_Real val /**< value to process */
509  );
510 
511 /** returns fractional part of value, i.e. x - floor(x) */
512 SCIP_EXPORT
514  SCIP* scip, /**< SCIP data structure */
515  SCIP_Real val /**< value to process */
516  );
517 
518 /** checks, if relative difference of values is in range of dual feasibility tolerance */
519 SCIP_EXPORT
521  SCIP* scip, /**< SCIP data structure */
522  SCIP_Real val1, /**< first value to be compared */
523  SCIP_Real val2 /**< second value to be compared */
524  );
525 
526 /** checks, if relative difference val1 and val2 is lower than dual feasibility tolerance */
527 SCIP_EXPORT
529  SCIP* scip, /**< SCIP data structure */
530  SCIP_Real val1, /**< first value to be compared */
531  SCIP_Real val2 /**< second value to be compared */
532  );
533 
534 /** checks, if relative difference of val1 and val2 is not greater than dual feasibility tolerance */
535 SCIP_EXPORT
537  SCIP* scip, /**< SCIP data structure */
538  SCIP_Real val1, /**< first value to be compared */
539  SCIP_Real val2 /**< second value to be compared */
540  );
541 
542 /** checks, if relative difference of val1 and val2 is greater than dual feasibility tolerance */
543 SCIP_EXPORT
545  SCIP* scip, /**< SCIP data structure */
546  SCIP_Real val1, /**< first value to be compared */
547  SCIP_Real val2 /**< second value to be compared */
548  );
549 
550 /** checks, if relative difference of val1 and val2 is not lower than -dual feasibility tolerance */
551 SCIP_EXPORT
553  SCIP* scip, /**< SCIP data structure */
554  SCIP_Real val1, /**< first value to be compared */
555  SCIP_Real val2 /**< second value to be compared */
556  );
557 
558 /** checks, if value is in range dual feasibility tolerance of 0.0 */
559 SCIP_EXPORT
561  SCIP* scip, /**< SCIP data structure */
562  SCIP_Real val /**< value to process */
563  );
564 
565 /** checks, if value is greater than dual feasibility tolerance */
566 SCIP_EXPORT
568  SCIP* scip, /**< SCIP data structure */
569  SCIP_Real val /**< value to process */
570  );
571 
572 /** checks, if value is lower than -dual feasibility tolerance */
573 SCIP_EXPORT
575  SCIP* scip, /**< SCIP data structure */
576  SCIP_Real val /**< value to process */
577  );
578 
579 /** checks, if value is integral within the LP dual feasibility tolerance */
580 SCIP_EXPORT
582  SCIP* scip, /**< SCIP data structure */
583  SCIP_Real val /**< value to process */
584  );
585 
586 /** checks, if given fractional part is smaller than dual feasibility tolerance */
587 SCIP_EXPORT
589  SCIP* scip, /**< SCIP data structure */
590  SCIP_Real val /**< value to process */
591  );
592 
593 /** rounds value + dual feasibility tolerance down to the next integer */
594 SCIP_EXPORT
596  SCIP* scip, /**< SCIP data structure */
597  SCIP_Real val /**< value to process */
598  );
599 
600 /** rounds value - dual feasibility tolerance up to the next integer */
601 SCIP_EXPORT
603  SCIP* scip, /**< SCIP data structure */
604  SCIP_Real val /**< value to process */
605  );
606 
607 /** rounds value to the nearest integer in dual feasibility tolerance */
608 SCIP_EXPORT
610  SCIP* scip, /**< SCIP data structure */
611  SCIP_Real val /**< value to process */
612  );
613 
614 /** returns fractional part of value, i.e. x - floor(x) in dual feasibility tolerance */
615 SCIP_EXPORT
617  SCIP* scip, /**< SCIP data structure */
618  SCIP_Real val /**< value to process */
619  );
620 
621 /** checks, if the given new lower bound is tighter (w.r.t. bound strengthening epsilon) than the old one */
622 SCIP_EXPORT
624  SCIP* scip, /**< SCIP data structure */
625  SCIP_Real newlb, /**< new lower bound */
626  SCIP_Real oldlb, /**< old lower bound */
627  SCIP_Real oldub /**< old upper bound */
628  );
629 
630 /** checks, if the given new upper bound is tighter (w.r.t. bound strengthening epsilon) than the old one */
631 SCIP_EXPORT
633  SCIP* scip, /**< SCIP data structure */
634  SCIP_Real newub, /**< new upper bound */
635  SCIP_Real oldlb, /**< old lower bound */
636  SCIP_Real oldub /**< old upper bound */
637  );
638 
639 /** checks, if relative difference of values is in range of epsilon */
640 SCIP_EXPORT
642  SCIP* scip, /**< SCIP data structure */
643  SCIP_Real val1, /**< first value to be compared */
644  SCIP_Real val2 /**< second value to be compared */
645  );
646 
647 /** checks, if relative difference of val1 and val2 is lower than epsilon */
648 SCIP_EXPORT
650  SCIP* scip, /**< SCIP data structure */
651  SCIP_Real val1, /**< first value to be compared */
652  SCIP_Real val2 /**< second value to be compared */
653  );
654 
655 /** checks, if relative difference of val1 and val2 is not greater than epsilon */
656 SCIP_EXPORT
658  SCIP* scip, /**< SCIP data structure */
659  SCIP_Real val1, /**< first value to be compared */
660  SCIP_Real val2 /**< second value to be compared */
661  );
662 
663 /** checks, if relative difference of val1 and val2 is greater than epsilon */
664 SCIP_EXPORT
666  SCIP* scip, /**< SCIP data structure */
667  SCIP_Real val1, /**< first value to be compared */
668  SCIP_Real val2 /**< second value to be compared */
669  );
670 
671 /** checks, if relative difference of val1 and val2 is not lower than -epsilon */
672 SCIP_EXPORT
674  SCIP* scip, /**< SCIP data structure */
675  SCIP_Real val1, /**< first value to be compared */
676  SCIP_Real val2 /**< second value to be compared */
677  );
678 
679 /** checks, if relative difference of values is in range of sumepsilon */
680 SCIP_EXPORT
682  SCIP* scip, /**< SCIP data structure */
683  SCIP_Real val1, /**< first value to be compared */
684  SCIP_Real val2 /**< second value to be compared */
685  );
686 
687 /** checks, if relative difference of val1 and val2 is lower than sumepsilon */
688 SCIP_EXPORT
690  SCIP* scip, /**< SCIP data structure */
691  SCIP_Real val1, /**< first value to be compared */
692  SCIP_Real val2 /**< second value to be compared */
693  );
694 
695 /** checks, if relative difference of val1 and val2 is not greater than sumepsilon */
696 SCIP_EXPORT
698  SCIP* scip, /**< SCIP data structure */
699  SCIP_Real val1, /**< first value to be compared */
700  SCIP_Real val2 /**< second value to be compared */
701  );
702 
703 /** checks, if relative difference of val1 and val2 is greater than sumepsilon */
704 SCIP_EXPORT
706  SCIP* scip, /**< SCIP data structure */
707  SCIP_Real val1, /**< first value to be compared */
708  SCIP_Real val2 /**< second value to be compared */
709  );
710 
711 /**! [SnippetCodeStyleNaming] */
712 
713 /** checks, if relative difference of val1 and val2 is not lower than -sumepsilon */
714 SCIP_EXPORT
716  SCIP* scip, /**< SCIP data structure */
717  SCIP_Real val1, /**< first value to be compared */
718  SCIP_Real val2 /**< second value to be compared */
719  );
720 
721 /** converts the given real number representing an integer to an int; in optimized mode the function gets inlined for
722  * performance; in debug mode we check some additional conditions
723  */
724 SCIP_EXPORT
726  SCIP* scip, /**< SCIP data structure */
727  SCIP_Real real /**< double bound to convert */
728  );
729 
730 /**! [SnippetCodeStyleNaming] */
731 
732 /** converts the given real number representing an integer to a long integer; in optimized mode the function gets inlined for
733  * performance; in debug mode we check some additional conditions
734  */
735 SCIP_EXPORT
737  SCIP* scip, /**< SCIP data structure */
738  SCIP_Real real /**< double bound to convert */
739  );
740 
741 /** Checks, if an iteratively updated value is reliable or should be recomputed from scratch.
742  * This is useful, if the value, e.g., the activity of a linear constraint or the pseudo objective value, gets a high
743  * absolute value during the optimization process which is later reduced significantly. In this case, the last digits
744  * were canceled out when increasing the value and are random after decreasing it.
745  * We do not consider the cancellations which can occur during increasing the absolute value because they just cannot
746  * be expressed using fixed precision floating point arithmetic, anymore.
747  * In order to get more reliable values, the idea is to always store the last reliable value, where increasing the
748  * absolute of the value is viewed as preserving reliability. Then, after each update, the new absolute value can be
749  * compared against the last reliable one with this method, checking whether it was decreased by a factor of at least
750  * "lp/recompfac" and should be recomputed.
751  */
752 SCIP_EXPORT
754  SCIP* scip, /**< SCIP data structure */
755  SCIP_Real newvalue, /**< new value after update */
756  SCIP_Real oldvalue /**< old value, i.e., last reliable value */
757  );
758 
759 #ifdef NDEBUG
760 
761 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
762  * speed up the algorithms.
763  */
764 
765 #define SCIPinfinity(scip) SCIPsetInfinity((scip)->set)
766 #define SCIPisInfinity(scip, val) SCIPsetIsInfinity((scip)->set, val)
767 #define SCIPisHugeValue(scip, val) SCIPsetIsHugeValue((scip)->set, val)
768 #define SCIPgetHugeValue(scip) SCIPsetGetHugeValue((scip)->set)
769 #define SCIPisEQ(scip, val1, val2) SCIPsetIsEQ((scip)->set, val1, val2)
770 #define SCIPisLT(scip, val1, val2) SCIPsetIsLT((scip)->set, val1, val2)
771 #define SCIPisLE(scip, val1, val2) SCIPsetIsLE((scip)->set, val1, val2)
772 #define SCIPisGT(scip, val1, val2) SCIPsetIsGT((scip)->set, val1, val2)
773 #define SCIPisGE(scip, val1, val2) SCIPsetIsGE((scip)->set, val1, val2)
774 #define SCIPisZero(scip, val) SCIPsetIsZero((scip)->set, val)
775 #define SCIPisPositive(scip, val) SCIPsetIsPositive((scip)->set, val)
776 #define SCIPisNegative(scip, val) SCIPsetIsNegative((scip)->set, val)
777 #define SCIPisIntegral(scip, val) SCIPsetIsIntegral((scip)->set, val)
778 #define SCIPisScalingIntegral(scip, val, scalar) SCIPsetIsScalingIntegral((scip)->set, val, scalar)
779 #define SCIPisFracIntegral(scip, val) SCIPsetIsFracIntegral((scip)->set, val)
780 #define SCIPfloor(scip, val) SCIPsetFloor((scip)->set, val)
781 #define SCIPceil(scip, val) SCIPsetCeil((scip)->set, val)
782 #define SCIPround(scip, val) SCIPsetRound((scip)->set, val)
783 #define SCIPfrac(scip, val) SCIPsetFrac((scip)->set, val)
784 
785 #define SCIPisSumEQ(scip, val1, val2) SCIPsetIsSumEQ((scip)->set, val1, val2)
786 #define SCIPisSumLT(scip, val1, val2) SCIPsetIsSumLT((scip)->set, val1, val2)
787 #define SCIPisSumLE(scip, val1, val2) SCIPsetIsSumLE((scip)->set, val1, val2)
788 #define SCIPisSumGT(scip, val1, val2) SCIPsetIsSumGT((scip)->set, val1, val2)
789 #define SCIPisSumGE(scip, val1, val2) SCIPsetIsSumGE((scip)->set, val1, val2)
790 #define SCIPisSumZero(scip, val) SCIPsetIsSumZero((scip)->set, val)
791 #define SCIPisSumPositive(scip, val) SCIPsetIsSumPositive((scip)->set, val)
792 #define SCIPisSumNegative(scip, val) SCIPsetIsSumNegative((scip)->set, val)
793 
794 #define SCIPisFeasEQ(scip, val1, val2) SCIPsetIsFeasEQ((scip)->set, val1, val2)
795 #define SCIPisFeasLT(scip, val1, val2) SCIPsetIsFeasLT((scip)->set, val1, val2)
796 #define SCIPisFeasLE(scip, val1, val2) SCIPsetIsFeasLE((scip)->set, val1, val2)
797 #define SCIPisFeasGT(scip, val1, val2) SCIPsetIsFeasGT((scip)->set, val1, val2)
798 #define SCIPisFeasGE(scip, val1, val2) SCIPsetIsFeasGE((scip)->set, val1, val2)
799 #define SCIPisFeasZero(scip, val) SCIPsetIsFeasZero((scip)->set, val)
800 #define SCIPisFeasPositive(scip, val) SCIPsetIsFeasPositive((scip)->set, val)
801 #define SCIPisFeasNegative(scip, val) SCIPsetIsFeasNegative((scip)->set, val)
802 #define SCIPisFeasIntegral(scip, val) SCIPsetIsFeasIntegral((scip)->set, val)
803 #define SCIPisFeasFracIntegral(scip, val) SCIPsetIsFeasFracIntegral((scip)->set, val)
804 #define SCIPfeasFloor(scip, val) SCIPsetFeasFloor((scip)->set, val)
805 #define SCIPfeasCeil(scip, val) SCIPsetFeasCeil((scip)->set, val)
806 #define SCIPfeasRound(scip, val) SCIPsetFeasRound((scip)->set, val)
807 #define SCIPfeasFrac(scip, val) SCIPsetFeasFrac((scip)->set, val)
808 
809 #define SCIPisDualfeasEQ(scip, val1, val2) SCIPsetIsDualfeasEQ((scip)->set, val1, val2)
810 #define SCIPisDualfeasLT(scip, val1, val2) SCIPsetIsDualfeasLT((scip)->set, val1, val2)
811 #define SCIPisDualfeasLE(scip, val1, val2) SCIPsetIsDualfeasLE((scip)->set, val1, val2)
812 #define SCIPisDualfeasGT(scip, val1, val2) SCIPsetIsDualfeasGT((scip)->set, val1, val2)
813 #define SCIPisDualfeasGE(scip, val1, val2) SCIPsetIsDualfeasGE((scip)->set, val1, val2)
814 #define SCIPisDualfeasZero(scip, val) SCIPsetIsDualfeasZero((scip)->set, val)
815 #define SCIPisDualfeasPositive(scip, val) SCIPsetIsDualfeasPositive((scip)->set, val)
816 #define SCIPisDualfeasNegative(scip, val) SCIPsetIsDualfeasNegative((scip)->set, val)
817 #define SCIPisDualfeasIntegral(scip, val) SCIPsetIsDualfeasIntegral((scip)->set, val)
818 #define SCIPisDualfeasFracIntegral(scip, val) SCIPsetIsDualfeasFracIntegral((scip)->set, val)
819 #define SCIPdualfeasFloor(scip, val) SCIPsetDualfeasFloor((scip)->set, val)
820 #define SCIPdualfeasCeil(scip, val) SCIPsetDualfeasCeil((scip)->set, val)
821 #define SCIPdualfeasRound(scip, val) SCIPsetDualfeasRound((scip)->set, val)
822 #define SCIPdualfeasFrac(scip, val) SCIPsetDualfeasFrac((scip)->set, val)
823 
824 #define SCIPisLbBetter(scip, newlb, oldlb, oldub) SCIPsetIsLbBetter(scip->set, newlb, oldlb, oldub)
825 #define SCIPisUbBetter(scip, newub, oldlb, oldub) SCIPsetIsUbBetter(scip->set, newub, oldlb, oldub)
826 
827 #define SCIPisRelEQ(scip, val1, val2) SCIPsetIsRelEQ((scip)->set, val1, val2)
828 #define SCIPisRelLT(scip, val1, val2) SCIPsetIsRelLT((scip)->set, val1, val2)
829 #define SCIPisRelLE(scip, val1, val2) SCIPsetIsRelLE((scip)->set, val1, val2)
830 #define SCIPisRelGT(scip, val1, val2) SCIPsetIsRelGT((scip)->set, val1, val2)
831 #define SCIPisRelGE(scip, val1, val2) SCIPsetIsRelGE((scip)->set, val1, val2)
832 
833 #define SCIPisSumRelEQ(scip, val1, val2) SCIPsetIsSumRelEQ((scip)->set, val1, val2)
834 #define SCIPisSumRelLT(scip, val1, val2) SCIPsetIsSumRelLT((scip)->set, val1, val2)
835 #define SCIPisSumRelLE(scip, val1, val2) SCIPsetIsSumRelLE((scip)->set, val1, val2)
836 #define SCIPisSumRelGT(scip, val1, val2) SCIPsetIsSumRelGT((scip)->set, val1, val2)
837 #define SCIPisSumRelGE(scip, val1, val2) SCIPsetIsSumRelGE((scip)->set, val1, val2)
838 #define SCIPconvertRealToInt(scip, real) ((int)((real) < 0 ? ((real) - 0.5) : ((real) + 0.5)))
839 #define SCIPconvertRealToLongint(scip, real) ((SCIP_Longint)((real) < 0 ? ((real) - 0.5) : ((real) + 0.5)))
840 
841 #define SCIPisUpdateUnreliable(scip, newval, oldval) SCIPsetIsUpdateUnreliable((scip)->set, newval, oldval)
842 
843 #endif
844 
845 /** outputs a real number, or "+infinity", or "-infinity" to a file */
846 SCIP_EXPORT
847 void SCIPprintReal(
848  SCIP* scip, /**< SCIP data structure */
849  FILE* file, /**< output file (or NULL for standard output) */
850  SCIP_Real val, /**< value to print */
851  int width, /**< width of the field */
852  int precision /**< number of significant digits printed */
853  );
854 
855 /** parse a real value that was written with SCIPprintReal() */
856 SCIP_EXPORT
858  SCIP* scip, /**< SCIP data structure */
859  const char* str, /**< string to search */
860  SCIP_Real* value, /**< pointer to store the parsed value */
861  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
862  );
863 
864 /**@} */
865 
866 #ifdef __cplusplus
867 }
868 #endif
869 
870 #endif
SCIP_Real SCIPdualfeasRound(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisDualfeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeastol(SCIP *scip)
SCIP_Bool SCIPisDualfeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisSumRelLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPchgBarrierconvtol(SCIP *scip, SCIP_Real barrierconvtol)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisSumGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisUbBetter(SCIP *scip, SCIP_Real newub, SCIP_Real oldlb, SCIP_Real oldub)
SCIP_Bool SCIPisFeasFracIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPparseReal(SCIP *scip, const char *str, SCIP_Real *value, char **endptr)
SCIP_Bool SCIPisSumPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisSumRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisUpdateUnreliable(SCIP *scip, SCIP_Real newvalue, SCIP_Real oldvalue)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisDualfeasFracIntegral(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeasRound(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPdualfeastol(SCIP *scip)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisSumNegative(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_Bool SCIPisDualfeasZero(SCIP *scip, SCIP_Real val)
type definitions for return codes for SCIP methods
void SCIPprintReal(SCIP *scip, FILE *file, SCIP_Real val, int width, int precision)
SCIP_Real SCIPfeasFrac(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisSumZero(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPepsilon(SCIP *scip)
SCIP_Real SCIPbarrierconvtol(SCIP *scip)
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPrelaxfeastol(SCIP *scip)
SCIP_Bool SCIPisRelGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisRelLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisLbBetter(SCIP *scip, SCIP_Real newlb, SCIP_Real oldlb, SCIP_Real oldub)
SCIP_Bool SCIPisSumRelGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisRelGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPdualfeasCeil(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisSumRelLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFracIntegral(SCIP *scip, SCIP_Real val)
type definitions for SCIP&#39;s main datastructure
SCIP_Bool SCIPisDualfeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPdualfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPchgDualfeastol(SCIP *scip, SCIP_Real dualfeastol)
SCIP_Bool SCIPisSumEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
internal methods for global SCIP settings
SCIP main data structure.
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPmarkLimitChanged(SCIP *scip)
SCIP_Bool SCIPisDualfeasNegative(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisHugeValue(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisSumGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIP_Bool
Definition: def.h:84
SCIP_Bool SCIPisSumLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPlpfeastol(SCIP *scip)
SCIP_RETCODE SCIPchgFeastol(SCIP *scip, SCIP_Real feastol)
SCIP_Real SCIPdualfeasFrac(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisSumRelGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
int SCIPconvertRealToInt(SCIP *scip, SCIP_Real real)
SCIP_RETCODE SCIPchgLpfeastol(SCIP *scip, SCIP_Real lpfeastol, SCIP_Bool printnewvalue)
SCIP_Longint SCIPconvertRealToLongint(SCIP *scip, SCIP_Real real)
SCIP_Bool SCIPisDualfeasPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPgetHugeValue(SCIP *scip)
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
#define SCIP_Real
Definition: def.h:177
SCIP_Bool SCIPisScalingIntegral(SCIP *scip, SCIP_Real val, SCIP_Real scalar)
SCIP_Bool SCIPisDualfeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPcutoffbounddelta(SCIP *scip)
#define SCIP_Longint
Definition: def.h:162
SCIP_Real SCIPchgRelaxfeastol(SCIP *scip, SCIP_Real relaxfeastol)
SCIP_Real SCIPfrac(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisDualfeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPsumepsilon(SCIP *scip)
SCIP_Bool SCIPisSumLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
common defines and data types used in all packages of SCIP
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisDualfeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
double real
SCIP_Bool SCIPisRelLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)