Scippy

SCIP

Solving Constraint Integer Programs

cons_abspower.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-2021 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 scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file cons_abspower.h
17  * @ingroup CONSHDLRS
18  * @brief Constraint handler for absolute power constraints \f$\textrm{lhs} \leq \textrm{sign}(x+a) |x+a|^n + c z \leq \textrm{rhs}\f$
19  * @author Stefan Vigerske
20  *
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 #ifndef __SCIP_CONS_ABSPOWER_H__
26 #define __SCIP_CONS_ABSPOWER_H__
27 
28 #include "scip/def.h"
29 #include "scip/type_cons.h"
30 #include "scip/type_nlp.h"
31 #include "scip/type_retcode.h"
32 #include "scip/type_scip.h"
33 #include "scip/type_sol.h"
34 #include "scip/type_var.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /** creates the handler for absolute power constraints and includes it in SCIP
41  *
42  * @ingroup ConshdlrIncludes
43  * */
46  SCIP* scip /**< SCIP data structure */
47  );
48 
49 /**@addtogroup CONSHDLRS
50  *
51  * @{
52  *
53  * @name Absolute Power Constraints
54  *
55  * @{
56  *
57  * This constraint handler handles constraints of the form
58  * \f[
59  * \textrm{lhs} \leq \textrm{sign}(x+a) |x+a|^n + c z \leq \textrm{rhs}
60  * \f]
61  * for \f$n > 1.0\f$ a rational number, \f$a\f$ and \f$c\f$ arbitrary, and \f$x\f$ and \f$z\f$ variables.
62  * Note that \f$x\f$ can have \f$-a\f$ in the interior of its domain.
63  *
64  * Constraints are enforced by separation, domain propagation, and spatial branching.
65  *
66  * Cuts that separate on the convex hull of the graph of \f$\textrm{sign}(x+a) |x+a|^n\f$ are generated as long as they separate the relaxation solution.
67  * Otherwise, spatial branching on \f$x\f$ is applied.
68  *
69  * Further, domain propagation is implemented to propagate bound changes on \f$x\f$ onto \f$z\f$, and vice versa, and
70  * repropagation is implemented to allow for conflict analysis.
71  * During presolve, a pairwise comparison of absolute power constraints may allow to fix or aggregate some variables.
72  * See also
73  *
74  * @par
75  * Stefan Vigerske@n
76  * Decomposition of Multistage Stochastic Programs and a Constraint Integer Programming Approach to Mixed-Integer Nonlinear Programming@n
77  * PhD Thesis, Humboldt-University Berlin, 2012, submitted.
78  *
79  */
80 
81 /** creates and captures a absolute power constraint
82  *
83  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
84  */
87  SCIP* scip, /**< SCIP data structure */
88  SCIP_CONS** cons, /**< pointer to hold the created constraint */
89  const char* name, /**< name of constraint */
90  SCIP_VAR* x, /**< nonlinear variable x in constraint */
91  SCIP_VAR* z, /**< linear variable z in constraint */
92  SCIP_Real exponent, /**< exponent n of |x+offset|^n term in constraint */
93  SCIP_Real xoffset, /**< offset in |x+offset|^n term in constraint */
94  SCIP_Real zcoef, /**< coefficient of z in constraint */
95  SCIP_Real lhs, /**< left hand side of constraint */
96  SCIP_Real rhs, /**< right hand side of constraint */
97  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
98  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
99  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
100  * Usually set to TRUE. */
101  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
102  * TRUE for model constraints, FALSE for additional, redundant constraints. */
103  SCIP_Bool check, /**< should the constraint be checked for feasibility?
104  * TRUE for model constraints, FALSE for additional, redundant constraints. */
105  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
106  * Usually set to TRUE. */
107  SCIP_Bool local, /**< is constraint only valid locally?
108  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
109  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
110  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
111  * adds coefficients to this constraint. */
112  SCIP_Bool dynamic, /**< is constraint subject to aging?
113  * Usually set to FALSE. Set to TRUE for own cuts which
114  * are seperated as constraints. */
115  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
116  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
117  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
118  * if it may be moved to a more global node?
119  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
120  );
121 
122 /** creates and captures an absolute power constraint
123  * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
124  * method SCIPcreateConsAbspower(); all flags can be set via SCIPconsSetFLAGNAME-methods in scip.h
125  *
126  * @see SCIPcreateConsAbspower() for information about the basic constraint flag configuration
127  *
128  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
129  */
132  SCIP* scip, /**< SCIP data structure */
133  SCIP_CONS** cons, /**< pointer to hold the created constraint */
134  const char* name, /**< name of constraint */
135  SCIP_VAR* x, /**< nonlinear variable x in constraint */
136  SCIP_VAR* z, /**< linear variable z in constraint */
137  SCIP_Real exponent, /**< exponent n of |x+offset|^n term in constraint */
138  SCIP_Real xoffset, /**< offset in |x+offset|^n term in constraint */
139  SCIP_Real zcoef, /**< coefficient of z in constraint */
140  SCIP_Real lhs, /**< left hand side of constraint */
141  SCIP_Real rhs /**< right hand side of constraint */
142  );
143 
144 /** gets the absolute power constraint as a nonlinear row representation */
147  SCIP* scip, /**< SCIP data structure */
148  SCIP_CONS* cons, /**< constraint */
149  SCIP_NLROW** nlrow /**< a buffer where to store pointer to nonlinear row */
150  );
151 
152 /** gets nonlinear variable x in absolute power constraint */
155  SCIP* scip, /**< SCIP data structure */
156  SCIP_CONS* cons /**< absolute power constraint */
157  );
158 
159 /** gets linear variable z in absolute power constraint */
162  SCIP* scip, /**< SCIP data structure */
163  SCIP_CONS* cons /**< absolute power constraint */
164  );
165 
166 /** gets exponent in power term in absolute power constraint */
169  SCIP* scip, /**< SCIP data structure */
170  SCIP_CONS* cons /**< absolute power constraint */
171  );
172 
173 /** gets offset in power term in absolute power constraint */
176  SCIP* scip, /**< SCIP data structure */
177  SCIP_CONS* cons /**< absolute power constraint */
178  );
179 
180 /** gets coefficient of linear variable in absolute power constraint */
183  SCIP* scip, /**< SCIP data structure */
184  SCIP_CONS* cons /**< absolute power constraint */
185  );
186 
187 /** gets left hand side in absolute power constraint */
190  SCIP* scip, /**< SCIP data structure */
191  SCIP_CONS* cons /**< absolute power constraint */
192  );
193 
194 /** gets right hand side in absolute power constraint */
197  SCIP* scip, /**< SCIP data structure */
198  SCIP_CONS* cons /**< absolute power constraint */
199  );
200 
201 /** gets the absolute violation of a absolute power constraint by a solution */
204  SCIP* scip, /**< SCIP data structure */
205  SCIP_CONS* cons, /**< absolute power constraint */
206  SCIP_SOL* sol /**< LP solution */
207  );
208 
209 /** returns whether constraint is convex w.r.t. global bounds
210  *
211  * @note in difference to SCIPisConvexQuadratic, we put convexity/concavity of the constraint function in relation to the constraint sides here
212  */
215  SCIP* scip, /**< SCIP data structure */
216  SCIP_CONS* cons /**< absolute power constraint */
217  );
218 
219 /** @} */
220 
221 /** @} */
222 
223 #ifdef __cplusplus
224 }
225 #endif
226 
227 #endif
SCIP_EXPORT SCIP_VAR * SCIPgetNonlinearVarAbspower(SCIP *scip, SCIP_CONS *cons)
SCIP_EXPORT SCIP_RETCODE SCIPgetNlRowAbspower(SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
type definitions for NLP management
SCIP_EXPORT SCIP_Real SCIPgetRhsAbspower(SCIP *scip, SCIP_CONS *cons)
SCIP_EXPORT SCIP_RETCODE SCIPincludeConshdlrAbspower(SCIP *scip)
#define SCIP_EXPORT
Definition: def.h:100
SCIP_EXPORT SCIP_Real SCIPgetCoefLinearAbspower(SCIP *scip, SCIP_CONS *cons)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_EXPORT SCIP_RETCODE SCIPcreateConsAbspower(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *x, SCIP_VAR *z, SCIP_Real exponent, SCIP_Real xoffset, SCIP_Real zcoef, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
type definitions for return codes for SCIP methods
SCIP_VAR ** x
Definition: circlepacking.c:54
SCIP_EXPORT SCIP_VAR * SCIPgetLinearVarAbspower(SCIP *scip, SCIP_CONS *cons)
type definitions for SCIP&#39;s main datastructure
type definitions for problem variables
#define SCIP_Bool
Definition: def.h:70
SCIP_EXPORT SCIP_Real SCIPgetViolationAbspower(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol)
SCIP_EXPORT SCIP_Bool SCIPisConvexAbspower(SCIP *scip, SCIP_CONS *cons)
SCIP_EXPORT SCIP_Real SCIPgetOffsetAbspower(SCIP *scip, SCIP_CONS *cons)
type definitions for storing primal CIP solutions
SCIP_EXPORT SCIP_Real SCIPgetExponentAbspower(SCIP *scip, SCIP_CONS *cons)
#define SCIP_Real
Definition: def.h:163
SCIP_EXPORT SCIP_Real SCIPgetLhsAbspower(SCIP *scip, SCIP_CONS *cons)
common defines and data types used in all packages of SCIP
SCIP_EXPORT SCIP_RETCODE SCIPcreateConsBasicAbspower(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *x, SCIP_VAR *z, SCIP_Real exponent, SCIP_Real xoffset, SCIP_Real zcoef, SCIP_Real lhs, SCIP_Real rhs)
type definitions for constraints and constraint handlers