Scippy

SCIP

Solving Constraint Integer Programs

cons_quadratic.c File Reference

Detailed Description

constraint handler for quadratic constraints $\textrm{lhs} \leq \sum_{i,j=1}^n a_{i,j} x_ix_j + \sum_{i=1}^n b_i x_i \leq \textrm{rhs}$

Author
Stefan Vigerske

Definition in file cons_quadratic.c.

#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "scip/cons_nonlinear.h"
#include "scip/cons_quadratic.h"
#include "scip/cons_linear.h"
#include "scip/cons_and.h"
#include "scip/cons_varbound.h"
#include "scip/intervalarith.h"
#include "scip/heur_subnlp.h"
#include "scip/heur_trysol.h"
#include "scip/debug.h"
#include "nlpi/nlpi.h"
#include "nlpi/nlpi_ipopt.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "quadratic"
 
#define CONSHDLR_DESC   "quadratic constraints of the form lhs <= b' x + x' A x <= rhs"
 
#define CONSHDLR_SEPAPRIORITY   10
 
#define CONSHDLR_ENFOPRIORITY   -50
 
#define CONSHDLR_CHECKPRIORITY   -4000000
 
#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_DELAYPRESOL   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP
 
#define MAXDNOM   10000LL
 
#define NONLINCONSUPGD_PRIORITY   40000
 
#define INITLPMAXVARVAL   1000.0
 
#define PROPBILINNEW
 
#define infty2infty(infty1, infty2, val)   ((val) >= (infty1) ? (infty2) : (val))
 

Typedefs

typedef struct SCIP_QuadConsUpgrade SCIP_QUADCONSUPGRADE
 

Functions

static SCIP_Bool conshdlrdataHasUpgrade (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_DECL_QUADCONSUPGD((*quadconsupgd)), const char *conshdlrname)
 
static SCIP_RETCODE catchLinearVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int linvarpos)
 
static SCIP_RETCODE dropLinearVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int linvarpos)
 
static SCIP_RETCODE catchQuadVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int quadvarpos)
 
static SCIP_RETCODE dropQuadVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int quadvarpos)
 
