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