Scippy

SCIP

Solving Constraint Integer Programs

cons_soc.c File Reference

Detailed Description

constraint handler for second order cone constraints $\sqrt{\gamma + \sum_{i=1}^{n} (\alpha_i\, (x_i + \beta_i))^2} \leq \alpha_{n+1}\, (x_{n+1}+\beta_{n+1})$

Author
Stefan Vigerske
Marc Pfetsch

Definition in file cons_soc.c.

#include <assert.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include "scip/cons_soc.h"
#include "scip/cons_quadratic.h"
#include "scip/cons_linear.h"
#include "scip/heur_subnlp.h"
#include "scip/heur_trysol.h"
#include "scip/intervalarith.h"
#include "nlpi/nlpi.h"
#include "nlpi/exprinterpret.h"
#include "nlpi/nlpi_ipopt.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "soc"
 
#define CONSHDLR_DESC   "constraint handler for second order cone constraints"
 
#define CONSHDLR_SEPAPRIORITY   10
 
#define CONSHDLR_ENFOPRIORITY   -40
 
#define CONSHDLR_CHECKPRIORITY   -10
 
#define CONSHDLR_SEPAFREQ   1
 
#define CONSHDLR_PROPFREQ   1
 
#define CONSHDLR_EAGERFREQ   100
 
#define CONSHDLR_MAXPREROUNDS   -1
 
#define CONSHDLR_DELAYSEPA   FALSE
 
#define CONSHDLR_DELAYPROP   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP
 
#define CONSHDLR_PRESOLTIMING   SCIP_PRESOLTIMING_ALWAYS
 
#define QUADCONSUPGD_PRIORITY   10000
 
#define M_PI   3.141592653589793238462643
 
#define UPGSCALE   10 /* scale factor used in general upgrades of quadratic cons to soc */
 

Typedefs

typedef struct VarEventData VAREVENTDATA
 

Functions

static SCIP_RETCODE catchLhsVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int varidx)
 
static SCIP_RETCODE catchRhsVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE catchVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE dropLhsVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int varidx)
 
static SCIP_RETCODE dropRhsVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE dropVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons)
 
static SCIP_DECL_EVENTEXEC (processVarEvent)
 
static SCIP_RETCODE createNlRow (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE evalLhs (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol)
 
static SCIP_Real getGradientNorm (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol)
 
static SCIP_RETCODE computeViolation (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol)
 
static SCIP_RETCODE computeViolations (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_CONS **maxviolcons)
 
static SCIP_RETCODE generateCutSol (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_ROW **row)
 
static SCIP_RETCODE generateCutPoint (SCIP *scip, SCIP_CONS *cons, SCIP_Real *x, SCIP_ROW **row)
 
static SCIP_RETCODE generateCutProjectedPoint (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_ROW **row)
 
static SCIP_RETCODE generateSparseCut (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_ROW **row, SCIP_Real minefficacy)
 
static SCIP_RETCODE separatePoint (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_Bool inenforcement, SCIP_Bool *cutoff, SCIP_Bool *success)
 
static SCIP_RETCODE addLinearizationCuts (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *ref, SCIP_Bool *separatedlpsol, SCIP_Real minefficacy, SCIP_Bool *cutoff)
 
static SCIP_DECL_EVENTEXEC (processNewSolutionEvent)
 
static SCIP_RETCODE presolveRemoveFixedVariables (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, int *ndelconss, int *nupgdconss, int *nchgbds, int *nfixedvars, SCIP_Bool *iscutoff, SCIP_Bool *isdeleted)
 
static SCIP_RETCODE presolveCreateGlineurApproxDim3 (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *x1, SCIP_VAR *x2, SCIP_VAR *x3, SCIP_Real alpha1, SCIP_Real alpha2, SCIP_Real alpha3, SCIP_Real offset1, SCIP_Real offset2, SCIP_Real offset3, int N, const char *basename, int *naddconss)
 
static SCIP_RETCODE presolveCreateBenTalNemirovskiApproxDim3 (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *x1, SCIP_VAR *x2, SCIP_VAR *x3, SCIP_Real alpha1, SCIP_Real alpha2, SCIP_Real alpha3, SCIP_Real offset1, SCIP_Real offset2, SCIP_Real offset3, int N, const char *basename, int *naddconss)
 
static SCIP_RETCODE presolveCreateOuterApproxDim3 (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *x1, SCIP_VAR *x2, SCIP_VAR *x3, SCIP_Real alpha1, SCIP_Real alpha2, SCIP_Real alpha3, SCIP_Real offset1, SCIP_Real offset2, SCIP_Real offset3, int N, SCIP_Bool glineur, const char *basename, int *naddconss)
 
static SCIP_RETCODE presolveCreateOuterApprox (SCIP *scip, int nlhsvars, SCIP_VAR **lhsvars, SCIP_Real *lhscoefs, SCIP_Real *lhsoffsets, SCIP_VAR *rhsvar, SCIP_Real rhscoeff, SCIP_Real rhsoffset, SCIP_Real constant, const char *basename, SCIP_CONS *origcons, int soc3_nr_auxvars, SCIP_Bool glineur, int *naddconss)
 
static SCIP_RETCODE propagateBounds (SCIP *scip, SCIP_CONS *cons, SCIP_RESULT *result, int *nchgbds)
 
static SCIP_RETCODE polishSolution (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *success)
 
static SCIP_DECL_QUADCONSUPGD (upgradeConsQuadratic)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopySOC)
 
static SCIP_DECL_CONSFREE (consFreeSOC)
 
static SCIP_DECL_CONSINIT (consInitSOC)
 
static SCIP_DECL_CONSEXIT (consExitSOC)
 
static SCIP_DECL_CONSEXITPRE (consExitpreSOC)
 
static SCIP_DECL_CONSINITSOL (consInitsolSOC)
 
static SCIP_DECL_CONSEXITSOL (consExitsolSOC)
 
static SCIP_DECL_CONSDELETE (consDeleteSOC)
 
static SCIP_DECL_CONSTRANS (consTransSOC)
 
static SCIP_DECL_CONSSEPALP (consSepalpSOC)
 
static SCIP_DECL_CONSSEPASOL (consSepasolSOC)
 
static SCIP_DECL_CONSENFOLP (consEnfolpSOC)
 
static SCIP_DECL_CONSENFOPS (consEnfopsSOC)
 
static SCIP_DECL_CONSCHECK (consCheckSOC)
 
