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_i x_j + \sum_{i=1}^n b_i x_i \leq \textrm{rhs}\)

Author
Stefan Vigerske
Benjamin Mueller
Felipe Serrano

Definition in file cons_quadratic.c.

#include "blockmemshell/memory.h"
#include <ctype.h>
#include "nlpi/nlpi.h"
#include "nlpi/nlpi_ipopt.h"
#include "nlpi/pub_expr.h"
#include "nlpi/type_expr.h"
#include "scip/cons_and.h"
#include "scip/cons_bounddisjunction.h"
#include "scip/cons_linear.h"
#include "scip/cons_nonlinear.h"
#include "scip/cons_quadratic.h"
#include "scip/cons_varbound.h"
#include "scip/debug.h"
#include "scip/heur_subnlp.h"
#include "scip/heur_trysol.h"
#include "scip/intervalarith.h"
#include "scip/pub_cons.h"
#include "scip/pub_event.h"
#include "scip/pub_heur.h"
#include "scip/pub_lp.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_misc_sort.h"
#include "scip/pub_nlp.h"
#include "scip/pub_sol.h"
#include "scip/pub_tree.h"
#include "scip/pub_var.h"
#include "scip/scip_branch.h"
#include "scip/scip_cons.h"
#include "scip/scip_copy.h"
#include "scip/scip_cut.h"
#include "scip/scip_event.h"
#include "scip/scip_general.h"
#include "scip/scip_heur.h"
#include "scip/scip_lp.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_nlp.h"
#include "scip/scip_nonlinear.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_probing.h"
#include "scip/scip_sepa.h"
#include "scip/scip_sol.h"
#include "scip/scip_solve.h"
#include "scip/scip_solvingstats.h"
#include "scip/scip_tree.h"
#include "scip/scip_var.h"
#include <string.h>

Go to the source code of this file.

Data Structures

struct  SCIP_QuadConsUpgrade
 
struct  BilinearEstimator
 

Macros

#define SCIP_PRIVATE_ROWPREP
 
#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_NEEDSCONS   TRUE
 
#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP
 
#define CONSHDLR_PRESOLTIMING   SCIP_PRESOLTIMING_ALWAYS
 
#define MAXDNOM   10000LL
 
#define NONLINCONSUPGD_PRIORITY   40000
 
#define INITLPMAXVARVAL   1000.0
 
#define PROPBILINNEW
 
#define INTERIOR_EPS   1e-1
 
#define GAUGESCALE   0.99999
 
#define ROWPREP_SCALEUP_VIOLNONZERO   (10.0*SCIPepsilon(scip))
 
#define ROWPREP_SCALEUP_MINVIOLFACTOR   2.0
 
#define ROWPREP_SCALEUP_MAXMINCOEF   (1.0 / SCIPfeastol(scip))
 
#define ROWPREP_SCALEUP_MAXMAXCOEF   SCIPgetHugeValue(scip)
 
#define ROWPREP_SCALEUP_MAXSIDE   SCIPgetHugeValue(scip)
 
#define ROWPREP_SCALEDOWN_MINMAXCOEF   (1.0 / SCIPfeastol(scip))
 
#define ROWPREP_SCALEDOWN_MINCOEF   SCIPfeastol(scip)
 
#define infty2infty(infty1, infty2, val)   ((val) >= (infty1) ? (infty2) : (val))
 

Typedefs

typedef struct SCIP_QuadConsUpgrade SCIP_QUADCONSUPGRADE
 
typedef struct BilinearEstimator BILINESTIMATOR
 

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_Bool hasQuadvarHpProperty (SCIP *scip, SCIP_CONSDATA *consdata, int idx)
 
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_Bool consdataCheckBilinTermsSort (SCIP_CONSDATA *consdata)
 
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)
 
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 SCIP_RETCODE getImpliedBounds (SCIP *scip, 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, SCIP_PRESOLTIMING presoltiming)
 
static SCIP_RETCODE presolveDisaggregateMarkComponent (SCIP *scip, SCIP_CONSDATA *consdata, int quadvaridx, SCIP_HASHMAP *var2component, int componentnr, int *componentsize)
 
static SCIP_RETCODE presolveDisaggregateMergeComponents (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_HASHMAP *var2component, int nvars, int *ncomponents, int *componentssize)
 
static unsigned int nextPowerOf2 (unsigned int v)
 
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_RETCODE computeViolation (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *solviolbounds)
 
static SCIP_RETCODE computeViolations (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, SCIP_Bool *solviolbounds, SCIP_CONS **maxviolcon)
 
static SCIP_DECL_SORTINDCOMP (bilinTermComp2)
 
static SCIP_DECL_SORTINDCOMP (bilinTermCompVolume)
 
static SCIP_RETCODE sortAllBilinTerms (SCIP *scip, SCIP_BILINTERM *bilinterms, int nbilinterms, SCIP_CONS **bilinconss, int *bilinposs)
 
static SCIP_RETCODE storeAllBilinearTerms (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS **conss, int nconss)
 
static SCIP_RETCODE freeAllBilinearTerms (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS **conss, int nconss)
 
static SCIP_RETCODE 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_ROWPREP *rowprep, SCIP_Bool *success)
 
static SCIP_RETCODE generateCutFactorable (SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
 
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_ROWPREP *rowprep, SCIP_Bool *success)
 
