Scippy

SCIP

Solving Constraint Integer Programs

nlhdlr_soc.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 nlhdlr_soc.h
17  * @ingroup NLHDLRS
18  * @brief soc nonlinear handler
19  *
20  * @author Benjamin Mueller
21  * @author Fabian Wegscheider
22  */
23 
24 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
25 
26 #ifndef __SCIP_NLHDLR_SOC_H__
27 #define __SCIP_NLHDLR_SOC_H__
28 
29 #include "scip/scip.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /** includes SOC nonlinear handler in nonlinear constraint handler
36  *
37  * @ingroup NlhdlrIncludes
38  */
39 SCIP_EXPORT
41  SCIP* scip /**< SCIP data structure */
42  );
43 
44 /**@addtogroup NLHDLRS
45  *
46  * @{
47  *
48  * @name SOC nonlinear handler
49  *
50  * This nonlinear handler detects second-order cone constraints in the extended formulation and provides specialized separation functionality.
51  *
52  * @{
53  */
54 
55 /** checks whether constraint is SOC representable in original variables and returns the SOC representation
56  *
57  * The SOC representation has the form:
58  * \f$\sqrt{\sum_{i=1}^{n} (v_i^T x + \beta_i)^2} - v_{n+1}^T x - \beta_{n+1} \lessgtr 0\f$,
59  * where \f$n+1 = \text{nterms}\f$ and the inequality type is given by sidetype (`SCIP_SIDETYPE_RIGHT` if inequality
60  * is \f$\leq\f$, `SCIP_SIDETYPE_LEFT` if \f$\geq\f$).
61  *
62  * For each term (i.e. for each \f$i\f$ in the above notation as well as \f$n+1\f$), the constant \f$\beta_i\f$ is given by the
63  * corresponding element `offsets[i-1]` and `termbegins[i-1]` is the starting position of the term in arrays
64  * `transcoefs` and `transcoefsidx`. The overall number of nonzeros is `termbegins[nterms]`.
65  *
66  * Arrays `transcoefs` and `transcoefsidx` have size `termbegins[nterms]` and define the linear expressions \f$v_i^T x\f$
67  * for each term. For a term \f$i\f$ in the above notation, the nonzeroes are given by elements
68  * `termbegins[i-1]...termbegins[i]` of `transcoefs` and `transcoefsidx`. There may be no nonzeroes for some term (i.e.,
69  * constant terms are possible). `transcoefs` contains the coefficients \f$v_i\f$ and `transcoefsidx` contains positions of
70  * variables in the `vars` array.
71  *
72  * The `vars` array has size `nvars` and contains \f$x\f$ variables; each variable is included at most once.
73  *
74  * The arrays should be freed by calling SCIPfreeSOCArraysNonlinear().
75  *
76  * This function uses the methods that are used in the detection algorithm of the SOC nonlinear handler.
77  */
78 SCIP_EXPORT
80  SCIP* scip, /**< SCIP data structure */
81  SCIP_CONS* cons, /**< nonlinear constraint */
82  SCIP_Bool compeigenvalues, /**< whether eigenvalues should be computed to detect complex cases */
83  SCIP_Bool* success, /**< pointer to store whether SOC structure has been detected */
84  SCIP_SIDETYPE* sidetype, /**< pointer to store which side of cons is SOC representable; only
85  valid when success is TRUE */
86  SCIP_VAR*** vars, /**< variables (x) that appear on both sides; no duplicates are allowed */
87  SCIP_Real** offsets, /**< offsets of both sides (beta_i) */
88  SCIP_Real** transcoefs, /**< non-zeros of linear transformation vectors (v_i) */
89  int** transcoefsidx, /**< mapping of transformation coefficients to variable indices in vars */
90  int** termbegins, /**< starting indices of transcoefs for each term */
91  int* nvars, /**< total number of variables appearing (i.e. size of vars) */
92  int* nterms /**< number of summands in the SQRT +1 for RHS (n+1) */
93  );
94 
95 /** frees arrays created by SCIPisSOCNonlinear() */
96 SCIP_EXPORT
98  SCIP* scip, /**< SCIP data structure */
99  SCIP_VAR*** vars, /**< variables that appear on both sides (x) */
100  SCIP_Real** offsets, /**< offsets of both sides (beta_i) */
101  SCIP_Real** transcoefs, /**< non-zeros of linear transformation vectors (v_i) */
102  int** transcoefsidx, /**< mapping of transformation coefficients to variable indices in vars */
103  int** termbegins, /**< starting indices of transcoefs for each term */
104  int nvars, /**< total number of variables appearing */
105  int nterms /**< number of summands in the SQRT +1 for RHS (n+1) */
106  );
107 
108 /** @}
109  * @}
110  */
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* __SCIP_NLHDLR_SOC_H__ */
static volatile int nterms
Definition: interrupt.c:38
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
void SCIPfreeSOCArraysNonlinear(SCIP *scip, SCIP_VAR ***vars, SCIP_Real **offsets, SCIP_Real **transcoefs, int **transcoefsidx, int **termbegins, int nvars, int nterms)
Definition: nlhdlr_soc.c:2814
#define SCIP_Bool
Definition: def.h:84
SCIP_RETCODE SCIPincludeNlhdlrSoc(SCIP *scip)
Definition: nlhdlr_soc.c:2667
#define SCIP_Real
Definition: def.h:177
SCIP_RETCODE SCIPisSOCNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_Bool compeigenvalues, SCIP_Bool *success, SCIP_SIDETYPE *sidetype, SCIP_VAR ***vars, SCIP_Real **offsets, SCIP_Real **transcoefs, int **transcoefsidx, int **termbegins, int *nvars, int *nterms)
Definition: nlhdlr_soc.c:2724
SCIP callable library.
enum SCIP_SideType SCIP_SIDETYPE
Definition: type_lp.h:58