static SCIP_DECL_CONSPROP (consPropSOC)
 
static SCIP_DECL_CONSPRESOL (consPresolSOC)
 
static SCIP_DECL_CONSLOCK (consLockSOC)
 
static SCIP_DECL_CONSPRINT (consPrintSOC)
 
static SCIP_DECL_CONSCOPY (consCopySOC)
 
static SCIP_DECL_CONSPARSE (consParseSOC)
 
static SCIP_DECL_CONSGETVARS (consGetVarsSOC)
 
static SCIP_DECL_CONSGETNVARS (consGetNVarsSOC)
 
SCIP_RETCODE SCIPincludeConshdlrSOC (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsSOC (SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *coefs, SCIP_Real *offsets, SCIP_Real constant, SCIP_VAR *rhsvar, SCIP_Real rhscoeff, SCIP_Real rhsoffset, 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_RETCODE SCIPcreateConsBasicSOC (SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *coefs, SCIP_Real *offsets, SCIP_Real constant, SCIP_VAR *rhsvar, SCIP_Real rhscoeff, SCIP_Real rhsoffset)
 
SCIP_RETCODE SCIPgetNlRowSOC (SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
 
int SCIPgetNLhsVarsSOC (SCIP *scip, SCIP_CONS *cons)
 
SCIP_VAR ** SCIPgetLhsVarsSOC (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RealSCIPgetLhsCoefsSOC (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RealSCIPgetLhsOffsetsSOC (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Real SCIPgetLhsConstantSOC (SCIP *scip, SCIP_CONS *cons)
 
SCIP_VARSCIPgetRhsVarSOC (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Real SCIPgetRhsCoefSOC (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Real SCIPgetRhsOffsetSOC (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPaddToNlpiProblemSOC (SCIP *scip, SCIP_CONS *cons, SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *nlpiprob, SCIP_HASHMAP *scipvar2nlpivar, SCIP_Bool names)
 

Macro Definition Documentation

#define CONSHDLR_DESC   "constraint handler for second order cone constraints"

Definition at line 45 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_SEPAPRIORITY   10

priority of the constraint handler for separation

Definition at line 46 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_ENFOPRIORITY   -40

priority of the constraint handler for constraint enforcing

Definition at line 47 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_CHECKPRIORITY   -10

priority of the constraint handler for checking feasibility

Definition at line 48 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_SEPAFREQ   1

frequency for separating cuts; zero means to separate only in the root node

Definition at line 49 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_PROPFREQ   1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 50 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_EAGERFREQ   100

frequency for using all instead of only the useful constraints in separation, propagation and enforcement, -1 for no eager evaluations, 0 for first only

Definition at line 51 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_MAXPREROUNDS   -1

maximal number of presolving rounds the constraint handler participates in (-1: no limit)

Definition at line 54 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_DELAYSEPA   FALSE

should separation method be delayed, if other separators found cuts?

Definition at line 55 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_DELAYPROP   FALSE

should propagation method be delayed, if other propagators found reductions?

Definition at line 56 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_NEEDSCONS   TRUE

should the constraint handler be skipped, if no constraints are available?

Definition at line 57 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

propagation timing mask of the constraint handler

Definition at line 59 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define CONSHDLR_PRESOLTIMING   SCIP_PRESOLTIMING_ALWAYS

presolving timing of the constraint handler (fast, medium, or exhaustive)

Definition at line 60 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define QUADCONSUPGD_PRIORITY   10000

priority of the constraint handler for upgrading of quadratic constraints

Definition at line 62 of file cons_soc.c.

Referenced by SCIPincludeConshdlrSOC().

#define M_PI   3.141592653589793238462643
#define UPGSCALE   10 /* scale factor used in general upgrades of quadratic cons to soc */

Definition at line 68 of file cons_soc.c.

Referenced by SCIP_DECL_QUADCONSUPGD().

Typedef Documentation

typedef struct VarEventData VAREVENTDATA

Definition at line 81 of file cons_soc.c.

Function Documentation

static SCIP_RETCODE catchLhsVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  varidx 
)
static

catch left hand side variable events

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
varidxindex of the variable which events to catch

Definition at line 142 of file cons_soc.c.

References catchRhsVarEvents(), VarEventData::consdata, FALSE, NULL, SCIP_CALL, SCIP_EVENTTYPE_BOUNDTIGHTENED, SCIP_OKAY, SCIPcatchVarEvent(), SCIPconsGetData(), and VarEventData::varidx.

Referenced by catchVarEvents(), and presolveRemoveFixedVariables().

static SCIP_RETCODE catchRhsVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons 
)
static

catch right hand side variable events

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events

Definition at line 172 of file cons_soc.c.

References catchVarEvents(), VarEventData::consdata, FALSE, NULL, SCIP_CALL, SCIP_EVENTTYPE_UBTIGHTENED, SCIP_OKAY, SCIPcatchVarEvent(), and SCIPconsGetData().

Referenced by catchLhsVarEvents(), catchVarEvents(), and presolveRemoveFixedVariables().

static SCIP_RETCODE catchVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons 
)
static

catch variables events

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events

Definition at line 198 of file cons_soc.c.

References catchLhsVarEvents(), catchRhsVarEvents(), VarEventData::consdata, dropLhsVarEvents(), NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, and SCIPconsGetData().

Referenced by catchRhsVarEvents(), presolveRemoveFixedVariables(), SCIP_DECL_CONSTRANS(), and SCIPcreateConsSOC().

static SCIP_RETCODE dropLhsVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  varidx 
)
static

drop left hand side variable events

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
varidxindex of the variable which events to catch

Definition at line 235 of file cons_soc.c.

References VarEventData::consdata, dropRhsVarEvents(), NULL, SCIP_CALL, SCIP_EVENTTYPE_BOUNDTIGHTENED, SCIP_OKAY, SCIPconsGetData(), SCIPdropVarEvent(), and VarEventData::varidx.

Referenced by catchVarEvents(), dropVarEvents(), and presolveRemoveFixedVariables().

static SCIP_RETCODE dropRhsVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons 
)
static

drop right hand side variable events

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events

Definition at line 262 of file cons_soc.c.

References VarEventData::consdata, dropVarEvents(), NULL, SCIP_CALL, SCIP_EVENTTYPE_UBTIGHTENED, SCIP_OKAY, SCIPconsGetData(), and SCIPdropVarEvent().

Referenced by dropLhsVarEvents(), dropVarEvents(), and presolveRemoveFixedVariables().

static SCIP_RETCODE dropVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons 
)
static

drop variable events

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events

Definition at line 285 of file cons_soc.c.

References VarEventData::consdata, dropLhsVarEvents(), dropRhsVarEvents(), NULL, SCIP_CALL, SCIP_DECL_EVENTEXEC(), SCIP_OKAY, SCIPconsGetData(), and SCIPfreeBlockMemoryArray.

Referenced by dropRhsVarEvents(), presolveRemoveFixedVariables(), and SCIP_DECL_CONSDELETE().

static SCIP_DECL_EVENTEXEC ( processVarEvent  )
static

process variable bound tightening event

Definition at line 321 of file cons_soc.c.

References VarEventData::consdata, createNlRow(), FALSE, NULL, and SCIP_OKAY.

Referenced by addLinearizationCuts(), and dropVarEvents().

static SCIP_RETCODE evalLhs ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol 
)
static

evaluates the left hand side of a SOC constraint

Parameters
scipSCIP data structure
consconstraint to evaluate
solsolution to evaluate, or NULL if LP solution should be used

Definition at line 674 of file cons_soc.c.

References VarEventData::consdata, getGradientNorm(), MAX, MIN, NULL, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasGE(), SCIPisFeasLE(), SCIPisInfinity(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and sqrt().

Referenced by addLinearizationCuts(), computeViolation(), and createNlRow().

static SCIP_Real getGradientNorm ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol 
)
static
Parameters
scipSCIP data structure
consconstraint
solsolution or NULL if LP solution should be used

Definition at line 727 of file cons_soc.c.

References computeViolation(), VarEventData::consdata, NULL, SCIP_Real, SCIPconsGetData(), SCIPgetSolVal(), SCIPisInfinity(), and sqrt().

Referenced by computeViolation(), and evalLhs().

static SCIP_RETCODE computeViolation ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_SOL sol 
)
static

computes violation of a SOC constraint

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint to evaluate
solsolution to evaluate, or NULL if LP solution should be used

Definition at line 760 of file cons_soc.c.

References computeViolations(), VarEventData::consdata, evalLhs(), getGradientNorm(), MAX, MIN, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPerrorMessage, SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasGE(), SCIPisFeasLE(), SCIPisInfinity(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by computeViolations(), getGradientNorm(), and SCIP_DECL_CONSCHECK().

static SCIP_RETCODE computeViolations ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS **  conss,
int  nconss,
SCIP_SOL sol,
SCIP_CONS **  maxviolcons 
)
static

computes violations for a set of constraints

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to evaluate
nconssnumber of constraints to evaluate
solsolution to evaluate, or NULL if LP solution should be used
maxviolconsa buffer to store pointer to maximal violated constraint, or NULL if of no interest

Definition at line 873 of file cons_soc.c.

References computeViolation(), VarEventData::consdata, generateCutSol(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPfeastol(), and SCIPisGT().

Referenced by computeViolation(), SCIP_DECL_CONSENFOLP(), SCIP_DECL_CONSENFOPS(), SCIP_DECL_CONSSEPALP(), and SCIP_DECL_CONSSEPASOL().

static SCIP_RETCODE generateCutSol ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_ROW **  row 
)
static
static SCIP_RETCODE generateCutPoint ( SCIP scip,
SCIP_CONS cons,
SCIP_Real x,
SCIP_ROW **  row 
)
static

generate supporting hyperplane in a given point

Parameters
scipSCIP pointer
consconstraint
xpoint (lhs-vars) where to generate cut
rowplace to store cut

Definition at line 964 of file cons_soc.c.

References VarEventData::consdata, FALSE, generateCutProjectedPoint(), NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddVarsToRow(), SCIPaddVarToRow(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconsIsLocal(), SCIPcreateEmptyRowCons(), SCIPfreeBufferArray, SCIPgetNLPs(), SCIPinfinity(), SCIPisInfinity(), SCIPisZero(), SCIPsnprintf(), sqrt(), and TRUE.

Referenced by generateCutSol(), and generateSparseCut().

static SCIP_RETCODE generateCutProjectedPoint ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_ROW **  row 
)
static

generate supporting hyperplane w.r.t. solution projected on feasible set

Instead of linearizing the SOC constraint in the given solution point, this function projects the point first onto the feasible set of the SOC constraint (w.r.t. euclidean norm (scaled by alpha)) and linearizes the SOC constraint there. The hope is that this produces somewhat tighter cuts.

The projection has only be computed for the case gamma = 0. If gamma > 0, generateCut is called.

Let $\hat x$ be sol or the LP solution if sol == NULL. Then the projected point $\tilde x$ is given by

\[ \tilde x_i = \frac{\hat x_i + \lambda \beta_i}{1-\lambda}, \quad i=1,\ldots, n; \quad \tilde x_{n+1} = \frac{\hat x_{n+1} - \lambda \beta_{n+1}}{1+\lambda} \]

where

\[ \lambda = \frac{1-A}{1+A}, \qquad A = \frac{\alpha_{n+1}(\hat x_{n+1}+\beta_{n+1})}{\sqrt{\sum_{i=1}^n (\alpha_i(\hat x_i+\beta_i))^2}} \]

If lambda is very close to 1, generateCut is called.

The generated cut is very similar to the unprojected form. The only difference is in the right hand side, which is (in the case beta = 0) multiplied by 1/(1-lambda).

Parameters
scipSCIP pointer
consconstraint
solsolution to separate, or NULL for LP solution
rowplace to store cut

Definition at line 1060 of file cons_soc.c.

References VarEventData::consdata, FALSE, generateCutSol(), generateSparseCut(), NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddVarsToRow(), SCIPaddVarToRow(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconsIsLocal(), SCIPcreateEmptyRowCons(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPgetNLPs(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasEQ(), SCIPisInfinity(), SCIPisNegative(), SCIPisPositive(), SCIPisZero(), SCIPsnprintf(), and TRUE.

Referenced by generateCutPoint(), and separatePoint().

static SCIP_RETCODE generateSparseCut ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_ROW **  row,
SCIP_Real  minefficacy 
)
static

generates sparsified supporting hyperplane

Parameters
scipSCIP pointer
conshdlrconstraint handler
consconstraint
solsolution to separate, or NULL for LP solution
rowplace to store cut
minefficacyminimal efficacy for a cut to be accepted

Definition at line 1136 of file cons_soc.c.

References VarEventData::consdata, generateCutPoint(), generateCutSol(), MAX, MIN, NULL, REALABS, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPallocBufferArray, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPdebugMessage, SCIPerrorMessage, SCIPfreeBufferArray, SCIPgetRowMaxCoef(), SCIPgetRowSolFeasibility(), SCIPgetSolVal(), SCIPgetSolVals(), SCIPisGT(), SCIPisInfinity(), SCIPisPositive(), SCIPreleaseRow(), SCIProwGetLhs(), SCIProwGetRhs(), SCIPsortRealInt(), separatePoint(), and TRUE.

Referenced by generateCutProjectedPoint(), and separatePoint().

static SCIP_RETCODE separatePoint ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS **  conss,
int  nconss,
int  nusefulconss,
SCIP_SOL sol,
SCIP_Bool  inenforcement,
SCIP_Bool cutoff,
SCIP_Bool success 
)
static

separates a point, if possible

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints
nconssnumber of constraints
nusefulconssnumber of constraints that seem to be useful
solsolution to separate, or NULL for LP solution
inenforcementwhether we are in constraint enforcement
cutoffpointer to store whether a fixing leads to a cutoff
successbuffer to store whether the point was separated

Definition at line 1275 of file cons_soc.c.

References addLinearizationCuts(), VarEventData::consdata, FALSE, generateCutProjectedPoint(), generateCutSol(), generateSparseCut(), MAX, MIN, NULL, REALABS, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPaddCut(), SCIPconsGetData(), SCIPconshdlrGetData(), SCIPdebugMessage, SCIPepsilon(), SCIPerrorMessage, SCIPfeastol(), SCIPgetCutEfficacy(), SCIPgetRelaxFeastolFactor(), SCIPgetRowMaxCoef(), SCIPgetRowSolFeasibility(), SCIPisCutApplicable(), SCIPisGT(), SCIPisInfinity(), SCIPisLE(), SCIPmarkRowNotRemovableLocal(), SCIPreleaseRow(), SCIPresetConsAge(), SCIProwGetLhs(), SCIProwGetRhs(), and TRUE.

Referenced by generateSparseCut(), SCIP_DECL_CONSENFOLP(), SCIP_DECL_CONSSEPALP(), and SCIP_DECL_CONSSEPASOL().

static SCIP_RETCODE addLinearizationCuts ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS **  conss,
int  nconss,
SCIP_SOL ref,
SCIP_Bool separatedlpsol,
SCIP_Real  minefficacy,
SCIP_Bool cutoff 
)
static

adds linearizations cuts for convex constraints w.r.t. a given reference point to cutpool and sepastore if separatedlpsol is not NULL, then a cut that separates the LP solution is added to the sepastore and is forced to enter the LP if separatedlpsol is not NULL, but cut does not separate the LP solution, then it is added to the cutpool only if separatedlpsol is NULL, then cut is added to cutpool only

Parameters
scipSCIP data structure
conshdlrquadratic constraints handler
conssconstraints
nconssnumber of constraints
refreference point where to linearize, or NULL for LP solution
separatedlpsolbuffer to store whether a cut that separates the current LP solution was found and added to LP, or NULL if adding to cutpool only
minefficacyminimal efficacy of a cut when checking for separation of LP solution
cutoffpointer to store whether a cutoff was detected

Definition at line 1415 of file cons_soc.c.

References VarEventData::consdata, evalLhs(), FALSE, generateCutSol(), MAX, MIN, NULL, REALABS, SCIP_Bool, SCIP_CALL, SCIP_DECL_EVENTEXEC(), SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPaddCut(), SCIPaddPoolCut(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsLocal(), SCIPdebugMessage, SCIPerrorMessage, SCIPgetRowLPFeasibility(), SCIPgetRowMaxCoef(), SCIPisInfinity(), SCIPisPositive(), SCIPreleaseRow(), SCIProwGetLhs(), SCIProwGetRhs(), SCIProwIsLocal(), and TRUE.

Referenced by SCIP_DECL_CONSSEPALP(), SCIP_DECL_EVENTEXEC(), and separatePoint().

static SCIP_DECL_EVENTEXEC ( processNewSolutionEvent  )
static
static SCIP_RETCODE presolveRemoveFixedVariables ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
int *  ndelconss,
int *  nupgdconss,
int *  nchgbds,
int *  nfixedvars,
SCIP_Bool iscutoff,
SCIP_Bool isdeleted 
)
static

removes fixed variables, replace aggregated and negated variables

repeats replacements until no further change is found; takes care of capture/release and locks, but not of variable events (assumes that var events are not caught yet)

Parameters
scipSCIP data structure
conshdlrconstraint handler for signpower constraints
consconstraint
ndelconsscounter for number of deleted constraints
nupgdconsscounter for number of upgraded constraints
nchgbdscounter for number of bound changes
nfixedvarscounter for number of fixed variables
iscutoffto store whether constraint cannot be satisfied
isdeletedto store whether constraint is redundant and can be deleted

Definition at line 1581 of file cons_soc.c.

References BMSclearMemoryArray, catchLhsVarEvents(), catchRhsVarEvents(), catchVarEvents(), VarEventData::consdata, dropLhsVarEvents(), dropRhsVarEvents(), dropVarEvents(), FALSE, SCIP_QuadVarTerm::lincoef, NULL, presolveCreateGlineurApproxDim3(), REALABS, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARSTATUS_MULTAGGR, SCIP_VARSTATUS_ORIGINAL, SCIPaddCons(), SCIPallocBufferArray, SCIPcaptureVar(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPcreateConsQuadratic2(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPdelCons(), SCIPfixVar(), SCIPfreeBufferArray, SCIPgetProbvarSum(), SCIPinfinity(), SCIPisFeasLE(), SCIPisNegative(), SCIPisZero(), SCIPlockVarCons(), SCIPreallocBlockMemoryArray, SCIPreleaseCons(), SCIPreleaseNlRow(), SCIPreleaseVar(), SCIPtightenVarLb(), SCIPtightenVarUb(), SCIPunlockVarCons(), SCIPvarGetName(), SCIPvarGetStatus(), SCIPvarIsActive(), SCIP_QuadVarTerm::sqrcoef, sqrt(), TRUE, and SCIP_QuadVarTerm::var.

Referenced by SCIP_DECL_CONSPRESOL(), and SCIP_DECL_EVENTEXEC().

static SCIP_RETCODE presolveCreateGlineurApproxDim3 ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR x1,
SCIP_VAR x2,
SCIP_VAR x3,
SCIP_Real  alpha1,
SCIP_Real  alpha2,
SCIP_Real  alpha3,
SCIP_Real  offset1,
SCIP_Real  offset2,
SCIP_Real  offset3,
int  N,
const char *  basename,
int *  naddconss 
)
static

adds the linear outer-approximation of Glineur et.al. for a SOC constraint of dimension 3

Input is the data for a constraint $\sqrt{(\alpha_1(x_1+offset1))^2 + (\alpha_2(x_2+offset2))^2) \leq \alpha_3(x_3+offset3)}$. Here constant >= 0.0, alpha3 > 0.0, and the lower bound of x3 >= -offset3. Also x2 = NULL is allowed, in which case the second term is assumed to be constant, and offset2 != 0 is needed.

Parameters
scipSCIP data structure
consoriginal constraint
x1variable x1
x2variable x2
x3variable x3
alpha1coefficient of x1
alpha2coefficient of x2
alpha3coefficient of x3
offset1offset of x1
offset2offset of x2
offset3offset of x3
Nsize of linear approximation, need to be >= 1
basenamestring to use for building variable and constraint names
naddconssbuffer where to add the number of added constraints

Definition at line 2018 of file cons_soc.c.

References cos(), FALSE, M_PI, NULL, presolveCreateBenTalNemirovskiApproxDim3(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPaddCons(), SCIPaddVar(), SCIPallocBufferArray, SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPcreateVar(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPinfinity(), SCIPisGE(), SCIPisPositive(), SCIPisZero(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), SCIPtightenVarLb(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPwarningMessage(), sin(), and TRUE.

Referenced by presolveCreateOuterApproxDim3(), and presolveRemoveFixedVariables().

static SCIP_RETCODE presolveCreateBenTalNemirovskiApproxDim3 ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR x1,
SCIP_VAR x2,
SCIP_VAR x3,
SCIP_Real  alpha1,
SCIP_Real  alpha2,
SCIP_Real  alpha3,
SCIP_Real  offset1,
SCIP_Real  offset2,
SCIP_Real  offset3,
int  N,
const char *  basename,
int *  naddconss 
)
static

adds the linear outer-approximation of Ben-Tal and Nemirovski for a SOC constraint of dimension 3

Input is the data for a constraint $\sqrt{constant + (\alpha_1(x_1+offset1))^2 + (\alpha_2(x_2+offset2))^2) \leq \alpha_3(x_3+offset3)}$. Here constant >= 0.0, alpha3 > 0.0, and the lower bound of x3 >= -offset3. Also x2 = NULL is allowed, in which case the second term is assumed to be constant, and offset2 != 0 is needed.

Parameters
scipSCIP data structure
consoriginal constraint
x1variable x1
x2variable x2
x3variable x3
alpha1coefficient of x1
alpha2coefficient of x2
alpha3coefficient of x3
offset1offset of x1
offset2offset of x2
offset3offset of x3
Nsize of linear approximation, need to be >= 1
basenamestring to use for building variable and constraint names
naddconssbuffer where to add the number of added constraints

Definition at line 2252 of file cons_soc.c.

References cos(), M_PI, NULL, pow(), presolveCreateOuterApproxDim3(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPaddCons(), SCIPaddVar(), SCIPallocBufferArray, SCIPchgVarLbGlobal(), SCIPchgVarLbNode(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPcreateVar(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPinfinity(), SCIPisGE(), SCIPisPositive(), SCIPisZero(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), sin(), and TRUE.

Referenced by presolveCreateGlineurApproxDim3(), and presolveCreateOuterApproxDim3().

static SCIP_RETCODE presolveCreateOuterApproxDim3 ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR x1,
SCIP_VAR x2,
SCIP_VAR x3,
SCIP_Real  alpha1,
SCIP_Real  alpha2,
SCIP_Real  alpha3,
SCIP_Real  offset1,
SCIP_Real  offset2,
SCIP_Real  offset3,
int  N,
SCIP_Bool  glineur,
const char *  basename,
int *  naddconss 
)
static

adds a linear outer approx for a three dimensional SOC constraint

chooses between Ben-Tan/Nemirovski and Glineur and calls the corresponding function

Parameters
scipSCIP data structure
consoriginal constraint
x1variable x1
x2variable x2
x3variable x3
alpha1coefficient of x1
alpha2coefficient of x2
alpha3coefficient of x3
offset1offset of x1
offset2offset of x2
offset3offset of x3
Nsize of linear approximation, need to be >= 1
glineurwhether to prefer Glineur to Ben-Tal Nemirovski
basenamestring to use for building variable and constraint names
naddconssbuffer where to add the number of added constraints

Definition at line 2498 of file cons_soc.c.

References presolveCreateBenTalNemirovskiApproxDim3(), presolveCreateGlineurApproxDim3(), presolveCreateOuterApprox(), SCIP_CALL, and SCIP_OKAY.

Referenced by presolveCreateBenTalNemirovskiApproxDim3(), and presolveCreateOuterApprox().

static SCIP_RETCODE presolveCreateOuterApprox ( SCIP scip,
int  nlhsvars,
SCIP_VAR **  lhsvars,
SCIP_Real lhscoefs,
SCIP_Real lhsoffsets,
SCIP_VAR rhsvar,
SCIP_Real  rhscoeff,
SCIP_Real  rhsoffset,
SCIP_Real  constant,
const char *  basename,
SCIP_CONS origcons,
int  soc3_nr_auxvars,
SCIP_Bool  glineur,
int *  naddconss 
)
static

adds linear outer approximation of Ben-Tal and Nemirovski for a constraint $\gamma + \sum_{i=1}^n (\alpha_i (x_i + \beta_i))^2 <= (\alpha_{n+1} (x_{n+1} + \beta_{n+1}))^2$ to the LP

if n>2, calls same function recursively; if n=2, calls presolveCreateBenTalNemirovskiApproxDim3

Parameters
scipSCIP data structure
nlhsvarsnumber of variables on left hand side (n)
lhsvarsvariables on left hand side (x_i)
lhscoefscoefficients of variables on left hand side (alpha_i)
lhsoffsetsoffsets of variable on left hand side (beta_i)
rhsvarvariable on right hand side (y)
rhscoeffcoefficient of variable on right hand side (alpha_{n+1})
rhsoffsetoffset of variable on right hand side (beta_{n+1})
constantconstant term (gamma)
basenameprefix for variable and constraint name
origconsoriginal constraint for which this SOC3 set is added
soc3_nr_auxvarsnumber of auxiliary variables to use for a SOC3 constraint, or 0 if automatic
glineurwhether Glineur should be preferred to Ben-Tal Nemirovski
naddconssbuffer where to add the number of added constraints

Definition at line 2534 of file cons_soc.c.

References FALSE, NULL, presolveCreateOuterApproxDim3(), propagateBounds(), SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_CONTINUOUS, SCIPaddVar(), SCIPcreateVar(), SCIPinfinity(), SCIPisNegative(), SCIPisPositive(), SCIPisZero(), SCIPreleaseVar(), SCIPsnprintf(), sqrt(), and TRUE.

Referenced by presolveCreateOuterApproxDim3(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE polishSolution ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_Bool success 
)
static

tries to adjust a solution such that it satisfies a given constraint by increasing the value for the constraints right hand side variable

Parameters
scipSCIP data structure
consconstraint
solsolution to polish
successbuffer to store whether polishing was successful

Definition at line 2853 of file cons_soc.c.

References VarEventData::consdata, FALSE, NULL, SCIP_CALL, SCIP_DECL_QUADCONSUPGD(), SCIP_OKAY, SCIP_Real, SCIPceil(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPfloor(), SCIPgetSolVal(), SCIPinfinity(), SCIPisGT(), SCIPisInfinity(), SCIPisLT(), SCIPisZero(), SCIPsetSolVal(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPvarIsIntegral(), SCIPvarMayRoundDown(), SCIPvarMayRoundUp(), and TRUE.

Referenced by propagateBounds(), and SCIP_DECL_CONSCHECK().

static SCIP_DECL_QUADCONSUPGD ( upgradeConsQuadratic  )
static

tries to upgrade a quadratic constraint to a SOC constraint

We treat as special cases, quadratic with no bilinear terms and hyperbolic quadratic constraints with exactly on bilinear component containing nonnegative variables. For this we use the formula:

\[ x^T x \leq yz,\; y \geq 0,\; z \geq 0 \qquad\Leftrightarrow\qquad \left\| \left(\begin{array}{c} x \\ \frac{1}{2}(y - z)\end{array}\right) \right\| \leq \frac{1}{2}(y + z). \]

Definition at line 2953 of file cons_soc.c.

References SCIP_BilinTerm::coef, CONSHDLR_NAME, FALSE, LapackDsyev(), SCIP_QuadVarTerm::lincoef, MAX, MIN, NULL, SCIP_Bool, SCIP_CALL, SCIP_DECL_CONSHDLRCOPY(), SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_PRESOLTIMING_FAST, SCIP_PRESOLTIMING_MEDIUM, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPaddCons(), SCIPaddVar(), SCIPallocBufferArray, SCIPallocClearBufferArray, SCIPcomputeVarLbGlobal(), SCIPcomputeVarUbGlobal(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPcreateConsQuadratic2(), SCIPcreateConsSOC(), SCIPcreateVar(), SCIPcreateVarBasic(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPfindConshdlr(), SCIPfindQuadVarTermQuadratic(), SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPgetBilinTermsQuadratic(), SCIPgetCoefsLinearVarsQuadratic(), SCIPgetLhsQuadratic(), SCIPgetLinearVarsQuadratic(), SCIPgetNBilinTermsQuadratic(), SCIPgetNLinearVarsQuadratic(), SCIPgetNQuadVarTermsQuadratic(), SCIPgetQuadVarTermsQuadratic(), SCIPgetRhsQuadratic(), SCIPinfinity(), SCIPisEQ(), SCIPisGE(), SCIPisGT(), SCIPisInfinity(), SCIPisIpoptAvailableIpopt(), SCIPisLE(), SCIPisLT(), SCIPisNegative(), SCIPisZero(), SCIPmarkDoNotMultaggrVar(), SCIPmultiaggregateVar(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), SCIPsortQuadVarTermsQuadratic(), SCIPvarGetLbGlobal(), SCIP_QuadVarTerm::sqrcoef, sqrt(), TRUE, UPGSCALE, SCIP_QuadVarTerm::var, SCIP_BilinTerm::var1, and SCIP_BilinTerm::var2.

Referenced by polishSolution().

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopySOC  )
static

copy method for constraint handler plugins (called when SCIP copies plugins)

Definition at line 3761 of file cons_soc.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_DECL_CONSFREE(), SCIP_OKAY, SCIPconshdlrGetName(), SCIPincludeConshdlrSOC(), and TRUE.

Referenced by SCIP_DECL_QUADCONSUPGD().

static SCIP_DECL_CONSFREE ( consFreeSOC  )
static

destructor of constraint handler to free constraint handler data (called when SCIP is exiting)

Definition at line 3777 of file cons_soc.c.

References CONSHDLR_NAME, NULL, SCIP_DECL_CONSINIT(), SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), and SCIPfreeBlockMemory.

Referenced by SCIP_DECL_CONSHDLRCOPY().

static SCIP_DECL_CONSINIT ( consInitSOC  )
static

initialization method of constraint handler (called after problem was transformed)

Definition at line 3796 of file cons_soc.c.

References NULL, SCIP_DECL_CONSEXIT(), SCIP_OKAY, SCIPconshdlrGetData(), SCIPexprintGetName(), and SCIPfindHeur().

Referenced by SCIP_DECL_CONSFREE().

static SCIP_DECL_CONSEXIT ( consExitSOC  )
static

deinitialization method of constraint handler (called before transformed problem is freed)

Definition at line 3816 of file cons_soc.c.

References FALSE, NULL, SCIP_DECL_CONSEXITPRE(), SCIP_OKAY, and SCIPconshdlrGetData().

Referenced by SCIP_DECL_CONSINIT().

static SCIP_DECL_CONSEXITPRE ( consExitpreSOC  )
static

presolving deinitialization method of constraint handler (called after presolving has been finished)

Definition at line 3835 of file cons_soc.c.

References NULL, SCIP_DECL_CONSINITSOL(), SCIP_OKAY, SCIPconsIsAdded(), and SCIPenableNLP().

Referenced by SCIP_DECL_CONSEXIT().

static SCIP_DECL_CONSINITSOL ( consInitsolSOC  )
static

solving process initialization method of constraint handler (called when branch and bound process is about to begin)

Definition at line 3859 of file cons_soc.c.

References VarEventData::consdata, CONSHDLR_NAME, createNlRow(), FALSE, NULL, SCIP_CALL, SCIP_DECL_CONSEXITSOL(), SCIP_EVENTTYPE_SOLFOUND, SCIP_OKAY, SCIPaddNlRow(), SCIPcatchEvent(), SCIPconsGetData(), SCIPconshdlrGetData(), SCIPconsIsEnabled(), SCIPfindEventhdlr(), and SCIPisNLPConstructed().

Referenced by SCIP_DECL_CONSEXITPRE().

static SCIP_DECL_CONSEXITSOL ( consExitsolSOC  )
static

solving process deinitialization method of constraint handler (called before branch and bound process data is freed)

Definition at line 3914 of file cons_soc.c.

References VarEventData::consdata, CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_DECL_CONSDELETE(), SCIP_EVENTTYPE_SOLFOUND, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPdropEvent(), SCIPfindEventhdlr(), and SCIPreleaseNlRow().

Referenced by SCIP_DECL_CONSINITSOL().

static SCIP_DECL_CONSSEPASOL ( consSepasolSOC  )
static

separation method of constraint handler for arbitrary primal solutions

Definition at line 4202 of file cons_soc.c.

References computeViolations(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DECL_CONSENFOLP(), SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SEPARATED, and separatePoint().

Referenced by SCIP_DECL_CONSSEPALP().

static SCIP_DECL_CONSENFOPS ( consEnfopsSOC  )
static

constraint enforcing method of constraint handler for pseudo solutions

Definition at line 4327 of file cons_soc.c.

References computeViolations(), NULL, SCIP_CALL, SCIP_DECL_CONSCHECK(), SCIP_FEASIBLE, SCIP_INFEASIBLE, and SCIP_OKAY.

Referenced by SCIP_DECL_CONSENFOLP().

static SCIP_DECL_CONSPROP ( consPropSOC  )
static

domain propagation method of constraint handler

Definition at line 4462 of file cons_soc.c.

References NULL, propagateBounds(), SCIP_CALL, SCIP_CUTOFF, SCIP_DECL_CONSPRESOL(), SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, and SCIP_OKAY.

Referenced by SCIP_DECL_CONSCHECK().

static SCIP_DECL_CONSLOCK ( consLockSOC  )
static

variable rounding lock method of constraint handler

Definition at line 4559 of file cons_soc.c.

References VarEventData::consdata, CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_DECL_CONSPRINT(), SCIP_OKAY, SCIPaddVarLocks(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), and SCIPdebugMessage.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_DECL_CONSPRINT ( consPrintSOC  )
static

constraint display method of constraint handler

Definition at line 4590 of file cons_soc.c.

References VarEventData::consdata, CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_DECL_CONSCOPY(), SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetName(), SCIPinfoMessage(), SCIPwriteVarName(), and TRUE.

Referenced by SCIP_DECL_CONSLOCK().

static SCIP_DECL_CONSCOPY ( consCopySOC  )
static
static SCIP_DECL_CONSPARSE ( consParseSOC  )
static
static SCIP_DECL_CONSGETVARS ( consGetVarsSOC  )
static

constraint method of constraint handler which returns the variables (if possible)

Definition at line 4908 of file cons_soc.c.

References BMScopyMemoryArray, VarEventData::consdata, FALSE, NULL, SCIP_DECL_CONSGETNVARS(), SCIP_OKAY, SCIPconsGetData(), and TRUE.

Referenced by SCIP_DECL_CONSPARSE().

static SCIP_DECL_CONSGETNVARS ( consGetNVarsSOC  )
static

constraint method of constraint handler which returns the number of variable (if possible)

Definition at line 4929 of file cons_soc.c.

References VarEventData::consdata, NULL, SCIP_OKAY, SCIPconsGetData(), SCIPincludeConshdlrSOC(), and TRUE.

Referenced by SCIP_DECL_CONSGETVARS().

SCIP_RETCODE SCIPcreateConsSOC ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nvars,
SCIP_VAR **  vars,
SCIP_Real coefs,
SCIP_Real offsets,
SCIP_Real  constant,
SCIP_VAR rhsvar,
SCIP_Real  rhscoeff,
SCIP_Real  rhsoffset,
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 
)

creates and captures a second order cone constraint

Note
the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
nvarsnumber of variables on left hand side of constraint (n)
varsarray with variables on left hand side (x_i)
coefsarray with coefficients of left hand side variables (alpha_i), or NULL if all 1.0
offsetsarray with offsets of variables (beta_i), or NULL if all 0.0
constantconstant on left hand side (gamma)
rhsvarvariable on right hand side of constraint (x_{n+1})
rhscoeffcoefficient of variable on right hand side (alpha_{n+1})
rhsoffsetoffset of variable on right hand side (beta_{n+1})
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'.
separateshould the constraint be separated during LP processing? Usually set to TRUE.
enforceshould the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints.
checkshould the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints.
propagateshould the constraint be propagated during node processing? Usually set to TRUE.
localis constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints.
modifiableis constraint modifiable (subject to column generation)? Usually set to FALSE. In column generation applications, set to TRUE if pricing adds coefficients to this constraint.
dynamicis constraint subject to aging? Usually set to FALSE. Set to TRUE for own cuts which are separated as constraints.
removableshould the relaxation be removed from the LP due to aging or cleanup? Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'.

Definition at line 5063 of file cons_soc.c.

References BMSclearMemoryArray, catchVarEvents(), VarEventData::consdata, CONSHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPcaptureVar(), SCIPcomputeVarLbGlobal(), SCIPcomputeVarLbLocal(), SCIPcomputeVarUbGlobal(), SCIPcomputeVarUbLocal(), SCIPconshdlrGetData(), SCIPcreateCons(), SCIPcreateConsBasicSOC(), SCIPduplicateBlockMemoryArray, SCIPerrorMessage, SCIPfindConshdlr(), SCIPisGE(), SCIPisInfinity(), SCIPisLE(), and SCIPisTransformed().

Referenced by SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSPARSE(), SCIP_DECL_QUADCONSUPGD(), SCIPcreateConsBasicSOC(), and SCIPincludeConshdlrSOC().

SCIP_RETCODE SCIPcreateConsBasicSOC ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nvars,
SCIP_VAR **  vars,
SCIP_Real coefs,
SCIP_Real offsets,
SCIP_Real  constant,
SCIP_VAR rhsvar,
SCIP_Real  rhscoeff,
SCIP_Real  rhsoffset 
)

creates and captures a second order cone constraint with all its constraint flags set to their default values

Note
the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
nvarsnumber of variables on left hand side of constraint (n)
varsarray with variables on left hand side (x_i)
coefsarray with coefficients of left hand side variables (alpha_i), or NULL if all 1.0
offsetsarray with offsets of variables (beta_i), or NULL if all 0.0
constantconstant on left hand side (gamma)
rhsvarvariable on right hand side of constraint (x_{n+1})
rhscoeffcoefficient of variable on right hand side (alpha_{n+1})
rhsoffsetoffset of variable on right hand side (beta_{n+1})

Definition at line 5191 of file cons_soc.c.

References FALSE, SCIP_CALL, SCIP_OKAY, SCIPcreateConsSOC(), SCIPgetNlRowSOC(), and TRUE.

Referenced by SCIPcreateConsSOC().

SCIP_RETCODE SCIPgetNlRowSOC ( SCIP scip,
SCIP_CONS cons,
SCIP_NLROW **  nlrow 
)

Gets the SOC constraint as a nonlinear row representation.

Parameters
scipSCIP data structure
consconstraint
nlrowpointer to store nonlinear row

Definition at line 5214 of file cons_soc.c.

References VarEventData::consdata, createNlRow(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetHdlr(), and SCIPgetNLhsVarsSOC().

Referenced by createCoveringProblem(), and SCIPcreateConsBasicSOC().

int SCIPgetNLhsVarsSOC ( SCIP scip,
SCIP_CONS cons 
)

Gets the number of variables on the left hand side of a SOC constraint.

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5240 of file cons_soc.c.

References NULL, SCIPconsGetData(), and SCIPgetLhsVarsSOC().

Referenced by createCoveringProblem(), printSOCCons(), SCIP_DECL_READERWRITE(), SCIPgetNlRowSOC(), SCIPwriteGms(), and SCIPwriteLp().

SCIP_VAR** SCIPgetLhsVarsSOC ( SCIP scip,
SCIP_CONS cons 
)

Gets the variables on the left hand side of a SOC constraint.

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5253 of file cons_soc.c.

References NULL, SCIP_Real, SCIPconsGetData(), and SCIPgetLhsCoefsSOC().

Referenced by createCoveringProblem(), printSOCCons(), SCIP_DECL_READERWRITE(), SCIPgetNLhsVarsSOC(), SCIPwriteGms(), and SCIPwriteLp().

SCIP_Real* SCIPgetLhsCoefsSOC ( SCIP scip,
SCIP_CONS cons 
)

Gets the coefficients of the variables on the left hand side of a SOC constraint, or NULL if all are equal to 1.0.

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5266 of file cons_soc.c.

References NULL, SCIP_Real, SCIPconsGetData(), and SCIPgetLhsOffsetsSOC().

Referenced by createCoveringProblem(), printSOCCons(), SCIP_DECL_READERWRITE(), SCIPgetLhsVarsSOC(), and SCIPwriteGms().

SCIP_Real* SCIPgetLhsOffsetsSOC ( SCIP scip,
SCIP_CONS cons 
)

Gets the offsets of the variables on the left hand side of a SOC constraint, or NULL if all are equal to 0.0.

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5279 of file cons_soc.c.

References NULL, SCIP_Real, SCIPconsGetData(), and SCIPgetLhsConstantSOC().

Referenced by printSOCCons(), SCIP_DECL_READERWRITE(), SCIPgetLhsCoefsSOC(), and SCIPwriteGms().

SCIP_Real SCIPgetLhsConstantSOC ( SCIP scip,
SCIP_CONS cons 
)

Gets the constant on the left hand side of a SOC constraint.

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5292 of file cons_soc.c.

References NULL, SCIPconsGetData(), and SCIPgetRhsVarSOC().

Referenced by printSOCCons(), SCIP_DECL_READERWRITE(), SCIPgetLhsOffsetsSOC(), and SCIPwriteGms().

SCIP_VAR* SCIPgetRhsVarSOC ( SCIP scip,
SCIP_CONS cons 
)

Gets the variable on the right hand side of a SOC constraint.

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5305 of file cons_soc.c.

References NULL, SCIP_Real, SCIPconsGetData(), and SCIPgetRhsCoefSOC().

Referenced by createCoveringProblem(), printSOCCons(), SCIP_DECL_READERWRITE(), SCIPgetLhsConstantSOC(), SCIPwriteGms(), and SCIPwriteLp().

SCIP_Real SCIPgetRhsCoefSOC ( SCIP scip,
SCIP_CONS cons 
)

Gets the coefficient of the variable on the right hand side of a SOC constraint.

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5318 of file cons_soc.c.

References NULL, SCIP_Real, SCIPconsGetData(), and SCIPgetRhsOffsetSOC().

Referenced by createCoveringProblem(), printSOCCons(), SCIP_DECL_READERWRITE(), SCIPgetRhsVarSOC(), and SCIPwriteGms().

SCIP_Real SCIPgetRhsOffsetSOC ( SCIP scip,
SCIP_CONS cons 
)

Gets the offset of the variables on the right hand side of a SOC constraint.

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5331 of file cons_soc.c.

References NULL, SCIPaddToNlpiProblemSOC(), and SCIPconsGetData().

Referenced by printSOCCons(), SCIP_DECL_READERWRITE(), SCIPgetRhsCoefSOC(), and SCIPwriteGms().

SCIP_RETCODE SCIPaddToNlpiProblemSOC ( SCIP scip,
SCIP_CONS cons,
SCIP_NLPI nlpi,
SCIP_NLPIPROBLEM nlpiprob,
SCIP_HASHMAP scipvar2nlpivar,
SCIP_Bool  names 
)

Adds the constraint to an NLPI problem. Uses nonconvex formulation as quadratic function.

Parameters
scipSCIP data structure
consSOC constraint
nlpiinterface to NLP solver
nlpiprobNLPI problem where to add constraint
scipvar2nlpivarmapping from SCIP variables to variable indices in NLPI
nameswhether to pass constraint names to NLPI

Definition at line 5345 of file cons_soc.c.

References SCIP_QuadElement::coef, VarEventData::consdata, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPhashmapGetImage(), SCIPinfinity(), and SCIPnlpiAddConstraints().

Referenced by SCIPgetRhsOffsetSOC().