static SCIP_RETCODE generateCutConvex (SCIP *scip, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
 
static void updateBilinearRelaxation (SCIP *scip, SCIP_VAR *RESTRICT x, SCIP_VAR *RESTRICT y, SCIP_Real bilincoef, SCIP_SIDETYPE violside, SCIP_Real refx, SCIP_Real refy, SCIP_Real *RESTRICT ineqs, int nineqs, SCIP_Real mccormickval, SCIP_Real *RESTRICT bestcoefx, SCIP_Real *RESTRICT bestcoefy, SCIP_Real *RESTRICT bestconst, SCIP_Real *RESTRICT bestval, SCIP_Bool *success)
 
static SCIP_Real getInteriority (SCIP *scip, SCIP_Real lbx, SCIP_Real ubx, SCIP_Real refx, SCIP_Real lby, SCIP_Real uby, SCIP_Real refy)
 
static SCIP_RETCODE generateCutNonConvex (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS *cons, SCIP_SIDETYPE violside, SCIP_Real *ref, SCIP_ROWPREP *rowprep, SCIP_Bool *success)
 
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 computeED (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE computeInteriorPoint (SCIP *scip, SCIP_CONS *cons, char method, SCIP_Bool *success)
 
static SCIP_RETCODE computeGauge (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE evaluateGauge (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *gaugeval, SCIP_Bool *success)
 
static SCIP_RETCODE computeReferencePointProjection (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *ref)
 
static SCIP_RETCODE computeReferencePointGauge (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *refsol, SCIP_Real *ref, SCIP_Bool *success)
 
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, char mode)
 
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 processCut (SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_Real efficacy, SCIP_Real minefficacy, SCIP_Bool inenforcement, SCIP_Real *bestefficacy, SCIP_RESULT *result)
 
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 registerBranchingCandidatesGap (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
 
static SCIP_RETCODE registerBranchingCandidatesViolation (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
 
static SCIP_RETCODE registerBranchingCandidatesCentrality (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
 
static SCIP_RETCODE registerBranchingCandidates (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, int *nnotify)
 
static SCIP_RETCODE registerLargeRelaxValueVariableForBranching (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_SOL *sol, 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_RETCODE enforceConstraint (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_Bool solinfeasible, SCIP_RESULT *result)
 
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_CONSENFORELAX (consEnforelaxQuadratic)
 
static SCIP_DECL_CONSENFOPS (consEnfopsQuadratic)
 
static SCIP_DECL_CONSPROP (consPropQuadratic)
 
static SCIP_DECL_CONSPRESOL (consPresolQuadratic)
 
static SCIP_DECL_CONSLOCK (consLockQuadratic)
 
static SCIP_DECL_CONSENABLE (consEnableQuadratic)
 
static SCIP_DECL_CONSDISABLE (consDisableQuadratic)
 
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)
 
int SCIPgetLinvarMayDecreaseQuadratic (SCIP *scip, SCIP_CONS *cons)
 
int SCIPgetLinvarMayIncreaseQuadratic (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)
 
SCIP_RETCODE SCIPchgLhsQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
 
SCIP_RETCODE SCIPchgRhsQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
 
SCIP_RETCODE SCIPgetFeasibilityQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *feasibility)
 
SCIP_RETCODE SCIPgetActivityQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *activity)
 
SCIP_RETCODE SCIPchgLinearCoefQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
 
SCIP_RETCODE SCIPchgSquareCoefQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
 
SCIP_RETCODE SCIPchgBilinCoefQuadratic (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
 
int SCIPgetNAllBilinearTermsQuadratic (SCIP *scip)
 
SCIP_RETCODE SCIPgetAllBilinearTermsQuadratic (SCIP *scip, SCIP_VAR **RESTRICT x, SCIP_VAR **RESTRICT y, int *RESTRICT nbilinterms, int *RESTRICT nunderests, int *RESTRICT noverests, SCIP_Real *maxnonconvexity)
 
static void getIneqViol (SCIP_VAR *x, SCIP_VAR *y, SCIP_Real xcoef, SCIP_Real ycoef, SCIP_Real constant, SCIP_Real *viol1, SCIP_Real *viol2)
 
SCIP_RETCODE SCIPaddBilinearIneqQuadratic (SCIP *scip, SCIP_VAR *x, SCIP_VAR *y, int idx, SCIP_Real xcoef, SCIP_Real ycoef, SCIP_Real constant, SCIP_Bool *success)
 
SCIP_RETCODE SCIPcreateRowprep (SCIP *scip, SCIP_ROWPREP **rowprep, SCIP_SIDETYPE sidetype, SCIP_Bool local)
 
void SCIPfreeRowprep (SCIP *scip, SCIP_ROWPREP **rowprep)
 
SCIP_RETCODE SCIPcopyRowprep (SCIP *scip, SCIP_ROWPREP **target, SCIP_ROWPREP *source)
 
SCIP_RETCODE SCIPensureRowprepSize (SCIP *scip, SCIP_ROWPREP *rowprep, int size)
 
void SCIPprintRowprep (SCIP *scip, SCIP_ROWPREP *rowprep, FILE *file)
 
SCIP_RETCODE SCIPaddRowprepTerm (SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_VAR *var, SCIP_Real coef)
 
SCIP_RETCODE SCIPaddRowprepTerms (SCIP *scip, SCIP_ROWPREP *rowprep, int nvars, SCIP_VAR **vars, SCIP_Real *coefs)
 
void SCIPaddRowprepSide (SCIP_ROWPREP *rowprep, SCIP_Real side)
 
void SCIPaddRowprepConstant (SCIP_ROWPREP *rowprep, SCIP_Real constant)
 
SCIP_Real SCIPgetRowprepViolation (SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol)
 
void SCIPmergeRowprepTerms (SCIP *scip, SCIP_ROWPREP *rowprep)
 
static SCIP_RETCODE rowprepCleanupSortTerms (SCIP *scip, SCIP_ROWPREP *rowprep)
 
static void rowprepCleanupImproveCoefrange (SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, SCIP_Real maxcoefrange)
 
static void rowprepCleanupScaleup (SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol, SCIP_Real minviol)
 
static void rowprepCleanupScaledown (SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol, SCIP_Real minviol)
 
static void rowprepCleanupIntegralCoefs (SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol)
 
static void rowprepCleanupSide (SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol)
 
SCIP_RETCODE SCIPcleanupRowprep (SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, SCIP_Real maxcoefrange, SCIP_Real minviol, SCIP_Real *coefrange, SCIP_Real *viol)
 
int SCIPscaleRowprep (SCIP_ROWPREP *rowprep, SCIP_Real factor)
 
SCIP_RETCODE SCIPgetRowprepRowCons (SCIP *scip, SCIP_ROW **row, SCIP_ROWPREP *rowprep, SCIP_CONSHDLR *conshdlr)
 
SCIP_RETCODE SCIPgetRowprepRowSepa (SCIP *scip, SCIP_ROW **row, SCIP_ROWPREP *rowprep, SCIP_SEPA *sepa)
 

Macro Definition Documentation

◆ SCIP_PRIVATE_ROWPREP

#define SCIP_PRIVATE_ROWPREP

Definition at line 34 of file cons_quadratic.c.

◆ CONSHDLR_NAME

◆ CONSHDLR_DESC

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

Definition at line 89 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_SEPAPRIORITY

#define CONSHDLR_SEPAPRIORITY   10

priority of the constraint handler for separation

Definition at line 90 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_ENFOPRIORITY

#define CONSHDLR_ENFOPRIORITY   -50

priority of the constraint handler for constraint enforcing

Definition at line 91 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_CHECKPRIORITY

#define CONSHDLR_CHECKPRIORITY   -4000000

priority of the constraint handler for checking feasibility

Definition at line 92 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_SEPAFREQ

#define CONSHDLR_SEPAFREQ   1

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

Definition at line 93 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_PROPFREQ

#define CONSHDLR_PROPFREQ   1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 94 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_EAGERFREQ

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

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_MAXPREROUNDS

#define CONSHDLR_MAXPREROUNDS   -1

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

Definition at line 98 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_DELAYSEPA

#define CONSHDLR_DELAYSEPA   FALSE

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

Definition at line 99 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_DELAYPROP

#define CONSHDLR_DELAYPROP   FALSE

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

Definition at line 100 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_NEEDSCONS

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 101 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_PROP_TIMING

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

propagation timing mask of the constraint handler

Definition at line 103 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ CONSHDLR_PRESOLTIMING

#define CONSHDLR_PRESOLTIMING   SCIP_PRESOLTIMING_ALWAYS

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

Definition at line 104 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ MAXDNOM

#define MAXDNOM   10000LL

maximal denominator for simple rational fixed values

Definition at line 106 of file cons_quadratic.c.

Referenced by presolveTryAddLinearReform().

◆ NONLINCONSUPGD_PRIORITY

#define NONLINCONSUPGD_PRIORITY   40000

priority of upgrading nonlinear constraints

Definition at line 107 of file cons_quadratic.c.

Referenced by SCIPincludeConshdlrQuadratic().

◆ INITLPMAXVARVAL

#define INITLPMAXVARVAL   1000.0

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

Definition at line 108 of file cons_quadratic.c.

Referenced by SCIP_DECL_CONSINITLP().

◆ PROPBILINNEW

#define PROPBILINNEW

Definition at line 118 of file cons_quadratic.c.

◆ INTERIOR_EPS

#define INTERIOR_EPS   1e-1

Definition at line 121 of file cons_quadratic.c.

Referenced by computeInteriorPoint().

◆ GAUGESCALE

#define GAUGESCALE   0.99999

Definition at line 124 of file cons_quadratic.c.

Referenced by computeReferencePointGauge().

◆ ROWPREP_SCALEUP_VIOLNONZERO

#define ROWPREP_SCALEUP_VIOLNONZERO   (10.0*SCIPepsilon(scip))

minimal violation for considering up-scaling of rowprep (we want to avoid upscaling very small violations)

Definition at line 126 of file cons_quadratic.c.

Referenced by rowprepCleanupScaleup().

◆ ROWPREP_SCALEUP_MINVIOLFACTOR

#define ROWPREP_SCALEUP_MINVIOLFACTOR   2.0

scale up will target a violation of ~MINVIOLFACTOR*minviol, where minviol is given by caller

Definition at line 127 of file cons_quadratic.c.

Referenced by rowprepCleanupScaledown(), and rowprepCleanupScaleup().

◆ ROWPREP_SCALEUP_MAXMINCOEF

#define ROWPREP_SCALEUP_MAXMINCOEF   (1.0 / SCIPfeastol(scip))

scale up only if min. coef is below this number (before scaling)

Definition at line 128 of file cons_quadratic.c.

Referenced by rowprepCleanupScaleup().

◆ ROWPREP_SCALEUP_MAXMAXCOEF

#define ROWPREP_SCALEUP_MAXMAXCOEF   SCIPgetHugeValue(scip)

scale up only if max. coef will not exceed this number by scaling

Definition at line 129 of file cons_quadratic.c.

Referenced by rowprepCleanupScaleup().

◆ ROWPREP_SCALEUP_MAXSIDE

#define ROWPREP_SCALEUP_MAXSIDE   SCIPgetHugeValue(scip)

scale up only if side will not exceed this number by scaling

Definition at line 130 of file cons_quadratic.c.

Referenced by rowprepCleanupScaleup().

◆ ROWPREP_SCALEDOWN_MINMAXCOEF

#define ROWPREP_SCALEDOWN_MINMAXCOEF   (1.0 / SCIPfeastol(scip))

scale down if max. coef is at least this number (before scaling)

Definition at line 131 of file cons_quadratic.c.

Referenced by rowprepCleanupScaledown().

◆ ROWPREP_SCALEDOWN_MINCOEF

#define ROWPREP_SCALEDOWN_MINCOEF   SCIPfeastol(scip)

scale down only if min. coef does not drop below this number by scaling

Definition at line 132 of file cons_quadratic.c.

Referenced by rowprepCleanupScaledown().

◆ infty2infty

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

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

Typedef Documentation

◆ SCIP_QUADCONSUPGRADE

quadratic constraint update method

Definition at line 230 of file cons_quadratic.c.

◆ BILINESTIMATOR

Definition at line 247 of file cons_quadratic.c.

Function Documentation

◆ conshdlrdataHasUpgrade()

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

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

Referenced by SCIPincludeQuadconsUpgrade().

◆ catchLinearVarEvents()

static SCIP_RETCODE catchLinearVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  linvarpos 
)
static

catches variable bound change events on a linear variable in a quadratic constraint

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
linvarposposition of variable in linear variables array

Definition at line 346 of file cons_quadratic.c.

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

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

◆ dropLinearVarEvents()

static SCIP_RETCODE dropLinearVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  linvarpos 
)
static

drops variable bound change events on a linear variable in a quadratic constraint

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
linvarposposition of variable in linear variables array

Definition at line 411 of file cons_quadratic.c.

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

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

◆ catchQuadVarEvents()

static SCIP_RETCODE catchQuadVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  quadvarpos 
)
static

catches variable bound change events on a quadratic variable in a quadratic constraint

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
quadvarposposition of variable in quadratic variables array

Definition at line 465 of file cons_quadratic.c.

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

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

◆ dropQuadVarEvents()

static SCIP_RETCODE dropQuadVarEvents ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  quadvarpos 
)
static

catches variable bound change events on a quadratic variable in a quadratic constraint

Parameters
scipSCIP data structure
eventhdlrevent handler
consconstraint for which to catch bound change events
quadvarposposition of variable in quadratic variables array

Definition at line 510 of file cons_quadratic.c.

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

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

◆ catchVarEvents()

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

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

Referenced by dropQuadVarEvents(), and SCIP_DECL_CONSENABLE().

◆ dropVarEvents()

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

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

Referenced by catchVarEvents(), and SCIP_DECL_CONSDISABLE().

◆ lockLinearVariable()

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

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

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

◆ unlockLinearVariable()

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

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

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

◆ lockQuadraticVariable()

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

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

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

◆ unlockQuadraticVariable()

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

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

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

◆ consdataUpdateLinearActivity()

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

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

Referenced by propagateBoundsCons(), and unlockQuadraticVariable().

◆ consdataUpdateLinearActivityLbChange()

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

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

Referenced by consdataUpdateLinearActivity(), and SCIP_DECL_EVENTEXEC().

◆ consdataUpdateLinearActivityUbChange()

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

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

Referenced by consdataUpdateLinearActivityLbChange(), and SCIP_DECL_EVENTEXEC().

◆ hasQuadvarHpProperty()

static SCIP_Bool hasQuadvarHpProperty ( SCIP scip,
SCIP_CONSDATA consdata,
int  idx 
)
static

returns whether a quadratic variable domain can be reduced to its lower or upper bound; this is the case if the quadratic variable is in just one single quadratic constraint and (sqrcoef > 0 and LHS = -infinity), or (sqrcoef < 0 and RHS = +infinity) hold

Parameters
scipSCIP data structure
consdataconstraint data
idxindex of quadratic variable

Definition at line 1046 of file cons_quadratic.c.

References NULL, SCIP_Bool, SCIP_DECL_EVENTEXEC(), SCIP_LOCKTYPE_MODEL, SCIP_Real, SCIP_VARTYPE_BINARY, SCIPisInfinity(), SCIPisZero(), SCIPvarGetNLocksDownType(), SCIPvarGetNLocksUpType(), SCIPvarGetObj(), and SCIPvarGetType().

Referenced by consdataUpdateLinearActivityUbChange(), and SCIP_DECL_CONSPRESOL().

◆ SCIP_DECL_EVENTEXEC() [1/2]

◆ consdataEnsureLinearVarsSize()

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

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

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

◆ consdataEnsureQuadVarTermsSize()

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

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

Referenced by addQuadVarTerm(), consdataEnsureLinearVarsSize(), and removeFixedVariables().

◆ consdataEnsureAdjBilinSize()

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

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

Referenced by addBilinearTerm(), consdataEnsureQuadVarTermsSize(), and mergeAndCleanQuadVarTerms().

◆ consdataEnsureBilinSize()

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

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

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

◆ consdataCreateEmpty()

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

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

Referenced by consdataEnsureBilinSize(), and SCIPcreateConsQuadratic().

◆ consdataCreate()

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

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

Referenced by consdataCreateEmpty(), SCIP_DECL_CONSTRANS(), and SCIPcreateConsQuadratic2().

◆ consdataFree()

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

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

Referenced by consdataCreate(), and SCIP_DECL_CONSDELETE().

◆ consdataSortLinearVars()

static void consdataSortLinearVars ( SCIP_CONSDATA consdata)
static

sorts linear part of constraint data

Parameters
consdataquadratic constraint data

Definition at line 1507 of file cons_quadratic.c.

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

Referenced by consdataFree(), and mergeAndCleanLinearVars().

◆ SCIP_DECL_SORTINDCOMP() [1/4]

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

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

Referenced by computeViolations(), consdataFindQuadVarTerm(), consdataSortLinearVars(), and SCIP_DECL_SORTINDCOMP().

◆ consdataSortQuadVarTerms()

static SCIP_RETCODE consdataSortQuadVarTerms ( SCIP scip,
SCIP_CONSDATA consdata 
)
static

◆ consdataFindQuadVarTerm()

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

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

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

◆ SCIP_DECL_SORTINDCOMP() [2/4]

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

References consdataCheckBilinTermsSort(), NULL, SCIP_Bool, and SCIPvarCompare().

◆ consdataCheckBilinTermsSort()

static SCIP_Bool consdataCheckBilinTermsSort ( SCIP_CONSDATA consdata)
static

checks if all bilinear terms are sorted correctly

Definition at line 1722 of file cons_quadratic.c.

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

Referenced by addBilinearTerm(), consdataSortBilinTerms(), mergeAndCleanBilinearTerms(), and SCIP_DECL_SORTINDCOMP().

◆ consdataSortBilinTerms()

static SCIP_RETCODE consdataSortBilinTerms ( SCIP scip,
SCIP_CONSDATA consdata 
)
static

sorting of bilinear terms

Parameters
scipSCIP data structure
consdataquadratic constraint data