static SCIP_RETCODE catchVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE dropVarEvents (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE lockLinearVariable (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
 
static SCIP_RETCODE unlockLinearVariable (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
 
static SCIP_RETCODE lockQuadraticVariable (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
 
static SCIP_RETCODE unlockQuadraticVariable (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
 
static void consdataUpdateLinearActivity (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real intervalinfty)
 
static void consdataUpdateLinearActivityLbChange (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real coef, SCIP_Real oldbnd, SCIP_Real newbnd)
 
static void consdataUpdateLinearActivityUbChange (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real coef, SCIP_Real oldbnd, SCIP_Real newbnd)
 
static SCIP_DECL_EVENTEXEC (processVarEvent)
 
static SCIP_RETCODE consdataEnsureLinearVarsSize (SCIP *scip, SCIP_CONSDATA *consdata, int num)
 
static SCIP_RETCODE consdataEnsureQuadVarTermsSize (SCIP *scip, SCIP_CONSDATA *consdata, int num)
 
static SCIP_RETCODE consdataEnsureAdjBilinSize (SCIP *scip, SCIP_QUADVARTERM *quadvarterm, int num)
 
static SCIP_RETCODE consdataEnsureBilinSize (SCIP *scip, SCIP_CONSDATA *consdata, int num)
 
static SCIP_RETCODE consdataCreateEmpty (SCIP *scip, SCIP_CONSDATA **consdata)
 
static SCIP_RETCODE consdataCreate (SCIP *scip, SCIP_CONSDATA **consdata, SCIP_Real lhs, SCIP_Real rhs, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvars, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, SCIP_Bool capturevars)
 
static SCIP_RETCODE consdataFree (SCIP *scip, SCIP_CONSDATA **consdata)
 
static void consdataSortLinearVars (SCIP_CONSDATA *consdata)
 
static SCIP_DECL_SORTINDCOMP (quadVarTermComp)
 
static SCIP_RETCODE consdataSortQuadVarTerms (SCIP *scip, SCIP_CONSDATA *consdata)
 
static SCIP_RETCODE consdataFindQuadVarTerm (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_VAR *var, int *pos)
 
static SCIP_DECL_SORTINDCOMP (bilinTermComp)
 
static SCIP_RETCODE consdataSortBilinTerms (SCIP *scip, SCIP_CONSDATA *consdata)
 
static void consdataMoveLinearVar (SCIP_CONSDATA *consdata, int oldpos, int newpos)
 
static void consdataMoveQuadVarTerm (SCIP_CONSDATA *consdata, int oldpos, int newpos)
 
static SCIP_RETCODE addLinearCoef (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
 
static SCIP_RETCODE delLinearCoefPos (SCIP *scip, SCIP_CONS *cons, int pos)
 
static SCIP_RETCODE chgLinearCoefPos (SCIP *scip, SCIP_CONS *cons, int pos, SCIP_Real newcoef)
 
static SCIP_RETCODE addQuadVarTerm (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real lincoef, SCIP_Real sqrcoef, SCIP_Bool catchevents)
 
static SCIP_RETCODE delQuadVarTermPos (SCIP *scip, SCIP_CONS *cons, int pos)
 
static SCIP_RETCODE replaceQuadVarTermPos (SCIP *scip, SCIP_CONS *cons, int pos, SCIP_VAR *var, SCIP_Real coef, SCIP_Real offset)
 
static SCIP_RETCODE addBilinearTerm (SCIP *scip, SCIP_CONS *cons, int var1pos, int var2pos, SCIP_Real coef)
 
static SCIP_RETCODE removeBilinearTermsPos (SCIP *scip, SCIP_CONS *cons, int nterms, int *termposs)
 
static SCIP_RETCODE mergeAndCleanQuadVarTerms (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE mergeAndCleanLinearVars (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE mergeAndCleanBilinearTerms (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE removeFixedVariables (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE createNlRow (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE presolveSolve (SCIP *scip, SCIP_CONS *cons, SCIP_RESULT *result, SCIP_Bool *redundant, int *naggrvars)
 
static SCIP_RETCODE presolveTryAddAND (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, int *naddconss)
 
static void getImpliedBounds (SCIP_VAR *x, SCIP_Bool xval, SCIP_VAR *y, SCIP_INTERVAL *resultant)
 
static SCIP_RETCODE presolveTryAddLinearReform (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, int *naddconss)
 
static SCIP_RETCODE presolveUpgrade (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Bool *upgraded, int *nupgdconss, int *naddconss)
 
static SCIP_RETCODE presolveDisaggregateMarkComponent (SCIP *scip, SCIP_CONSDATA *consdata, int quadvaridx, SCIP_HASHMAP *var2component, int componentnr)
 
static SCIP_RETCODE presolveDisaggregate (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, int *naddconss)
 
static void checkCurvatureEasy (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *determined, SCIP_Bool checkmultivariate)
 
static SCIP_RETCODE checkCurvature (SCIP *scip, SCIP_CONS *cons, SCIP_Bool checkmultivariate)
 
static SCIP_RETCODE checkFactorable (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_Real getGradientMaxElement (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 **maxviolcon)
 
static void generateCutFactorableDo (SCIP *scip, SCIP_CONS *cons, SCIP_Real *ref, SCIP_Real multleft, SCIP_Real *coefleft, SCIP_Real multright, SCIP_Real *coefright, SCIP_Real rightminactivity, SCIP_Real rightmaxactivity, SCIP_Real rhs, SCIP_Real *cutcoef, SCIP_Real *cutrhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
 
static SCIP_RETCODE generateCutFactorable (SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_Real *cutcoef, SCIP_Real *cutlhs, SCIP_Real *cutrhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
 
static SCIP_Bool generateCutLTIfindIntersection (SCIP *scip, SCIP_Real x0, SCIP_Real y0_, SCIP_Real x1, SCIP_Real y1_, SCIP_Real wl, SCIP_Real wu, SCIP_Real *xl, SCIP_Real *yl, SCIP_Real *xu, SCIP_Real *yu)
 
static SCIP_Bool generateCutLTIgenMulCoeff (SCIP *scip, SCIP_Real x1, SCIP_Real y1_, SCIP_Real x2, SCIP_Real y2, SCIP_Bool whichuse, SCIP_Real *cx, SCIP_Real *cy, SCIP_Real *cw)
 
static void generateCutLTIcomputeCoefs (SCIP *scip, SCIP_Real xl, SCIP_Real xu, SCIP_Real x0, SCIP_Real yl, SCIP_Real yu, SCIP_Real y0_, SCIP_Real wl, SCIP_Real wu, SCIP_Real w0, SCIP_Real *cx, SCIP_Real *cy, SCIP_Real *cw, SCIP_Real *c0, SCIP_Bool *success)
 
static SCIP_RETCODE generateCutLTI (SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_SOL *sol, SCIP_Real **cutcoeflin, SCIP_Real *cutcoefquad, SCIP_Real *cutlhs, SCIP_Real *cutrhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
 
static void addSquareLinearization (SCIP *scip, SCIP_Real sqrcoef, SCIP_Real refpoint, SCIP_Bool isint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
 
static void addSquareSecant (SCIP *scip, SCIP_Real sqrcoef, SCIP_Real lb, SCIP_Real ub, SCIP_Real refpoint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
 
static void addBilinLinearization (SCIP *scip, SCIP_Real bilincoef, SCIP_Real refpointx, SCIP_Real refpointy, SCIP_Real *lincoefx, SCIP_Real *lincoefy, SCIP_Real *linconstant, SCIP_Bool *success)
 
static void addBilinMcCormick (SCIP *scip, SCIP_Real bilincoef, SCIP_Real lbx, SCIP_Real ubx, SCIP_Real refpointx, SCIP_Real lby, SCIP_Real uby, SCIP_Real refpointy, SCIP_Bool overestimate, SCIP_Real *lincoefx, SCIP_Real *lincoefy, SCIP_Real *linconstant, SCIP_Bool *success)
 
static SCIP_RETCODE generateCutConvex (SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_Real *coef, SCIP_Real *lhs, SCIP_Real *rhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
 
static SCIP_RETCODE generateCutNonConvex (SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_Real *coef, SCIP_Real *lhs, SCIP_Real *rhs, SCIP_Bool *islocal, SCIP_Bool *success, char *name)
 
static SCIP_RETCODE generateCut (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Real *ref, SCIP_SOL *sol, SCIP_SIDETYPE violside, SCIP_ROW **row, SCIP_Real *efficacy, SCIP_Bool checkcurvmultivar, SCIP_Real minefficacy)
 
static SCIP_RETCODE generateCutSol (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_SOL *refsol, SCIP_SIDETYPE violside, SCIP_ROW **row, SCIP_Real *efficacy, SCIP_Bool checkcurvmultivar, SCIP_Real minefficacy)
 
static SCIP_RETCODE generateCutUnboundedLP (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_ROW **row, SCIP_Real *rowrayprod, SCIP_Bool checkcurvmultivar)
 
static SCIP_RETCODE separatePoint (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_Real minefficacy, SCIP_Bool inenforcement, SCIP_RESULT *result, SCIP_Real *bestefficacy)
 
static SCIP_RETCODE addLinearizationCuts (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *ref, SCIP_Bool *separatedlpsol, SCIP_Real minefficacy)
 
static SCIP_DECL_EVENTEXEC (processNewSolutionEvent)
 
static SCIP_RETCODE registerVariableInfeasibilities (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int *nnotify)
 
static SCIP_RETCODE registerLargeLPValueVariableForBranching (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_VAR **brvar)
 
static SCIP_RETCODE replaceByLinearConstraints (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool *addedcons, SCIP_Bool *reduceddom, SCIP_Bool *infeasible)
 
static SCIP_RETCODE propagateBoundsTightenVarLb (SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *var, SCIP_Real bnd, SCIP_RESULT *result, int *nchgbds)
 
static SCIP_RETCODE propagateBoundsTightenVarUb (SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *var, SCIP_Real bnd, SCIP_RESULT *result, int *nchgbds)
 
static SCIP_RETCODE propagateBoundsQuadVar (SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *var, SCIP_Real a, SCIP_INTERVAL b, SCIP_INTERVAL rhs, SCIP_RESULT *result, int *nchgbds)
 
static SCIP_RETCODE propagateBoundsBilinearTerm (SCIP *scip, SCIP_CONS *cons, SCIP_Real intervalinfty, SCIP_VAR *x, SCIP_Real xsqrcoef, SCIP_Real xlincoef, SCIP_VAR *y, SCIP_Real ysqrcoef, SCIP_Real ylincoef, SCIP_Real bilincoef, SCIP_INTERVAL rhs, SCIP_RESULT *result, int *nchgbds)
 
static void propagateBoundsGetQuadActivity (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_Real intervalinfty, SCIP_Real *minquadactivity, SCIP_Real *maxquadactivity, int *minactivityinf, int *maxactivityinf, SCIP_INTERVAL *quadactcontr)
 
static SCIP_RETCODE propagateBoundsCons (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_RESULT *result, int *nchgbds, SCIP_Bool *redundant)
 
static SCIP_RETCODE propagateBounds (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_RESULT *result, int *nchgbds)
 
static void consdataFindUnlockedLinearVar (SCIP *scip, SCIP_CONSDATA *consdata)
 
static SCIP_RETCODE proposeFeasibleSolution (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_Bool *success)
 
static SCIP_DECL_NONLINCONSUPGD (nonlinconsUpgdQuadratic)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyQuadratic)
 
static SCIP_DECL_CONSFREE (consFreeQuadratic)
 
static SCIP_DECL_CONSINIT (consInitQuadratic)
 
static SCIP_DECL_CONSEXIT (consExitQuadratic)
 
static SCIP_DECL_CONSEXITPRE (consExitpreQuadratic)
 
static SCIP_DECL_CONSINITSOL (consInitsolQuadratic)
 
static SCIP_DECL_CONSEXITSOL (consExitsolQuadratic)
 
static SCIP_DECL_CONSDELETE (consDeleteQuadratic)
 
static SCIP_DECL_CONSTRANS (consTransQuadratic)
 
static SCIP_DECL_CONSINITLP (consInitlpQuadratic)
 
static SCIP_DECL_CONSSEPALP (consSepalpQuadratic)
 
static SCIP_DECL_CONSSEPASOL (consSepasolQuadratic)
 
static SCIP_DECL_CONSENFOLP (consEnfolpQuadratic)
 
static SCIP_DECL_CONSENFOPS (consEnfopsQuadratic)
 
static SCIP_DECL_CONSPROP (consPropQuadratic)
 
static SCIP_DECL_CONSPRESOL (consPresolQuadratic)
 
static SCIP_DECL_CONSLOCK (consLockQuadratic)
 
static SCIP_DECL_CONSPRINT (consPrintQuadratic)
 
static SCIP_DECL_CONSCHECK (consCheckQuadratic)
 
static SCIP_DECL_CONSCOPY (consCopyQuadratic)
 
static SCIP_DECL_CONSPARSE (consParseQuadratic)
 
static SCIP_DECL_CONSGETVARS (consGetVarsQuadratic)
 
static SCIP_DECL_CONSGETNVARS (consGetNVarsQuadratic)
 
SCIP_RETCODE SCIPincludeConshdlrQuadratic (SCIP *scip)
 
SCIP_RETCODE SCIPincludeQuadconsUpgrade (SCIP *scip, SCIP_DECL_QUADCONSUPGD((*quadconsupgd)), int priority, SCIP_Bool active, const char *conshdlrname)
 
SCIP_RETCODE SCIPcreateConsQuadratic (SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, 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_RETCODE SCIPcreateConsBasicQuadratic (SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, SCIP_Real lhs, SCIP_Real rhs)
 
SCIP_RETCODE SCIPcreateConsQuadratic2 (SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvarterms, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, 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_RETCODE SCIPcreateConsBasicQuadratic2 (SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvarterms, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, SCIP_Real lhs, SCIP_Real rhs)
 
void SCIPaddConstantQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_Real constant)
 
SCIP_RETCODE SCIPaddLinearVarQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
 
SCIP_RETCODE SCIPaddQuadVarQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real lincoef, SCIP_Real sqrcoef)
 
SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
 
SCIP_RETCODE SCIPaddSquareCoefQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
 
SCIP_RETCODE SCIPaddBilinTermQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
 
SCIP_RETCODE SCIPgetNlRowQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
 
int SCIPgetNLinearVarsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_VAR ** SCIPgetLinearVarsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RealSCIPgetCoefsLinearVarsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
int SCIPgetNQuadVarTermsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_QUADVARTERMSCIPgetQuadVarTermsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPsortQuadVarTermsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPfindQuadVarTermQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, int *pos)
 
int SCIPgetNBilinTermsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_BILINTERMSCIPgetBilinTermsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Real SCIPgetLhsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Real SCIPgetRhsQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPcheckCurvatureQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Bool SCIPisConvexQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Bool SCIPisConcaveQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPgetViolationQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *violation)
 
SCIP_Bool SCIPisLinearLocalQuadratic (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPaddToNlpiProblemQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *nlpiprob, SCIP_HASHMAP *scipvar2nlpivar, SCIP_Bool names)
 

Macro Definition Documentation

#define CONSHDLR_DESC   "quadratic constraints of the form lhs <= b' x + x' A x <= rhs"

Definition at line 53 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_SEPAPRIORITY   10

priority of the constraint handler for separation

Definition at line 54 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_ENFOPRIORITY   -50

priority of the constraint handler for constraint enforcing

Definition at line 55 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_CHECKPRIORITY   -4000000

priority of the constraint handler for checking feasibility

Definition at line 56 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_SEPAFREQ   1

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

Definition at line 57 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_PROPFREQ   1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 58 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#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 59 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_MAXPREROUNDS   -1

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

Definition at line 61 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_DELAYSEPA   FALSE

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

Definition at line 62 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_DELAYPROP   FALSE

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

Definition at line 63 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_DELAYPRESOL   FALSE

should presolving method be delayed, if other presolvers found reductions?

Definition at line 64 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 65 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

Definition at line 67 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define MAXDNOM   10000LL

maximal denominator for simple rational fixed values

Definition at line 69 of file cons_quadratic.c.

Referenced by presolveTryAddLinearReform().

#define NONLINCONSUPGD_PRIORITY   40000

priority of upgrading nonlinear constraints

Definition at line 70 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

#define INITLPMAXVARVAL   1000.0

maximal absolute value of variable for still generating a linearization cut at that point in initlp

Definition at line 71 of file cons_quadratic.c.

Referenced by SCIP_DECL_CONSINITLP().

#define PROPBILINNEW

Definition at line 81 of file cons_quadratic.c.

#define infty2infty (   infty1,
  infty2,
  val 
)    ((val) >= (infty1) ? (infty2) : (val))

translate from one value of infinity to another

if val is >= infty1, then give infty2, else give val

Definition at line 244 of file cons_quadratic.c.

Referenced by propagateBoundsBilinearTerm(), propagateBoundsCons(), and propagateBoundsGetQuadActivity().

Typedef Documentation

quadratic constraint update method

Definition at line 163 of file cons_quadratic.c.

Function Documentation

static SCIP_Bool conshdlrdataHasUpgrade ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_DECL_QUADCONSUPGD((*quadconsupgd))  ,
const char *  conshdlrname 
)
static

checks whether a quadratic constraint upgrade method has already be registered

Parameters
scipSCIP data structure
conshdlrdataconstraint handler data
conshdlrnamename of the constraint handler

Definition at line 210 of file cons_quadratic.c.

References FALSE, NULL, SCIPwarningMessage(), and TRUE.

Referenced by SCIPincludeQuadconsUpgrade().

static SCIP_RETCODE catchLinearVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  linvarpos 
)
static
Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
linvarposposition of variable in linear variables array

Definition at line 248 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_LBCHANGED, SCIP_EVENTTYPE_UBCHANGED, SCIP_EVENTTYPE_VARFIXED, SCIP_OKAY, SCIPallocBlockMemory, SCIPcatchVarEvent(), SCIPconsGetData(), and SCIPisInfinity().

Referenced by addLinearCoef(), catchVarEvents(), and chgLinearCoefPos().

static SCIP_RETCODE dropLinearVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  linvarpos 
)
static
Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
linvarposposition of variable in linear variables array

Definition at line 304 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_LBCHANGED, SCIP_EVENTTYPE_UBCHANGED, SCIP_EVENTTYPE_VARFIXED, SCIP_OKAY, SCIPconsGetData(), SCIPdropVarEvent(), SCIPfreeBlockMemory, and SCIPisInfinity().

Referenced by chgLinearCoefPos(), delLinearCoefPos(), and dropVarEvents().

static SCIP_RETCODE catchQuadVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  quadvarpos 
)
static
Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
quadvarposposition of variable in quadratic variables array

Definition at line 358 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_EVENTTYPE_IMPLADDED, SCIP_EVENTTYPE_VARFIXED, SCIP_OKAY, SCIPallocBlockMemory, SCIPcatchVarEvent(), and SCIPconsGetData().

Referenced by addQuadVarTerm(), catchVarEvents(), and replaceQuadVarTermPos().

static SCIP_RETCODE dropQuadVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  quadvarpos 
)
static
Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
quadvarposposition of variable in quadratic variables array

Definition at line 397 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_EVENTTYPE_IMPLADDED, SCIP_EVENTTYPE_VARFIXED, SCIP_OKAY, SCIPconsGetData(), SCIPdropVarEvent(), and SCIPfreeBlockMemory.

Referenced by delQuadVarTermPos(), dropVarEvents(), and replaceQuadVarTermPos().

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

catch variable events

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

Definition at line 435 of file cons_quadratic.c.

References catchLinearVarEvents(), catchQuadVarEvents(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPconsGetData(), SCIPvarIsActive(), and TRUE.

Referenced by SCIP_DECL_CONSINIT(), SCIPcreateConsQuadratic(), and SCIPcreateConsQuadratic2().

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 drop bound change events

Definition at line 479 of file cons_quadratic.c.

References dropLinearVarEvents(), dropQuadVarEvents(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), and SCIPfreeBlockMemoryArray.

Referenced by presolveUpgrade(), SCIP_DECL_CONSDELETE(), SCIP_DECL_CONSEXIT(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE lockLinearVariable ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var,
SCIP_Real  coef 
)
static

locks a linear variable in a constraint

Parameters
scipSCIP data structure
consconstraint where to lock a variable
varvariable to lock
coefcoefficient of variable in constraint

Definition at line 520 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPisInfinity(), and SCIPlockVarCons().

Referenced by addLinearCoef(), and chgLinearCoefPos().

static SCIP_RETCODE unlockLinearVariable ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var,
SCIP_Real  coef 
)
static

unlocks a linear variable in a constraint

Parameters
scipSCIP data structure
consconstraint where to unlock a variable
varvariable to unlock
coefcoefficient of variable in constraint

Definition at line 551 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPisInfinity(), and SCIPunlockVarCons().

Referenced by chgLinearCoefPos(), and delLinearCoefPos().

static SCIP_RETCODE lockQuadraticVariable ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var 
)
static

locks a quadratic variable in a constraint

Parameters
scipSCIP data structure
consconstraint where to lock a variable
varvariable to lock

Definition at line 582 of file cons_quadratic.c.

References SCIP_CALL, SCIP_OKAY, SCIPlockVarCons(), and TRUE.

Referenced by addQuadVarTerm(), and replaceQuadVarTermPos().

static SCIP_RETCODE unlockQuadraticVariable ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var 
)
static

unlocks a quadratic variable in a constraint

Parameters
scipSCIP data structure
consconstraint where to unlock a variable
varvariable to unlock

Definition at line 595 of file cons_quadratic.c.

References SCIP_CALL, SCIP_OKAY, SCIPunlockVarCons(), and TRUE.

Referenced by delQuadVarTermPos(), and replaceQuadVarTermPos().

static void consdataUpdateLinearActivity ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_Real  intervalinfty 
)
static

computes the minimal and maximal activity for the linear part in a constraint data only sums up terms that contribute finite values gives the number of terms that contribute infinite values only computes those activities where the corresponding side of the constraint is finite

Parameters
scipSCIP data structure
consdataconstraint data
intervalinftyinfinity value used in interval operations

Definition at line 612 of file cons_quadratic.c.

References MAX, MIN, NULL, SCIP_INVALID, SCIP_Real, SCIPintervalGetRoundingMode(), SCIPintervalSetRoundingMode(), SCIPintervalSetRoundingModeDownwards(), SCIPintervalSetRoundingModeUpwards(), SCIPisInfinity(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by propagateBoundsCons().

static void consdataUpdateLinearActivityLbChange ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_Real  coef,
SCIP_Real  oldbnd,
SCIP_Real  newbnd 
)
static

update the linear activities after a change in the lower bound of a variable

Parameters
scipSCIP data structure
consdataconstraint data
coefcoefficient of variable in constraint
oldbndprevious lower bound of variable
newbndnew lower bound of variable

Definition at line 726 of file cons_quadratic.c.

References NULL, SCIP_INVALID, SCIP_Real, SCIPintervalGetRoundingMode(), SCIPintervalSetRoundingMode(), SCIPintervalSetRoundingModeDownwards(), SCIPintervalSetRoundingModeUpwards(), and SCIPisInfinity().

Referenced by SCIP_DECL_EVENTEXEC().

static void consdataUpdateLinearActivityUbChange ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_Real  coef,
SCIP_Real  oldbnd,
SCIP_Real  newbnd 
)
static

update the linear activities after a change in the upper bound of a variable

Parameters
scipSCIP data structure
consdataconstraint data
coefcoefficient of variable in constraint
oldbndprevious lower bound of variable
newbndnew lower bound of variable

Definition at line 829 of file cons_quadratic.c.

References NULL, SCIP_INVALID, SCIP_Real, SCIPintervalGetRoundingMode(), SCIPintervalSetRoundingMode(), SCIPintervalSetRoundingModeDownwards(), SCIPintervalSetRoundingModeUpwards(), and SCIPisInfinity().

Referenced by SCIP_DECL_EVENTEXEC().

static SCIP_RETCODE consdataEnsureLinearVarsSize ( SCIP scip,
SCIP_CONSDATA consdata,
int  num 
)
static

ensures, that linear vars and coefs arrays can store at least num entries

Parameters
scipSCIP data structure
consdataquadratic constraint data
numminimum number of entries to store

Definition at line 992 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), and SCIPreallocBlockMemoryArray.

Referenced by addLinearCoef(), presolveDisaggregate(), removeFixedVariables(), and SCIPcreateConsQuadratic().

static SCIP_RETCODE consdataEnsureQuadVarTermsSize ( SCIP scip,
SCIP_CONSDATA consdata,
int  num 
)
static

ensures, that quadratic variable terms array can store at least num entries

Parameters
scipSCIP data structure
consdataquadratic constraint data
numminimum number of entries to store

Definition at line 1022 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), and SCIPreallocBlockMemoryArray.

Referenced by addQuadVarTerm(), and removeFixedVariables().

static SCIP_RETCODE consdataEnsureAdjBilinSize ( SCIP scip,
SCIP_QUADVARTERM quadvarterm,
int  num 
)
static

ensures, that adjacency array can store at least num entries

Parameters
scipSCIP data structure
quadvartermquadratic variable term
numminimum number of entries to store

Definition at line 1047 of file cons_quadratic.c.

References SCIP_QuadVarTerm::adjbilin, SCIP_QuadVarTerm::adjbilinsize, SCIP_QuadVarTerm::nadjbilin, NULL, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), and SCIPreallocBlockMemoryArray.

Referenced by addBilinearTerm(), and mergeAndCleanQuadVarTerms().

static SCIP_RETCODE consdataEnsureBilinSize ( SCIP scip,
SCIP_CONSDATA consdata,
int  num 
)
static

ensures, that bilinear term arrays can store at least num entries

Parameters
scipSCIP data structure
consdataquadratic constraint data
numminimum number of entries to store

Definition at line 1072 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), and SCIPreallocBlockMemoryArray.

Referenced by addBilinearTerm(), removeFixedVariables(), and SCIPcreateConsQuadratic().

static SCIP_RETCODE consdataCreateEmpty ( SCIP scip,
SCIP_CONSDATA **  consdata 
)
static

creates empty constraint data structure

Parameters
scipSCIP data structure
consdataa buffer to store pointer to new constraint data

Definition at line 1097 of file cons_quadratic.c.

References BMSclearMemory, FALSE, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIPallocBlockMemory, SCIPinfinity(), and TRUE.

Referenced by SCIPcreateConsQuadratic().

static SCIP_RETCODE consdataCreate ( SCIP scip,
SCIP_CONSDATA **  consdata,
SCIP_Real  lhs,
SCIP_Real  rhs,
int  nlinvars,
SCIP_VAR **  linvars,
SCIP_Real lincoefs,
int  nquadvars,
SCIP_QUADVARTERM quadvarterms,
int  nbilinterms,
SCIP_BILINTERM bilinterms,
SCIP_Bool  capturevars 
)
static

creates constraint data structure

Parameters
scipSCIP data structure
consdataa buffer to store pointer to new constraint data
lhsleft hand side of constraint
rhsright hand side of constraint
nlinvarsnumber of linear variables
linvarsarray of linear variables
lincoefsarray of coefficients of linear variables
nquadvarsnumber of quadratic variables
quadvartermsarray of quadratic variable terms
nbilintermsnumber of bilinear terms
bilintermsarray of bilinear terms
capturevarswhether we should capture variables

Definition at line 1135 of file cons_quadratic.c.

References SCIP_QuadVarTerm::adjbilin, BMSclearMemory, SCIP_QuadVarTerm::nadjbilin, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIPallocBlockMemory, SCIPcaptureVar(), SCIPduplicateBlockMemoryArray, SCIPintervalSet(), SCIPintervalSetEmpty(), SCIPisInfinity(), and TRUE.

Referenced by SCIP_DECL_CONSTRANS(), and SCIPcreateConsQuadratic2().

static SCIP_RETCODE consdataFree ( SCIP scip,
SCIP_CONSDATA **  consdata 
)
static

frees constraint data structure

Parameters
scipSCIP data structure
consdatapointer to constraint data to free

Definition at line 1253 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPfreeBlockMemoryArrayNull, SCIPreleaseNlRow(), and SCIPreleaseVar().

Referenced by SCIP_DECL_CONSDELETE().

static void consdataSortLinearVars ( SCIP_CONSDATA consdata)
static

sorts linear part of constraint data

Parameters
consdataquadratic constraint data

Definition at line 1310 of file cons_quadratic.c.

References NULL, SCIPsortPtrPtrReal(), SCIPsortPtrReal(), and TRUE.

Referenced by mergeAndCleanLinearVars().

static SCIP_DECL_SORTINDCOMP ( quadVarTermComp  )
static

index comparison method for quadratic variable terms: compares two indices of the quadratic variable set in the quadratic constraint

Definition at line 1371 of file cons_quadratic.c.

References NULL, and SCIPvarCompare().

static SCIP_RETCODE consdataSortQuadVarTerms ( SCIP scip,
SCIP_CONSDATA consdata 
)
static
static SCIP_RETCODE consdataFindQuadVarTerm ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_VAR var,
int *  pos 
)
static

