Scippy

SCIP

Solving Constraint Integer Programs

expr_abs.c
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 scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file expr_abs.c
17  * @ingroup DEFPLUGINS_EXPR
18  * @brief absolute expression handler
19  * @author Stefan Vigerske
20  * @author Benjamin Mueller
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 #include <string.h>
26 
27 #include "scip/expr_value.h"
28 #include "scip/expr_abs.h"
29 #include "scip/expr.h"
30 
31 #define EXPRHDLR_NAME "abs"
32 #define EXPRHDLR_DESC "absolute value expression"
33 #define EXPRHDLR_PRECEDENCE 70000
34 #define EXPRHDLR_HASHKEY SCIPcalcFibHash(7187.0)
35 
36 /*
37  * Data structures
38  */
39 
40 /*
41  * Local methods
42  */
43 
44 /** computes both tangent underestimates and secant */
45 static
47  SCIP* scip, /**< SCIP data structure */
48  SCIP_INTERVAL bounds, /**< bounds of child */
49  SCIP_Bool overestimate, /**< whether the expression shall be overestimated or underestimated */
50  SCIP_Real** coefs, /**< buffer to store coefficients of computed estimators */
51  SCIP_Real* constant, /**< buffer to store constant of computed estimators */
52  int* nreturned /**< buffer to store number of estimators that have been computed */
53  )
54 {
55  assert(scip != NULL);
56 
57  *nreturned = 0;
58 
59  /**! [SnippetExprInitestimatesAbs] */
60  if( !overestimate )
61  {
62  /* compute left tangent -x <= z */
63  coefs[*nreturned][0] = -1.0;
64  constant[*nreturned] = 0.0;
65  (*nreturned)++;
66 
67  /* compute right tangent x <= z */
68  coefs[*nreturned][0] = 1.0;
69  constant[*nreturned] = 0.0;
70  (*nreturned)++;
71  }
72 
73  /* compute secant */
74  if( overestimate )
75  {
76  SCIP_Real lb;
77  SCIP_Real ub;
78 
79  lb = bounds.inf;
80  ub = bounds.sup;
81 
82  /* it does not make sense to add a cut if child variable is unbounded or fixed */
83  if( !SCIPisInfinity(scip, -lb) && !SCIPisInfinity(scip, ub) && !SCIPisEQ(scip, lb, ub) )
84  {
85  if( !SCIPisPositive(scip, ub) )
86  {
87  /* z = -x, so add z <= -x here (-x <= z is the underestimator that is added above) */
88  coefs[*nreturned][0] = -1.0;
89  constant[*nreturned] = 0.0;
90  (*nreturned)++;
91  }
92  else if( !SCIPisNegative(scip, lb) )
93  {
94  /* z = x, so add z <= x here (x <= z is the underestimator that is added above) */
95  coefs[*nreturned][0] = 1.0;
96  constant[*nreturned] = 0.0;
97  (*nreturned)++;
98  }
99  else
100  {
101  /* z = abs(x), x still has mixed sign */
102  SCIP_Real alpha;
103 
104  /* let alpha = (|ub|-|lb|) / (ub-lb) then the resulting secant looks like
105  *
106  * z - |ub| <= alpha * (x - ub) <=> z <= alpha * x + |ub| - alpha * ub
107  */
108  alpha = (REALABS(ub) - REALABS(lb)) / (ub - lb);
109 
110  coefs[*nreturned][0] = alpha;
111  constant[*nreturned] = REALABS(ub) - alpha * ub;
112  (*nreturned)++;
113  }
114  }
115  }
116  /**! [SnippetExprInitestimatesAbs] */
117 
118  return SCIP_OKAY;
119 }
120 
121 
122 /*
123  * Callback methods of expression handler
124  */
125 
126 /** simplifies an abs expression
127  *
128  * Evaluates the absolute value function when its child is a value expression.
129  *
130  * TODO: abs(*) = * if * >= 0 or - * if * < 0
131  */
132 static
134 { /*lint --e{715}*/
135  SCIP_EXPR* child;
136 
137  assert(scip != NULL);
138  assert(expr != NULL);
139  assert(simplifiedexpr != NULL);
140  assert(SCIPexprGetNChildren(expr) == 1);
141 
142  child = SCIPexprGetChildren(expr)[0];
143  assert(child != NULL);
144 
145  /* check for value expression */
146  if( SCIPisExprValue(scip, child) )
147  {
148  SCIP_CALL( SCIPcreateExprValue(scip, simplifiedexpr, REALABS(SCIPgetValueExprValue(child)), ownercreate, ownercreatedata) );
149  }
150  else
151  {
152  *simplifiedexpr = expr;
153 
154  /* we have to capture it, since it must simulate a "normal" simplified call in which a new expression is created */
155  SCIPcaptureExpr(*simplifiedexpr);
156  }
157 
158  return SCIP_OKAY;
159 }
160 
161 static
163 { /*lint --e{715}*/
165 
166  return SCIP_OKAY;
167 }
168 
169 static
171 { /*lint --e{715}*/
172  SCIP_EXPR* childexpr;
173 
174  assert(expr != NULL);
175 
176  /* parse child expression from remaining string */
177  SCIP_CALL( SCIPparseExpr(scip, &childexpr, string, endstring, ownercreate, ownercreatedata) );
178  assert(childexpr != NULL);
179 
180  /* create absolute expression */
181  SCIP_CALL( SCIPcreateExprAbs(scip, expr, childexpr, ownercreate, ownercreatedata) );
182  assert(*expr != NULL);
183 
184  /* release child expression since it has been captured by the absolute expression */
185  SCIP_CALL( SCIPreleaseExpr(scip, &childexpr) );
186 
187  *success = TRUE;
188 
189  return SCIP_OKAY;
190 }
191 
192 /** expression point evaluation callback */
193 static
195 { /*lint --e{715}*/
196  assert(expr != NULL);
197  assert(SCIPexprGetNChildren(expr) == 1);
198  assert(SCIPexprGetEvalValue(SCIPexprGetChildren(expr)[0]) != SCIP_INVALID); /*lint !e777*/
199 
201 
202  return SCIP_OKAY;
203 }
204 
205 
206 /** expression derivative evaluation callback */
207 static
209 { /*lint --e{715}*/
210  SCIP_EXPR* child;
211 
212  assert(expr != NULL);
213  assert(childidx == 0);
214  assert(SCIPexprGetEvalValue(expr) != SCIP_INVALID); /*lint !e777*/
215 
216  child = SCIPexprGetChildren(expr)[0];
217  assert(child != NULL);
218  assert(strcmp(SCIPexprhdlrGetName(SCIPexprGetHdlr(child)), "val") != 0);
219 
220  *val = (SCIPexprGetEvalValue(child) >= 0.0) ? 1.0 : -1.0;
221 
222  return SCIP_OKAY;
223 }
224 
225 /** expression interval evaluation callback */
226 static
228 { /*lint --e{715}*/
229  SCIP_INTERVAL childinterval;
230 
231  assert(expr != NULL);
232  assert(SCIPexprGetNChildren(expr) == 1);
233 
234  childinterval = SCIPexprGetActivity(SCIPexprGetChildren(expr)[0]);
235 
236  if( SCIPintervalIsEmpty(SCIP_INTERVAL_INFINITY, childinterval) )
237  SCIPintervalSetEmpty(interval);
238  else
239  SCIPintervalAbs(SCIP_INTERVAL_INFINITY, interval, childinterval);
240 
241  return SCIP_OKAY;
242 }
243 
244 /** expression estimator callback */
245 static
247 { /*lint --e{715}*/
248  assert(scip != NULL);
249  assert(expr != NULL);
250  assert(SCIPexprGetNChildren(expr) == 1);
251  assert(strcmp(SCIPexprhdlrGetName(SCIPexprGetHdlr(expr)), EXPRHDLR_NAME) == 0);
252  assert(coefs != NULL);
253  assert(constant != NULL);
254  assert(islocal != NULL);
255  assert(branchcand != NULL);
256  assert(*branchcand == TRUE);
257  assert(success != NULL);
258 
259  SCIPdebugMsg(scip, "%sestimate |child| over locdom=[%g,%g] glbdom=[%g,%g]\n", overestimate ? "over" : "under",
260  localbounds[0].inf, localbounds[0].sup, globalbounds[0].inf, globalbounds[0].sup);
261 
262  /**! [SnippetExprEstimateAbs] */
263  if( !overestimate )
264  {
265  *constant = 0.0;
266 
267  if( refpoint[0] <= 0.0 )
268  *coefs = -1.0;
269  else
270  *coefs = 1.0;
271 
272  *islocal = FALSE;
273  *branchcand = FALSE;
274  }
275  else
276  {
277  /* overestimator */
278  SCIP_Real lb;
279  SCIP_Real ub;
280 
281  lb = localbounds[0].inf;
282  ub = localbounds[0].sup;
283 
284  if( !SCIPisPositive(scip, ub) )
285  {
286  /* |x| = -x */
287  *coefs = -1.0;
288  *constant = 0.0;
289  *islocal = SCIPisPositive(scip, globalbounds[0].sup);
290  *branchcand = FALSE;
291  }
292  else if( !SCIPisNegative(scip, lb) )
293  {
294  /* |x| = x */
295  *coefs = 1.0;
296  *constant = 0.0;
297  *islocal = SCIPisNegative(scip, globalbounds[0].inf);
298  *branchcand = FALSE;
299  }
300  else if( !SCIPisRelEQ(scip, lb, -ub) )
301  {
302  /* |x| with x having mixed sign and ub+lb does not cancel out -> secant */
303  SCIP_Real alpha;
304 
305  assert(lb < 0.0);
306  assert(ub > 0.0);
307 
308  /* let alpha = (|ub|-|lb|) / (ub-lb) = (ub+lb)/(ub-lb)
309  * then the resulting secant is -lb + alpha * (x - lb) = -lb - alpha*lb + alpha*x
310  */
311  alpha = (ub + lb) / (ub - lb);
312 
313  *coefs = alpha;
314  *constant = -lb - alpha * lb;
315  *islocal = TRUE;
316  }
317  else if( lb == -ub ) /*lint !e777*/
318  {
319  /* alpha = 0 */
320  *coefs = 0.0;
321  *constant = -lb;
322  *islocal = TRUE;
323  }
324  else
325  {
326  *success = FALSE;
327  return SCIP_OKAY;
328  }
329  }
330  /**! [SnippetExprEstimateAbs] */
331 
332  SCIPdebugMsg(scip, "-> %g * <child> %+g, local=%u branchcand=%u\n", *coefs, *constant, *islocal, *branchcand);
333 
334  *success = TRUE;
335 
336  return SCIP_OKAY;
337 }
338 
339 /** expression estimate initialization callback */
340 static
342 { /*lint --e{715}*/
343  assert(expr != NULL);
344  assert(SCIPexprGetNChildren(expr) == 1);
345  assert(strcmp(SCIPexprhdlrGetName(SCIPexprGetHdlr(expr)), EXPRHDLR_NAME) == 0);
346 
347  /* compute initial cuts */
348  SCIP_CALL( computeCutsAbs(scip, bounds[0], overestimate, coefs, constant, nreturned) );
349 
350  return SCIP_OKAY;
351 }
352 
353 /** expression reverse propagation callback */
354 static
356 { /*lint --e{715}*/
357  SCIP_INTERVAL childbounds;
358  SCIP_INTERVAL left;
359  SCIP_INTERVAL right;
360 
361  assert(scip != NULL);
362  assert(expr != NULL);
363  assert(SCIPexprGetNChildren(expr) == 1);
364  assert(bounds.inf >= 0.0); /* bounds should have been intersected with activity, which is >= 0 */
365 
366  /**! [SnippetExprReversepropAbs] */
367  /* abs(x) in I -> x \in (-I \cup I) \cap bounds(x) */
368  right = bounds; /* I */
369  SCIPintervalSetBounds(&left, -right.sup, -right.inf); /* -I */
370 
371  childbounds = childrenbounds[0];
372  /* childbounds can be empty here already, but that should work fine here */
373 
374  SCIPintervalIntersect(&left, left, childbounds); /* -I \cap bounds(x), could become empty */
375  SCIPintervalIntersect(&right, right, childbounds); /* I \cap bounds(x), could become empty */
376 
377  /* compute smallest interval containing (-I \cap bounds(x)) \cup (I \cap bounds(x)) = (-I \cup I) \cap bounds(x)
378  * this works also if left or right is empty
379  */
380  SCIPintervalUnify(&childrenbounds[0], left, right);
381  /**! [SnippetExprReversepropAbs] */
382 
383  return SCIP_OKAY;
384 }
385 
386 /** expression hash callback */
387 static
389 { /*lint --e{715}*/
390  assert(scip != NULL);
391  assert(expr != NULL);
392  assert(SCIPexprGetNChildren(expr) == 1);
393  assert(hashkey != NULL);
394  assert(childrenhashes != NULL);
395 
396  *hashkey = EXPRHDLR_HASHKEY;
397  *hashkey ^= childrenhashes[0];
398 
399  return SCIP_OKAY;
400 }
401 
402 /** expression curvature detection callback */
403 static
405 { /*lint --e{715}*/
406  SCIP_EXPR* child;
407  SCIP_INTERVAL childbounds;
408  SCIP_Real childinf;
409  SCIP_Real childsup;
410 
411  assert(scip != NULL);
412  assert(expr != NULL);
413  assert(exprcurvature != SCIP_EXPRCURV_UNKNOWN);
414  assert(success != NULL);
415  assert(childcurv != NULL);
416  assert(SCIPexprGetNChildren(expr) == 1);
417 
418  child = SCIPexprGetChildren(expr)[0];
419  assert(child != NULL);
420 
421  /**! [SnippetExprCurvatureAbs] */
422  /* expression is |child|, get domain of child */
424  childbounds = SCIPexprGetActivity(child);
425  childinf = SCIPintervalGetInf(childbounds);
426  childsup = SCIPintervalGetSup(childbounds);
427 
428  *success = TRUE;
429  if( childinf >= 0.0 ) /* |f(x)| = f(x) */
430  childcurv[0] = exprcurvature;
431  else if( childsup <= 0.0 ) /* |f(x)| = -f(x) */
432  childcurv[0] = SCIPexprcurvNegate(exprcurvature);
433  else if( exprcurvature == SCIP_EXPRCURV_CONVEX ) /* |f(x)|, f mixed sign, is convex if f is linear */
434  childcurv[0] = SCIP_EXPRCURV_LINEAR;
435  else /* |f(x)|, f mixed sign, is never concave nor linear */
436  *success = FALSE;
437  /**! [SnippetExprCurvatureAbs] */
438 
439  return SCIP_OKAY;
440 }
441 
442 /** expression monotonicity detection callback */
443 static
445 { /*lint --e{715}*/
446  SCIP_EXPR* child;
447  SCIP_INTERVAL childbounds;
448 
449  assert(scip != NULL);
450  assert(expr != NULL);
451  assert(result != NULL);
452  assert(childidx == 0);
453 
454  child = SCIPexprGetChildren(expr)[0];
455  assert(child != NULL);
456 
457  /**! [SnippetExprMonotonicityAbs] */
459  childbounds = SCIPexprGetActivity(child);
460 
461  if( childbounds.sup <= 0.0 )
462  *result = SCIP_MONOTONE_DEC;
463  else if( childbounds.inf >= 0.0 )
464  *result = SCIP_MONOTONE_INC;
465  else
466  *result = SCIP_MONOTONE_UNKNOWN;
467  /**! [SnippetExprMonotonicityAbs] */
468 
469  return SCIP_OKAY;
470 }
471 
472 /** expression integrality detection callback */
473 static
475 { /*lint --e{715}*/
476  SCIP_EXPR* child;
477 
478  assert(scip != NULL);
479  assert(expr != NULL);
480  assert(isintegral != NULL);
481  assert(SCIPexprGetNChildren(expr) == 1);
482 
483  child = SCIPexprGetChildren(expr)[0];
484  assert(child != NULL);
485 
486  *isintegral = SCIPexprIsIntegral(child);
487 
488  return SCIP_OKAY;
489 }
490 
491 
492 /** creates the handler for absolute expression and includes it into SCIP */
494  SCIP* scip /**< SCIP data structure */
495  )
496 {
497  SCIP_EXPRHDLR* exprhdlr;
498 
500  EXPRHDLR_PRECEDENCE, evalAbs, NULL) );
501  assert(exprhdlr != NULL);
502 
503  SCIPexprhdlrSetCopyFreeHdlr(exprhdlr, copyhdlrAbs, NULL);
504  SCIPexprhdlrSetSimplify(exprhdlr, simplifyAbs);
505  SCIPexprhdlrSetParse(exprhdlr, parseAbs);
506  SCIPexprhdlrSetIntEval(exprhdlr, intevalAbs);
507  SCIPexprhdlrSetEstimate(exprhdlr, initEstimatesAbs, estimateAbs);
508  SCIPexprhdlrSetHash(exprhdlr, hashAbs);
509  SCIPexprhdlrSetReverseProp(exprhdlr, reversepropAbs);
510  SCIPexprhdlrSetDiff(exprhdlr, bwdiffAbs, NULL, NULL);
511  SCIPexprhdlrSetCurvature(exprhdlr, curvatureAbs);
512  SCIPexprhdlrSetMonotonicity(exprhdlr, monotonicityAbs);
513  SCIPexprhdlrSetIntegrality(exprhdlr, integralityAbs);
514 
515  return SCIP_OKAY;
516 }
517 
518 /** creates an absolute value expression */
520  SCIP* scip, /**< SCIP data structure */
521  SCIP_EXPR** expr, /**< pointer where to store expression */
522  SCIP_EXPR* child, /**< single child */
523  SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), /**< function to call to create ownerdata */
524  void* ownercreatedata /**< data to pass to ownercreate */
525  )
526 {
527  assert(expr != NULL);
528  assert(child != NULL);
529  assert(SCIPfindExprhdlr(scip, EXPRHDLR_NAME) != NULL);
530 
531  SCIP_CALL( SCIPcreateExpr(scip, expr, SCIPfindExprhdlr(scip, EXPRHDLR_NAME), NULL, 1, &child, ownercreate, ownercreatedata) );
532 
533  return SCIP_OKAY;
534 }
535 
536 /** indicates whether expression is of abs-type */ /*lint -e{715}*/
538  SCIP* scip, /**< SCIP data structure */
539  SCIP_EXPR* expr /**< expression */
540  )
541 { /*lint --e{715}*/
542  assert(expr != NULL);
543 
544  return strcmp(SCIPexprhdlrGetName(SCIPexprGetHdlr(expr)), EXPRHDLR_NAME) == 0;
545 }
void SCIPintervalUnify(SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
SCIP_Bool SCIPisRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPevalExprActivity(SCIP *scip, SCIP_EXPR *expr)
Definition: scip_expr.c:1706
static SCIP_DECL_EXPRCURVATURE(curvatureAbs)
Definition: expr_abs.c:404
int SCIPexprGetNChildren(SCIP_EXPR *expr)
Definition: expr.c:3798
void SCIPexprhdlrSetDiff(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRBWDIFF((*bwdiff)), SCIP_DECL_EXPRFWDIFF((*fwdiff)), SCIP_DECL_EXPRBWFWDIFF((*bwfwdiff)))
Definition: expr.c:464
const char * SCIPexprhdlrGetName(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:525
static SCIP_DECL_EXPRHASH(hashAbs)
Definition: expr_abs.c:388
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_EXPRCURV SCIPexprcurvNegate(SCIP_EXPRCURV curvature)
Definition: exprcurv.c:52
void SCIPexprhdlrSetParse(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRPARSE((*parse)))
Definition: expr.c:398
private functions to work with algebraic expressions
#define FALSE
Definition: def.h:87
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
#define TRUE
Definition: def.h:86
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
void SCIPexprhdlrSetHash(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRHASH((*hash)))
Definition: expr.c:442
SCIP_INTERVAL SCIPexprGetActivity(SCIP_EXPR *expr)
Definition: expr.c:3954
void SCIPexprhdlrSetIntegrality(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINTEGRALITY((*integrality)))
Definition: expr.c:431
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPcaptureExpr(SCIP_EXPR *expr)
Definition: scip_expr.c:1399
static SCIP_DECL_EXPREVAL(evalAbs)
Definition: expr_abs.c:194
#define SCIPdebugMsg
Definition: scip_message.h:69
SCIP_EXPRHDLR * SCIPfindExprhdlr(SCIP *scip, const char *name)
Definition: scip_expr.c:859
static SCIP_DECL_EXPRMONOTONICITY(monotonicityAbs)
Definition: expr_abs.c:444
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
Definition: expr.c:3808
static SCIP_DECL_EXPRPARSE(parseAbs)
Definition: expr_abs.c:170
SCIP_Real inf
Definition: intervalarith.h:46
static SCIP_DECL_EXPRCOPYHDLR(copyhdlrAbs)
Definition: expr_abs.c:162
static SCIP_DECL_EXPRINTEGRALITY(integralityAbs)
Definition: expr_abs.c:474
SCIP_Real SCIPexprGetEvalValue(SCIP_EXPR *expr)
Definition: expr.c:3872
SCIP_RETCODE SCIPcreateExpr(SCIP *scip, SCIP_EXPR **expr, SCIP_EXPRHDLR *exprhdlr, SCIP_EXPRDATA *exprdata, int nchildren, SCIP_EXPR **children, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
Definition: scip_expr.c:964
void SCIPintervalAbs(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
SCIP_Bool SCIPintervalIsEmpty(SCIP_Real infinity, SCIP_INTERVAL operand)
void SCIPintervalSetEmpty(SCIP_INTERVAL *resultant)
#define EXPRHDLR_PRECEDENCE
Definition: expr_abs.c:33
SCIP_Bool SCIPisExprValue(SCIP *scip, SCIP_EXPR *expr)
Definition: scip_expr.c:1432
SCIP_Real SCIPintervalGetInf(SCIP_INTERVAL interval)
#define NULL
Definition: lpi_spx1.cpp:155
SCIP_Real SCIPintervalGetSup(SCIP_INTERVAL interval)
#define REALABS(x)
Definition: def.h:201
void SCIPintervalIntersect(SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
#define SCIP_CALL(x)
Definition: def.h:384
SCIP_Real sup
Definition: intervalarith.h:47
SCIP_RETCODE SCIPcreateExprValue(SCIP *scip, SCIP_EXPR **expr, SCIP_Real value, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
Definition: expr_value.c:261
void SCIPexprhdlrSetCopyFreeHdlr(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOPYHDLR((*copyhdlr)), SCIP_DECL_EXPRFREEHDLR((*freehdlr)))
Definition: expr.c:359
#define SCIP_INTERVAL_INFINITY
Definition: def.h:199
static SCIP_DECL_EXPRINTEVAL(intevalAbs)
Definition: expr_abs.c:227
#define SCIP_Bool
Definition: def.h:84
#define SCIP_DECL_EXPR_OWNERCREATE(x)
Definition: type_expr.h:131
SCIP_RETCODE SCIPcreateExprAbs(SCIP *scip, SCIP_EXPR **expr, SCIP_EXPR *child, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
Definition: expr_abs.c:519
void SCIPexprhdlrSetMonotonicity(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRMONOTONICITY((*monotonicity)))
Definition: expr.c:420
SCIP_RETCODE SCIPreleaseExpr(SCIP *scip, SCIP_EXPR **expr)
Definition: scip_expr.c:1407
void SCIPexprhdlrSetReverseProp(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRREVERSEPROP((*reverseprop)))
Definition: expr.c:501
SCIP_RETCODE SCIPparseExpr(SCIP *scip, SCIP_EXPR **expr, const char *exprstr, const char **finalpos, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
Definition: scip_expr.c:1370
static SCIP_DECL_EXPRINITESTIMATES(initEstimatesAbs)
Definition: expr_abs.c:341
SCIP_Bool SCIPexprIsIntegral(SCIP_EXPR *expr)
Definition: expr.c:4017
SCIP_EXPRHDLR * SCIPexprGetHdlr(SCIP_EXPR *expr)
Definition: expr.c:3821
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
static SCIP_DECL_EXPRBWDIFF(bwdiffAbs)
Definition: expr_abs.c:208
absolute expression handler
#define EXPRHDLR_DESC
Definition: expr_abs.c:32
constant value expression handler
static SCIP_RETCODE computeCutsAbs(SCIP *scip, SCIP_INTERVAL bounds, SCIP_Bool overestimate, SCIP_Real **coefs, SCIP_Real *constant, int *nreturned)
Definition: expr_abs.c:46
void SCIPexprhdlrSetCurvature(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCURVATURE((*curvature)))
Definition: expr.c:409
SCIP_Bool SCIPisExprAbs(SCIP *scip, SCIP_EXPR *expr)
Definition: expr_abs.c:537
void SCIPintervalSetBounds(SCIP_INTERVAL *resultant, SCIP_Real inf, SCIP_Real sup)
#define SCIP_Real
Definition: def.h:177
#define EXPRHDLR_HASHKEY
Definition: expr_abs.c:34
static SCIP_DECL_EXPRSIMPLIFY(simplifyAbs)
Definition: expr_abs.c:133
static SCIP_DECL_EXPRESTIMATE(estimateAbs)
Definition: expr_abs.c:246
#define SCIP_INVALID
Definition: def.h:197
SCIP_Real SCIPgetValueExprValue(SCIP_EXPR *expr)
Definition: expr_value.c:285
#define EXPRHDLR_NAME
Definition: expr_abs.c:31
void SCIPexprhdlrSetEstimate(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINITESTIMATES((*initestimates)), SCIP_DECL_EXPRESTIMATE((*estimate)))
Definition: expr.c:512
SCIP_RETCODE SCIPincludeExprhdlrAbs(SCIP *scip)
Definition: expr_abs.c:493
SCIP_RETCODE SCIPincludeExprhdlr(SCIP *scip, SCIP_EXPRHDLR **exprhdlr, const char *name, const char *desc, unsigned int precedence, SCIP_DECL_EXPREVAL((*eval)), SCIP_EXPRHDLRDATA *data)
Definition: scip_expr.c:814
void SCIPexprhdlrSetSimplify(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRSIMPLIFY((*simplify)))
Definition: expr.c:490
void SCIPexprhdlrSetIntEval(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINTEVAL((*inteval)))
Definition: expr.c:479
static SCIP_DECL_EXPRREVERSEPROP(reversepropAbs)
Definition: expr_abs.c:355