Definition at line 1745 of file cons_quadratic.c.

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

Referenced by consdataCheckBilinTermsSort(), and mergeAndCleanBilinearTerms().

◆ consdataMoveLinearVar()

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

References consdataMoveQuadVarTerm(), FALSE, and NULL.

Referenced by consdataSortBilinTerms(), and delLinearCoefPos().

◆ consdataMoveQuadVarTerm()

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

References addLinearCoef(), FALSE, and NULL.

Referenced by consdataMoveLinearVar(), and delQuadVarTermPos().

◆ addLinearCoef()

◆ delLinearCoefPos()

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

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

Referenced by addLinearCoef(), mergeAndCleanLinearVars(), removeFixedVariables(), and SCIPchgLinearCoefQuadratic().

◆ chgLinearCoefPos()

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

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

Referenced by delLinearCoefPos(), mergeAndCleanLinearVars(), presolveDisaggregate(), and SCIPchgLinearCoefQuadratic().

◆ addQuadVarTerm()

◆ delQuadVarTermPos()

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

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

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

◆ replaceQuadVarTermPos()

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

References addBilinearTerm(), 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(), SCIPconsIsEnabled(), SCIPintervalSetEmpty(), SCIPisEQ(), SCIPisInfinity(), SCIPreleaseNlRow(), SCIPreleaseVar(), SCIPvarCompare(), SCIPvarGetLbGlobal(), SCIPvarGetUbGlobal(), SCIPvarIsActive(), SCIP_QuadVarTerm::sqrcoef, unlockQuadraticVariable(), SCIP_QuadVarTerm::var, SCIP_BilinTerm::var1, and SCIP_BilinTerm::var2.

Referenced by delQuadVarTermPos(), and removeFixedVariables().

◆ addBilinearTerm()

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

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

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

◆ removeBilinearTermsPos()

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

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

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

◆ mergeAndCleanQuadVarTerms()

static SCIP_RETCODE mergeAndCleanQuadVarTerms ( SCIP scip,
SCIP_CONS cons 
)
static

merges quad var terms that correspond to the same variable and does additional cleanup

If a quadratic variable terms is actually linear, makes a linear term out of it also replaces squares of binary variables by the binary variables, i.e., adds sqrcoef to lincoef.

Parameters
scipSCIP data structure
consquadratic constraint

Definition at line 2680 of file cons_quadratic.c.

References addLinearCoef(), SCIP_QuadVarTerm::adjbilin, BMScopyMemoryArray, consdataEnsureAdjBilinSize(), consdataSortQuadVarTerms(), delQuadVarTermPos(), SCIP_QuadVarTerm::lincoef, mergeAndCleanLinearVars(), SCIP_QuadVarTerm::nadjbilin, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPdebugMsg, SCIPintervalSetEmpty(), SCIPisZero(), SCIPreleaseNlRow(), SCIPvarGetName(), SCIPvarIsBinary(), SCIP_QuadVarTerm::sqrcoef, TRUE, and SCIP_QuadVarTerm::var.

Referenced by presolveDisaggregate(), removeBilinearTermsPos(), removeFixedVariables(), SCIP_DECL_CONSENABLE(), SCIP_DECL_CONSEXITPRE(), and SCIP_DECL_CONSPRESOL().

◆ mergeAndCleanLinearVars()

static SCIP_RETCODE mergeAndCleanLinearVars ( SCIP scip,
SCIP_CONS cons 
)
static

merges entries with same linear variable into one entry and cleans up entries with coefficient 0.0

Parameters
scipSCIP data structure
consquadratic constraint

Definition at line 2777 of file cons_quadratic.c.

References chgLinearCoefPos(), consdataFindQuadVarTerm(), consdataSortLinearVars(), delLinearCoefPos(), mergeAndCleanBilinearTerms(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPintervalSetEmpty(), SCIPisZero(), and TRUE.

Referenced by mergeAndCleanQuadVarTerms(), removeFixedVariables(), SCIP_DECL_CONSENABLE(), SCIP_DECL_CONSEXITPRE(), and SCIP_DECL_CONSPRESOL().

◆ mergeAndCleanBilinearTerms()

static SCIP_RETCODE mergeAndCleanBilinearTerms ( SCIP scip,
SCIP_CONS cons 
)
static

◆ removeFixedVariables()

◆ createNlRow()

◆ presolveSolve()

static SCIP_RETCODE presolveSolve ( SCIP scip,
SCIP_CONS cons,
SCIP_RESULT result,
SCIP_Bool redundant,
int *  naggrvars 
)
static

solve constraint as presolving

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

References a, b, FALSE, NULL, presolveTryAddAND(), SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_Real, SCIP_SUCCESS, SCIPaggregateVars(), SCIPconsGetData(), SCIPdebugMsg, SCIPisEQ(), SCIPisZero(), SCIPvarGetName(), SCIPvarIsBinary(), TRUE, x, and y.

Referenced by createNlRow(), and SCIP_DECL_CONSPRESOL().

◆ presolveTryAddAND()

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

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

Referenced by presolveSolve(), and SCIP_DECL_CONSPRESOL().

◆ getImpliedBounds()

static SCIP_RETCODE getImpliedBounds ( SCIP scip,
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
scipSCIP data structure
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 3574 of file cons_quadratic.c.

References FALSE, SCIP_Interval::inf, MAX, MIN, NULL, presolveTryAddLinearReform(), SCIP_BOUNDTYPE_LOWER, SCIP_OKAY, SCIP_Real, SCIPhaveVarsCommonClique(), SCIPintervalSetBounds(), SCIPsortedvecFindPtr(), SCIPvarGetImplBounds(), SCIPvarGetImplTypes(), SCIPvarGetImplVars(), SCIPvarGetLbGlobal(), SCIPvarGetNImpls(), SCIPvarGetUbGlobal(), SCIPvarIsActive(), SCIPvarIsBinary(), SCIP_Interval::sup, and TRUE.

Referenced by presolveDisaggregate(), presolveTryAddAND(), and presolveTryAddLinearReform().

◆ 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 3665 of file cons_quadratic.c.

References ABS, addLinearCoef(), FALSE, getImpliedBounds(), SCIP_Interval::inf, MAX, MAXDNOM, MIN, NULL, presolveUpgrade(), 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(), SCIPconsIsDynamic(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsAnd(), SCIPcreateConsLinear(), SCIPcreateConsVarbound(), SCIPcreateVar(), SCIPdebugAddSolVal, SCIPdebugGetSolVal, SCIPdebugMsg, SCIPdebugPrintCons, SCIPfeastol(), SCIPfreeBufferArrayNull, SCIPgetNBinVars(), 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, TRUE, and y.

Referenced by getImpliedBounds(), and SCIP_DECL_CONSPRESOL().

◆ presolveUpgrade()

static SCIP_RETCODE presolveUpgrade ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_Bool upgraded,
int *  nupgdconss,
int *  naddconss,
SCIP_PRESOLTIMING  presoltiming 
)
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
presoltimingcurrent presolving timing

Definition at line 4111 of file cons_quadratic.c.

References FALSE, NULL, presolveDisaggregateMarkComponent(), 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(), SCIPdebugMsg, SCIPdebugMsgPrint, SCIPdebugPrintCons, SCIPdelCons(), SCIPerrorMessage, SCIPfreeBufferArray, SCIPisIntegral(), SCIPisRelEQ(), SCIPisZero(), SCIPreallocBufferArray, SCIPreleaseCons(), SCIPvarGetLbLocal(), SCIPvarGetType(), SCIPvarGetUbLocal(), and TRUE.

Referenced by presolveTryAddLinearReform(), and SCIP_DECL_CONSPRESOL().

◆ presolveDisaggregateMarkComponent()

static SCIP_RETCODE presolveDisaggregateMarkComponent ( SCIP scip,
SCIP_CONSDATA consdata,
int  quadvaridx,
SCIP_HASHMAP var2component,
int  componentnr,
int *  componentsize 
)
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
componentsizebuffer to store size of component (incremented by 1)

Definition at line 4327 of file cons_quadratic.c.

References SCIP_QuadVarTerm::adjbilin, consdataFindQuadVarTerm(), SCIP_QuadVarTerm::nadjbilin, NULL, presolveDisaggregateMergeComponents(), SCIP_CALL, SCIP_OKAY, SCIPhashmapExists(), SCIPhashmapGetImageInt(), SCIPhashmapInsertInt(), and SCIP_QuadVarTerm::var.

Referenced by presolveDisaggregate(), and presolveUpgrade().

◆ presolveDisaggregateMergeComponents()

static SCIP_RETCODE presolveDisaggregateMergeComponents ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_HASHMAP var2component,
int  nvars,
int *  ncomponents,
int *  componentssize 
)
static

merges components in variables connectivity graph

Parameters
scipSCIP data structure
conshdlrconstraint handler data structure
var2componentvariables to component mapping
nvarsnumber of variables
ncomponentsnumber of components
componentssizesize of components

Definition at line 4375 of file cons_quadratic.c.

References nextPowerOf2(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_PARAMETERWRONGVAL, SCIP_Real, SCIPallocBufferArray, SCIPconshdlrGetData(), SCIPdebugMsg, SCIPerrorMessage, SCIPfreeBufferArray, SCIPgetProbName(), SCIPhashmapEntryGetImage(), SCIPhashmapEntrySetImage(), SCIPhashmapGetEntry(), SCIPhashmapGetNEntries(), SCIPsortDownIntInt(), and SCIPsortIntInt().

Referenced by presolveDisaggregate(), and presolveDisaggregateMarkComponent().

◆ nextPowerOf2()

static unsigned int nextPowerOf2 ( unsigned int  v)
static

compute the next highest power of 2 for a 32-bit argument

Source: https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2

Note
Returns 0 for v=0.
Parameters
vinput

Definition at line 4523 of file cons_quadratic.c.

References presolveDisaggregate().

Referenced by presolveDisaggregate(), and presolveDisaggregateMergeComponents().

◆ presolveDisaggregate()

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

for quadratic constraints that consists of a sum of quadratic terms, disaggregates the sum into a set of constraints by introducing auxiliary variables

Assume the quadratic constraint can be written in the form lhs <= b'x + sum_{k=1..p} q_k(x_k) <= rhs where x_k denotes a subset of the variables in x and these subsets are pairwise disjunct and q_k(.) is a quadratic form. p is selected as large as possible, but to be <= conshdlrdata->maxdisaggrsize.

Without additional scaling, the constraint is disaggregated into lhs <= b'x + sum_k c_k z_k <= rhs c_k z_k ~ q_k(x) where "~" is either "<=", "==", or ">=", depending on whether lhs or rhs are infinite. Further, c_k is chosen to be the maximal absolute value of the coefficients of the quadratic terms in q_k(x). This is done to ensure that z_k takes values with a similar magnitute as the variables in x_k (better for separation).

However, a solution of this disaggregated system can violate the original constraint by (p+1)*epsilon (assuming unscaled violations are used, which is the default). Therefore, all constraints are scaled by p+1: (p+1)*lhs <= (p+1)*b'x + (p+1) * sum_k c_k z_k <= (p+1) * rhs (p+1)*c_k z_k ~ (p+1)*q_k(x)

Parameters
scipSCIP data structure
conshdlrconstraint handler data structure
conssource constraint to try to convert
naddconsspointer to counter of added constraints

Definition at line 4561 of file cons_quadratic.c.

References ABS, addLinearCoef(), checkCurvatureEasy(), chgLinearCoefPos(), consdataEnsureLinearVarsSize(), consdataSortQuadVarTerms(), delQuadVarTermPos(), FALSE, getImpliedBounds(), SCIP_Interval::inf, mergeAndCleanBilinearTerms(), mergeAndCleanQuadVarTerms(), nextPowerOf2(), NULL, presolveDisaggregateMarkComponent(), presolveDisaggregateMergeComponents(), REALABS, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIPaddBilinTermQuadratic(), SCIPaddCons(), SCIPaddLinearVarQuadratic(), SCIPaddQuadVarLinearCoefQuadratic(), SCIPaddQuadVarQuadratic(), SCIPaddVar(), SCIPallocBufferArray, SCIPallocClearBufferArray, SCIPblkmem(), SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsDynamic(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPcreateConsQuadratic2(), SCIPcreateVar(), SCIPdebugAddSolVal, SCIPdebugGetSolVal, SCIPdebugMsg, SCIPdebugPrintCons, SCIPfreeBlockMemoryArray, SCIPfreeBufferArray, SCIPhashmapCreate(), SCIPhashmapExists(), SCIPhashmapFree(), SCIPhashmapGetImageInt(), SCIPinfinity(), SCIPisInfinity(), SCIPisZero(), SCIPreleaseCons(), SCIPreleaseNlRow(), SCIPreleaseVar(), SCIPsnprintf(), SCIPvarGetName(), SCIPvarGetNImpls(), SCIPvarIsActive(), SCIPvarIsBinary(), SCIP_Interval::sup, TRUE, x, and y.

Referenced by nextPowerOf2(), and SCIP_DECL_CONSPRESOL().

◆ checkCurvatureEasy()

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

References checkCurvature(), FALSE, NULL, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPinfinity(), SCIPisInfinity(), SCIPisNegative(), SCIPisPositive(), and TRUE.

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

◆ checkCurvature()

◆ checkFactorable()

◆ computeViolation()

static SCIP_RETCODE computeViolation ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_Bool solviolbounds 
)
static

computes activity and violation of a constraint

If solution violates bounds by more than feastol, the violation is still computed, but *solviolbounds is set to TRUE

Parameters
scipSCIP data structure
consconstraint
solsolution or NULL if LP solution should be used
solviolboundsbuffer to store whether quadratic variables in solution are outside their bounds by more than feastol

Definition at line 5431 of file cons_quadratic.c.

References computeViolations(), FALSE, MAX, MIN, NULL, REALABS, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasGE(), SCIPisFeasLE(), SCIPisInfinity(), SCIPrelDiff(), SCIPupdateSolConsViolation(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by checkFactorable(), computeViolations(), proposeFeasibleSolution(), SCIP_DECL_CONSCHECK(), SCIPgetActivityQuadratic(), SCIPgetFeasibilityQuadratic(), and SCIPgetViolationQuadratic().

◆ computeViolations()

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

computes violation of a set of constraints

Parameters
scipSCIP data structure
conssconstraints
nconssnumber of constraints
solsolution or NULL if LP solution should be used
solviolboundsbuffer to store whether quadratic variables in solution are outside their bounds by more than feastol in some constraint
maxviolconbuffer to store constraint with largest violation, or NULL if solution is feasible

Definition at line 5617 of file cons_quadratic.c.

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

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

◆ SCIP_DECL_SORTINDCOMP() [3/4]

static SCIP_DECL_SORTINDCOMP ( bilinTermComp2  )
static

index comparison method for bilinear terms

Definition at line 5667 of file cons_quadratic.c.

References NULL, SCIP_DECL_SORTINDCOMP(), and SCIPvarCompare().

◆ SCIP_DECL_SORTINDCOMP() [4/4]

static SCIP_DECL_SORTINDCOMP ( bilinTermCompVolume  )
static

volume comparison method for bilinear terms; prioritizes bilinear products with a larger volume

Definition at line 5683 of file cons_quadratic.c.

References NULL, SCIP_Real, SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and sortAllBilinTerms().

◆ sortAllBilinTerms()

static SCIP_RETCODE sortAllBilinTerms ( SCIP scip,
SCIP_BILINTERM bilinterms,
int  nbilinterms,
SCIP_CONS **  bilinconss,
int *  bilinposs 
)
static

helper function to sort all bilinear terms in the constraint handler data

Parameters
scipSCIP data structure
bilintermsarray containing all bilinear terms
nbilintermstotal number of bilinear terms
bilinconssarray for mapping each term to its constraint
bilinpossarray for mapping each term to its position in the corresponding bilinconss constraint

Definition at line 5705 of file cons_quadratic.c.

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

Referenced by SCIP_DECL_SORTINDCOMP(), and storeAllBilinearTerms().

◆ storeAllBilinearTerms()

static SCIP_RETCODE storeAllBilinearTerms ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_CONS **  conss,
int  nconss 
)
static

stores all bilinear terms in the quadratic constraint handler data; in addition, for each bilinear term we store the number of nonconvex constraints that require to over- or underestimate this term, which only depends on the lhs, rhs, and the bilinear coefficient

Parameters
scipSCIP data structure
conshdlrdataconstraint handler data
conssconstraints to process
nconssnumber of constraints

Definition at line 5776 of file cons_quadratic.c.

References freeAllBilinearTerms(), MAX, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPallocBufferArray, SCIPallocClearBlockMemoryArray, SCIPconsGetData(), SCIPfreeBufferArray, SCIPgetDepth(), SCIPgetSubscipDepth(), SCIPinDive(), SCIPinProbing(), SCIPisInfinity(), SCIPisNegative(), SCIPisPositive(), sortAllBilinTerms(), TRUE, and x.

Referenced by SCIP_DECL_CONSINITLP(), and sortAllBilinTerms().

◆ freeAllBilinearTerms()

static SCIP_RETCODE freeAllBilinearTerms ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_CONS **  conss,
int  nconss 
)
static

frees memory allocated in storeAllBilinearTerms()

Parameters
scipSCIP data structure
conshdlrdataconstraint handler data
conssconstraints to process
nconssnumber of constraints

Definition at line 5963 of file cons_quadratic.c.

References FALSE, generateCutFactorableDo(), NULL, SCIP_OKAY, SCIPconsGetData(), and SCIPfreeBlockMemoryArrayNull.

Referenced by SCIP_DECL_CONSEXITSOL(), and storeAllBilinearTerms().

◆ generateCutFactorableDo()

static SCIP_RETCODE 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_ROWPREP rowprep,
SCIP_Bool success 
)
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
rowpreprowprep to store cut coefs and constant
successbuffer to indicate whether a cut was successfully computed

