Scippy

SCIP

Solving Constraint Integer Programs

expr_sum.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_sum.h
17  * @ingroup EXPRHDLRS
18  * @brief sum 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 #ifndef __SCIP_EXPR_SUM_H__
26 #define __SCIP_EXPR_SUM_H__
27 
28 
29 #include "scip/scip.h"
30 #include "scip/type_expr.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /** creates the handler for sum expressions and includes it into SCIP
37  *
38  * @ingroup ExprhdlrIncludes
39  */
40 SCIP_EXPORT
42  SCIP* scip /**< SCIP data structure */
43  );
44 
45 /**@addtogroup EXPRHDLRS
46  *
47  * @{
48  *
49  * @name Sum expression
50  *
51  * This expression handler provides the sum function, that is,
52  * \f[
53  * x \mapsto c + \sum_{i=1}^n a_i x_i
54  * \f]
55  * for some constant c and constant coefficients \f$a_i\f$.
56  *
57  * @{
58  */
59 
60 /** creates a sum expression */
61 SCIP_EXPORT
63  SCIP* scip, /**< SCIP data structure */
64  SCIP_EXPR** expr, /**< pointer where to store expression */
65  int nchildren, /**< number of children */
66  SCIP_EXPR** children, /**< children */
67  SCIP_Real* coefficients, /**< array with coefficients for all children (or NULL if all 1.0) */
68  SCIP_Real constant, /**< constant term of sum */
69  SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), /**< function to call to create ownerdata */
70  void* ownercreatedata /**< data to pass to ownercreate */
71  );
72 
73 /** sets the constant of a summation expression */
74 SCIP_EXPORT
76  SCIP_EXPR* expr, /**< sum expression */
77  SCIP_Real constant /**< constant */
78  );
79 
80 /** appends an expression to a sum expression */
81 SCIP_EXPORT
83  SCIP* scip, /**< SCIP data structure */
84  SCIP_EXPR* expr, /**< sum expression */
85  SCIP_EXPR* child, /**< expression to be appended */
86  SCIP_Real childcoef /**< child's coefficient */
87  );
88 
89 /** multiplies given sum expression by a constant */
90 SCIP_EXPORT
92  SCIP_EXPR* expr, /**< sum expression */
93  SCIP_Real constant /**< constant that multiplies sum expression */
94  );
95 
96 /** @}
97  * @}
98  */
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* __SCIP_EXPR_SUM_H__ */
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_RETCODE SCIPappendExprSumExpr(SCIP *scip, SCIP_EXPR *expr, SCIP_EXPR *child, SCIP_Real childcoef)
Definition: expr_sum.c:1107
SCIP_RETCODE SCIPcreateExprSum(SCIP *scip, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, SCIP_Real *coefficients, SCIP_Real constant, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
Definition: expr_sum.c:1070
#define SCIP_DECL_EXPR_OWNERCREATE(x)
Definition: type_expr.h:131
type and macro definitions related to algebraic expressions
void SCIPmultiplyByConstantExprSum(SCIP_EXPR *expr, SCIP_Real constant)
Definition: expr_sum.c:1136
#define SCIP_Real
Definition: def.h:177
void SCIPsetConstantExprSum(SCIP_EXPR *expr, SCIP_Real constant)
Definition: expr_sum.c:1091
SCIP_RETCODE SCIPincludeExprhdlrSum(SCIP *scip)
Definition: expr_sum.c:1043
SCIP callable library.