returns the position of variable in the quadratic variable terms array of a constraint, or -1 if not found

Parameters
scipSCIP data structure
consdataquadratic constraint data
varvariable to search for
posbuffer where to store position of var in quadvarterms array, or -1 if not found

Definition at line 1453 of file cons_quadratic.c.

References consdataSortQuadVarTerms(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPvarCompare().

Referenced by checkFactorable(), createNlRow(), mergeAndCleanLinearVars(), presolveDisaggregateMarkComponent(), propagateBoundsCons(), SCIP_DECL_CONSINITSOL(), SCIPaddBilinTermQuadratic(), SCIPaddQuadVarLinearCoefQuadratic(), SCIPaddSquareCoefQuadratic(), and SCIPfindQuadVarTermQuadratic().

static SCIP_DECL_SORTINDCOMP ( bilinTermComp  )
static

index comparison method for bilinear terms: compares two index pairs of the bilinear term set in the quadratic constraint

Definition at line 1506 of file cons_quadratic.c.

References NULL, and SCIPvarCompare().

static SCIP_RETCODE consdataSortBilinTerms ( SCIP scip,
SCIP_CONSDATA consdata 
)
static

sorting of bilinear terms

Parameters
scipSCIP data structure
consdataquadratic constraint data

Definition at line 1524 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPsort(), and TRUE.

Referenced by mergeAndCleanBilinearTerms().

static void consdataMoveLinearVar ( SCIP_CONSDATA consdata,
int  oldpos,
int  newpos 
)
static

moves a linear variable from one position to another

Parameters
consdataconstraint data
oldposposition of variable that shall be moved
newposnew position of variable

Definition at line 1601 of file cons_quadratic.c.

References FALSE, and NULL.

Referenced by delLinearCoefPos().

static void consdataMoveQuadVarTerm ( SCIP_CONSDATA consdata,
int  oldpos,
int  newpos 
)
static

moves a quadratic variable from one position to another

Parameters
consdataconstraint data
oldposposition of variable that shall be moved
newposnew position of variable

Definition at line 1634 of file cons_quadratic.c.

References FALSE, and NULL.

Referenced by delQuadVarTermPos().

static SCIP_RETCODE delLinearCoefPos ( SCIP scip,
SCIP_CONS cons,
int  pos 
)
static

deletes linear coefficient at given position from quadratic constraint data

Parameters
scipSCIP data structure
consquadratic constraint
posposition of coefficient to delete

Definition at line 1754 of file cons_quadratic.c.

References consdataMoveLinearVar(), dropLinearVarEvents(), FALSE, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetData(), SCIPreleaseNlRow(), SCIPreleaseVar(), and unlockLinearVariable().

Referenced by mergeAndCleanLinearVars(), and removeFixedVariables().

static SCIP_RETCODE chgLinearCoefPos ( SCIP scip,
SCIP_CONS cons,
int  pos,
SCIP_Real  newcoef 
)
static

changes linear coefficient value at given position of quadratic constraint

Parameters
scipSCIP data structure
consquadratic constraint
posposition of linear coefficient to change
newcoefnew value of linear coefficient

Definition at line 1823 of file cons_quadratic.c.

References catchLinearVarEvents(), dropLinearVarEvents(), FALSE, lockLinearVariable(), NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetData(), SCIPconsIsLocked(), SCIPconsIsTransformed(), SCIPisZero(), SCIPreleaseNlRow(), SCIPvarIsTransformed(), and unlockLinearVariable().

Referenced by mergeAndCleanLinearVars().

static SCIP_RETCODE delQuadVarTermPos ( SCIP scip,
SCIP_CONS cons,
int  pos 
)
static

deletes quadratic variable term at given position from quadratic constraint data

Parameters
scipSCIP data structure
consquadratic constraint
posposition of term to delete

Definition at line 2010 of file cons_quadratic.c.

References consdataMoveQuadVarTerm(), dropQuadVarEvents(), FALSE, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetData(), SCIPfreeBlockMemoryArrayNull, SCIPintervalSetEmpty(), SCIPreleaseNlRow(), SCIPreleaseVar(), and unlockQuadraticVariable().

Referenced by mergeAndCleanQuadVarTerms(), presolveDisaggregate(), and removeFixedVariables().

static SCIP_RETCODE replaceQuadVarTermPos ( SCIP scip,
SCIP_CONS cons,
int  pos,
SCIP_VAR var,
SCIP_Real  coef,
SCIP_Real  offset 
)
static

replace variable in quadratic variable term at given position of quadratic constraint data allows to replace x by coef*y+offset, thereby maintaining linear and square coefficients and bilinear terms

Parameters
scipSCIP data structure
consquadratic constraint
posposition of term to replace
varnew variable
coeflinear coefficient of new variable
offsetoffset of new variable

Definition at line 2080 of file cons_quadratic.c.

References SCIP_QuadVarTerm::adjbilin, catchQuadVarEvents(), SCIP_BilinTerm::coef, dropQuadVarEvents(), SCIP_QuadVarTerm::eventdata, FALSE, SCIP_QuadVarTerm::lincoef, lockQuadraticVariable(), SCIP_QuadVarTerm::nadjbilin, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPcaptureVar(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetData(), SCIPintervalSetEmpty(), SCIPisInfinity(), SCIPreleaseNlRow(), SCIPreleaseVar(), SCIPvarCompare(), SCIPvarIsActive(), SCIP_QuadVarTerm::sqrcoef, unlockQuadraticVariable(), SCIP_QuadVarTerm::var, SCIP_BilinTerm::var1, and SCIP_BilinTerm::var2.

Referenced by removeFixedVariables().

static SCIP_RETCODE addBilinearTerm ( SCIP scip,
SCIP_CONS cons,
int  var1pos,
int  var2pos,
SCIP_Real  coef 
)
static

adds a bilinear term to quadratic constraint

Parameters
scipSCIP data structure
consquadratic constraint
var1posposition of first variable in quadratic variables array
var2posposition of second variable in quadratic variables array
coefcoefficient of bilinear term

Definition at line 2246 of file cons_quadratic.c.

References SCIP_BilinTerm::coef, consdataEnsureAdjBilinSize(), consdataEnsureBilinSize(), FALSE, NULL, SCIP_CALL, SCIP_INVALID, SCIP_INVALIDDATA, SCIP_OKAY, SCIPconsGetData(), SCIPerrorMessage, SCIPintervalSetEmpty(), SCIPreleaseNlRow(), SCIPvarCompare(), TRUE, SCIP_BilinTerm::var1, and SCIP_BilinTerm::var2.

Referenced by removeFixedVariables(), SCIPaddBilinTermQuadratic(), and SCIPcreateConsQuadratic().

static SCIP_RETCODE removeBilinearTermsPos ( SCIP scip,
SCIP_CONS cons,
int  nterms,
int *  termposs 
)
static

removes a set of bilinear terms and updates adjacency information in quad var terms Note: this function sorts the given array termposs

Parameters
scipSCIP data structure
consquadratic constraint
ntermsnumber of terms to delete
termpossindices of terms to delete

Definition at line 2338 of file cons_quadratic.c.

References FALSE, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIPallocBufferArray, SCIPconsGetData(), SCIPfreeBufferArray, SCIPintervalSetEmpty(), SCIPreleaseNlRow(), and SCIPsortInt().

Referenced by mergeAndCleanBilinearTerms(), presolveTryAddAND(), presolveTryAddLinearReform(), and removeFixedVariables().

static SCIP_RETCODE mergeAndCleanLinearVars ( SCIP scip,
SCIP_CONS cons 
)
static
static SCIP_RETCODE createNlRow ( SCIP scip,
SCIP_CONS cons 
)
static

create a nonlinear row representation of the constraint and stores them in consdata

Parameters
scipSCIP data structure
consquadratic constraint

Definition at line 2983 of file cons_quadratic.c.

References SCIP_QuadElement::coef, consdataFindQuadVarTerm(), SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, MAX, MIN, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddLinearCoefsToNlRow(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPcreateNlRow(), SCIPfreeBufferArray, SCIPisZero(), and SCIPreleaseNlRow().

Referenced by SCIP_DECL_CONSINITSOL(), and SCIPgetNlRowQuadratic().

static SCIP_RETCODE presolveSolve ( SCIP scip,
SCIP_CONS cons,
SCIP_RESULT result,
SCIP_Bool redundant,
int *  naggrvars 
)
static
Parameters
scipSCIP data structure
consconstraint
resultto store result of solve: cutoff, success, or do-not-find
redundantto store whether constraint is redundant now (should be deleted)
naggrvarscounter on number of variable aggregations

Definition at line 3100 of file cons_quadratic.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_Real, SCIP_SUCCESS, SCIPaggregateVars(), SCIPconsGetData(), SCIPdebugMessage, SCIPisEQ(), SCIPisZero(), SCIPvarGetName(), SCIPvarIsBinary(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE presolveTryAddAND ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
int *  naddconss 
)
static

reformulates products of binary variables as AND constraint For a product x*y, with x and y binary variables, the product is replaced by a new auxiliary variable z and the constraint z = {x and y} is added.

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint
naddconssbuffer where to add the number of AND constraints added

Definition at line 3184 of file cons_quadratic.c.

References addLinearCoef(), NULL, removeBilinearTermsPos(), SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPaddCons(), SCIPaddVar(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsAnd(), SCIPcreateVar(), SCIPdebugAddSolVal, SCIPdebugGetSolVal, SCIPdebugMessage, SCIPdebugPrintCons, SCIPfreeBufferArray, SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), SCIPvarGetName(), SCIPvarIsBinary(), SCIPvarIsInitial(), and SCIPvarIsRemovable().

Referenced by SCIP_DECL_CONSPRESOL().

static void getImpliedBounds ( SCIP_VAR x,
SCIP_Bool  xval,
SCIP_VAR y,
SCIP_INTERVAL resultant 
)
static

gets bounds of variable y if x takes a certain value checks whether x = xval has implications on y

Parameters
xvariable which implications to check
xvalvalue of x to check for (TRUE for 1, FALSE for 0)
yvariable to check if bounds can be reduced
resultantbuffer to store bounds on y

Definition at line 3282 of file cons_quadratic.c.

References SCIP_Interval::inf, MAX, MIN, NULL, SCIP_BOUNDTYPE_LOWER, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPintervalIsEmpty(), SCIPintervalSetBounds(), SCIPsortedvecFindPtr(), SCIPvarGetImplBounds(), SCIPvarGetImplTypes(), SCIPvarGetImplVars(), SCIPvarGetLbGlobal(), SCIPvarGetNBinImpls(), SCIPvarGetNImpls(), SCIPvarGetType(), SCIPvarGetUbGlobal(), SCIPvarIsActive(), SCIPvarIsBinary(), and SCIP_Interval::sup.

Referenced by presolveTryAddLinearReform().

static SCIP_RETCODE presolveTryAddLinearReform ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
int *  naddconss 
)
static

Reformulates products of binary times bounded continuous variables as system of linear inequalities (plus auxiliary variable).

For a product x*y, with y a binary variable and x a continous variable with finite bounds, an auxiliary variable z and the inequalities $ x^L * y \leq z \leq x^U * y $ and $ x - (1-y)*x^U \leq z \leq x - (1-y)*x^L $ are added.

If x is a linear term consisting of more than one variable, it is split up in groups of linear terms of length at most maxnrvar. For each product of linear term of length at most maxnrvar with y, an auxiliary z and linear inequalities are added.

If y is a binary variable, the AND constraint $ z = x \wedge y $ may be added instead of linear constraints.

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint
naddconssbuffer where to add the number of auxiliary constraints added

Definition at line 3362 of file cons_quadratic.c.

References addLinearCoef(), FALSE, getImpliedBounds(), SCIP_Interval::inf, MAX, MAXDNOM, MIN, NULL, REALABS, removeBilinearTermsPos(), SCIP_Bool, SCIP_CALL, SCIP_Longint, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_IMPLINT, SCIPaddCons(), SCIPaddVar(), SCIPcalcGreComDiv(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsAnd(), SCIPcreateConsLinear(), SCIPcreateConsVarbound(), SCIPcreateVar(), SCIPdebugAddSolVal, SCIPdebugGetSolVal, SCIPdebugMessage, SCIPdebugPrintCons, SCIPfeastol(), SCIPfreeBufferArrayNull, SCIPinfinity(), SCIPintervalAdd(), SCIPintervalDivScalar(), SCIPintervalGetInf(), SCIPintervalGetSup(), SCIPintervalMulScalar(), SCIPintervalSet(), SCIPisEQ(), SCIPisInfinity(), SCIPisIntegral(), SCIPisNegative(), SCIPisPositive(), SCIPisZero(), SCIPreallocBufferArray, SCIPreleaseCons(), SCIPreleaseVar(), SCIPround(), SCIPselectSimpleValue(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetType(), SCIPvarGetUbGlobal(), SCIPvarIsBinary(), SCIPvarIsInitial(), SCIPvarIsRemovable(), SCIP_Interval::sup, and TRUE.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE presolveUpgrade ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_Bool upgraded,
int *  nupgdconss,
int *  naddconss 
)
static

tries to automatically convert a quadratic constraint (or a part of it) into a more specific and more specialized constraint

Parameters
scipSCIP data structure
conshdlrconstraint handler data structure
conssource constraint to try to convert
upgradedbuffer to store whether constraint was upgraded
nupgdconssbuffer to increase if constraint was upgraded
naddconssbuffer to increase with number of additional constraints created during upgrade

Definition at line 3793 of file cons_quadratic.c.

References dropVarEvents(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_IMPLINT, SCIP_VARTYPE_INTEGER, SCIPaddCons(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsModifiable(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPdebugPrintf, SCIPdelCons(), SCIPerrorMessage, SCIPfreeBufferArray, SCIPisIntegral(), SCIPisRelEQ(), SCIPisZero(), SCIPreallocBufferArray, SCIPreleaseCons(), SCIPvarGetLbLocal(), SCIPvarGetType(), SCIPvarGetUbLocal(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE presolveDisaggregateMarkComponent ( SCIP scip,
SCIP_CONSDATA consdata,
int  quadvaridx,
SCIP_HASHMAP var2component,
int  componentnr 
)
static

helper function for presolveDisaggregate

Parameters
scipSCIP data structure
consdataconstraint data
quadvaridxindex of quadratic variable to mark
var2componentvariables to components mapping
componentnrthe component number to mark to

Definition at line 4009 of file cons_quadratic.c.

References SCIP_QuadVarTerm::adjbilin, consdataFindQuadVarTerm(), SCIP_QuadVarTerm::nadjbilin, NULL, SCIP_CALL, SCIP_OKAY, SCIPhashmapExists(), SCIPhashmapGetImage(), SCIPhashmapInsert(), and SCIP_QuadVarTerm::var.

Referenced by presolveDisaggregate().

static SCIP_RETCODE presolveDisaggregate ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
int *  naddconss 
)
static
static void checkCurvatureEasy ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool determined,
SCIP_Bool  checkmultivariate 
)
static

checks a quadratic constraint for convexity and/or concavity without checking multivariate functions

Parameters
scipSCIP data structure
consquadratic constraint
determinedpointer to store whether the curvature could be determined
checkmultivariatewhether curvature will be checked later on for multivariate functions

Definition at line 4329 of file cons_quadratic.c.

References FALSE, NULL, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPisNegative(), SCIPisPositive(), and TRUE.

Referenced by checkCurvature(), SCIPisConcaveQuadratic(), and SCIPisConvexQuadratic().

static SCIP_RETCODE checkCurvature ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool  checkmultivariate 
)
static
static SCIP_Real getGradientMaxElement ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol 
)
static

gets maximal absolute value in gradient of quadratic function

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

Definition at line 4759 of file cons_quadratic.c.

References NULL, REALABS, SCIP_Real, SCIP_STAGE_SOLVING, SCIPconsGetData(), SCIPgetSolVal(), SCIPgetStage(), and SCIPisInfinity().

Referenced by computeViolation().

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

computes activity and violation of a constraint

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

Definition at line 4813 of file cons_quadratic.c.

References getGradientMaxElement(), MAX, MIN, NULL, REALABS, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPerrorMessage, SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasGE(), SCIPisFeasLE(), SCIPisInfinity(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by computeViolations(), proposeFeasibleSolution(), SCIP_DECL_CONSCHECK(), and SCIPgetViolationQuadratic().

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

computes violation of a set of constraints

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints
nconssnumber of constraints
solsolution or NULL if LP solution should be used
maxviolconbuffer to store constraint with largest violation, or NULL if solution is feasible

Definition at line 4976 of file cons_quadratic.c.

References computeViolation(), MAX, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPfeastol(), and SCIPisGT().

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

static void generateCutFactorableDo ( SCIP scip,
SCIP_CONS cons,
SCIP_Real ref,
SCIP_Real  multleft,
SCIP_Real coefleft,
SCIP_Real  multright,
SCIP_Real coefright,
SCIP_Real  rightminactivity,
SCIP_Real  rightmaxactivity,
SCIP_Real  rhs,
SCIP_Real cutcoef,
SCIP_Real cutrhs,
SCIP_Bool islocal,
SCIP_Bool success,
char *  name 
)
static

tries to compute cut for multleft * <coefleft, x'> * multright <= rhs / (multright * <coefright, x'>) where x'=(x,1)

Parameters
scipSCIP data structure
consconstraint
refreference solution where to generate the cut
multleftmultiplicator on lhs
coefleftcoefficient for factor on lhs
multrightmultiplicator on both sides
coefrightcoefficient for factor that goes to rhs
rightminactivityminimal activity of <coefright, x>
rightmaxactivitymaximal activity of <coefright, x>
rhsdenominator on rhs
cutcoefarray to store cut coefficients for quadratic variables
cutrhsbuffer to store cut rhs
islocalbuffer to set to TRUE if local information was used
successbuffer to indicate whether a cut was successfully computed
namebuffer to store name of cut

Definition at line 5021 of file cons_quadratic.c.

References FALSE, NULL, SCIP_MAXSTRLEN, SCIP_Real, SCIPconsGetData(), SCIPconsGetName(), SCIPgetNLPs(), SCIPisFeasLE(), SCIPisInfinity(), SCIPisZero(), SCIPsnprintf(), and TRUE.

Referenced by generateCutFactorable().

static SCIP_RETCODE generateCutFactorable ( SCIP scip,
SCIP_CONS cons,
SCIP_SIDETYPE  violside,
SCIP_Real ref,
SCIP_Real cutcoef,
SCIP_Real cutlhs,
SCIP_Real cutrhs,
SCIP_Bool islocal,
SCIP_Bool success,
char *  name 
)
static

tries to generate a cut if constraint quadratic function is factorable and there are no linear variables (ax+b)(cx+d) <= rhs and cx+d >= 0 -> (ax+b) <= rhs / (cx+d), where the right hand side is concave and can be linearized

Parameters
scipSCIP data structure
consconstraint
violsidefor which side a cut should be generated
refreference solution where to generate the cut
cutcoefarray to store cut coefficients for quadratic variables
cutlhsbuffer to store cut lhs
cutrhsbuffer to store cut rhs
islocalbuffer to set to TRUE if local information was used
successbuffer to indicate whether a cut was successfully computed
namebuffer to store name of cut

Definition at line 5129 of file cons_quadratic.c.

References FALSE, generateCutFactorableDo(), NULL, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_RIGHT, SCIPconsGetData(), SCIPinfinity(), SCIPisFeasNegative(), SCIPisFeasPositive(), SCIPisInfinity(), SCIPisZero(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by generateCut().

static SCIP_Bool generateCutLTIfindIntersection ( SCIP scip,
SCIP_Real  x0,
SCIP_Real  y0_,
SCIP_Real  x1,
SCIP_Real  y1_,
SCIP_Real  wl,
SCIP_Real  wu,
SCIP_Real xl,
SCIP_Real yl,
SCIP_Real xu,
SCIP_Real yu 
)
static
static SCIP_Bool generateCutLTIgenMulCoeff ( SCIP scip,
SCIP_Real  x1,
SCIP_Real  y1_,
SCIP_Real  x2,
SCIP_Real  y2,
SCIP_Bool  whichuse,
SCIP_Real cx,
SCIP_Real cy,
SCIP_Real cw 
)
static

Definition at line 5467 of file cons_quadratic.c.

References FALSE, NULL, SCIP_Real, SCIPisZero(), and TRUE.

Referenced by generateCutLTIcomputeCoefs().

static void generateCutLTIcomputeCoefs ( SCIP scip,
SCIP_Real  xl,
SCIP_Real  xu,
SCIP_Real  x0,
SCIP_Real  yl,
SCIP_Real  yu,
SCIP_Real  y0_,
SCIP_Real  wl,
SCIP_Real  wu,
SCIP_Real  w0,
SCIP_Real cx,
SCIP_Real cy,
SCIP_Real cw,
SCIP_Real c0,
SCIP_Bool success 
)
static

computes coefficients of a lifted-tangent inequality for x*y = w The code is an adaptation of the methods in exprMul-upperHull.cpp in Couenne/stable/0.4 rev773, written by P. Belotti and licensed under Eclipse Public License.

Parameters
scipSCIP data structure
xllower bound on x
xuupper bound on x
x0reference point for x
yllower bound on y
yuupper bound on y
y0_reference point for y
wllower bound on w
wuupper bound on w
w0reference point for w
cxbuffer where to store cut coefficient for x
cybuffer where to store cut coefficient for y
cwbuffer where to store cut coefficient for w
c0buffer where to store cut left-hand-side
successbuffer where to indicate whether cut coefficients were computed

Definition at line 5524 of file cons_quadratic.c.

References FALSE, generateCutLTIfindIntersection(), generateCutLTIgenMulCoeff(), MAX, MIN, NULL, SCIP_Bool, SCIP_INVALID, SCIP_Real, SCIPdebugMessage, SCIPisFeasGE(), SCIPisFeasLE(), SCIPisGE(), SCIPisGT(), SCIPisInfinity(), SCIPisLE(), SCIPisLT(), SCIPisZero(), and TRUE.

Referenced by generateCutLTI().

static SCIP_RETCODE generateCutLTI ( SCIP scip,
SCIP_CONS cons,
SCIP_SIDETYPE  violside,
SCIP_Real ref,
SCIP_SOL sol,
SCIP_Real **  cutcoeflin,
SCIP_Real cutcoefquad,
SCIP_Real cutlhs,
SCIP_Real cutrhs,
SCIP_Bool islocal,
SCIP_Bool success,
char *  name 
)
static

tries to generate a cut if constraint quadratic function is factorable and there are linear variables computes what is called a lifted tangent inequality described in Belotti, Miller, Namazifar, Lifted inequalities for bounded products of variables, SIAG/OPT Views-and-News 22:1, 2011

Parameters
scipSCIP data structure
consconstraint
violsidefor which side a cut should be generated
refreference solution where to generate the cut
solsolution that shall be cutoff, NULL for LP solution
cutcoeflinbuffer to store pointer to array with coefficients for linear variables
cutcoefquadarray to store cut coefficients for quadratic variables
cutlhsbuffer to store cut lhs
cutrhsbuffer to store cut rhs
islocalbuffer to set to TRUE if local information was used
successbuffer to indicate whether a cut was successfully computed
namebuffer to store name of cut

Definition at line 5882 of file cons_quadratic.c.

References FALSE, generateCutLTIcomputeCoefs(), NULL, SCIP_CALL, SCIP_LPSOLSTAT_OPTIMAL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPgetLPSolstat(), SCIPgetNLPs(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasNegative(), SCIPisFeasPositive(), SCIPisInfinity(), SCIPisRelEQ(), SCIPsnprintf(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by generateCut().

static void addSquareLinearization ( SCIP scip,
SCIP_Real  sqrcoef,
SCIP_Real  refpoint,
SCIP_Bool  isint,
SCIP_Real lincoef,
SCIP_Real linconstant,
SCIP_Bool success 
)
static

computes coefficients of linearization of a square term in a reference point

Parameters
scipSCIP data structure
sqrcoefcoefficient of square term
refpointpoint where to linearize
isintwhether corresponding variable is a discrete variable, and thus linearization could be moved
lincoefbuffer to add coefficient of linearization
linconstantbuffer to add constant of linearization
successbuffer to set to FALSE if linearization has failed due to large numbers

Definition at line 6144 of file cons_quadratic.c.

References FALSE, NULL, REALABS, SCIP_Real, SCIPfloor(), SCIPisInfinity(), and SCIPisIntegral().

Referenced by generateCutConvex(), and generateCutNonConvex().

static void addSquareSecant ( SCIP scip,
SCIP_Real  sqrcoef,
SCIP_Real  lb,
SCIP_Real  ub,
SCIP_Real  refpoint,
SCIP_Real lincoef,
SCIP_Real linconstant,
SCIP_Bool success 
)
static

computes coefficients of secant of a square term

Parameters
scipSCIP data structure
sqrcoefcoefficient of square term
lblower bound on variable
ubupper bound on variable
refpointpoint for which to compute value of linearization
lincoefbuffer to add coefficient of secant
linconstantbuffer to add constant of secant
successbuffer to set to FALSE if secant has failed due to large numbers or unboundedness

Definition at line 6211 of file cons_quadratic.c.

References FALSE, NULL, REALABS, SCIP_Real, SCIPisGE(), SCIPisInfinity(), and SCIPisLE().

Referenced by generateCutNonConvex().

static void addBilinLinearization ( SCIP scip,
SCIP_Real  bilincoef,
SCIP_Real  refpointx,
SCIP_Real  refpointy,
SCIP_Real lincoefx,
SCIP_Real lincoefy,
SCIP_Real linconstant,
SCIP_Bool success 
)
static

computes coefficients of linearization of a bilinear term in a reference point

Parameters
scipSCIP data structure
bilincoefcoefficient of bilinear term
refpointxpoint where to linearize first variable
refpointypoint where to linearize second variable
lincoefxbuffer to add coefficient of first variable in linearization
lincoefybuffer to add coefficient of second variable in linearization
linconstantbuffer to add constant of linearization
successbuffer to set to FALSE if linearization has failed due to large numbers

Definition at line 6261 of file cons_quadratic.c.

References FALSE, NULL, REALABS, SCIP_Real, and SCIPisInfinity().

Referenced by generateCutConvex().

static void addBilinMcCormick ( SCIP scip,
SCIP_Real  bilincoef,
SCIP_Real  lbx,
SCIP_Real  ubx,
SCIP_Real  refpointx,
SCIP_Real  lby,
SCIP_Real  uby,
SCIP_Real  refpointy,
SCIP_Bool  overestimate,
SCIP_Real lincoefx,
SCIP_Real lincoefy,
SCIP_Real linconstant,
SCIP_Bool success 
)
static

computes coefficients of McCormick under- or overestimation of a bilinear term

Parameters
scipSCIP data structure
bilincoefcoefficient of bilinear term
lbxlower bound on first variable
ubxupper bound on first variable
refpointxreference point for first variable
lbylower bound on second variable
ubyupper bound on second variable
refpointyreference point for second variable
overestimatewhether to compute an overestimator instead of an underestimator
lincoefxbuffer to add coefficient of first variable in linearization
lincoefybuffer to add coefficient of second variable in linearization
linconstantbuffer to add constant of linearization
successbuffer to set to FALSE if linearization has failed due to large numbers

Definition at line 6308 of file cons_quadratic.c.

References FALSE, MAX, MIN, NULL, REALABS, SCIP_Real, SCIPisGE(), SCIPisInfinity(), SCIPisLE(), and SCIPisRelEQ().

Referenced by generateCutNonConvex().

static SCIP_RETCODE generateCutConvex ( SCIP scip,
SCIP_CONS cons,
SCIP_SIDETYPE  violside,
SCIP_Real ref,
SCIP_Real coef,
SCIP_Real lhs,
SCIP_Real rhs,
SCIP_Bool islocal,
SCIP_Bool success,
char *  name 
)
static

computes cut coefficients by linearizing a quadratic function

Parameters
scipSCIP data structure
consconstraint
violsideside for which to generate cut
refreference solution where to generate the cut
coefarray to store cut coefficients w.r.t. quadratic variables
lhsbuffer to store left-hand-side of cut
rhsbuffer to store right-hand-side of cut
islocalbuffer to set to TRUE if local bounds were used
successbuffer to indicate whether a cut was successfully computed
namebuffer to store name for cut

Definition at line 6507 of file cons_quadratic.c.

References addBilinLinearization(), addSquareLinearization(), BMSclearMemoryArray, SCIP_BilinTerm::coef, NULL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_VARTYPE_CONTINUOUS, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPgetNLPs(), SCIPinfinity(), SCIPsnprintf(), SCIPvarGetType(), TRUE, SCIP_BilinTerm::var1, and SCIP_BilinTerm::var2.

Referenced by generateCut().

static SCIP_RETCODE generateCutNonConvex ( SCIP scip,
SCIP_CONS cons,
SCIP_SIDETYPE  violside,
SCIP_Real ref,
SCIP_Real coef,
SCIP_Real lhs,
SCIP_Real rhs,
SCIP_Bool islocal,
SCIP_Bool success,
char *  name 
)
static

computes cut coefficients for a nonconvex quadratic function

Parameters
scipSCIP data structure
consconstraint
violsideside for which to generate cut
refreference solution where to generate the cut
coefarray to store cut coefficients w.r.t. quadratic variables
lhsbuffer to store left-hand-side of cut
rhsbuffer to store right-hand-side of cut
islocalbuffer to set to TRUE if local bounds were used
successbuffer to indicate whether a cut was successfully computed
namebuffer to store name for cut

Definition at line 6596 of file cons_quadratic.c.

References addBilinMcCormick(), addSquareLinearization(), addSquareSecant(), BMSclearMemoryArray, SCIP_BilinTerm::coef, NULL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIP_VARTYPE_CONTINUOUS, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPgetNLPs(), SCIPinfinity(), SCIPsnprintf(), SCIPvarGetLbLocal(), SCIPvarGetType(), SCIPvarGetUbLocal(), TRUE, SCIP_BilinTerm::var1, and SCIP_BilinTerm::var2.

Referenced by generateCut().

static SCIP_RETCODE generateCut ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_Real ref,
SCIP_SOL sol,
SCIP_SIDETYPE  violside,
SCIP_ROW **  row,
SCIP_Real efficacy,
SCIP_Bool  checkcurvmultivar,
SCIP_Real  minefficacy 
)
static

generates a cut based on linearization (if convex) or McCormick (if nonconvex) in a given reference point

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint
refreference solution where to generate the cut
solpoint that we aim to separate, or NULL for LP solution
violsidefor which side a cut should be generated
rowstorage for cut
efficacybuffer to store efficacy of row in reference solution, or NULL if not of interest
checkcurvmultivarare we allowed to check the curvature of a multivariate quadratic function, if not done yet
minefficacyminimal required efficacy (violation scaled by maximal absolute coefficient)

Definition at line 6702 of file cons_quadratic.c.

References checkCurvature(), FALSE, generateCutConvex(), generateCutFactorable(), generateCutLTI(), generateCutNonConvex(), MAX, NULL, REALABS, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LPSOLSTAT_OPTIMAL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIP_STAGE_SOLVING, SCIP_VARSTATUS_LOOSE, SCIPABORT, SCIPaddVarsToRow(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsLocal(), SCIPcreateEmptyRowCons(), SCIPdebugMessage, SCIPerrorMessage, SCIPfreeBufferArray, SCIPgetDepth(), SCIPgetLPSolstat(), SCIPgetSolVal(), SCIPgetStage(), SCIPinfinity(), SCIPisEQ(), SCIPisFeasNegative(), SCIPisFeasPositive(), SCIPisGT(), SCIPisInfinity(), SCIPisIntegral(), SCIPisLT(), SCIPround(), SCIProwGetName(), SCIProwGetNNonz(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetStatus(), SCIPvarGetUbGlobal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by generateCutSol(), generateCutUnboundedLP(), and SCIP_DECL_CONSINITLP().

static SCIP_RETCODE generateCutSol ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_SOL refsol,
SCIP_SIDETYPE  violside,
SCIP_ROW **  row,
SCIP_Real efficacy,
SCIP_Bool  checkcurvmultivar,
SCIP_Real  minefficacy 
)
static

generates a cut based on linearization (if convex) or McCormick (if nonconvex) in a solution

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint
solsolution where to generate cut, or NULL if LP solution should be used
refsolreference point where to generate cut, or NULL if sol should be used
violsidefor which side a cut should be generated
rowstorage for cut
efficacybuffer to store efficacy of row in reference solution, or NULL if not of interest
checkcurvmultivarare we allowed to check the curvature of a multivariate quadratic function, if not done yet
minefficacyminimal required efficacy (violation scaled by maximal absolute coefficient)

Definition at line 7065 of file cons_quadratic.c.

References generateCut(), MAX, MIN, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPfreeBufferArray, SCIPgetSolVal(), SCIPisInfinity(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by addLinearizationCuts(), generateCutUnboundedLP(), and separatePoint().

static SCIP_RETCODE generateCutUnboundedLP ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_SIDETYPE  violside,
SCIP_ROW **  row,
SCIP_Real rowrayprod,
SCIP_Bool  checkcurvmultivar 
)
static

tries to find a cut that intersects with an unbounded ray of the LP for convex functions, we do this by linearizing in the feasible solution of the LPI for nonconvex functions, we just call generateCutSol with the unbounded solution as reference point

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint
violsidefor which side a cut should be generated
rowstorage for cut
rowrayprodbuffer to store product of ray with row coefficients, or NULL if not of interest
checkcurvmultivarare we allowed to check the curvature of a multivariate quadratic function, if not done yet

Definition at line 7121 of file cons_quadratic.c.

References checkCurvature(), SCIP_BilinTerm::coef, FALSE, generateCut(), generateCutSol(), NULL, REALABS, SCIP_CALL, SCIP_LPSOLSTAT_UNBOUNDEDRAY, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPallocBufferArray, SCIPcolGetVar(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPgetLPSolstat(), SCIPgetPrimalRayVal(), SCIPhasPrimalRay(), SCIPinfinity(), SCIPisNegative(), SCIPisPositive(), SCIPisZero(), SCIProwGetCols(), SCIProwGetNNonz(), SCIProwGetVals(), SCIP_BilinTerm::var1, and SCIP_BilinTerm::var2.

Referenced by separatePoint().

static SCIP_RETCODE separatePoint ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS **  conss,
int  nconss,
int  nusefulconss,
SCIP_SOL sol,
SCIP_Real  minefficacy,
SCIP_Bool  inenforcement,
SCIP_RESULT result,
SCIP_Real bestefficacy 
)
static

tries to separate solution or LP solution by a linear cut

assumes that constraint violations have been computed

Parameters
scipSCIP data structure
conshdlrquadratic constraints handler
conssconstraints
nconssnumber of constraints
nusefulconssnumber of constraints that seem to be useful
solsolution to separate, or NULL if LP solution should be used
minefficacyminimal efficacy of a cut if it should be added to the LP
inenforcementwhether we are in constraint enforcement
resultresult of separation
bestefficacybuffer to store best efficacy of a cut that was added to the LP, if found; or NULL if not of interest

Definition at line 7268 of file cons_quadratic.c.

References FALSE, generateCutSol(), generateCutUnboundedLP(), MAX, MIN, NULL, REALABS, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_FEASIBLE, SCIP_INVALIDDATA, SCIP_LPSOLSTAT_UNBOUNDEDRAY, SCIP_OKAY, SCIP_Real, SCIP_SEPARATED, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPABORT, SCIPaddCut(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPdebugMessage, SCIPepsilon(), SCIPerrorMessage, SCIPfeastol(), SCIPgetLPSolstat(), SCIPgetRelaxFeastolFactor(), SCIPgetRowMaxCoef(), SCIPisCutApplicable(), SCIPisGT(), SCIPisInfinity(), SCIPisNegative(), SCIPisPositive(), SCIPmarkRowNotRemovableLocal(), SCIPreleaseRow(), SCIPresetConsAge(), SCIProwGetLhs(), and SCIProwGetRhs().

Referenced by 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 
)
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

Definition at line 7439 of file cons_quadratic.c.

References checkCurvature(), FALSE, generateCutSol(), MAX, MIN, NULL, REALABS, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPABORT, SCIPaddCut(), SCIPaddPoolCut(), SCIPconsGetData(), SCIPconshdlrGetData(), SCIPconsIsLocal(), SCIPdebugMessage, SCIPerrorMessage, SCIPgetRowLPFeasibility(), SCIPgetRowMaxCoef(), SCIPinfinity(), SCIPisInfinity(), SCIPreleaseRow(), SCIProwGetLhs(), SCIProwGetName(), SCIProwGetRhs(), SCIProwIsLocal(), and TRUE.

Referenced by SCIP_DECL_CONSSEPALP(), and SCIP_DECL_EVENTEXEC().

static SCIP_DECL_EVENTEXEC ( processNewSolutionEvent  )
static
static SCIP_RETCODE registerVariableInfeasibilities ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS **  conss,
int  nconss,
int *  nnotify 
)
static

computes the infeasibilities of variables from the convexification gaps in the constraints and notifies the branching rule about them

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to check
nconssnumber of constraints to check
nnotifycounter for number of notifications performed

Definition at line 7604 of file cons_quadratic.c.

References MAX, MIN, NULL, REALABS, SCIP_Bool, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPaddExternBranchCand(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPfeastol(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasNegative(), SCIPisGE(), SCIPisGT(), SCIPisInfinity(), SCIPisLE(), SCIPisLT(), SCIPisNegative(), SCIPisRelEQ(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), SCIPvarIsBinary(), SCIPvarIsIntegral(), and sqrt().

Referenced by SCIP_DECL_CONSENFOLP().

static SCIP_RETCODE registerLargeLPValueVariableForBranching ( SCIP scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_VAR **  brvar 
)
static

registers a quadratic variable from a violated constraint as branching candidate that has a large absolute value in the LP relaxation

Parameters
scipSCIP data structure
conssconstraints
nconssnumber of constraints
brvarbuffer to store branching variable

Definition at line 7811 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPaddExternBranchCand(), SCIPconsGetData(), SCIPfeastol(), SCIPgetSolVal(), SCIPisGT(), SCIPisRelEQ(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by SCIP_DECL_CONSENFOLP().

static SCIP_RETCODE replaceByLinearConstraints ( SCIP scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool addedcons,
SCIP_Bool reduceddom,
SCIP_Bool infeasible 
)
static

replaces violated quadratic constraints where all quadratic variables are fixed by linear constraints

Parameters
scipSCIP data structure
conssconstraints
nconssnumber of constraints
addedconsbuffer to store whether a linear constraint was added
reduceddomwhether a domain has been reduced
infeasiblewhether we detected infeasibility

Definition at line 7863 of file cons_quadratic.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_INFEASIBLE, SCIP_OKAY, SCIP_Real, SCIPaddConsLocal(), SCIPcheckCons(), SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPdelConsLocal(), SCIPfeastol(), SCIPinfinity(), SCIPisGT(), SCIPisInfinity(), SCIPisRelEQ(), SCIPisZero(), SCIPreleaseCons(), SCIPtightenVarLb(), SCIPtightenVarUb(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), and TRUE.

Referenced by SCIP_DECL_CONSENFOLP().

static SCIP_RETCODE propagateBoundsTightenVarLb ( SCIP scip,
SCIP_CONS cons,
SCIP_Real  intervalinfty,
SCIP_VAR var,
SCIP_Real  bnd,
SCIP_RESULT result,
int *  nchgbds 
)
static
Parameters
scipSCIP data structure
consconstraint where we currently propagate
intervalinftyinfinity value used in interval operations
varvariable which domain we might reduce
bndnew lower bound for variable
resultresult to update if there was a tightening or cutoff
nchgbdscounter to increase if a bound was tightened

Definition at line 8033 of file cons_quadratic.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, SCIPadjustedVarLb(), SCIPconsGetName(), SCIPdebugMessage, SCIPinProbing(), SCIPisHugeValue(), SCIPisInfinity(), SCIPisLE(), SCIPresetConsAge(), SCIPtightenVarLb(), SCIPvarGetLbLocal(), and SCIPvarGetName().

Referenced by propagateBoundsBilinearTerm(), propagateBoundsCons(), and propagateBoundsQuadVar().

static SCIP_RETCODE propagateBoundsTightenVarUb ( SCIP scip,
SCIP_CONS cons,
SCIP_Real  intervalinfty,
SCIP_VAR var,
SCIP_Real  bnd,
SCIP_RESULT result,
int *  nchgbds 
)
static
Parameters
scipSCIP data structure
consconstraint where we currently propagate
intervalinftyinfinity value used in interval operations
varvariable which domain we might reduce
bndnew upper bound for variable
resultresult to update if there was a tightening or cutoff
nchgbdscounter to increase if a bound was tightened

Definition at line 8092 of file cons_quadratic.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, SCIPadjustedVarUb(), SCIPconsGetName(), SCIPdebugMessage, SCIPinProbing(), SCIPisGE(), SCIPisHugeValue(), SCIPisInfinity(), SCIPresetConsAge(), SCIPtightenVarUb(), SCIPvarGetName(), and SCIPvarGetUbLocal().

Referenced by propagateBoundsBilinearTerm(), propagateBoundsCons(), and propagateBoundsQuadVar().

static SCIP_RETCODE propagateBoundsQuadVar ( SCIP scip,
SCIP_CONS cons,
SCIP_Real  intervalinfty,
SCIP_VAR var,
SCIP_Real  a,
SCIP_INTERVAL  b,
SCIP_INTERVAL  rhs,
SCIP_RESULT result,
int *  nchgbds 
)
static

solves a quadratic equation $ a x^2 + b x \in rhs $ (with b an interval) and reduces bounds on x or deduces infeasibility if possible

Parameters
scipSCIP data structure
consconstraint where we currently propagate
intervalinftyinfinity value used in interval operations
varvariable which bounds with might tighten
acoefficient in square term
bcoefficient in linear term
rhsright hand side of quadratic equation
resultresult of propagation
nchgbdsbuffer where to add number of tightened bounds

Definition at line 8152 of file cons_quadratic.c.

References NULL, propagateBoundsTightenVarLb(), propagateBoundsTightenVarUb(), SCIP_CALL, SCIP_CUTOFF, SCIP_OKAY, SCIPconsGetName(), SCIPdebugMessage, SCIPintervalGetInf(), SCIPintervalGetSup(), SCIPintervalIsEmpty(), SCIPintervalSet(), SCIPintervalSetBounds(), SCIPintervalSolveUnivariateQuadExpression(), SCIPintervalSolveUnivariateQuadExpressionPositive(), SCIPisInfinity(), SCIPresetConsAge(), SCIPvarGetLbLocal(), SCIPvarGetName(), and SCIPvarGetUbLocal().

Referenced by propagateBoundsCons().

static SCIP_RETCODE propagateBoundsBilinearTerm ( SCIP scip,
SCIP_CONS cons,
SCIP_Real  intervalinfty,
SCIP_VAR x,
SCIP_Real  xsqrcoef,
SCIP_Real  xlincoef,
SCIP_VAR y,
SCIP_Real  ysqrcoef,
SCIP_Real  ylincoef,
SCIP_Real  bilincoef,
SCIP_INTERVAL  rhs,
SCIP_RESULT result,
int *  nchgbds 
)
static

tries to deduce domain reductions for x in xsqrcoef x^2 + xlincoef x + ysqrcoef y^2 + ylincoef y + bilincoef x y \in rhs NOTE that domain reductions for y are not deduced

Parameters
scipSCIP data structure
consthe constraint, where the bilinear term belongs to
intervalinftyinfinity value used in interval operations
xfirst variable
xsqrcoefsquare coefficient of x
xlincoeflinear coefficient of x
ysecond variable
ysqrcoefsquare coefficient of y
ylincoeflinear coefficient of y
bilincoefbilinear coefficient of x*y
rhsright hand side of quadratic equation
resultpointer to store result of domain propagation
nchgbdscounter to increment if domain reductions are found

Definition at line 8346 of file cons_quadratic.c.

References infty2infty, MAX, MIN, NULL, propagateBoundsTightenVarLb(), propagateBoundsTightenVarUb(), SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, SCIPconsGetName(), SCIPdebugMessage, SCIPinfinity(), SCIPintervalGetInf(), SCIPintervalGetSup(), SCIPintervalIsEmpty(), SCIPintervalIsEntire(), SCIPintervalSetBounds(), SCIPintervalSolveBivariateQuadExpressionAllScalar(), SCIPisInfinity(), SCIPvarGetLbLocal(), SCIPvarGetName(), and SCIPvarGetUbLocal().

Referenced by propagateBoundsCons().

static void propagateBoundsGetQuadActivity ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_Real  intervalinfty,
SCIP_Real minquadactivity,
SCIP_Real maxquadactivity,
int *  minactivityinf,
int *  maxactivityinf,
SCIP_INTERVAL quadactcontr 
)
static

computes the minimal and maximal activity for the quadratic part in a constraint data only sums up terms that contribute finite values gives the number of terms that contribute infinite values only computes those activities where the corresponding side of the constraint is finite

Parameters
scipSCIP data structure
consdataconstraint data
intervalinftyinfinity value used in interval operations
minquadactivityminimal activity of quadratic variable terms where only terms with finite minimal activity contribute
maxquadactivitymaximal activity of quadratic variable terms where only terms with finite maximal activity contribute
minactivityinfnumber of quadratic variables that contribute -infinity to minimal activity
maxactivityinfnumber of quadratic variables that contribute +infinity to maximal activity
quadactcontrcontribution of each quadratic variables to quadactivity

Definition at line 8419 of file cons_quadratic.c.

References SCIP_Interval::inf, infty2infty, MAX, MIN, NULL, SCIP_Real, SCIPinfinity(), SCIPintervalAdd(), SCIPintervalGetInf(), SCIPintervalGetRoundingMode(), SCIPintervalGetSup(), SCIPintervalIsEmpty(), SCIPintervalMulScalar(), SCIPintervalQuadUpperBound(), SCIPintervalSet(), SCIPintervalSetBounds(), SCIPintervalSetRoundingMode(), SCIPintervalSetRoundingModeDownwards(), SCIPintervalSetRoundingModeUpwards(), SCIPisInfinity(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), sqrt(), and SCIP_Interval::sup.

Referenced by propagateBoundsCons().

static SCIP_RETCODE propagateBoundsCons ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_RESULT result,
int *  nchgbds,
SCIP_Bool redundant 
)
static

propagates bounds on a quadratic constraint

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint to process
resultpointer to store the result of the propagation call
nchgbdsbuffer where to add the the number of changed bounds
redundantbuffer where to store whether constraint has been found to be redundant

Definition at line 8554 of file cons_quadratic.c.

References consdataFindQuadVarTerm(), consdataSortQuadVarTerms(), consdataUpdateLinearActivity(), FALSE, SCIP_Interval::inf, infty2infty, MAX, MIN, NULL, propagateBoundsBilinearTerm(), propagateBoundsGetQuadActivity(), propagateBoundsQuadVar(), propagateBoundsTightenVarLb(), propagateBoundsTightenVarUb(), SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPepsilon(), SCIPfreeBufferArrayNull, SCIPinfinity(), SCIPintervalAdd(), SCIPintervalGetInf(), SCIPintervalGetRoundingMode(), SCIPintervalGetSup(), SCIPintervalIsEmpty(), SCIPintervalIsEntire(), SCIPintervalIsSubsetEQ(), SCIPintervalMulInf(), SCIPintervalMulScalar(), SCIPintervalMulSup(), SCIPintervalNegateReal(), SCIPintervalSet(), SCIPintervalSetBounds(), SCIPintervalSetRoundingMode(), SCIPintervalSetRoundingModeDownwards(), SCIPintervalSetRoundingModeUpwards(), SCIPintervalSub(), SCIPisEQ(), SCIPisFeasGT(), SCIPisFeasLT(), SCIPisInfinity(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), SCIP_Interval::sup, and TRUE.

Referenced by propagateBounds(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE propagateBounds ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS **  conss,
int  nconss,
SCIP_RESULT result,
int *  nchgbds 
)
static

calls domain propagation for a set of constraints

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to process
nconssnumber of constraints
resultpointer to store the result of the propagation calls
nchgbdsbuffer where to add the the number of changed bounds

Definition at line 9097 of file cons_quadratic.c.

References FALSE, NULL, propagateBoundsCons(), SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_OKAY, SCIP_STAGE_PRESOLVING, SCIP_STAGE_SOLVING, SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsEnabled(), SCIPdebugMessage, SCIPdelConsLocal(), SCIPgetStage(), and TRUE.

Referenced by SCIP_DECL_CONSENFOLP(), SCIP_DECL_CONSENFOPS(), and SCIP_DECL_CONSPROP().

static void consdataFindUnlockedLinearVar ( SCIP scip,
SCIP_CONSDATA consdata 
)
static
Parameters
scipSCIP data structure
consdataconstraint data

Definition at line 9166 of file cons_quadratic.c.

References SCIPdebugMessage, SCIPisInfinity(), SCIPvarGetName(), SCIPvarGetNLocksDown(), and SCIPvarGetObj().

Referenced by SCIP_DECL_CONSCHECK(), and SCIP_DECL_CONSINITSOL().

static SCIP_RETCODE proposeFeasibleSolution ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS **  conss,
int  nconss,
SCIP_SOL sol,
SCIP_Bool success 
)
static

Given a solution where every quadratic constraint is either feasible or can be made feasible by moving a linear variable, construct the corresponding feasible solution and pass it to the trysol heuristic. The method assumes that this is always possible and that not all constraints are feasible already.

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to process
nconssnumber of constraints
solsolution to process
successbuffer to store whether we succeeded to construct a solution that satisfies all provided constraints

Definition at line 9230 of file cons_quadratic.c.

References computeViolation(), FALSE, MAX, MIN, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPceil(), SCIPconsGetData(), SCIPconshdlrGetData(), SCIPcreateLPSol(), SCIPcreateSolCopy(), SCIPdebugMessage, SCIPfeastol(), SCIPfloor(), SCIPfreeSol(), SCIPgetSolTransObj(), SCIPgetSolVal(), SCIPgetUpperbound(), SCIPheurGetName(), SCIPheurPassSolTrySol(), SCIPincSolVal(), SCIPisGT(), SCIPisInfinity(), SCIPisNegative(), SCIPisPositive(), SCIPisSumLT(), SCIPisZero(), SCIPsolGetHeur(), SCIPunlinkSol(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPvarIsIntegral(), and TRUE.

Referenced by SCIP_DECL_CONSCHECK().

static SCIP_DECL_NONLINCONSUPGD ( nonlinconsUpgdQuadratic  )
static

tries to upgrade a nonlinear constraint into a quadratic constraint

Definition at line 9381 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_ERROR, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIP_Real, SCIPaddBilinTermQuadratic(), SCIPaddConstantQuadratic(), SCIPaddQuadVarLinearCoefQuadratic(), SCIPaddQuadVarQuadratic(), SCIPaddSquareCoefQuadratic(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsQuadratic(), SCIPerrorMessage, SCIPexprgraphAreAllNodeChildrenVars(), SCIPexprgraphGetNodeChildren(), SCIPexprgraphGetNodeNChildren(), SCIPexprgraphGetNodeOperator(), SCIPexprgraphGetNodeQuadraticConstant(), SCIPexprgraphGetNodeQuadraticLinearCoefs(), SCIPexprgraphGetNodeQuadraticNQuadElements(), SCIPexprgraphGetNodeQuadraticQuadElements(), SCIPexprgraphGetNodeVar(), SCIPgetExprgraphNodeNonlinear(), SCIPgetExprgraphNonlinear(), SCIPgetLhsNonlinear(), SCIPgetLinearCoefsNonlinear(), SCIPgetLinearVarsNonlinear(), SCIPgetNLinearVarsNonlinear(), SCIPgetRhsNonlinear(), and SCIPwarningMessage().

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyQuadratic  )
static

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

Definition at line 9560 of file cons_quadratic.c.

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

static SCIP_DECL_CONSFREE ( consFreeQuadratic  )
static

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

Definition at line 9576 of file cons_quadratic.c.

References NULL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPfreeMemory, and SCIPfreeMemoryArrayNull.

static SCIP_DECL_CONSINIT ( consInitQuadratic  )
static

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

Definition at line 9601 of file cons_quadratic.c.

References catchVarEvents(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPfindHeur().

static SCIP_DECL_CONSEXIT ( consExitQuadratic  )
static

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

Definition at line 9627 of file cons_quadratic.c.

References dropVarEvents(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPconshdlrGetData().

static SCIP_DECL_CONSEXITPRE ( consExitpreQuadratic  )
static

presolving initialization method of constraint handler (called when presolving is about to begin) presolving deinitialization method of constraint handler (called after presolving has been finished)

Definition at line 9672 of file cons_quadratic.c.

References mergeAndCleanBilinearTerms(), mergeAndCleanLinearVars(), mergeAndCleanQuadVarTerms(), NULL, removeFixedVariables(), SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsIsAdded(), SCIPenableNLP(), and SCIPvarIsActive().

static SCIP_DECL_CONSEXITSOL ( consExitsolQuadratic  )
static

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

Definition at line 9820 of file cons_quadratic.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_EVENTTYPE_SOLFOUND, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPdropEvent(), SCIPfindEventhdlr(), SCIPfreeBlockMemoryArrayNull, and SCIPreleaseNlRow().

static SCIP_DECL_CONSDELETE ( consDeleteQuadratic  )
static

frees specific constraint data

Definition at line 9869 of file cons_quadratic.c.

References consdataFree(), dropVarEvents(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetData(), and SCIPconsIsTransformed().

static SCIP_DECL_CONSSEPASOL ( consSepasolQuadratic  )
static

separation method of constraint handler for arbitrary primal solutions

Definition at line 10300 of file cons_quadratic.c.

References computeViolations(), FALSE, NULL, SCIP_CALL, SCIP_DIDNOTFIND, SCIP_OKAY, SCIPconshdlrGetData(), and separatePoint().

static SCIP_DECL_CONSENFOPS ( consEnfopsQuadratic  )
static
static SCIP_DECL_CONSPROP ( consPropQuadratic  )
static

domain propagation method of constraint handler

Definition at line 10594 of file cons_quadratic.c.

References NULL, propagateBounds(), SCIP_CALL, and SCIP_OKAY.

static SCIP_DECL_CONSLOCK ( consLockQuadratic  )
static

variable rounding lock method of constraint handler

Definition at line 10898 of file cons_quadratic.c.

References NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPaddVarLocks(), SCIPconsGetData(), and SCIPisInfinity().

static SCIP_DECL_CONSPRINT ( consPrintQuadratic  )
static
static SCIP_DECL_CONSGETVARS ( consGetVarsQuadratic  )
static

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

Definition at line 11491 of file cons_quadratic.c.

References BMScopyMemoryArray, FALSE, NULL, SCIP_OKAY, SCIPconsGetData(), and TRUE.

static SCIP_DECL_CONSGETNVARS ( consGetNVarsQuadratic  )
static

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

Definition at line 11522 of file cons_quadratic.c.

References NULL, SCIP_OKAY, SCIPconsGetData(), and TRUE.

SCIP_RETCODE SCIPincludeQuadconsUpgrade ( SCIP scip,
SCIP_DECL_QUADCONSUPGD((*quadconsupgd))  ,
int  priority,
SCIP_Bool  active,
const char *  conshdlrname 
)

includes a quadratic constraint update method into the quadratic constraint handler

Parameters
scipSCIP data structure
prioritypriority of upgrading method
activeshould the upgrading method be active by default?
conshdlrnamename of the constraint handler

Definition at line 11672 of file cons_quadratic.c.

References SCIP_QuadConsUpgrade::active, CONSHDLR_NAME, conshdlrdataHasUpgrade(), FALSE, NULL, paramname, SCIP_QuadConsUpgrade::priority, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPaddBoolParam(), SCIPallocMemory, SCIPcalcMemGrowSize(), SCIPconshdlrGetData(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPreallocMemoryArray, and SCIPsnprintf().

Referenced by SCIPincludeConshdlrAbspower(), SCIPincludeConshdlrBivariate(), SCIPincludeConshdlrBounddisjunction(), SCIPincludeConshdlrLinear(), SCIPincludeConshdlrSetppc(), and SCIPincludeConshdlrSOC().

SCIP_RETCODE SCIPcreateConsQuadratic ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nlinvars,
SCIP_VAR **  linvars,
SCIP_Real lincoefs,
int  nquadterms,
SCIP_VAR **  quadvars1,
SCIP_VAR **  quadvars2,
SCIP_Real quadcoefs,
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 
)

Creates and captures a quadratic constraint.

The constraint should be given in the form

\[ \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_jz_j \leq u, \]

where $x_i = y_j = z_k$ is possible.

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
nlinvarsnumber of linear terms (n)
linvarsarray with variables in linear part (x_i)
lincoefsarray with coefficients of variables in linear part (b_i)
nquadtermsnumber of quadratic terms (m)
quadvars1array with first variables in quadratic terms (y_j)
quadvars2array with second variables in quadratic terms (z_j)
quadcoefsarray with coefficients of quadratic terms (a_j)
lhsleft hand side of quadratic equation (ell)
rhsright hand side of quadratic equation (u)
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 11748 of file cons_quadratic.c.

References addBilinearTerm(), addLinearCoef(), addQuadVarTerm(), catchVarEvents(), consdataCreateEmpty(), consdataEnsureBilinSize(), consdataEnsureLinearVarsSize(), CONSHDLR_NAME, FALSE, mergeAndCleanBilinearTerms(), mergeAndCleanLinearVars(), mergeAndCleanQuadVarTerms(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIPblkmem(), SCIPcalcHashtableSize(), SCIPconshdlrGetData(), SCIPcreateCons(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPerrorMessage, SCIPfindConshdlr(), SCIPhashmapCreate(), SCIPhashmapExists(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPhashmapInsert(), SCIPisTransformed(), and SCIPisZero().

Referenced by createQuadraticCons(), readConstraints(), readObjective(), readQCMatrix(), readQMatrix(), readQuadraticCoefs(), SCIP_DECL_CONSPARSE(), SCIP_DECL_NONLINCONSUPGD(), SCIP_DECL_QUADCONSUPGD(), SCIPcreateConsBasicQuadratic(), SCIPcreateConsIndicator(), and SCIPcreateConsIndicatorLinCons().

SCIP_RETCODE SCIPcreateConsBasicQuadratic ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nlinvars,
SCIP_VAR **  linvars,
SCIP_Real lincoefs,
int  nquadterms,
SCIP_VAR **  quadvars1,
SCIP_VAR **  quadvars2,
SCIP_Real quadcoefs,
SCIP_Real  lhs,
SCIP_Real  rhs 
)

creates and captures a quadratic constraint with all its flags set to their default values.

The constraint should be given in the form

\[ \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_jz_j \leq u, \]

where $x_i = y_j = z_k$ is possible.

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
nlinvarsnumber of linear terms (n)
linvarsarray with variables in linear part (x_i)
lincoefsarray with coefficients of variables in linear part (b_i)
nquadtermsnumber of quadratic terms (m)
quadvars1array with first variables in quadratic terms (y_j)
quadvars2array with second variables in quadratic terms (z_j)
quadcoefsarray with coefficients of quadratic terms (a_j)
lhsleft hand side of quadratic equation (ell)
rhsright hand side of quadratic equation (u)

Definition at line 11936 of file cons_quadratic.c.

References FALSE, SCIP_CALL, SCIP_OKAY, SCIPcreateConsQuadratic(), and TRUE.

SCIP_RETCODE SCIPcreateConsQuadratic2 ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nlinvars,
SCIP_VAR **  linvars,
SCIP_Real lincoefs,
int  nquadvarterms,
SCIP_QUADVARTERM quadvarterms,
int  nbilinterms,
SCIP_BILINTERM bilinterms,
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 
)

Creates and captures a quadratic constraint.

The constraint should be given in the form

\[ \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m (a_j y_j^2 + b_j y_j) + \sum_{k=1}^p c_kv_kw_k \leq u. \]

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
nlinvarsnumber of linear terms (n)
linvarsarray with variables in linear part (x_i)
lincoefsarray with coefficients of variables in linear part (b_i)
nquadvartermsnumber of quadratic terms (m)
quadvartermsquadratic variable terms
nbilintermsnumber of bilinear terms (p)
bilintermsbilinear terms
lhsconstraint left hand side (ell)
rhsconstraint right hand side (u)
initialshould the LP relaxation of constraint be in the initial LP?
separateshould the constraint be separated during LP processing?
enforceshould the constraint be enforced during node processing?
checkshould the constraint be checked for feasibility?
propagateshould the constraint be propagated during node processing?
localis constraint only valid locally?
modifiableis constraint modifiable (subject to column generation)?
dynamicis constraint dynamic?
removableshould the constraint be removed from the LP due to aging or cleanup?

Definition at line 11967 of file cons_quadratic.c.

References catchVarEvents(), consdataCreate(), CONSHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPconshdlrGetData(), SCIPcreateCons(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPisTransformed(), and TRUE.

Referenced by presolveDisaggregate(), presolveRemoveFixedVariables(), SCIP_DECL_CONSCOPY(), SCIP_DECL_QUADCONSUPGD(), and SCIPcreateConsBasicQuadratic2().

SCIP_RETCODE SCIPcreateConsBasicQuadratic2 ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
int  nlinvars,
SCIP_VAR **  linvars,
SCIP_Real lincoefs,
int  nquadvarterms,
SCIP_QUADVARTERM quadvarterms,
int  nbilinterms,
SCIP_BILINTERM bilinterms,
SCIP_Real  lhs,
SCIP_Real  rhs 
)

creates and captures a quadratic constraint in its most basic version, i.e., all constraint flags are set to their default values.

The constraint should be given in the form

\[ \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m (a_j y_j^2 + b_j y_j) + \sum_{k=1}^p c_kv_kw_k \leq u. \]

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
nlinvarsnumber of linear terms (n)
linvarsarray with variables in linear part (x_i)
lincoefsarray with coefficients of variables in linear part (b_i)
nquadvartermsnumber of quadratic terms (m)
quadvartermsquadratic variable terms
nbilintermsnumber of bilinear terms (p)
bilintermsbilinear terms
lhsconstraint left hand side (ell)
rhsconstraint right hand side (u)

Definition at line 12038 of file cons_quadratic.c.

References FALSE, SCIP_CALL, SCIP_OKAY, SCIPcreateConsQuadratic2(), and TRUE.

void SCIPaddConstantQuadratic ( SCIP scip,
SCIP_CONS cons,
SCIP_Real  constant 
)

Adds a constant to the constraint function, that is, subtracts a constant from both sides

Parameters
scipSCIP data structure
consconstraint
constantconstant to subtract from both sides

Definition at line 12062 of file cons_quadratic.c.

References NULL, REALABS, SCIPconsGetData(), SCIPisEQ(), and SCIPisInfinity().

Referenced by SCIP_DECL_CONSPARSE(), and SCIP_DECL_NONLINCONSUPGD().

SCIP_RETCODE SCIPaddLinearVarQuadratic ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var,
SCIP_Real  coef 
)

Adds a linear variable with coefficient to a quadratic constraint.

Parameters
scipSCIP data structure
consconstraint
varvariable
coefcoefficient of variable

Definition at line 12092 of file cons_quadratic.c.

References addLinearCoef(), NULL, REALABS, SCIP_CALL, SCIP_OKAY, and SCIPisInfinity().

Referenced by presolveDisaggregate(), readObjective(), SCIP_DECL_CONSPARSE(), and SCIP_DECL_QUADCONSUPGD().

SCIP_RETCODE SCIPaddQuadVarQuadratic ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var,
SCIP_Real  lincoef,
SCIP_Real  sqrcoef 
)

Adds a quadratic variable with linear and square coefficient to a quadratic constraint.

Parameters
scipSCIP data structure
consconstraint
varvariable
lincoeflinear coefficient of variable
sqrcoefsquare coefficient of variable

Definition at line 12111 of file cons_quadratic.c.

References addQuadVarTerm(), NULL, REALABS, SCIP_CALL, SCIP_OKAY, SCIPconsIsTransformed(), and SCIPisInfinity().

Referenced by presolveDisaggregate(), SCIP_DECL_CONSPARSE(), SCIP_DECL_NONLINCONSUPGD(), and SCIP_DECL_QUADCONSUPGD().

SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var,
SCIP_Real  coef 
)

Adds a linear coefficient for a quadratic variable.

Variable will be added with square coefficient 0.0 if not existing yet.

Parameters
scipSCIP data structure
consconstraint
varvariable
coefvalue to add to linear coefficient of variable

Definition at line 12134 of file cons_quadratic.c.

References addQuadVarTerm(), consdataFindQuadVarTerm(), FALSE, NULL, REALABS, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIPconsGetData(), SCIPconsIsTransformed(), SCIPintervalSetEmpty(), SCIPisInfinity(), and SCIPisZero().

Referenced by SCIP_DECL_NONLINCONSUPGD(), and SCIP_DECL_QUADCONSUPGD().

SCIP_RETCODE SCIPaddSquareCoefQuadratic ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var,
SCIP_Real  coef 
)

Adds a square coefficient for a quadratic variable.

Variable will be added with linear coefficient 0.0 if not existing yet.

Parameters
scipSCIP data structure
consconstraint
varvariable
coefvalue to add to square coefficient of variable

Definition at line 12180 of file cons_quadratic.c.

References addQuadVarTerm(), consdataFindQuadVarTerm(), FALSE, NULL, REALABS, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIPconsGetData(), SCIPconsIsTransformed(), SCIPintervalSetEmpty(), SCIPisInfinity(), and SCIPisZero().

Referenced by SCIP_DECL_NONLINCONSUPGD(), SCIP_DECL_QUADCONSUPGD(), and SCIPaddBilinTermQuadratic().

SCIP_RETCODE SCIPaddBilinTermQuadratic ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var1,
SCIP_VAR var2,
SCIP_Real  coef 
)

Adds a bilinear term to a quadratic constraint.

Variables will be added with linear and square coefficient 0.0 if not existing yet. If variables are equal, only the square coefficient of the variable is updated.

Parameters
scipSCIP data structure
consconstraint
var1first variable
var2second variable
coefcoefficient of bilinear term

Definition at line 12230 of file cons_quadratic.c.

References addBilinearTerm(), addQuadVarTerm(), consdataFindQuadVarTerm(), consdataSortQuadVarTerms(), NULL, REALABS, SCIP_CALL, SCIP_OKAY, SCIPaddSquareCoefQuadratic(), SCIPconsGetData(), SCIPconsIsTransformed(), and SCIPisInfinity().

Referenced by presolveDisaggregate(), readQuadraticCoefs(), SCIP_DECL_CONSPARSE(), SCIP_DECL_NONLINCONSUPGD(), and SCIP_DECL_QUADCONSUPGD().

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

Gets the quadratic constraint as a nonlinear row representation.

Parameters
scipSCIP data structure
consconstraint
nlrowpointer to store nonlinear row

Definition at line 12290 of file cons_quadratic.c.

References createNlRow(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPconsGetData().

Referenced by createCoveringProblem().

int SCIPgetNLinearVarsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Gets the number of variables in the linear term of a quadratic constraint.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12316 of file cons_quadratic.c.

References NULL, and SCIPconsGetData().

Referenced by SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and SCIPwritePip().

SCIP_VAR** SCIPgetLinearVarsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Gets the variables in the linear part of a quadratic constraint. Length is given by SCIPgetNLinearVarsQuadratic.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12330 of file cons_quadratic.c.

References NULL, and SCIPconsGetData().

Referenced by SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and SCIPwritePip().

SCIP_Real* SCIPgetCoefsLinearVarsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Gets the coefficients in the linear part of a quadratic constraint. Length is given by SCIPgetNLinearVarsQuadratic.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12344 of file cons_quadratic.c.

References NULL, and SCIPconsGetData().

Referenced by SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and SCIPwritePip().

int SCIPgetNQuadVarTermsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Gets the number of quadratic variable terms of a quadratic constraint.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12357 of file cons_quadratic.c.

References NULL, and SCIPconsGetData().

Referenced by readNonlinearExprs(), SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and SCIPwritePip().

SCIP_QUADVARTERM* SCIPgetQuadVarTermsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Gets the quadratic variable terms of a quadratic constraint. Length is given by SCIPgetNQuadVarTermsQuadratic.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12371 of file cons_quadratic.c.

References NULL, and SCIPconsGetData().

Referenced by readNonlinearExprs(), SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and SCIPwritePip().

SCIP_RETCODE SCIPsortQuadVarTermsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Ensures that quadratic variable terms are sorted.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12383 of file cons_quadratic.c.

References consdataSortQuadVarTerms(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPconsGetData().

Referenced by readNonlinearExprs().

SCIP_RETCODE SCIPfindQuadVarTermQuadratic ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var,
int *  pos 
)

Finds the position of a quadratic variable term for a given variable.

Note
If the quadratic variable terms have not been sorted before, then a search may reorder the current order of the terms.
Parameters
scipSCIP data structure
consconstraint
varvariable to search for
posbuffer to store position of quadvarterm for var, or -1 if not found

Definition at line 12400 of file cons_quadratic.c.

References consdataFindQuadVarTerm(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPconsGetData().

Referenced by readNonlinearExprs(), SCIP_DECL_CONSPARSE(), and SCIP_DECL_QUADCONSUPGD().

int SCIPgetNBilinTermsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Gets the number of bilinear terms of a quadratic constraint.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12419 of file cons_quadratic.c.

References NULL, and SCIPconsGetData().

Referenced by readNonlinearExprs(), SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and SCIPwritePip().

SCIP_BILINTERM* SCIPgetBilinTermsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Gets the bilinear terms of a quadratic constraint. Length is given by SCIPgetNBilinTermQuadratic.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12433 of file cons_quadratic.c.

References NULL, and SCIPconsGetData().

Referenced by readNonlinearExprs(), SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and SCIPwritePip().

SCIP_Real SCIPgetLhsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Gets the left hand side of a quadratic constraint.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12446 of file cons_quadratic.c.

References NULL, and SCIPconsGetData().

Referenced by checkConsnames(), createCoveringProblem(), SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and SCIPwritePip().

SCIP_Real SCIPgetRhsQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Gets the right hand side of a quadratic constraint.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12459 of file cons_quadratic.c.

References NULL, and SCIPconsGetData().

Referenced by checkConsnames(), createCoveringProblem(), SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and SCIPwritePip().

SCIP_RETCODE SCIPcheckCurvatureQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Check the quadratic function of a quadratic constraint for its semi-definiteness, if not done yet.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12472 of file cons_quadratic.c.

References checkCurvature(), NULL, SCIP_CALL, SCIP_OKAY, and TRUE.

Referenced by SCIP_DECL_QUADCONSUPGD().

SCIP_Bool SCIPisConvexQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Indicates whether the quadratic function of a quadratic constraint is (known to be) convex.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12486 of file cons_quadratic.c.

References checkCurvatureEasy(), FALSE, NULL, SCIP_Bool, and SCIPconsGetData().

Referenced by createCoveringProblem(), and SCIP_DECL_QUADCONSUPGD().

SCIP_Bool SCIPisConcaveQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Indicates whether the quadratic function of a quadratic constraint is (known to be) concave.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12504 of file cons_quadratic.c.

References checkCurvatureEasy(), FALSE, NULL, SCIP_Bool, and SCIPconsGetData().

Referenced by createCoveringProblem(), and SCIP_DECL_QUADCONSUPGD().

SCIP_RETCODE SCIPgetViolationQuadratic ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_Real violation 
)

Computes the violation of a constraint by a solution

Parameters
scipSCIP data structure
consconstraint
solsolution which violation to calculate, or NULL for LP solution
violationpointer to store violation of constraint

Definition at line 12521 of file cons_quadratic.c.

References computeViolation(), MAX, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), and SCIPconsGetHdlr().

SCIP_Bool SCIPisLinearLocalQuadratic ( SCIP scip,
SCIP_CONS cons 
)

Indicates whether the quadratic constraint is local w.r.t. the current local bounds.

That is, checks whether each variable with a square term is fixed and for each bilinear term at least one variable is fixed.

Parameters
scipSCIP data structure
consconstraint

Definition at line 12552 of file cons_quadratic.c.

References FALSE, NULL, SCIPconsGetData(), SCIPisRelEQ(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.

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

Adds the constraint to an NLPI problem.

Parameters
scipSCIP data structure
consconstraint
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 12598 of file cons_quadratic.c.

References SCIP_QuadElement::coef, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, MAX, MIN, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPfreeBufferArrayNull, SCIPhashmapExists(), SCIPhashmapGetImage(), and SCIPnlpiAddConstraints().