Definition at line 5993 of file cons_quadratic.c.

References FALSE, generateCutFactorable(), SCIP_RowPrep::local, SCIP_RowPrep::name, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_RIGHT, SCIPaddRowprepConstant(), SCIPaddRowprepTerm(), SCIPconsGetData(), SCIPconsGetName(), SCIPgetNLPs(), SCIPisFeasLE(), SCIPisInfinity(), SCIPisZero(), SCIPsnprintf(), SCIP_RowPrep::sidetype, and TRUE.

Referenced by freeAllBilinearTerms(), and generateCutFactorable().

◆ generateCutFactorable()

static SCIP_RETCODE generateCutFactorable ( SCIP scip,
SCIP_CONS cons,
SCIP_SIDETYPE  violside,
SCIP_Real ref,
SCIP_ROWPREP rowprep,
SCIP_Bool success 
)
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
rowprepdata structure to store cut coefficients
successbuffer to indicate whether a cut was successfully computed

Definition at line 6107 of file cons_quadratic.c.

References FALSE, generateCutFactorableDo(), generateCutLTIfindIntersection(), SCIP_RowPrep::local, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_RIGHT, SCIPconsGetData(), SCIPgetDepth(), SCIPinfinity(), SCIPisFeasNegative(), SCIPisFeasPositive(), SCIPisInfinity(), SCIPisZero(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetUbGlobal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by generateCut(), and generateCutFactorableDo().

◆ generateCutLTIfindIntersection()

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

◆ generateCutLTIgenMulCoeff()

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

generate coefficients for a plane through points (x1, y1_, x1*y1) and (x2, y2, x2*y2) such that intersecting it with one of them (the first if whichuse is FALSE, the second otherwise) gives a tangent to the curve x*y = k

Returns TRUE on error and FALSE on success.

Definition at line 6555 of file cons_quadratic.c.

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

Referenced by generateCutLTIcomputeCoefs(), and generateCutLTIfindIntersection().

◆ 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 6613 of file cons_quadratic.c.

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

Referenced by generateCutLTI(), and generateCutLTIgenMulCoeff().

◆ generateCutLTI()

static SCIP_RETCODE generateCutLTI ( SCIP scip,
SCIP_CONS cons,
SCIP_SIDETYPE  violside,
SCIP_Real ref,
SCIP_SOL sol,
SCIP_ROWPREP rowprep,
SCIP_Bool success 
)
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
rowpreprowprep to store cut data
successbuffer to indicate whether a cut was successfully computed

Definition at line 6972 of file cons_quadratic.c.

References FALSE, generateCutConvex(), generateCutLTIcomputeCoefs(), SCIP_RowPrep::local, SCIP_RowPrep::name, NULL, REALABS, SCIP_CALL, SCIP_LPSOLSTAT_OPTIMAL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIPaddRowprepConstant(), SCIPaddRowprepSide(), SCIPaddRowprepTerm(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPgetLPSolstat(), SCIPgetNLPs(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasNegative(), SCIPisFeasPositive(), SCIPisInfinity(), SCIPisRelEQ(), SCIPsnprintf(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), SCIP_RowPrep::sidetype, and TRUE.

Referenced by generateCut(), and generateCutLTIcomputeCoefs().

◆ generateCutConvex()

static SCIP_RETCODE generateCutConvex ( SCIP scip,
SCIP_CONS cons,
SCIP_SIDETYPE  violside,
SCIP_Real ref,
SCIP_ROWPREP rowprep,
SCIP_Bool success 
)
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
rowpreprowprep to store cut data
successbuffer to indicate whether a cut was successfully computed

Definition at line 7236 of file cons_quadratic.c.

References SCIP_BilinTerm::coef, SCIP_RowPrep::name, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_VARTYPE_CONTINUOUS, SCIPaddBilinLinearization(), SCIPaddRowprepConstant(), SCIPaddRowprepSide(), SCIPaddRowprepTerm(), SCIPaddSquareLinearization(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPgetNLPs(), SCIPsnprintf(), SCIPvarGetType(), SCIP_RowPrep::sidetype, TRUE, updateBilinearRelaxation(), SCIP_BilinTerm::var1, and SCIP_BilinTerm::var2.

Referenced by generateCut(), and generateCutLTI().

◆ updateBilinearRelaxation()

static void updateBilinearRelaxation ( SCIP scip,
SCIP_VAR *RESTRICT  x,
SCIP_VAR *RESTRICT  y,
SCIP_Real  bilincoef,
SCIP_SIDETYPE  violside,
SCIP_Real  refx,
SCIP_Real  refy,
SCIP_Real *RESTRICT  ineqs,
int  nineqs,
SCIP_Real  mccormickval,
SCIP_Real *RESTRICT  bestcoefx,
SCIP_Real *RESTRICT  bestcoefy,
SCIP_Real *RESTRICT  bestconst,
SCIP_Real *RESTRICT  bestval,
SCIP_Bool success 
)
static

helper function to update the best relaxation for a bilinear term when using valid linear inequalities

Parameters
scipSCIP data structure
xfirst variable
ysecond variable
bilincoefcoefficient of the bilinear term
violsideside of quadratic constraint that is violated
refxreference point for the x variable
refyreference point for the y variable
ineqscoefficients of each linear inequality; stored as triple (xcoef,ycoef,constant)
nineqstotal number of inequalities
mccormickvalvalue of the McCormick relaxation at the reference point
bestcoefxpointer to update the x coefficient
bestcoefypointer to update the y coefficient
bestconstpointer to update the constant
bestvalvalue of the best relaxation that have been found so far
successbuffer to store whether we found a better relaxation

Definition at line 7321 of file cons_quadratic.c.

References getInteriority(), MAX, NULL, REALABS, SCIP_Bool, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIPcomputeBilinEnvelope1(), SCIPcomputeBilinEnvelope2(), SCIPdebugMsg, SCIPisFeasGE(), SCIPisFeasLE(), SCIPisRelGT(), SCIPisRelLT(), SCIPisZero(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by generateCutConvex(), and generateCutNonConvex().

◆ getInteriority()

static SCIP_Real getInteriority ( SCIP scip,
SCIP_Real  lbx,
SCIP_Real  ubx,
SCIP_Real  refx,
SCIP_Real  lby,
SCIP_Real  uby,
SCIP_Real  refy 
)
static
Parameters
scipSCIP data structure
lbxlower bound of the first variable
ubxupper bound of the first variable
refxreference point of the first variable
lbylower bound of the second variable
ubyupper bound of the second variable
refyreference point of the second variable

Definition at line 7436 of file cons_quadratic.c.

References generateCutNonConvex(), MAX, MIN, SCIP_Real, and SCIPepsilon().

Referenced by generateCutNonConvex(), and updateBilinearRelaxation().

◆ generateCutNonConvex()

static SCIP_RETCODE generateCutNonConvex ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_CONS cons,
SCIP_SIDETYPE  violside,
SCIP_Real ref,
SCIP_ROWPREP rowprep,
SCIP_Bool success 
)
static

◆ 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

Definition at line 7653 of file cons_quadratic.c.

References checkCurvature(), SCIP_RowPrep::coefs, computeED(), FALSE, generateCutConvex(), generateCutFactorable(), generateCutLTI(), generateCutNonConvex(), NULL, SCIP_RowPrep::nvars, REALABS, SCIP_Bool, SCIP_CALL, SCIP_LPSOLSTAT_OPTIMAL, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPaddRowprepTerms(), SCIPcleanupRowprep(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsLocal(), SCIPcreateRowprep(), SCIPdebugMsg, SCIPfreeRowprep(), SCIPgetLPSolstat(), SCIPgetRowprepRowCons(), SCIPgetRowprepViolation(), SCIPisInfinity(), SCIPmergeRowprepTerms(), SCIProwGetLhs(), SCIProwGetName(), SCIProwGetNNonz(), SCIProwGetRhs(), and SCIP_RowPrep::side.

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

◆ computeED()

static SCIP_RETCODE computeED ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons 
)
static

computes eigen decomposition of A, where \( f(x) = x^T A x + b^T x \).

The eigen decomposition is given by A = P D P^T, where D is diagonal formed by the eigenvalues and P is orthonormal whose columns are the eigenvectors; we also compute b^T * P, in case one needs the change of variables P^T x = y <=> x = P y We store P^T in an array, specifically, in consdata->eigenvectors we store P^T row-wise, i.e., the first row of P^T is stored in eigenvector[0..n-1], the second row is stored in eigenvectors[n..2n-1], etc; equivalently, the first eigenvector is eigenvector[0..n-1], the second one is eigenvectors[n..2n-1], etc.

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint

Definition at line 7796 of file cons_quadratic.c.

References BMSclearMemoryArray, computeInteriorPoint(), FALSE, LapackDsyev(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBlockMemoryArray, SCIPallocClearBlockMemoryArray, SCIPblkmem(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPhashmapCreate(), SCIPhashmapExists(), SCIPhashmapFree(), SCIPhashmapGetImageInt(), SCIPhashmapInsertInt(), SCIPisInfinity(), SCIPisIpoptAvailableIpopt(), and TRUE.

Referenced by generateCut(), and SCIP_DECL_CONSINITSOL().

◆ computeInteriorPoint()

static SCIP_RETCODE computeInteriorPoint ( SCIP scip,
SCIP_CONS cons,
char  method,
SCIP_Bool success 
)
static

computes an interior point for the quadratic part of the convex constraint

There are different methods for computing the interior point

  • 'a'ny: solves min 0, f(x) <= rhs, x in bounds
  • 'm'ost interior: solves min f(x), x in bounds
Parameters
scipSCIP data structure
consconstraint
methodmethod for computing interior point ('a' any point, 'm'ost interior)
successbuffer to store if an interior point was found

Definition at line 7948 of file cons_quadratic.c.

References SCIP_QuadElement::coef, computeGauge(), createNlRow(), FALSE, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, INTERIOR_EPS, MAX, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_MAXSTRLEN, SCIP_NLPPAR_FEASTOL, SCIP_NLPPAR_RELOBJTOL, SCIP_NLPPAR_VERBLEVEL, SCIP_NLPSOLSTAT_FEASIBLE, SCIP_NLPSOLSTAT_GLOBINFEASIBLE, SCIP_NLPSOLSTAT_GLOBOPT, SCIP_NLPSOLSTAT_LOCINFEASIBLE, SCIP_NLPSOLSTAT_LOCOPT, SCIP_NLPSOLSTAT_UNBOUNDED, SCIP_NLPSOLSTAT_UNKNOWN, SCIP_NLPTERMSTAT_OKAY, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPallocBlockMemoryArray, SCIPallocBufferArray, SCIPallocClearBlockMemoryArray, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPdualfeastol(), SCIPerrorMessage, SCIPfeastol(), SCIPfreeBufferArrayNull, SCIPgetNlpis(), SCIPgetNNlpis(), SCIPgetProbName(), SCIPinfinity(), SCIPinfoMessage(), SCIPisFeasZero(), SCIPisGE(), SCIPisInfinity(), SCIPisLE(), SCIPnlpiAddConstraints(), SCIPnlpiAddVars(), SCIPnlpiCreateProblem(), SCIPnlpiFreeProblem(), SCIPnlpiGetSolstat(), SCIPnlpiGetSolution(), SCIPnlpiGetTermstat(), SCIPnlpiSetIntPar(), SCIPnlpiSetObjective(), SCIPnlpiSetRealPar(), SCIPnlpiSolve(), SCIPnlrowGetNQuadElems(), SCIPnlrowGetQuadElems(), SCIPnlrowGetQuadVars(), SCIPprintCons(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by computeED(), and computeGauge().

◆ computeGauge()

static SCIP_RETCODE computeGauge ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons 
)
static

compute gauge function of the set \(S - s_0\) where \( S = \{ x : f(x) \le c \}\) and \( s_0 \in \mathring S\).

Here, \( f(x) \) is a purely quadratic (i.e, all \(x\) variables appear in a bilinear or quadratic term). Explicitly, \( f(x) = \pm x^T A x \pm b^T x \) depending whether \(A\) is positive semidefinite (+) or negative semidefinite (-). The constant \(c\) is rhs - maximum activity of the purely linear part of the constraint if \(A \succeq 0\) and minimum activity - lhs if \(A \preceq 0\). This is computed only at INITSOL.

The method does:

  1. compute interior point
  2. compute gauge function
Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint

Definition at line 8327 of file cons_quadratic.c.

References SCIP_QuadVarTerm::adjbilin, SCIP_BilinTerm::coef, computeInteriorPoint(), evaluateGauge(), FALSE, SCIP_QuadVarTerm::lincoef, SCIP_QuadVarTerm::nadjbilin, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocClearBlockMemoryArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPdebugMsg, SCIPisInfinity(), SCIPvarGetName(), SCIP_QuadVarTerm::sqrcoef, TRUE, SCIP_QuadVarTerm::var, SCIP_BilinTerm::var1, and SCIP_BilinTerm::var2.

Referenced by computeInteriorPoint(), and SCIP_DECL_CONSINITSOL().

◆ evaluateGauge()

static SCIP_RETCODE evaluateGauge ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_SOL refsol,
SCIP_Real gaugeval,
SCIP_Bool success 
)
static

evaluates gauge function of the set \(S - s_0\) where \( S = \{ x : f(x) \le c \}\) and \( s_0 \in \mathring S\).

\( S = \{ x : f(x) \le c \}\) at \(sol - s_0\); see computeGauge() for more details

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint
refsolreference point where to generate cut, or NULL if sol should be used
gaugevalbuffer to store the value of the gauge function
successbuffer to store if evaluation was successful

Definition at line 8464 of file cons_quadratic.c.

References computeReferencePointProjection(), FALSE, NULL, SCIP_Bool, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPgetSolVal(), SCIPisGE(), SCIPisInfinity(), SCIPisLE(), SCIPisNegative(), SCIPisPositive(), SCIPisZero(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), sqrt(), and TRUE.

Referenced by computeGauge(), and computeReferencePointGauge().

◆ computeReferencePointProjection()

static SCIP_RETCODE computeReferencePointProjection ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_SOL refsol,
SCIP_Real ref 
)
static

compute projection of refsol onto feasible region of cons; stores the projection in ref

This method solves

\[ \min \{ ||x - \bar x||^2 : x^T A x + 2 b^T x \le c \} \]

where \( \bar x \) is refsol. Note that \( \bar x \) is not feasible, so the optimal solution actually satisfies

\[ \min \{ ||x - \bar x||^2 : x^T A x + 2 b^T x = c \} \]

Using the eigendecomposition \( A = P D P^T \), the change of variables \( y = P^T x \) and the optimality conditions, this reduces to finding \( \rho \) such that

\[ y(\rho) = (I + \rho D)^{-1} (\bar y - \rho \bar b) \]

makes the constraint active. In the previous formula, \( \bar y = P^T \bar x\) and \( \bar b = P^T b \). If \( D \neq 0 \), the function

\[ \varphi(\rho) := y(\rho)^T D y(\rho) + 2 \bar b^T y(\rho) - c \]

is strictly convex. So this method actually computes the unique 0 of this function using Newton's method.

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint
refsolthe given point to project, or NULL if LP solution should be used
refarray to store reference point

Definition at line 8656 of file cons_quadratic.c.

References computeReferencePointGauge(), MAX, MIN, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPallocClearBufferArray, SCIPconsGetData(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPgetSolVal(), SCIPisInfinity(), SCIPvarGetLbLocal(), SCIPvarGetName(), and SCIPvarGetUbLocal().

Referenced by evaluateGauge(), and generateCutSol().

◆ computeReferencePointGauge()

static SCIP_RETCODE computeReferencePointGauge ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_SOL refsol,
SCIP_Real ref,
SCIP_Bool success 
)
static

compute reference point suggested by gauge function

Parameters
scipSCIP data structure
conshdlrconstraint handler
consconstraint
refsolreference point where to compute gauge, or NULL if LP solution should be used
refarray to store reference point
successbuffer to store whether we succeeded computing reference point

Definition at line 8848 of file cons_quadratic.c.

References evaluateGauge(), FALSE, GAUGESCALE, generateCutSol(), MAX, MIN, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPgetSolVal(), SCIPisFeasLE(), SCIPisInfinity(), SCIPvarGetLbLocal(), SCIPvarGetName(), and SCIPvarGetUbLocal().

Referenced by computeReferencePointProjection(), and generateCutSol().

◆ generateCutSol()

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,
char  mode 
)
static

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

Note
mode indicates whether we should modify the point we want to cutoff (sol) via gauge or projection, or if just normal linearization should be use, or the default way (whatever is specified via settings)
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
modemode of execution 'g'auge, 'p'rojection, 'l'inearization gradient, 'd'efault

Definition at line 8954 of file cons_quadratic.c.

References computeReferencePointGauge(), computeReferencePointProjection(), FALSE, generateCut(), generateCutUnboundedLP(), MAX, MIN, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPallocBufferArray, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPdebugMessage, SCIPdebugMsg, SCIPfreeBufferArray, SCIPgetSolVal(), SCIPisCutApplicable(), SCIPisGT(), SCIPisInfinity(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.

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

◆ generateCutUnboundedLP()

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

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

Referenced by generateCutSol(), and separatePoint().

◆ processCut()

static SCIP_RETCODE processCut ( SCIP scip,
SCIP_ROW **  row,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons,
SCIP_Real  efficacy,
SCIP_Real  minefficacy,
SCIP_Bool  inenforcement,
SCIP_Real bestefficacy,
SCIP_RESULT result 
)
static

processes a cut for constraint cons, i.e., checks numerics and possibly adds cut to sepastore

Parameters
scipSCIP data structure
rowcut to process
conshdlrquadratic constraints handler
consconstraint
efficacyefficacy of row in reference solution
minefficacyminimal efficacy
inenforcementwhether we are in constraint enforcement
bestefficacybuffer to store best efficacy of a cut that was added to the LP, if found; or NULL if not of interest
resultresult of separation

Definition at line 9239 of file cons_quadratic.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_OKAY, SCIP_SEPARATED, SCIPaddRow(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPdebugMessage, SCIPisCutApplicable(), SCIPisGT(), SCIPmarkRowNotRemovableLocal(), SCIPreleaseRow(), SCIPresetConsAge(), and separatePoint().

Referenced by generateCutUnboundedLP(), and separatePoint().

◆ 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 9305 of file cons_quadratic.c.

References addLinearizationCuts(), generateCutSol(), generateCutUnboundedLP(), NULL, processCut(), SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_FEASIBLE, SCIP_LPSOLSTAT_UNBOUNDEDRAY, SCIP_OKAY, SCIP_Real, SCIP_SEPARATED, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPfeastol(), SCIPgetLPSolstat(), SCIPisGT(), SCIPisInfinity(), SCIPisNegative(), SCIPisPositive(), SCIProwGetLhs(), and SCIProwGetRhs().

Referenced by enforceConstraint(), processCut(), SCIP_DECL_CONSSEPALP(), and SCIP_DECL_CONSSEPASOL().

◆ addLinearizationCuts()

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

References checkCurvature(), FALSE, generateCutSol(), NULL, SCIP_Bool, SCIP_CALL, SCIP_DECL_EVENTEXEC(), SCIP_OKAY, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPaddPoolCut(), SCIPaddRow(), SCIPconsGetData(), SCIPconshdlrGetData(), SCIPconsIsEnabled(), SCIPconsIsLocal(), SCIPdebugMsg, SCIPgetRowLPFeasibility(), SCIPinfinity(), SCIPisInfinity(), SCIPreleaseRow(), SCIProwGetName(), SCIProwIsLocal(), and TRUE.

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

◆ SCIP_DECL_EVENTEXEC() [2/2]

static SCIP_DECL_EVENTEXEC ( processNewSolutionEvent  )
static

◆ registerBranchingCandidatesGap()

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

registers branching candidates according to convexification gap rule

That is, computes for every nonconvex term the gap between the terms value in the LP solution and the value of the underestimator as it would be (and maybe has been) constructed by the separation routines of this constraint handler. Then it registers all variables occurring in each term with the computed gap. If variables appear in more than one term, they are registered several times.

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to check
nconssnumber of constraints to check
solsolution to enforce (NULL for the LP solution)
nnotifycounter for number of notifications performed

Definition at line 9551 of file cons_quadratic.c.

References ABS, BilinearEstimator::lastimprfac, MAX, MAX3, MIN, NULL, REALABS, registerBranchingCandidatesViolation(), SCIP_Bool, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPaddExternBranchCand(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPdebugMsg, SCIPfeastol(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasNegative(), SCIPisGE(), SCIPisGT(), SCIPisInfinity(), SCIPisLE(), SCIPisLT(), SCIPisNegative(), SCIPisRelEQ(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), SCIPvarIsBinary(), SCIPvarIsIntegral(), sqrt(), x, BilinearEstimator::x, y, and BilinearEstimator::y.

Referenced by registerBranchingCandidates(), and SCIP_DECL_EVENTEXEC().

◆ registerBranchingCandidatesViolation()

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

registers branching candidates according to constraint violation rule

That is, registers all variables appearing in nonconvex terms^1 with a score that is the violation of the constraint. This is the same rule as is applied in cons_nonlinear and other nonlinear constraint handlers.

1) We mean all quadratic variables that appear either in a nonconvex square term or in a bilinear term, if the constraint itself is nonconvex. (and this under the assumption that the rhs is violated; for violated lhs, swap terms)

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to check
nconssnumber of constraints to check
solsolution to enforce (NULL for the LP solution)
nnotifycounter for number of notifications performed

Definition at line 9790 of file cons_quadratic.c.

References MAX, SCIP_QuadVarTerm::nadjbilin, NULL, registerBranchingCandidatesCentrality(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPaddExternBranchCand(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPfeastol(), SCIPgetSolVal(), SCIPisGE(), SCIPisGT(), SCIPisLE(), SCIPisRelEQ(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), SCIP_QuadVarTerm::sqrcoef, SCIP_QuadVarTerm::var, and x.

Referenced by registerBranchingCandidates(), and registerBranchingCandidatesGap().

◆ registerBranchingCandidatesCentrality()

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

registers branching candidates according to centrality rule

That is, registers all variables appearing in nonconvex terms^1 with a score that is given by the distance of the variable value from its bounds. This rule should not make sense, as the distance to the bounds is also (often) considered by the branching rule later on.

1) We mean all quadratic variables that appear either in a nonconvex square term or in a bilinear term, if the constraint itself is nonconvex. (and this under the assumption that the rhs is violated; for violated lhs, swap terms)

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to check
nconssnumber of constraints to check
solsolution to enforce (NULL for the LP solution)
nnotifycounter for number of notifications performed

Definition at line 9875 of file cons_quadratic.c.

References MAX, MIN, SCIP_QuadVarTerm::nadjbilin, NULL, registerBranchingCandidates(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPaddExternBranchCand(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPfeastol(), SCIPgetSolVal(), SCIPisEQ(), SCIPisGT(), SCIPisInfinity(), SCIPisRelEQ(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), SCIP_QuadVarTerm::sqrcoef, SCIP_QuadVarTerm::var, and x.

Referenced by registerBranchingCandidates(), and registerBranchingCandidatesViolation().

◆ registerBranchingCandidates()

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

registers branching candidates

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to check
nconssnumber of constraints to check
solsolution to enforce (NULL for the LP solution)
nnotifycounter for number of notifications performed

Definition at line 9963 of file cons_quadratic.c.

References NULL, registerBranchingCandidatesCentrality(), registerBranchingCandidatesGap(), registerBranchingCandidatesViolation(), registerLargeRelaxValueVariableForBranching(), SCIP_CALL, SCIP_ERROR, SCIP_OKAY, SCIPABORT, SCIPconshdlrGetData(), and SCIPerrorMessage.

Referenced by enforceConstraint(), and registerBranchingCandidatesCentrality().

◆ registerLargeRelaxValueVariableForBranching()

static SCIP_RETCODE registerLargeRelaxValueVariableForBranching ( SCIP scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_SOL sol,
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
solsolution to enforce (NULL for the LP solution)
brvarbuffer to store branching variable

Definition at line 10003 of file cons_quadratic.c.

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

Referenced by enforceConstraint(), and registerBranchingCandidates().

◆ replaceByLinearConstraints()

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

◆ propagateBoundsTightenVarLb()

static SCIP_RETCODE propagateBoundsTightenVarLb ( SCIP scip,
SCIP_CONS cons,
SCIP_Real  intervalinfty,
SCIP_VAR var,
SCIP_Real  bnd,
SCIP_RESULT result,
int *  nchgbds 
)
static

tightens a lower bound on a variable and checks the result

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

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

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

◆ propagateBoundsTightenVarUb()

static SCIP_RETCODE propagateBoundsTightenVarUb ( SCIP scip,
SCIP_CONS cons,
SCIP_Real  intervalinfty,
SCIP_VAR var,
SCIP_Real  bnd,
SCIP_RESULT result,
int *  nchgbds 
)
static

tightens an upper bound on a variable and checks the result

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

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

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

◆ 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 10386 of file cons_quadratic.c.

References a, infty2infty, MAX, MIN, NULL, propagateBoundsBilinearTerm(), propagateBoundsTightenVarLb(), propagateBoundsTightenVarUb(), SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_Real, SCIP_REDUCEDDOM, SCIPconsGetName(), SCIPdebugMsg, SCIPinfinity(), SCIPintervalAddScalar(), SCIPintervalGetInf(), SCIPintervalGetRoundingMode(), SCIPintervalGetSup(), SCIPintervalIsEmpty(), SCIPintervalIsEntire(), SCIPintervalMulScalar(), SCIPintervalQuad(), SCIPintervalQuadUpperBound(), SCIPintervalSet(), SCIPintervalSetBounds(), SCIPintervalSetRoundingMode(), SCIPintervalSetRoundingModeDownwards(), SCIPintervalSetRoundingModeUpwards(), SCIPintervalSolveUnivariateQuadExpression(), SCIPintervalSub(), SCIPisInfinity(), SCIPresetConsAge(), SCIPvarGetLbLocal(), SCIPvarGetName(), and SCIPvarGetUbLocal().

Referenced by propagateBoundsCons(), and propagateBoundsTightenVarUb().

◆ propagateBoundsBilinearTerm()

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

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

Referenced by propagateBoundsCons(), and propagateBoundsQuadVar().

◆ propagateBoundsGetQuadActivity()

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

References SCIP_Interval::inf, infty2infty, MAX, MIN, NULL, propagateBoundsCons(), 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 propagateBoundsBilinearTerm(), and propagateBoundsCons().

◆ 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 10770 of file cons_quadratic.c.

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

Referenced by propagateBounds(), propagateBoundsGetQuadActivity(), and SCIP_DECL_CONSPRESOL().

◆ propagateBounds()

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

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

Referenced by enforceConstraint(), propagateBoundsCons(), SCIP_DECL_CONSENFOPS(), and SCIP_DECL_CONSPROP().

◆ consdataFindUnlockedLinearVar()

static void consdataFindUnlockedLinearVar ( SCIP scip,
SCIP_CONSDATA consdata 
)
static

checks for a linear variable that can be increase or decreased without harming feasibility

Parameters
scipSCIP data structure
consdataconstraint data

Definition at line 11393 of file cons_quadratic.c.

References proposeFeasibleSolution(), SCIP_LOCKTYPE_MODEL, SCIPdebugMsg, SCIPisInfinity(), SCIPvarGetName(), SCIPvarGetNLocksDownType(), SCIPvarGetNLocksUpType(), and SCIPvarGetObj().

Referenced by propagateBounds(), SCIP_DECL_CONSCHECK(), SCIP_DECL_CONSINITSOL(), SCIPgetLinvarMayDecreaseQuadratic(), and SCIPgetLinvarMayIncreaseQuadratic().

◆ proposeFeasibleSolution()

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

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

Referenced by consdataFindUnlockedLinearVar(), and SCIP_DECL_CONSCHECK().

◆ enforceConstraint()

static SCIP_RETCODE enforceConstraint ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS **  conss,
int  nconss,
int  nusefulconss,
SCIP_SOL sol,
SCIP_Bool  solinfeasible,
SCIP_RESULT result 
)
static

helper function to enforce constraints

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to process
nconssnumber of constraints
nusefulconssnumber of useful (non-obsolete) constraints to process
solsolution to enforce (NULL for the LP solution)
solinfeasiblewas the solution already declared infeasible by a constraint handler?
resultpointer to store the result of the enforcing call

Definition at line 11617 of file cons_quadratic.c.

References computeViolations(), NULL, propagateBounds(), registerBranchingCandidates(), registerLargeRelaxValueVariableForBranching(), replaceByLinearConstraints(), SCIP_Bool, SCIP_BRANCHED, SCIP_CALL, SCIP_CONSADDED, SCIP_CUTOFF, SCIP_DECL_NONLINCONSUPGD(), SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIP_Real, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIP_VERBLEVEL_HIGH, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPcreateChild(), SCIPdebugMsg, SCIPfeastol(), SCIPgetCurrentNode(), SCIPgetSolVal(), SCIPisGT(), SCIPisInfinity(), SCIPisStopped(), SCIPlpfeastol(), SCIPnodeGetEstimate(), SCIPvarGetName(), SCIPverbMessage(), SCIPwarningMessage(), separatePoint(), and TRUE.

Referenced by proposeFeasibleSolution(), SCIP_DECL_CONSENFOLP(), and SCIP_DECL_CONSENFORELAX().

◆ SCIP_DECL_NONLINCONSUPGD()

static SCIP_DECL_NONLINCONSUPGD ( nonlinconsUpgdQuadratic  )
static

tries to upgrade a nonlinear constraint into a quadratic constraint

Definition at line 11826 of file cons_quadratic.c.

References NULL, SCIP_CALL, SCIP_DECL_CONSHDLRCOPY(), 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_USER, 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().

Referenced by enforceConstraint().

◆ SCIP_DECL_CONSHDLRCOPY()

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyQuadratic  )
static

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

Definition at line 12006 of file cons_quadratic.c.

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

Referenced by SCIP_DECL_NONLINCONSUPGD().

◆ SCIP_DECL_CONSFREE()

static SCIP_DECL_CONSFREE ( consFreeQuadratic  )
static

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

Definition at line 12022 of file cons_quadratic.c.

References NULL, SCIP_DECL_CONSINIT(), SCIP_OKAY, SCIPconshdlrGetData(), SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArrayNull.

Referenced by SCIP_DECL_CONSHDLRCOPY().

◆ SCIP_DECL_CONSINIT()

static SCIP_DECL_CONSINIT ( consInitQuadratic  )
static

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

Definition at line 12046 of file cons_quadratic.c.

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

Referenced by SCIP_DECL_CONSFREE().

◆ SCIP_DECL_CONSEXIT()

static SCIP_DECL_CONSEXIT ( consExitQuadratic  )
static

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

Definition at line 12065 of file cons_quadratic.c.

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

Referenced by SCIP_DECL_CONSINIT().

◆ SCIP_DECL_CONSEXITPRE()

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

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

Referenced by SCIP_DECL_CONSEXIT().

◆ SCIP_DECL_CONSINITSOL()

◆ SCIP_DECL_CONSEXITSOL()

static SCIP_DECL_CONSEXITSOL ( consExitsolQuadratic  )
static

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

Note
Also called from consDisableQuadratic during solving stage.

Definition at line 12292 of file cons_quadratic.c.

References CONSHDLR_NAME, freeAllBilinearTerms(), NULL, SCIP_CALL, SCIP_DECL_CONSDELETE(), SCIP_EVENTTYPE_SOLFOUND, SCIP_OKAY, SCIP_STAGE_EXITSOLVE, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPconsIsEnabled(), SCIPdropEvent(), SCIPfindEventhdlr(), SCIPfreeBlockMemoryArrayNull, SCIPgetStage(), and SCIPreleaseNlRow().

Referenced by SCIP_DECL_CONSINITSOL().

◆ SCIP_DECL_CONSDELETE()

static SCIP_DECL_CONSDELETE ( consDeleteQuadratic  )
static

frees specific constraint data

Definition at line 12358 of file cons_quadratic.c.

References consdataFree(), NULL, SCIP_CALL, SCIP_DECL_CONSTRANS(), SCIP_OKAY, and SCIPconsGetData().

Referenced by SCIP_DECL_CONSEXITSOL().

◆ SCIP_DECL_CONSTRANS()

◆ SCIP_DECL_CONSINITLP()

◆ SCIP_DECL_CONSSEPALP()

◆ SCIP_DECL_CONSSEPASOL()

static SCIP_DECL_CONSSEPASOL ( consSepasolQuadratic  )
static

separation method of constraint handler for arbitrary primal solutions

Definition at line 12782 of file cons_quadratic.c.

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

Referenced by SCIP_DECL_CONSSEPALP().

◆ SCIP_DECL_CONSENFOLP()

static SCIP_DECL_CONSENFOLP ( consEnfolpQuadratic  )
static

constraint enforcing method of constraint handler for LP solutions

Definition at line 12812 of file cons_quadratic.c.

References enforceConstraint(), NULL, SCIP_CALL, SCIP_DECL_CONSENFORELAX(), and SCIP_OKAY.

Referenced by SCIP_DECL_CONSSEPASOL().

◆ SCIP_DECL_CONSENFORELAX()

static SCIP_DECL_CONSENFORELAX ( consEnforelaxQuadratic  )
static

constraint enforcing method of constraint handler for relaxation solutions

Definition at line 12821 of file cons_quadratic.c.

References enforceConstraint(), SCIP_CALL, SCIP_DECL_CONSENFOPS(), and SCIP_OKAY.

Referenced by SCIP_DECL_CONSENFOLP().

◆ SCIP_DECL_CONSENFOPS()

◆ SCIP_DECL_CONSPROP()

static SCIP_DECL_CONSPROP ( consPropQuadratic  )
static

domain propagation method of constraint handler

Definition at line 12939 of file cons_quadratic.c.

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

Referenced by SCIP_DECL_CONSENFOPS().

◆ SCIP_DECL_CONSPRESOL()

◆ SCIP_DECL_CONSLOCK()

static SCIP_DECL_CONSLOCK ( consLockQuadratic  )
static

variable rounding lock method of constraint handler

Definition at line 13310 of file cons_quadratic.c.

References NULL, SCIP_Bool, SCIP_CALL, SCIP_DECL_CONSENABLE(), SCIP_LOCKTYPE_MODEL, SCIP_OKAY, SCIPaddVarLocksType(), SCIPconsGetData(), and SCIPisInfinity().

Referenced by SCIP_DECL_CONSPRESOL().

◆ SCIP_DECL_CONSENABLE()

◆ SCIP_DECL_CONSDISABLE()

static SCIP_DECL_CONSDISABLE ( consDisableQuadratic  )
static

constraint disabling notification method of constraint handler

Definition at line 13402 of file cons_quadratic.c.

References dropVarEvents(), FALSE, NULL, SCIP_CALL, SCIP_DECL_CONSPRINT(), SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconsIsTransformed(), SCIPdebugMsg, and SCIPgetStage().

Referenced by SCIP_DECL_CONSENABLE().

◆ SCIP_DECL_CONSPRINT()

static SCIP_DECL_CONSPRINT ( consPrintQuadratic  )
static

◆ SCIP_DECL_CONSCHECK()

◆ SCIP_DECL_CONSCOPY()

◆ SCIP_DECL_CONSPARSE()

◆ SCIP_DECL_CONSGETVARS()

static SCIP_DECL_CONSGETVARS ( consGetVarsQuadratic  )
static

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

Definition at line 13972 of file cons_quadratic.c.

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

Referenced by SCIP_DECL_CONSPARSE().

◆ SCIP_DECL_CONSGETNVARS()

static SCIP_DECL_CONSGETNVARS ( consGetNVarsQuadratic  )
static

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

Definition at line 14003 of file cons_quadratic.c.

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

Referenced by SCIP_DECL_CONSGETVARS().

◆ getIneqViol()

static void getIneqViol ( SCIP_VAR x,
SCIP_VAR y,
SCIP_Real  xcoef,
SCIP_Real  ycoef,
SCIP_Real  constant,
SCIP_Real viol1,
SCIP_Real viol2 
)
static

helper function to compute the violation of an inequality of the form xcoef * x <= ycoef * y + constant for two corner points of the domain [lbx,ubx]x[lby,uby]

Parameters
xfirst variable
ysecond variable
xcoefx-coefficient
ycoefy-coefficient
constantconstant
viol1buffer to store the violation of the first corner point
viol2buffer to store the violation of the second corner point

Definition at line 15781 of file cons_quadratic.c.

References MAX, NULL, SCIP_Real, SCIPaddBilinearIneqQuadratic(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), SQR, and SQRT.

Referenced by SCIPaddBilinearIneqQuadratic(), and SCIPgetAllBilinearTermsQuadratic().

◆ SCIPcreateRowprep()

SCIP_RETCODE SCIPcreateRowprep ( SCIP scip,
SCIP_ROWPREP **  rowprep,
SCIP_SIDETYPE  sidetype,
SCIP_Bool  local 
)

creates a SCIP_ROWPREP datastructure

Initial cut represents 0 <= 0.

Parameters
scipSCIP data structure
rowprepbuffer to store pointer to rowprep
sidetypewhether cut will be or lower-equal or larger-equal type
localwhether cut will be valid only locally

Definition at line 15962 of file cons_quadratic.c.

References BMSclearMemory, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, and SCIPfreeRowprep().

Referenced by generateCut(), generateCutPoint(), generateCutProjectedPoint(), generateCutSol(), generateLinearizationCut(), generateSecantCut(), generateSecantCutNoCheck(), and SCIPaddBilinearIneqQuadratic().

◆ SCIPfreeRowprep()

void SCIPfreeRowprep ( SCIP scip,
SCIP_ROWPREP **  rowprep 
)

frees a SCIP_ROWPREP datastructure

Parameters
scipSCIP data structure
rowpreppointer that stores pointer to rowprep

Definition at line 15982 of file cons_quadratic.c.

References NULL, SCIPcopyRowprep(), SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArrayNull.

Referenced by addLinearizationCuts(), generateCut(), generateSparseCut(), SCIP_DECL_CONSINITLP(), SCIPcreateRowprep(), and separatePoint().

◆ SCIPcopyRowprep()

SCIP_RETCODE SCIPcopyRowprep ( SCIP scip,
SCIP_ROWPREP **  target,
SCIP_ROWPREP source 
)

creates a copy of a SCIP_ROWPREP datastructure

Parameters
scipSCIP data structure
targetbuffer to store pointer of rowprep copy
sourcerowprep to copy

Definition at line 15997 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, NULL, SCIP_CALL, SCIP_OKAY, SCIPduplicateBlockMemory, SCIPduplicateBlockMemoryArray, SCIPensureRowprepSize(), SCIP_RowPrep::vars, and SCIP_RowPrep::varssize.

Referenced by SCIPfreeRowprep().

◆ SCIPensureRowprepSize()

SCIP_RETCODE SCIPensureRowprepSize ( SCIP scip,
SCIP_ROWPREP rowprep,
int  size 
)

ensures that rowprep has space for at least given number of additional terms

Useful when knowing in advance how many terms will be added.

Parameters
scipSCIP data structure
rowpreprowprep
sizenumber of additional terms for which to alloc space in rowprep

Definition at line 16024 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, NULL, SCIP_RowPrep::nvars, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), SCIPprintRowprep(), SCIPreallocBlockMemoryArray, SCIP_RowPrep::vars, and SCIP_RowPrep::varssize.

Referenced by generateCutPoint(), generateCutProjectedPoint(), generateCutSol(), SCIPaddRowprepTerm(), SCIPaddRowprepTerms(), and SCIPcopyRowprep().

◆ SCIPprintRowprep()

void SCIPprintRowprep ( SCIP scip,
SCIP_ROWPREP rowprep,
FILE *  file 
)

◆ SCIPaddRowprepTerm()

◆ SCIPaddRowprepTerms()

SCIP_RETCODE SCIPaddRowprepTerms ( SCIP scip,
SCIP_ROWPREP rowprep,
int  nvars,
SCIP_VAR **  vars,
SCIP_Real coefs 
)

adds several terms coef*var to a rowprep

Parameters
scipSCIP data structure
rowpreprowprep
nvarsnumber of terms to add
varsvariables to add
coefscoefficients to add

Definition at line 16100 of file cons_quadratic.c.

References BMScopyMemoryArray, SCIP_RowPrep::coefs, NULL, SCIP_RowPrep::nvars, SCIP_CALL, SCIP_OKAY, SCIPaddRowprepSide(), SCIPensureRowprepSize(), SCIP_RowPrep::vars, and SCIP_RowPrep::varssize.

Referenced by addIntervalGradientEstimator(), addLinearization(), addUserEstimator(), generateCut(), and SCIPaddRowprepTerm().

◆ SCIPaddRowprepSide()

void SCIPaddRowprepSide ( SCIP_ROWPREP rowprep,
SCIP_Real  side 
)

◆ SCIPaddRowprepConstant()

void SCIPaddRowprepConstant ( SCIP_ROWPREP rowprep,
SCIP_Real  constant 
)

◆ SCIPgetRowprepViolation()

SCIP_Real SCIPgetRowprepViolation ( SCIP scip,
SCIP_ROWPREP rowprep,
SCIP_SOL sol 
)

computes violation of cut in a given solution

Parameters
scipSCIP data structure
rowpreprowprep to be turned into a row
solsolution or NULL for LP solution

Definition at line 16158 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, MAX, NULL, SCIP_RowPrep::nvars, SCIP_Real, SCIP_SIDETYPE_RIGHT, SCIP_VARSTATUS_LOOSE, SCIPgetSolVal(), SCIPmergeRowprepTerms(), SCIPvarGetStatus(), SCIP_RowPrep::side, SCIP_RowPrep::sidetype, and SCIP_RowPrep::vars.

Referenced by addLinearizationCuts(), generateCut(), generateSparseCut(), SCIPaddRowprepConstant(), and SCIPcleanupRowprep().

◆ SCIPmergeRowprepTerms()

void SCIPmergeRowprepTerms ( SCIP scip,
SCIP_ROWPREP rowprep 
)

Merge terms that use same variable and eliminate zero coefficients.

Terms are sorted by variable (

See also
SCIPvarComp) after return.
Parameters
scipSCIP data structure
rowpreprowprep to be cleaned up

Definition at line 16191 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, NULL, SCIP_RowPrep::nvars, rowprepCleanupSortTerms(), SCIPsortPtrReal(), and SCIP_RowPrep::vars.

Referenced by generateCut(), and SCIPgetRowprepViolation().

◆ rowprepCleanupSortTerms()

static SCIP_RETCODE rowprepCleanupSortTerms ( SCIP scip,
SCIP_ROWPREP rowprep 
)
static

sort cut terms by absolute value of coefficients, from largest to smallest

Parameters
scipSCIP data structure
rowpreprowprep to be sorted

Definition at line 16250 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, NULL, SCIP_RowPrep::nvars, REALABS, rowprepCleanupImproveCoefrange(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPsortDownRealRealPtr(), and SCIP_RowPrep::vars.

Referenced by SCIPcleanupRowprep(), and SCIPmergeRowprepTerms().

◆ rowprepCleanupImproveCoefrange()

static void rowprepCleanupImproveCoefrange ( SCIP scip,
SCIP_ROWPREP rowprep,
SCIP_SOL sol,
SCIP_Real  maxcoefrange 
)
static

try to improve coef range by aggregating cut with variable bounds

Assumes terms have been sorted by rowprepCleanupSortTerms().

Parameters
scipSCIP data structure
rowpreprowprep to be improve
solsolution that we try to cut off, or NULL for LP solution
maxcoefrangemaximal allowed coefficients range

Definition at line 16309 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, SCIP_RowPrep::local, MAX, MIN, SCIP_RowPrep::nvars, REALABS, rowprepCleanupScaleup(), SCIP_INVALID, SCIP_Real, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPaddRowprepConstant(), SCIPdebugMsg, SCIPgetSolVal(), SCIPisGT(), SCIPisInfinity(), SCIPisLT(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPvarGetUbLocal(), SCIP_RowPrep::sidetype, and SCIP_RowPrep::vars.

Referenced by rowprepCleanupSortTerms(), and SCIPcleanupRowprep().

◆ rowprepCleanupScaleup()

static void rowprepCleanupScaleup ( SCIP scip,
SCIP_ROWPREP rowprep,
SCIP_Real viol,
SCIP_Real  minviol 
)
static

scales up rowprep if it seems useful

Parameters
scipSCIP data structure
rowpreprowprep to be improve
violviolation of cut in sol (input and output)
minviolminimal violation we try to achieve

Definition at line 16472 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, NULL, SCIP_RowPrep::nvars, REALABS, ROWPREP_SCALEUP_MAXMAXCOEF, ROWPREP_SCALEUP_MAXMINCOEF, ROWPREP_SCALEUP_MAXSIDE, ROWPREP_SCALEUP_MINVIOLFACTOR, ROWPREP_SCALEUP_VIOLNONZERO, rowprepCleanupScaledown(), SCIP_Real, SCIPscaleRowprep(), and SCIP_RowPrep::side.

Referenced by rowprepCleanupImproveCoefrange(), and SCIPcleanupRowprep().

◆ rowprepCleanupScaledown()

static void rowprepCleanupScaledown ( SCIP scip,
SCIP_ROWPREP rowprep,
SCIP_Real viol,
SCIP_Real  minviol 
)
static

scales down rowprep if it improves coefs and keeps rowprep violated

Parameters
scipSCIP data structure
rowpreprowprep to be improve
violviolation of cut in sol (input and output)
minviolminimal violation we try to keep

Definition at line 16521 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, SCIP_RowPrep::nvars, REALABS, ROWPREP_SCALEDOWN_MINCOEF, ROWPREP_SCALEDOWN_MINMAXCOEF, ROWPREP_SCALEUP_MINVIOLFACTOR, rowprepCleanupIntegralCoefs(), SCIP_Real, and SCIPscaleRowprep().

Referenced by rowprepCleanupScaleup(), and SCIPcleanupRowprep().

◆ rowprepCleanupIntegralCoefs()

static void rowprepCleanupIntegralCoefs ( SCIP scip,
SCIP_ROWPREP rowprep,
SCIP_Real viol 
)
static

rounds almost integral coefs to integrals, thereby trying to relax the cut

Parameters
scipSCIP data structure
rowpreprowprep to be improve
violviolation of cut in sol (input), set to SCIP_INVALID if some coef changed

Definition at line 16565 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, SCIP_RowPrep::local, NULL, SCIP_RowPrep::nvars, REALABS, rowprepCleanupSide(), SCIP_INVALID, SCIP_Real, SCIP_SIDETYPE_RIGHT, SCIPaddRowprepConstant(), SCIPdebugMsg, SCIPisEQ(), SCIPisInfinity(), SCIPround(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPvarGetUbLocal(), SCIP_RowPrep::sidetype, and SCIP_RowPrep::vars.

Referenced by rowprepCleanupScaledown(), and SCIPcleanupRowprep().

◆ rowprepCleanupSide()

static void rowprepCleanupSide ( SCIP scip,
SCIP_ROWPREP rowprep,
SCIP_Real viol 
)
static

relaxes almost zero side

Parameters
scipSCIP data structure
rowpreprowprep to be improve
violviolation of cut in sol (input), set to SCIP_INVALID if some coef changed

Definition at line 16639 of file cons_quadratic.c.

References SCIP_INVALID, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPcleanupRowprep(), SCIPepsilon(), SCIPisZero(), SCIP_RowPrep::side, and SCIP_RowPrep::sidetype.

Referenced by rowprepCleanupIntegralCoefs(), and SCIPcleanupRowprep().

◆ SCIPcleanupRowprep()

SCIP_RETCODE SCIPcleanupRowprep ( SCIP scip,
SCIP_ROWPREP rowprep,
SCIP_SOL sol,
SCIP_Real  maxcoefrange,
SCIP_Real  minviol,
SCIP_Real coefrange,
SCIP_Real viol 
)
Parameters
scipSCIP data structure
rowpreprowprep to be cleaned
solsolution that we try to cut off, or NULL for LP solution
maxcoefrangemaximal allowed coefficients range
minviolminimal absolute violation the row should achieve (w.r.t. sol)
coefrangebuffer to store coefrange of cleaned up cut, or NULL if not of interest
violbuffer to store absolute violation of cleaned up cut in sol, or NULL if not of interest

Definition at line 16673 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, MAX, NULL, SCIP_RowPrep::nvars, REALABS, rowprepCleanupImproveCoefrange(), rowprepCleanupIntegralCoefs(), rowprepCleanupScaledown(), rowprepCleanupScaleup(), rowprepCleanupSide(), rowprepCleanupSortTerms(), SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPgetRowprepViolation(), SCIPgetSepaMinEfficacy(), SCIPinfoMessage(), SCIPprintRowprep(), and SCIPscaleRowprep().

Referenced by generateCut(), rowprepCleanupSide(), SCIP_DECL_CONSINITLP(), and separatePoint().

◆ SCIPscaleRowprep()

int SCIPscaleRowprep ( SCIP_ROWPREP rowprep,
SCIP_Real  factor 
)

scales a rowprep

Returns
Exponent of actually applied scaling factor, if written as 2^x.
Parameters
rowpreprowprep to be scaled
factorsuggested scale factor

Definition at line 16777 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, NULL, SCIP_RowPrep::nvars, SCIPgetRowprepRowCons(), and SCIP_RowPrep::side.

Referenced by rowprepCleanupScaledown(), rowprepCleanupScaleup(), and SCIPcleanupRowprep().

◆ SCIPgetRowprepRowCons()

SCIP_RETCODE SCIPgetRowprepRowCons ( SCIP scip,
SCIP_ROW **  row,
SCIP_ROWPREP rowprep,
SCIP_CONSHDLR conshdlr 
)

generates a SCIP_ROW from a rowprep

Parameters
scipSCIP data structure
rowbuffer to store pointer to new row
rowpreprowprep to be turned into a row
conshdlrconstraint handler

Definition at line 16806 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, FALSE, SCIP_RowPrep::local, SCIP_RowPrep::name, NULL, SCIP_RowPrep::nvars, SCIP_CALL, SCIP_OKAY, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPaddVarsToRow(), SCIPcreateEmptyRowCons(), SCIPgetDepth(), SCIPgetRowprepRowSepa(), SCIPinfinity(), SCIP_RowPrep::side, SCIP_RowPrep::sidetype, TRUE, and SCIP_RowPrep::vars.

Referenced by addLinearizationCuts(), generateCut(), SCIP_DECL_CONSINITLP(), SCIPscaleRowprep(), and separatePoint().

◆ SCIPgetRowprepRowSepa()

SCIP_RETCODE SCIPgetRowprepRowSepa ( SCIP scip,
SCIP_ROW **  row,
SCIP_ROWPREP rowprep,
SCIP_SEPA sepa 
)

generates a SCIP_ROW from a rowprep

Parameters
scipSCIP data structure
rowbuffer to store pointer to new row
rowpreprowprep to be turned into a row
sepaseparator

Definition at line 16828 of file cons_quadratic.c.

References SCIP_RowPrep::coefs, FALSE, SCIP_RowPrep::local, SCIP_RowPrep::name, NULL, SCIP_RowPrep::nvars, SCIP_CALL, SCIP_OKAY, SCIP_SIDETYPE_LEFT, SCIP_SIDETYPE_RIGHT, SCIPaddVarsToRow(), SCIPcreateEmptyRowSepa(), SCIPgetDepth(), SCIPinfinity(), SCIP_RowPrep::side, SCIP_RowPrep::sidetype, TRUE, and SCIP_RowPrep::vars.

Referenced by SCIPgetRowprepRowCons().