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-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 expr_pow.h
26 * @ingroup EXPRHDLRS
27 * @brief power and signed power expression handlers
28 * @author Benjamin Mueller
29 */
30
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32
33#ifndef __SCIP_EXPR_POW_H__
34#define __SCIP_EXPR_POW_H__
35
36#include "scip/scip.h"
37#include "scip/type_expr.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43/**@addtogroup EXPRHDLRS
44 *
45 * @{
46 *
47 * @name Power and signed power expression
48 *
49 * These expression handlers provide the power function, that is,
50 * \f[
51 * x \mapsto \begin{cases}
52 * x^e & \textrm{if}\; x \geq 0\; \textrm{or}\; e\in\mathbb{Z}, \\
53 * \textrm{undefined}, & \textrm{otherwise}.
54 * \end{cases}
55 * \f]
56 * and the signed power function, that is,
57 * \f[
58 * x \mapsto \textrm{sign}(x) |x|^e
59 * \f]
60 * for some exponent \f$e\f$.
61 *
62 * @{
63 */
64
65/** creates a power expression */
66SCIP_EXPORT
68 SCIP* scip, /**< SCIP data structure */
69 SCIP_EXPR** expr, /**< pointer where to store expression */
70 SCIP_EXPR* child, /**< single child */
71 SCIP_Real exponent, /**< exponent of the power expression */
72 SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), /**< function to call to create ownerdata */
73 void* ownercreatedata /**< data to pass to ownercreate */
74 );
75
76/** creates a signpower expression */
77SCIP_EXPORT
79 SCIP* scip, /**< SCIP data structure */
80 SCIP_EXPR** expr, /**< pointer where to store expression */
81 SCIP_EXPR* child, /**< single child */
82 SCIP_Real exponent, /**< exponent of the power expression */
83 SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), /**< function to call to create ownerdata */
84 void* ownercreatedata /**< data to pass to ownercreate */
85 );
86
87/** indicates whether expression is of signpower-type */
88SCIP_EXPORT
90 SCIP* scip, /**< SCIP data structure */
91 SCIP_EXPR* expr /**< expression */
92 );
93
94/** @}
95 * @}
96 */
97
98/** creates the handler for power expression and includes it into SCIP
99 *
100 * @ingroup ExprhdlrIncludes
101 */
102SCIP_EXPORT
104 SCIP* scip /**< SCIP data structure */
105 );
106
107/** creates the handler for signed power expression and includes it into SCIP
108 *
109 * @ingroup ExprhdlrIncludes
110 */
111SCIP_EXPORT
113 SCIP* scip /**< SCIP data structure */
114 );
115
116/** computes coefficients of linearization of a square term in a reference point */
117SCIP_EXPORT
119 SCIP* scip, /**< SCIP data structure */
120 SCIP_Real sqrcoef, /**< coefficient of square term */
121 SCIP_Real refpoint, /**< point where to linearize */
122 SCIP_Bool isint, /**< whether corresponding variable is a discrete variable, and thus linearization could be moved */
123 SCIP_Real* lincoef, /**< buffer to add coefficient of linearization */
124 SCIP_Real* linconstant, /**< buffer to add constant of linearization */
125 SCIP_Bool* success /**< buffer to set to FALSE if linearization has failed due to large numbers */
126 );
127
128/** computes coefficients of secant of a square term */
129SCIP_EXPORT
131 SCIP* scip, /**< SCIP data structure */
132 SCIP_Real sqrcoef, /**< coefficient of square term */
133 SCIP_Real lb, /**< lower bound on variable */
134 SCIP_Real ub, /**< upper bound on variable */
135 SCIP_Real* lincoef, /**< buffer to add coefficient of secant */
136 SCIP_Real* linconstant, /**< buffer to add constant of secant */
137 SCIP_Bool* success /**< buffer to set to FALSE if secant has failed due to large numbers or unboundedness */
138 );
139
140/** Separation for roots with exponent in [0,1] */
141SCIP_EXPORT
143 SCIP* scip, /**< SCIP data structure */
144 SCIP_Real exponent, /**< exponent */
145 SCIP_Bool overestimate, /**< should the power be overestimated? */
146 SCIP_Real xlb, /**< lower bound on x */
147 SCIP_Real xub, /**< upper bound on x */
148 SCIP_Real xref, /**< reference point (where to linearize) */
149 SCIP_Real* constant, /**< buffer to store constant term of estimator */
150 SCIP_Real* slope, /**< buffer to store slope of estimator */
151 SCIP_Bool* islocal, /**< buffer to store whether estimator only locally valid, that is,
152 it depends on given bounds */
153 SCIP_Bool* success /**< buffer to store whether estimator could be computed */
154 );
155
156#ifdef __cplusplus
157}
158#endif
159
160#endif /* __SCIP_EXPR_POW_H__ */
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:173
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:3253
void SCIPestimateRoot(SCIP *scip, SCIP_Real exponent, SCIP_Bool overestimate, SCIP_Real xlb, SCIP_Real xub, SCIP_Real xref, SCIP_Real *constant, SCIP_Real *slope, SCIP_Bool *islocal, SCIP_Bool *success)
Definition: expr_pow.c:3395
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:3321
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:3217
SCIP_Bool SCIPisExprSignpower(SCIP *scip, SCIP_EXPR *expr)
Definition: expr_pow.c:3242
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:3193
SCIP_RETCODE SCIPincludeExprhdlrSignpower(SCIP *scip)
Definition: expr_pow.c:3163
SCIP_RETCODE SCIPincludeExprhdlrPow(SCIP *scip)
Definition: expr_pow.c:3119
SCIP callable library.
type and macro definitions related to algebraic expressions
#define SCIP_DECL_EXPR_OWNERCREATE(x)
Definition: type_expr.h:143
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63