Scippy

SCIP

Solving Constraint Integer Programs

expr_pow.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 email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file expr_pow.h
17  * @ingroup EXPRHDLRS
18  * @brief power and signed power expression handlers
19  * @author Benjamin Mueller
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_EXPR_POW_H__
25 #define __SCIP_EXPR_POW_H__
26 
27 #include "scip/scip.h"
28 #include "scip/type_expr.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /**@addtogroup EXPRHDLRS
35  *
36  * @{
37  *
38  * @name Power and signed power expression
39  *
40  * These expression handler provide the power function, that is,
41  * \f[
42  * x \mapsto \begin{cases}
43  * x^e & \textrm{if}\; x \geq 0\; \textrm{or}\; e\in\mathbb{Z}, \\
44  * \textrm{undefined}, & \textrm{otherwise}.
45  * \end{cases}
46  * \f]
47  * and the signed power function, that is,
48  * \f[
49  * x \mapsto \textrm{sign}(e) |x|^e
50  * \f]
51  * for some exponent \f$e\f$.
52  *
53  * @{
54  */
55 
56 /** creates a power expression */
57 SCIP_EXPORT
59  SCIP* scip, /**< SCIP data structure */
60  SCIP_EXPR** expr, /**< pointer where to store expression */
61  SCIP_EXPR* child, /**< single child */
62  SCIP_Real exponent, /**< exponent of the power expression */
63  SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), /**< function to call to create ownerdata */
64  void* ownercreatedata /**< data to pass to ownercreate */
65  );
66 
67 /** creates a signpower expression */
68 SCIP_EXPORT
70  SCIP* scip, /**< SCIP data structure */
71  SCIP_EXPR** expr, /**< pointer where to store expression */
72  SCIP_EXPR* child, /**< single child */
73  SCIP_Real exponent, /**< exponent of the power expression */
74  SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), /**< function to call to create ownerdata */
75  void* ownercreatedata /**< data to pass to ownercreate */
76  );
77 
78 /** indicates whether expression is of signpower-type */
79 SCIP_EXPORT
81  SCIP* scip, /**< SCIP data structure */
82  SCIP_EXPR* expr /**< expression */
83  );
84 
85 /** @}
86  * @}
87  */
88 
89 /** creates the handler for power expression and includes it into SCIP
90  *
91  * @ingroup ExprhdlrIncludes
92  */
93 SCIP_EXPORT
95  SCIP* scip /**< SCIP data structure */
96  );
97 
98 /** creates the handler for signed power expression and includes it into SCIP
99  *
100  * @ingroup ExprhdlrIncludes
101  */
102 SCIP_EXPORT
104  SCIP* scip /**< SCIP data structure */
105  );
106 
107 /** computes coefficients of linearization of a square term in a reference point */
108 SCIP_EXPORT
110  SCIP* scip, /**< SCIP data structure */
111  SCIP_Real sqrcoef, /**< coefficient of square term */
112  SCIP_Real refpoint, /**< point where to linearize */
113  SCIP_Bool isint, /**< whether corresponding variable is a discrete variable, and thus linearization could be moved */
114  SCIP_Real* lincoef, /**< buffer to add coefficient of linearization */
115  SCIP_Real* linconstant, /**< buffer to add constant of linearization */
116  SCIP_Bool* success /**< buffer to set to FALSE if linearization has failed due to large numbers */
117  );
118 
119 /** computes coefficients of secant of a square term */
120 SCIP_EXPORT
122  SCIP* scip, /**< SCIP data structure */
123  SCIP_Real sqrcoef, /**< coefficient of square term */
124  SCIP_Real lb, /**< lower bound on variable */
125  SCIP_Real ub, /**< upper bound on variable */
126  SCIP_Real* lincoef, /**< buffer to add coefficient of secant */
127  SCIP_Real* linconstant, /**< buffer to add constant of secant */
128  SCIP_Bool* success /**< buffer to set to FALSE if secant has failed due to large numbers or unboundedness */
129  );
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* __SCIP_EXPR_POW_H__ */
void SCIPaddSquareLinearization(SCIP *scip, SCIP_Real sqrcoef, SCIP_Real refpoint, SCIP_Bool isint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
Definition: expr_pow.c:3226
SCIP_RETCODE SCIPcreateExprPow(SCIP *scip, SCIP_EXPR **expr, SCIP_EXPR *child, SCIP_Real exponent, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
Definition: expr_pow.c:3166
SCIP_RETCODE SCIPcreateExprSignpower(SCIP *scip, SCIP_EXPR **expr, SCIP_EXPR *child, SCIP_Real exponent, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
Definition: expr_pow.c:3190
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
#define SCIP_Bool
Definition: def.h:84
#define SCIP_DECL_EXPR_OWNERCREATE(x)
Definition: type_expr.h:131
SCIP_RETCODE SCIPincludeExprhdlrSignpower(SCIP *scip)
Definition: expr_pow.c:3137
void SCIPaddSquareSecant(SCIP *scip, SCIP_Real sqrcoef, SCIP_Real lb, SCIP_Real ub, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
Definition: expr_pow.c:3294
type and macro definitions related to algebraic expressions
SCIP_Bool SCIPisExprSignpower(SCIP *scip, SCIP_EXPR *expr)
Definition: expr_pow.c:3215
#define SCIP_Real
Definition: def.h:177
SCIP_RETCODE SCIPincludeExprhdlrPow(SCIP *scip)
Definition: expr_pow.c:3102
SCIP callable library.