SCIP-SDP  4.0.0
Macros | Functions
cons_sdp.c File Reference

Constraint handler for SDP-constraints. More...

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "SDP"
 
#define CONSHDLR_DESC   "SDP constraints of the form \\sum_{j} A_j y_j - A_0 psd"
 
#define CONSHDLRRANK1_NAME   "SDPrank1"
 
#define CONSHDLRRANK1_DESC   "rank 1 SDP constraints"
 
#define CONSHDLR_SEPAPRIORITY   +1000000
 
#define CONSHDLR_ENFOPRIORITY   -2000000
 
#define CONSHDLR_CHECKPRIORITY   -2000000
 
#define CONSHDLR_PROPFREQ   1
 
#define CONSHDLR_SEPAFREQ   1
 
#define CONSHDLR_EAGERFREQ   100
 
#define CONSHDLR_MAXPREROUNDS   -1
 
#define CONSHDLR_DELAYSEPA   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define CONSHDLR_PRESOLTIMING   SCIP_PRESOLTIMING_EXHAUSTIVE
 
#define CONSHDLR_PROPTIMING   SCIP_PROPTIMING_BEFORELP
 
#define PARSE_STARTSIZE   1
 
#define PARSE_SIZEFACTOR   10
 
#define DEFAULT_PROPUPPERBOUNDS   TRUE
 
#define DEFAULT_PROPUBPRESOL   TRUE
 
#define DEFAULT_PROPTIGHTENBOUNDS   TRUE
 
#define DEFAULT_PROPTBPROBING   FALSE
 
#define DEFAULT_TIGHTENBOUNDSCONT   FALSE
 
#define DEFAULT_TIGHTENMATRICES   FALSE
 
#define DEFAULT_TIGHTENBOUNDS   TRUE
 
#define DEFAULT_DIAGGEZEROCUTS   FALSE
 
#define DEFAULT_DIAGZEROIMPLCUTS   TRUE
 
#define DEFAULT_TWOMINORLINCONSS   FALSE
 
#define DEFAULT_TWOMINORPRODCONSS   FALSE
 
#define DEFAULT_TWOMINORVARBOUNDS   TRUE
 
#define DEFAULT_QUADCONSRANK1   TRUE
 
#define DEFAULT_UPGRADEQUADCONSS   FALSE
 
#define DEFAULT_UPGRADEKEEPQUAD   FALSE
 
#define DEFAULT_MAXNVARSQUADUPGD   1000
 
#define DEFAULT_RANK1APPROXHEUR   FALSE
 
#define DEFAULT_SEPARATEONECUT   FALSE
 
#define DEFAULT_CUTSTOPOOL   TRUE
 
#define DEFAULT_SPARSIFYCUT   FALSE
 
#define DEFAULT_SPARSIFYFACTOR   0.1
 
#define DEFAULT_SPARSIFYTARGETSIZE   -1
 
#define DEFAULT_MULTIPLESPARSECUTS   FALSE
 
#define DEFAULT_MAXNSPARSECUTS   0
 
#define DEFAULT_ENFORCESDP   FALSE
 
#define DEFAULT_ONLYFIXEDINTSSDP   FALSE
 
#define DEFAULT_ADDSOCRELAX   FALSE
 
#define DEFAULT_USEDIMACSFEASTOL   FALSE
 
#define DEFAULT_GENERATEROWS   TRUE
 
#define DEFAULT_RECOMPUTESPARSEEV   FALSE
 
#define DEFAULT_RECOMPUTEINITIAL   FALSE
 
#define DEFAULT_EXACTTRANS   FALSE
 

Functions

static SCIP_RETCODE convertRowToColFormatFullMatrix (int rows, int cols, SCIP_Real *rowmatrix, SCIP_Real *colmatrix)
 
static SCIP_RETCODE scaleRowsMatrix (int blocksize, SCIP_Real *matrix, SCIP_Real *scale)
 
static SCIP_RETCODE expandSymMatrix (int size, SCIP_Real *symMat, SCIP_Real *fullMat)
 
static SCIP_RETCODE computeSdpMatrix (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_SOL *sol, SCIP_Real *matrix)
 
static SCIP_RETCODE computeFullSdpMatrix (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_SOL *sol, SCIP_Real *fullmatrix)
 
static SCIP_RETCODE constructMatrixvar (SCIP *scip, SCIP_CONS *cons, SCIP_CONSDATA *consdata)
 
static SCIP_RETCODE SCIPconsSdpCheckSdpCons (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_RESULT *result)
 
static SCIP_RETCODE isMatrixRankOne (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *result)
 
static SCIP_RETCODE multiplyConstraintMatrix (SCIP_CONS *cons, int j, SCIP_Real *v, SCIP_Real *vAv)
 
static SCIP_RETCODE setMaxRhsEntry (SCIP_CONS *cons)
 
static SCIP_RETCODE truncatedPowerMethod (SCIP *scip, int blocksize, SCIP_Real *fullmatrix, SCIP_Real *vector, int sparsity, SCIP_Real convergencetol, SCIP_Real *eigenvector, int *support, SCIP_Real *eigenvalue)
 
static SCIP_RETCODE sparsifyCut (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_CONSDATA *consdata, SCIP_SOL *sol, int blocksize, SCIP_Real *fullconstmatrix, SCIP_Real *eigenvector, SCIP_Real *vector, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Bool *success, SCIP_RESULT *result)
 
static SCIP_RETCODE addMultipleSparseCuts (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_CONSDATA *consdata, SCIP_SOL *sol, int blocksize, SCIP_Real *fullmatrix, SCIP_Real *fullconstmatrix, SCIP_Real *eigenvector, SCIP_Real tol, int maxncuts, SCIP_Real *vector, SCIP_VAR **vars, SCIP_Real *vals, int *ncuts, SCIP_Bool *success, SCIP_RESULT *result)
 
static SCIP_RETCODE separateSol (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool enforce, SCIP_RESULT *result)
 
static SCIP_RETCODE computeAllmatricespsd (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE tightenMatrices (SCIP *scip, SCIP_CONS **conss, int nconss, int *nchgcoefs)
 
static SCIP_RETCODE tightenBounds (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool tightenboundscont, int *nchgbds, SCIP_Bool *infeasible)
 
static SCIP_RETCODE diagGEzero (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, SCIP_Bool solvesdps, int *naddconss, int *nchgbds, SCIP_Bool *infeasible)
 
static SCIP_RETCODE diagZeroImpl (SCIP *scip, SCIP_CONS **conss, int nconss, int *naddconss)
 
static SCIP_RETCODE addTwoMinorLinConstraints (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool solvesdps, int *naddconss)
 
static SCIP_RETCODE addTwoMinorSOCConstraints (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool solvesdps, int *naddconss)
 
static SCIP_RETCODE addTwoMinorProdConstraints (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool solvesdps, int *naddconss)
 
static SCIP_RETCODE addTwoMinorVarBounds (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool solvesdps, int *naddconss)
 
static SCIP_RETCODE addRank1QuadConss (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int *naddconss)
 
static SCIP_RETCODE move_1x1_blocks_to_lp (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int *naddconss, int *ndelconss, int *nchgbds, SCIP_Bool *infeasible)
 
static SCIP_RETCODE unlockVar (SCIP *scip, SCIP_CONSDATA *consdata, int v)
 
static SCIP_RETCODE updateVarLocks (SCIP *scip, SCIP_CONS *cons, int v)
 
static SCIP_RETCODE checkVarsLocks (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE multiaggrVar (SCIP *scip, SCIP_CONS *cons, int v, SCIP_VAR **aggrvars, SCIP_Real *scalars, int naggrvars, SCIP_Real constant, int *savedcol, int *savedrow, SCIP_Real *savedval, int *nfixednonz, int *vararraylength)
 
static SCIP_RETCODE fixAndAggrVars (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool aggregate)
 
static SCIP_RETCODE analyzeConflict (SCIP *scip, SCIP_CONS *cons, int diags, int diagt, int pos, SCIP_Bool upperbound, SCIP_Bool usepos)
 
static SCIP_RETCODE propagateUpperBounds (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_Bool *infeasible, int *nprop)
 
static SCIP_DECL_QUADCONSUPGD (consQuadConsUpgdSdp)
 
static SCIP_DECL_CONSINITPRE (consInitpreSdp)
 
static SCIP_DECL_CONSLOCK (consLockSdp)
 
static SCIP_DECL_CONSEXIT (consExitSdp)
 
static SCIP_DECL_CONSEXITPRE (consExitpreSdp)
 
static SCIP_DECL_CONSINITSOL (consInitsolSdp)
 
static SCIP_DECL_CONSPROP (consPropSdp)
 
static SCIP_DECL_CONSRESPROP (consRespropSdp)
 
static SCIP_DECL_CONSPRESOL (consPresolSdp)
 
static SCIP_DECL_CONSTRANS (consTransSdp)
 
static SCIP_DECL_CONSCHECK (consCheckSdp)
 
static SCIP_DECL_CONSENFOPS (consEnfopsSdp)
 
static SCIP_DECL_CONSENFOLP (consEnfolpSdp)
 
static SCIP_DECL_CONSENFORELAX (consEnforelaxSdp)
 
static SCIP_DECL_CONSSEPASOL (consSepasolSdp)
 
static SCIP_DECL_CONSSEPALP (consSepalpSdp)
 
static SCIP_DECL_CONSDELETE (consDeleteSdp)
 
static SCIP_DECL_CONSFREE (consFreeSdp)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopySdp)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopySdpRank1)
 
static SCIP_DECL_CONSCOPY (consCopySdp)
 
static SCIP_DECL_CONSPRINT (consPrintSdp)
 
static SCIP_DECL_CONSPARSE (consParseSdp)
 
static SCIP_DECL_CONSGETVARS (consGetVarsSdp)
 
static SCIP_DECL_CONSGETNVARS (consGetNVarsSdp)
 
SCIP_RETCODE SCIPincludeConshdlrSdp (SCIP *scip)
 
SCIP_RETCODE SCIPincludeConshdlrSdpRank1 (SCIP *scip)
 
int SCIPconsSdpCompLowerTriangPos (int i, int j)
 
SCIP_RETCODE SCIPconsSdpGetData (SCIP *scip, SCIP_CONS *cons, int *nvars, int *nnonz, int *blocksize, int *arraylength, int *nvarnonz, int **col, int **row, SCIP_Real **val, SCIP_VAR **vars, int *constnnonz, int *constcol, int *constrow, SCIP_Real *constval, SCIP_Bool *rankone, int **maxevsubmat, SCIP_Bool *addedquadcons)
 
SCIP_RETCODE SCIPconsSdpGetNNonz (SCIP *scip, SCIP_CONS *cons, int *nnonz, int *constnnonz)
 
int SCIPconsSdpGetNVars (SCIP *scip, SCIP_CONS *cons)
 
SCIP_VAR ** SCIPconsSdpGetVars (SCIP *scip, SCIP_CONS *cons)
 
int SCIPconsSdpGetBlocksize (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPconsSdpGetFullAj (SCIP *scip, SCIP_CONS *cons, int j, SCIP_Real *Aj)
 
SCIP_RETCODE SCIPconsSdpGetFullConstMatrix (SCIP *scip, SCIP_CONS *cons, SCIP_Real *mat)
 
SCIP_RETCODE SCIPconsSdpGetLowerTriangConstMatrix (SCIP *scip, SCIP_CONS *cons, SCIP_Real *mat)
 
SCIP_RETCODE SCIPconsSdpGuessInitialPoint (SCIP *scip, SCIP_CONS *cons, SCIP_Real *lambdastar)
 
SCIP_Real SCIPconsSdpGetMaxConstEntry (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Real SCIPconsSdpGetMaxSdpCoef (SCIP *scip, SCIP_CONS *cons)
 
int SCIPconsSdpComputeUbSparseSdpMatrixLength (SCIP_CONS *cons)
 
SCIP_RETCODE SCIPconsSdpComputeSparseSdpMatrix (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, int *length, int *row, int *col, SCIP_Real *val)
 
SCIP_Bool SCIPconsSdpShouldBeRankOne (SCIP_CONS *cons)
 
SCIP_RETCODE SCIPconsSdpGetMaxEVSubmat (SCIP_CONS *cons, int **maxevsubmat)
 
SCIP_Bool SCIPconsSdpAddedQuadCons (SCIP_CONS *cons)
 
SCIP_RETCODE SCIPcreateConsSdp (SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, int nnonz, int blocksize, int *nvarnonz, int **col, int **row, SCIP_Real **val, SCIP_VAR **vars, int constnnonz, int *constcol, int *constrow, SCIP_Real *constval, SCIP_Bool removeduplicates)
 
SCIP_RETCODE SCIPcreateConsSdpRank1 (SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, int nnonz, int blocksize, int *nvarnonz, int **col, int **row, SCIP_Real **val, SCIP_VAR **vars, int constnnonz, int *constcol, int *constrow, SCIP_Real *constval, SCIP_Bool removeduplicates)
 

Detailed Description

Constraint handler for SDP-constraints.

Author
Sonja Mars
Lars Schewe
Tristan Gally
Frederic Matter
Marc Pfetsch

Constraint handler for semidefinite constraints of the form \( \sum_{j=1}^n A_j y_j - A_0 \succeq 0 \), where the matrices \(A_j\) and \(A_0\) need to be symmetric. Only the nonzero entries of the matrices are stored.

This file also contains a separate constraint handler for handling rank 1 SDP constraints. The callback functions are essentially the same, but some quadratic constraints are added to enforce the rank 1 condition.

Definition in file cons_sdp.c.

Macro Definition Documentation

#define CONSHDLR_NAME   "SDP"
#define CONSHDLR_DESC   "SDP constraints of the form \\sum_{j} A_j y_j - A_0 psd"

Definition at line 84 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define CONSHDLRRANK1_NAME   "SDPrank1"
#define CONSHDLRRANK1_DESC   "rank 1 SDP constraints"

Definition at line 87 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_SEPAPRIORITY   +1000000

priority of the constraint handler for separation

Definition at line 89 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_ENFOPRIORITY   -2000000

priority of the constraint handler for constraint enforcing

Definition at line 90 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_CHECKPRIORITY   -2000000

priority of the constraint handler for checking feasibility

Definition at line 91 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_PROPFREQ   1

priority of the constraint handler for propagation

Definition at line 92 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_SEPAFREQ   1

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

Definition at line 93 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#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 94 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_MAXPREROUNDS   -1

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

Definition at line 97 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_DELAYSEPA   FALSE

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

Definition at line 98 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 99 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_PRESOLTIMING   SCIP_PRESOLTIMING_EXHAUSTIVE

Definition at line 101 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define CONSHDLR_PROPTIMING   SCIP_PROPTIMING_BEFORELP

Definition at line 102 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp(), and SCIPincludeConshdlrSdpRank1().

#define PARSE_STARTSIZE   1

initial size of the consdata-arrays when parsing a problem

Definition at line 104 of file cons_sdp.c.

Referenced by SCIP_DECL_CONSPARSE().

#define PARSE_SIZEFACTOR   10

size of consdata-arrays is increased by this factor when parsing a problem

Definition at line 105 of file cons_sdp.c.

Referenced by SCIP_DECL_CONSPARSE().

#define DEFAULT_PROPUPPERBOUNDS   TRUE

Should upper bounds be propagated?

Definition at line 107 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_PROPUBPRESOL   TRUE

Should upper bounds be propagated in presolving?

Definition at line 108 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_PROPTIGHTENBOUNDS   TRUE

Should tighten bounds be propagated?

Definition at line 109 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_PROPTBPROBING   FALSE

Should tighten bounds be propagated in probing?

Definition at line 110 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_TIGHTENBOUNDSCONT   FALSE

Should only bounds be tightend for continuous variables?

Definition at line 111 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_TIGHTENMATRICES   FALSE

If all matrices are psd, should the matrices be tightened if possible?

Definition at line 112 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_TIGHTENBOUNDS   TRUE

If all matrices are psd, should the bounds be tightened if possible?

Definition at line 113 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_DIAGGEZEROCUTS   FALSE

Should linear cuts enforcing the non-negativity of diagonal entries of SDP-matrices be added?

Definition at line 114 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_DIAGZEROIMPLCUTS   TRUE

Should linear cuts enforcing the implications of diagonal entries of zero in SDP-matrices be added?

Definition at line 115 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_TWOMINORLINCONSS   FALSE

Should linear cuts corresponding to 2 by 2 minors be added?

Definition at line 116 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_TWOMINORPRODCONSS   FALSE

Should linear cuts corresponding to products of 2 by 2 minors be added?

Definition at line 117 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_TWOMINORVARBOUNDS   TRUE

Should linear cuts corresponding to variable bounds for 2 by 2 minors be added?

Definition at line 118 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_QUADCONSRANK1   TRUE

Should quadratic cons for 2x2 minors be added in the rank-1 case?

Definition at line 119 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_UPGRADEQUADCONSS   FALSE

Should quadratic constraints be upgraded to a rank 1 SDP?

Definition at line 120 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_UPGRADEKEEPQUAD   FALSE

Should the quadratic constraints be kept in the problem after upgrading and the corresponding SDP constraint be added without the rank 1 constraint?

Definition at line 121 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_MAXNVARSQUADUPGD   1000

maximal number of quadratic constraints and appearing variables so that the QUADCONSUPGD is performed

Definition at line 122 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_RANK1APPROXHEUR   FALSE

Should the heuristic that computes the best rank-1 approximation for a given solution be executed?

Definition at line 123 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_SEPARATEONECUT   FALSE

Should only one cut corresponding to the most negative eigenvalue be separated?

Definition at line 124 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_CUTSTOPOOL   TRUE

Should the cuts be added to the pool?

Definition at line 125 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_SPARSIFYCUT   FALSE

Should the eigenvector cuts be sparsified?

Definition at line 126 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_SPARSIFYFACTOR   0.1

target size for sparsification in relation to number of variables

Definition at line 127 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_SPARSIFYTARGETSIZE   -1

absolute target size for sparsification (-1: use sparsifyfactor instead)

Definition at line 128 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_MULTIPLESPARSECUTS   FALSE

Should multiple sparsified eigenvector cuts be added?

Definition at line 129 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_MAXNSPARSECUTS   0

maximal number of sparse eigenvector cuts that should be added (-1: no limit)

Definition at line 130 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_ENFORCESDP   FALSE

Solve SDP if we do lp-solving and have an integral solution in enforcing?

Definition at line 131 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_ONLYFIXEDINTSSDP   FALSE

Should solving an SDP only be applied if all integral variables are fixed (instead of having integral values)?

Definition at line 132 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_ADDSOCRELAX   FALSE

Should a relaxation of SOC constraints be added

Definition at line 133 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_USEDIMACSFEASTOL   FALSE

Should a feasibility tolerance based on the DIMACS be used for computing negative eigenvalues?

Definition at line 134 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_GENERATEROWS   TRUE

Should rows be generated (constraints otherwise)?

Definition at line 135 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_RECOMPUTESPARSEEV   FALSE

Should the sparse eigenvalue returned from TPower be recomputed exactly by using Lapack for the corresponding submatrix?

Definition at line 142 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_RECOMPUTEINITIAL   FALSE

Should the inital vector for TPower be computed each time before calling TPower (instead of using the original smallest eigenvector)?

Definition at line 143 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

#define DEFAULT_EXACTTRANS   FALSE

Should the matrix be transformed with the exact maximal eigenvalue before calling TPower (instead of using estimate)?

Definition at line 144 of file cons_sdp.c.

Referenced by SCIPincludeConshdlrSdp().

Function Documentation

static SCIP_RETCODE convertRowToColFormatFullMatrix ( int  rows,
int  cols,
SCIP_Real *  rowmatrix,
SCIP_Real *  colmatrix 
)
static

generates matrix in colum-first format (needed by LAPACK) from matrix given in full row-first format (SCIP-SDP default)

Parameters
rowsnumber of rows
colsnumber of columns
rowmatrixmatrix entries given as rows*cols array
colmatrixpointer to array of length blocksize^2 to store rowmatrix in column-first format

Definition at line 235 of file cons_sdp.c.

References scaleRowsMatrix().

Referenced by SCIP_DECL_CONSCHECK().

static SCIP_RETCODE scaleRowsMatrix ( int  blocksize,
SCIP_Real *  matrix,
SCIP_Real *  scale 
)
static

multiplies all entries in the i-th row by scale[i]

Definition at line 266 of file cons_sdp.c.

References expandSymMatrix().

Referenced by convertRowToColFormatFullMatrix(), and SCIP_DECL_CONSCHECK().

static SCIP_RETCODE expandSymMatrix ( int  size,
SCIP_Real *  symMat,
SCIP_Real *  fullMat 
)
static

takes a 0.5*n*(n+1) array of a symmetric matrix and expands it to an n*n array of the full matrix to input into LAPACK

Parameters
sizesize of the matrix, named n above
symMatsymmetric matrix indexed via SCIPconsSdpCompLowerTriangPos that should be expanded
fullMatpointer to store the n*n matrix, that is the symmetric expansion of symMat

Definition at line 293 of file cons_sdp.c.

References computeSdpMatrix(), and SCIPconsSdpCompLowerTriangPos().

Referenced by isMatrixRankOne(), and scaleRowsMatrix().

static SCIP_RETCODE computeSdpMatrix ( SCIP *  scip,
SCIP_CONSDATA *  consdata,
SCIP_SOL *  sol,
SCIP_Real *  matrix 
)
static

For a vector \(y\) given by sol, computes the (length of y) * (length of y + 1) /2 -long array of the lower-triangular part of the matrix \( \sum_{j=1}^m A_j y_j - A_0 \) for this SDP block, indexed by SCIPconsSdpCompLowerTriangPos().

Parameters
scipSCIP data structure
consdataconstraint data
solsolution to separate
matrixpointer to store the SDP-Matrix

Definition at line 326 of file cons_sdp.c.

References computeFullSdpMatrix(), and SCIPconsSdpCompLowerTriangPos().

Referenced by expandSymMatrix(), and isMatrixRankOne().

static SCIP_RETCODE computeFullSdpMatrix ( SCIP *  scip,
SCIP_CONSDATA *  consdata,
SCIP_SOL *  sol,
SCIP_Real *  fullmatrix 
)
static

for a vector \(y\) given by sol, computes the full matrix \( \sum_{j=1}^m A_j y_j - A_0 \)

Parameters
scipSCIP data structure
consdataconstraint data
solsolution to separate
fullmatrixarray for full matrix

Definition at line 369 of file cons_sdp.c.

References constructMatrixvar().

Referenced by computeSdpMatrix(), SCIP_DECL_CONSCHECK(), SCIPconsSdpCheckSdpCons(), and separateSol().

static SCIP_RETCODE constructMatrixvar ( SCIP *  scip,
SCIP_CONS *  cons,
SCIP_CONSDATA *  consdata 
)
static

build matrixvar data

Parameters
scipSCIP data structure
consconstraint
consdataconstraint data

Definition at line 441 of file cons_sdp.c.

References SCIPconsSdpCheckSdpCons(), SCIPconsSdpGetFullAj(), and SCIPconsSdpGetFullConstMatrix().

Referenced by computeFullSdpMatrix(), and propagateUpperBounds().

static SCIP_RETCODE SCIPconsSdpCheckSdpCons ( SCIP *  scip,
SCIP_CONSHDLRDATA *  conshdlrdata,
SCIP_CONS *  cons,
SCIP_SOL *  sol,
SCIP_Bool  printreason,
SCIP_RESULT *  result 
)
static

checks feasibility for a single SDP constraint

Parameters
scipSCIP data structure
conshdlrdataconstraint handler data
consthe constraint the solution should be checked for
solthe solution to check feasibility for
printreasonshould the reason for the violation be printed?
resultpointer to store the result of the feasibility checking call

Definition at line 535 of file cons_sdp.c.

References computeFullSdpMatrix(), CONSHDLR_NAME, CONSHDLRRANK1_NAME, isMatrixRankOne(), and SCIPlapackComputeIthEigenvalue().

Referenced by constructMatrixvar(), isMatrixRankOne(), SCIP_DECL_CONSCHECK(), and SCIP_DECL_CONSENFOPS().

static SCIP_RETCODE isMatrixRankOne ( SCIP *  scip,
SCIP_CONSHDLRDATA *  conshdlrdata,
SCIP_CONS *  cons,
SCIP_SOL *  sol,
SCIP_Bool *  result 
)
static

Check whether current matrix is rank one, if not so, sets maxevsubmat

Parameters
scipSCIP data structure
conshdlrdataconstraint handler data
consthe SDP constraint to check the rank for
solsolution to check for rank one
resultresult pointer to return whether matrix is rank one

Definition at line 596 of file cons_sdp.c.

References computeSdpMatrix(), expandSymMatrix(), multiplyConstraintMatrix(), SCIPconsSdpCheckSdpCons(), SCIPconsSdpCompLowerTriangPos(), and SCIPlapackComputeIthEigenvalue().

Referenced by SCIP_DECL_CONSCHECK(), and SCIPconsSdpCheckSdpCons().

static SCIP_RETCODE multiplyConstraintMatrix ( SCIP_CONS *  cons,
int  j,
SCIP_Real *  v,
SCIP_Real *  vAv 
)
static

For a given variable-index j and a Vector v computes \( v^T A_j v \).

Parameters
consthe SDP constraint that includes the Matrix \( A_j \)
jvariable-index of the matrix to multiply with
vvector to multiply with
vAvpointer to store the the resulting scalar \( v^T A_j v \)

Definition at line 697 of file cons_sdp.c.

References setMaxRhsEntry().

Referenced by addMultipleSparseCuts(), isMatrixRankOne(), separateSol(), and sparsifyCut().

static SCIP_RETCODE setMaxRhsEntry ( SCIP_CONS *  cons)
static

Set the maximum absolute value of an entry of the constant matrix. This must be done before presolving, because otherwise this is influenced by variable fixings (which might lead to solutions being feasible in presolving no longer being feasible afterwards)

Parameters
consthe SDP constraint that includes the Matrix \( A_j \)

Definition at line 741 of file cons_sdp.c.

References truncatedPowerMethod().

Referenced by multiplyConstraintMatrix(), SCIP_DECL_CONSPARSE(), SCIPcreateConsSdp(), and SCIPcreateConsSdpRank1().

static SCIP_RETCODE truncatedPowerMethod ( SCIP *  scip,
int  blocksize,
SCIP_Real *  fullmatrix,
SCIP_Real *  vector,
int  sparsity,
SCIP_Real  convergencetol,
SCIP_Real *  eigenvector,
int *  support,
SCIP_Real *  eigenvalue 
)
static

compute largest sparse eigenvalue for a given sparsity level and corresponding eigenvector of a given matrix

The truncated power method works like the ordinary power method to compute the largest eigenvalue of a matrix, but truncates the iterates in each step to the k largest entries in absolute value, if k is the sparsity level. See [Yuan, Zhang: Truncated Power Method for Sparse Eigenvalue Problems].

Parameters
scipSCIP data structure
blocksizesize of matrix
fullmatrixmatrix for which the smallest sparse eigenvalue and eigenvector should be computed, need to be given with all blocksze * blocksize entries
vectorinitial vector for starting the truncated power method
sparsitysparsity level of eigenvalue and eigenvector
convergencetoltolerance to be used to detect convergence
eigenvectorpointer to store computed eigenvector
supportpointer to store support of the computed eigenvector
eigenvaluepointer to store computed eigenvalue

Definition at line 771 of file cons_sdp.c.

References SCIPlapackMatrixVectorMult(), and sparsifyCut().

Referenced by addMultipleSparseCuts(), and setMaxRhsEntry().

static SCIP_RETCODE sparsifyCut ( SCIP *  scip,
SCIP_CONSHDLR *  conshdlr,
SCIP_CONS *  cons,
SCIP_CONSDATA *  consdata,
SCIP_SOL *  sol,
int  blocksize,
SCIP_Real *  fullconstmatrix,
SCIP_Real *  eigenvector,
SCIP_Real *  vector,
SCIP_VAR **  vars,
SCIP_Real *  vals,
SCIP_Bool *  success,
SCIP_RESULT *  result 
)
static

try to sparsify cut

We currently take a small subset of the components of a given eigenvector and check whether the cut is violated. Note that this does not necessarily yield a sparse cut because the resulting vector has to be multiplied with the matrix pencil.

Parameters
scipSCIP data structure
conshdlrthe constraint handler itself
consconstraint
consdataconstraint data
solprimal solution that should be separated
blocksizesize of block
fullconstmatrixprecomputed full constant matrix
eigenvectororiginal eigenvector
vectortemporary workspace (length blocksize)
varstemporary workspace
valstemporary workspace
successpointer to store whether we have produced a cut/constraint
resultpointer to store the result of the separation call

Definition at line 874 of file cons_sdp.c.

References addMultipleSparseCuts(), multiplyConstraintMatrix(), and SCIPlapackMatrixVectorMult().

Referenced by separateSol(), and truncatedPowerMethod().

static SCIP_RETCODE addMultipleSparseCuts ( SCIP *  scip,
SCIP_CONSHDLR *  conshdlr,
SCIP_CONS *  cons,
SCIP_CONSDATA *  consdata,
SCIP_SOL *  sol,
int  blocksize,
SCIP_Real *  fullmatrix,
SCIP_Real *  fullconstmatrix,
SCIP_Real *  eigenvector,
SCIP_Real  tol,
int  maxncuts,
SCIP_Real *  vector,
SCIP_VAR **  vars,
SCIP_Real *  vals,
int *  ncuts,
SCIP_Bool *  success,
SCIP_RESULT *  result 
)
static

add multiple sparse eigenvector cuts

We use Algorithm 1 from [Dey et al: Cutting Plan Generation Through Sparse Principal Component Analysis] to produce maxncuts many sparse eigenvector cuts.

Parameters
scipSCIP data structure
conshdlrthe constraint handler itself
consconstraint
consdataconstraint data
solprimal solution that should be separated
blocksizesize of block
fullmatrixprecomputed full matrix \( \sum_j A_j y_j - A_0 \)
fullconstmatrixprecomputed full constant matrix
eigenvectororiginal eigenvector
toltolerance to be used when computing eigenvectors
maxncutsmaximal number of cuts to be produced
vectortemporary workspace (length blocksize)
varstemporary workspace
valstemporary workspace
ncutspointer to store the number of produced cuts/constrains
successpointer to store whether we have produced a cut/constraint
resultpointer to store the result of the separation call

Definition at line 1036 of file cons_sdp.c.

References multiplyConstraintMatrix(), SCIPlapackComputeIthEigenvalue(), SCIPlapackMatrixVectorMult(), separateSol(), and truncatedPowerMethod().

Referenced by separateSol(), and sparsifyCut().

static SCIP_RETCODE separateSol ( SCIP *  scip,
SCIP_CONSHDLR *  conshdlr,
SCIP_CONS *  cons,
SCIP_SOL *  sol,
SCIP_Bool  enforce,
SCIP_RESULT *  result 
)
static

separate current solution with a cut using the eigenvectors and -values of the solution matrix

Parameters
scipSCIP data structure
conshdlrthe constraint handler itself
consconstraint to process
solprimal solution that should be separated
enforcewhether we are enforcing cuts
resultpointer to store the result of the separation call

Definition at line 1391 of file cons_sdp.c.

References addMultipleSparseCuts(), computeAllmatricespsd(), computeFullSdpMatrix(), multiplyConstraintMatrix(), SCIPconsSdpGetFullConstMatrix(), SCIPlapackComputeEigenvectorsNegative(), SCIPlapackComputeIthEigenvalue(), SCIPlapackMatrixVectorMult(), and sparsifyCut().

Referenced by addMultipleSparseCuts(), SCIP_DECL_CONSENFOLP(), SCIP_DECL_CONSENFORELAX(), SCIP_DECL_CONSSEPALP(), and SCIP_DECL_CONSSEPASOL().

static SCIP_RETCODE computeAllmatricespsd ( SCIP *  scip,
SCIP_CONS *  cons 
)
static

check whether all matrices are psd

Only needs to be called by rank-1 constraints to check whether all matrices are psd.

Parameters
scipSCIP pointer
consconstraint

Definition at line 1645 of file cons_sdp.c.

References SCIPconsSdpGetFullAj(), SCIPlapackComputeIthEigenvalue(), and tightenMatrices().

Referenced by separateSol(), tightenBounds(), and tightenMatrices().

static SCIP_RETCODE tightenMatrices ( SCIP *  scip,
SCIP_CONS **  conss,
int  nconss,
int *  nchgcoefs 
)
static

try to tighten matrices if all matrices are psd

Parameters
scipSCIP data structure
conssarray of constraints to add cuts for
nconssnumber of constraints to add cuts for
nchgcoefspointer to store how many matrices were tightened

Definition at line 1694 of file cons_sdp.c.

References computeAllmatricespsd(), CONSHDLR_NAME, CONSHDLRRANK1_NAME, SCIPconsSdpGetFullConstMatrix(), SCIPsolveOneVarSDPDense(), and tightenBounds().

Referenced by computeAllmatricespsd(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE tightenBounds ( SCIP *  scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool  tightenboundscont,
int *  nchgbds,
SCIP_Bool *  infeasible 
)
static

try to tighten bounds if all matrices are psd

Parameters
scipSCIP data structure
conssarray of constraints to add cuts for
nconssnumber of constraints to add cuts for
tightenboundscontShould only continuous variables be tightened?
nchgbdspointer to store how many bounds were tightened
infeasiblepointer to store whether infeasibility was detected

Definition at line 1802 of file cons_sdp.c.

References computeAllmatricespsd(), CONSHDLR_NAME, CONSHDLRRANK1_NAME, diagGEzero(), SCIPconsSdpGetFullConstMatrix(), SCIPlapackComputeIthEigenvalue(), and SCIPsolveOneVarSDPDense().

Referenced by SCIP_DECL_CONSPRESOL(), SCIP_DECL_CONSPROP(), and tightenMatrices().

static SCIP_RETCODE diagGEzero ( SCIP *  scip,
SCIP_CONSHDLR *  conshdlr,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool  solvesdps,
int *  naddconss,
int *  nchgbds,
SCIP_Bool *  infeasible 
)
static

approximates the sdpcone using the fact that every diagonal entry must be non-negative, so it adds the LP-cut \( \sum_{j = 1}^m (A_j)_{kk} y_j - (A_0)_{kk} \geq 0 \quad \forall k \leq n \)

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssarray of constraints to add cuts for
nconssnumber of constraints to add cuts for
solvesdpsare we solving SDPs or LPs?
naddconsspointer to store how many constraints were added
nchgbdspointer to store how many bounds were changed
infeasiblepointer to store whether infeasibility was detected

Definition at line 2029 of file cons_sdp.c.

References CONSHDLR_NAME, CONSHDLRRANK1_NAME, diagZeroImpl(), SCIPconsSdpCompLowerTriangPos(), and SCIPconsSdpGetLowerTriangConstMatrix().

Referenced by SCIP_DECL_CONSPRESOL(), and tightenBounds().

static SCIP_RETCODE diagZeroImpl ( SCIP *  scip,
SCIP_CONS **  conss,
int  nconss,
int *  naddconss 
)
static

Presolve-routine that enforces implications of diagonal entries of zero in SDP-matrices, namely that if \(X_{ij} > 0\), then also \(X_{ii} > 0\) and \( X_{jj} > 0\).

More precisely, if \( (A_0)_{k\ell} \neq 0\), \( (A_0)_{kk} = 0\), \( (A_i)_{k\ell} = 0\) for all \( i \leq m\), \( (A_i)_{kk} = 0\) for all continuous variables and \( \ell_i \geq 0\) for all integer variables, we add the cut \( \sum_{\substack{i \in \mathcal{I}:\\ (A_i)_{kk} > 0}} y_i \geq 1.\)

Parameters
scipSCIP data structure
conssarray of constraints
nconssnumber of constraints
naddconsspointer to store how many constraints were added

Definition at line 2200 of file cons_sdp.c.

References addTwoMinorLinConstraints().

Referenced by diagGEzero(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE addTwoMinorLinConstraints ( SCIP *  scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool  solvesdps,
int *  naddconss 
)
static

presolve-routine that adds linear constraints arising from 2 by 2 minor inequalities

For a positive semidefinite matrix \(X\) the following two inequalities hold: \(X_{ss} + X_{tt} - 2\, X_{st} \geq 0\) and \(X_{ss} + X_{tt} + 2\, X_{st} \geq 0\). This follows by using a 2 by 2 minor and multiplying from left and right by the all-ones vector and \([1,-1]\), respectively. We add the corresponding linear constraint only to be propagated.

Translated to the matrix pencil notation the cut looks as follows:

\[ \sum_{i=1}^m (A_i)_{ss}\, y_i - (A_0)_{ss} + \sum_{i=1}^m (A_i)_{tt}\, y_i - (A_0)_{tt} - 2 \Big(\sum_{i=1}^m (A_i)_{st}\, y_i - (A_0)_{st}\Big) \geq 0 \quad\Leftrightarrow\quad \sum_{i=1}^m \Big((A_i)_{ss} + (A_i)_{tt} - 2\, (A_i)_{st}\Big)\, y_i \geq (A_0)_{ss} + (A_0)_{tt} - 2 (A_0)_{st}. \]

Parameters
scipSCIP data structure
conssarray of constraints
nconssnumber of constraints
solvesdpsare we solving SDPs or LPs?
naddconsspointer to store how many constraints were added

Definition at line 2455 of file cons_sdp.c.

References addTwoMinorSOCConstraints(), SCIPconsSdpGetFullAj(), and SCIPconsSdpGetFullConstMatrix().

Referenced by diagZeroImpl(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE addTwoMinorSOCConstraints ( SCIP *  scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool  solvesdps,
int *  naddconss 
)
static

presolve-routine that adds SOC constraints arising from 2 by 2 minor inequalities

For a positive semidefinite matrix \(X\) the following quadratic inequality holds by using the 2 by 2 minor: \(X_{st}^2 \leq X_{ss} X_{tt}\). This constraint is SOC representable:

\[ \left\|\binom{2\,X_{st}}{X_{ss} - X_{tt}}\right\| \leq X_{ss} + X_{tt}. \quad\Leftrightarrow\quad 4\, X_{st}^2 + (X_{ss}^2 - 2\,X_{ss}\, X_{tt} + X_{tt}^2) \leq X_{ss}^2 + 2\, X_{ss}\,X_{tt} + X_{tt}^2. \]

Translated to the matrix pencil notation the cut looks as follows:

\[ \left\|\binom{2\, \sum_{i=1}^m (A_i)_{st}\, y_i - 2\, (A_0)_{st}}{ \sum_{i=1}^m (A_i)_{ss}\, y_i - (A_0)_{ss} - \sum_{i=1}^m (A_i)_{tt}\, y_i + (A_0)_{tt}}\right\| \leq \sum_{i=1}^m (A_i)_{ss}\, y_i - (A_0)_{ss} + \sum_{i=1}^m (A_i)_{tt}\, y_i - (A_0)_{tt}. \]

We add add new variables for \(X_{st}\) and corresponding linear constraints. Then we add SOC-constraints.

Parameters
scipSCIP data structure
conssarray of constraints
nconssnumber of constraints
solvesdpsare we solving SDPs or LPs?
naddconsspointer to store how many constraints were added

Definition at line 2606 of file cons_sdp.c.

References addTwoMinorProdConstraints(), SCIPconsSdpGetFullAj(), and SCIPconsSdpGetFullConstMatrix().

Referenced by addTwoMinorLinConstraints(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE addTwoMinorProdConstraints ( SCIP *  scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool  solvesdps,
int *  naddconss 
)
static

Presolve-routine that adds a linear cut arising from 2 by 2 minor inequalities \(\sum_{i=1}^m (A_i)_{st} y_i \geq (A_0)_{st} - \sqrt{(A_0)_{ss} (A_0)_{tt}}\), if \((A_i)_{ss} = (A_i)_{tt} = 0\) and \((A_0)_{ss} (A_0)_{tt} > 0\) for all \(i,s,t\).

See the dissertation of T. Gally, page 150.

Parameters
scipSCIP data structure
conssarray of constraints
nconssnumber of constraints
solvesdpsare we solving SDPs or LPs?
naddconsspointer to store how many constraints were added

Definition at line 2848 of file cons_sdp.c.

References addTwoMinorVarBounds(), SCIPconsSdpGetFullAj(), and SCIPconsSdpGetFullConstMatrix().

Referenced by addTwoMinorSOCConstraints(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE addTwoMinorVarBounds ( SCIP *  scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool  solvesdps,
int *  naddconss 
)
static

add variable bounds based on 2 by 2 minors

We generate inequalities of the following form:

\[ 2\, \tilde{U}_{st} A(y)_{st} - \tilde{U}_{tt} A(y)_{ss} \leq \tilde{U}_{st}^2. \]

Parameters
scipSCIP data structure
conssarray of constraints
nconssnumber of constraints
solvesdpsare we solving SDPs or LPs?
naddconsspointer to store how many constraints were added

Definition at line 2995 of file cons_sdp.c.

References addRank1QuadConss(), SCIPconsSdpGetFullAj(), and SCIPconsSdpGetFullConstMatrix().

Referenced by addTwoMinorProdConstraints(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE addRank1QuadConss ( SCIP *  scip,
SCIP_CONSHDLR *  conshdlr,
SCIP_CONS **  conss,
int  nconss,
int *  naddconss 
)
static

add quadratic constraints to enforce rank-1 condition

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssarray of constraints to check
nconssnumber of constraints to check
naddconsspointer to store how many constraints were added

Definition at line 3263 of file cons_sdp.c.

References move_1x1_blocks_to_lp(), SCIPconsSdpCompLowerTriangPos(), SCIPconsSdpGetFullAj(), and SCIPconsSdpGetLowerTriangConstMatrix().

Referenced by addTwoMinorVarBounds(), SCIP_DECL_CONSINITSOL(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE move_1x1_blocks_to_lp ( SCIP *  scip,
SCIP_CONSHDLR *  conshdlr,
SCIP_CONS **  conss,
int  nconss,
int *  naddconss,
int *  ndelconss,
int *  nchgbds,
SCIP_Bool *  infeasible 
)
static

detects if there are blocks with size one and transforms them to lp-rows

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssarray of constraints to check
nconssnumber of constraints to check
naddconsspointer to store how many constraints were added
ndelconsspointer to store how many constraints were deleted
nchgbdspointer to store how many bounds were changed
infeasiblepointer to store whether infeasibility was detected

Definition at line 3486 of file cons_sdp.c.

References CONSHDLR_NAME, CONSHDLRRANK1_NAME, and unlockVar().

Referenced by addRank1QuadConss(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE unlockVar ( SCIP *  scip,
SCIP_CONSDATA *  consdata,
int  v 
)
static

unlock variable

Parameters
scipSCIP pointer
consdatadata of constraint
vindex of variable

Definition at line 3634 of file cons_sdp.c.

References updateVarLocks().

Referenced by fixAndAggrVars(), move_1x1_blocks_to_lp(), multiaggrVar(), and updateVarLocks().

static SCIP_RETCODE updateVarLocks ( SCIP *  scip,
SCIP_CONS *  cons,
int  v 
)
static

update locks of variable after aggregation

Parameters
scipSCIP pointer
consconstraint
vindex of variable

Definition at line 3667 of file cons_sdp.c.

References checkVarsLocks(), SCIPconsSdpGetFullAj(), SCIPlapackComputeIthEigenvalue(), and unlockVar().

Referenced by multiaggrVar(), and unlockVar().

static SCIP_RETCODE checkVarsLocks ( SCIP *  scip,
SCIP_CONS *  cons 
)
static

check whether variable locks are correctly set

Parameters
scipSCIP pointer
consconstraint

Definition at line 3756 of file cons_sdp.c.

References multiaggrVar(), SCIPconsSdpGetFullAj(), and SCIPlapackComputeIthEigenvalue().

Referenced by multiaggrVar(), SCIP_DECL_CONSLOCK(), and updateVarLocks().

static SCIP_RETCODE multiaggrVar ( SCIP *  scip,
SCIP_CONS *  cons,
int  v,
SCIP_VAR **  aggrvars,
SCIP_Real *  scalars,
int  naggrvars,
SCIP_Real  constant,
int *  savedcol,
int *  savedrow,
SCIP_Real *  savedval,
int *  nfixednonz,
int *  vararraylength 
)
static

local function to perform (parts of) multiaggregation of a single variable within fixAndAggrVars

Parameters
scipSCIP pointer
consconstraint to multiaggregate for
vposition of the variable that gets (multi-)aggregated
aggrvarsvariables this has to be (multi-)aggregated to
scalarsscalar parts to multiply with for each variable this is aggregated to
naggrvarsnumber of variables this is (multi-)aggregated to
constantthe constant part for the (multi-)aggregation
savedcolarray of columns for nonzeros that need to be added to the constant matrix
savedrowarray of rows for nonzeros that need to be added to the constant matrix
savedvalarray of values for nonzeros that need to be added to the constant matrix
nfixednonzlength of the arrays of saved nonzeros for the constant matrix
vararraylengthlength of the variable array

Definition at line 3821 of file cons_sdp.c.

References checkVarsLocks(), fixAndAggrVars(), SCIPsdpVarfixerMergeArrays(), SCIPsdpVarfixerSortRowCol(), unlockVar(), and updateVarLocks().

Referenced by checkVarsLocks(), and fixAndAggrVars().

static SCIP_RETCODE fixAndAggrVars ( SCIP *  scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool  aggregate 
)
static

presolve routine that looks through the data and handles fixed, (multi-)aggregated and negated variables

Parameters
scipSCIP data structure
conssarray with constraints to check
nconssnumber of constraints to check
aggregatedo we want to (mutli-)aggregate variables ?

Definition at line 3995 of file cons_sdp.c.

References analyzeConflict(), CONSHDLR_NAME, CONSHDLRRANK1_NAME, multiaggrVar(), SCIPsdpVarfixerMergeArrays(), and unlockVar().

Referenced by multiaggrVar(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSEXITPRE(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE analyzeConflict ( SCIP *  scip,
SCIP_CONS *  cons,
int  diags,
int  diagt,
int  pos,
SCIP_Bool  upperbound,
SCIP_Bool  usepos 
)
static

analyzes conflicting assignment on given constraint, and adds conflict constraint to problem

Parameters
scipSCIP data structure
consSDP constraint
diagsindex for diagonal entry corresponding to s
diagtindex for diagonal entry corresponding to t
posindex for off-diagonal entry corresponding to (s,t)
upperboundwhether upper bound on pos caused infeasibility
useposwhether the off-diagonal entry for (s,t) is necessary for analysis

Definition at line 4272 of file cons_sdp.c.

References propagateUpperBounds().

Referenced by fixAndAggrVars(), and propagateUpperBounds().

static SCIP_RETCODE propagateUpperBounds ( SCIP *  scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_Bool *  infeasible,
int *  nprop 
)
static

propagates upper bounds

Parameters
scipSCIP data structure
conssconstraints to process
nconssnumber of constraints
infeasiblepointer to store whether infeasibility was detected
nproppointer to store the number of propagations performed

Definition at line 4344 of file cons_sdp.c.

References analyzeConflict(), CONSHDLRRANK1_NAME, constructMatrixvar(), SCIP_DECL_QUADCONSUPGD(), SCIPcreateConsSdp(), and SCIPcreateConsSdpRank1().

Referenced by analyzeConflict(), SCIP_DECL_CONSPRESOL(), and SCIP_DECL_CONSPROP().

static SCIP_DECL_QUADCONSUPGD ( consQuadConsUpgdSdp  )
static

upgrade quadratic constraints to an SDP constraint with rank 1

Definition at line 5067 of file cons_sdp.c.

References CONSHDLRRANK1_NAME, SCIP_DECL_CONSINITPRE(), SCIPcreateConsSdp(), and SCIPcreateConsSdpRank1().

Referenced by propagateUpperBounds().

static SCIP_DECL_CONSINITPRE ( consInitpreSdp  )
static

informs constraint handler that the presolving process is being started

Definition at line 5501 of file cons_sdp.c.

References SCIP_DECL_CONSLOCK().

Referenced by SCIP_DECL_QUADCONSUPGD().

static SCIP_DECL_CONSLOCK ( consLockSdp  )
static

locks a variable up if the corresponding constraint matrix is not positive semidefinite, locks it down if it is not negative semidefinite

Definition at line 5519 of file cons_sdp.c.

References checkVarsLocks(), SCIP_DECL_CONSEXIT(), SCIPconsSdpGetFullAj(), and SCIPlapackComputeIthEigenvalue().

Referenced by SCIP_DECL_CONSINITPRE().

static SCIP_DECL_CONSEXIT ( consExitSdp  )
static

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

At the end of the solution process, the parameter for adding linear constraints in presolving needs to be reset.

Definition at line 5645 of file cons_sdp.c.

References SCIP_DECL_CONSEXITPRE().

Referenced by SCIP_DECL_CONSLOCK().

static SCIP_DECL_CONSEXITPRE ( consExitpreSdp  )
static

after presolving variables are fixed and multiaggregated

Definition at line 5663 of file cons_sdp.c.

References fixAndAggrVars(), and SCIP_DECL_CONSINITSOL().

Referenced by SCIP_DECL_CONSEXIT().

static SCIP_DECL_CONSINITSOL ( consInitsolSdp  )
static

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

At the beginning of the solution process the stored rank one submatrix is reset.

Definition at line 5717 of file cons_sdp.c.

References addRank1QuadConss(), and SCIP_DECL_CONSPROP().

Referenced by SCIP_DECL_CONSEXITPRE().

static SCIP_DECL_CONSPROP ( consPropSdp  )
static

domain propagation method of constraint handler

Definition at line 5753 of file cons_sdp.c.

References propagateUpperBounds(), SCIP_DECL_CONSRESPROP(), and tightenBounds().

Referenced by SCIP_DECL_CONSINITSOL().

static SCIP_DECL_CONSRESPROP ( consRespropSdp  )
static

propagation conflict resolving method of constraint handler

Definition at line 5826 of file cons_sdp.c.

References CONSHDLR_NAME, CONSHDLRRANK1_NAME, and SCIP_DECL_CONSPRESOL().

Referenced by SCIP_DECL_CONSPROP().

static SCIP_DECL_CONSPRESOL ( consPresolSdp  )
static
static SCIP_DECL_CONSTRANS ( consTransSdp  )
static

creates transformed constraint

Definition at line 6174 of file cons_sdp.c.

References SCIP_DECL_CONSCHECK().

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_DECL_CONSCHECK ( consCheckSdp  )
static
static SCIP_DECL_CONSENFOPS ( consEnfopsSdp  )
static

enforce pseudo solution method

Returns didnotrun if objinfeasible, computes feasibility otherwise.

Definition at line 6727 of file cons_sdp.c.

References SCIP_DECL_CONSENFOLP(), and SCIPconsSdpCheckSdpCons().

Referenced by SCIP_DECL_CONSCHECK().

static SCIP_DECL_CONSENFOLP ( consEnfolpSdp  )
static

Enforce lp solution; if some block is not psd, an eigenvector cut is added.

Definition at line 6770 of file cons_sdp.c.

References SCIP_DECL_CONSENFORELAX(), SCIPrelaxSdpIsFeasible(), SCIPrelaxSdpSolvedProbing(), and separateSol().

Referenced by SCIP_DECL_CONSENFOPS().

static SCIP_DECL_CONSENFORELAX ( consEnforelaxSdp  )
static

Enforce relaxation solution; if some block is not psd, an eigenvector cut is added.

Definition at line 6965 of file cons_sdp.c.

References SCIP_DECL_CONSSEPASOL(), and separateSol().

Referenced by SCIP_DECL_CONSENFOLP().

static SCIP_DECL_CONSSEPASOL ( consSepasolSdp  )
static

separates a solution using constraint specific ideas, gives cuts to SCIP

Definition at line 7001 of file cons_sdp.c.

References SCIP_DECL_CONSSEPALP(), and separateSol().

Referenced by SCIP_DECL_CONSENFORELAX().

static SCIP_DECL_CONSSEPALP ( consSepalpSdp  )
static

separation method of constraint handler for LP solution

Definition at line 7028 of file cons_sdp.c.

References SCIP_DECL_CONSDELETE(), and separateSol().

Referenced by SCIP_DECL_CONSSEPASOL().

static SCIP_DECL_CONSDELETE ( consDeleteSdp  )
static

delete method of SDP constrainthandler

Definition at line 7056 of file cons_sdp.c.

References SCIP_DECL_CONSFREE().

Referenced by SCIP_DECL_CONSSEPALP().

static SCIP_DECL_CONSFREE ( consFreeSdp  )
static

free method of SDP constrainthandler

Definition at line 7100 of file cons_sdp.c.

References SCIP_DECL_CONSHDLRCOPY().

Referenced by SCIP_DECL_CONSDELETE().

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopySdp  )
static

copy SDP constraint handler

Definition at line 7122 of file cons_sdp.c.

References CONSHDLR_NAME, and SCIPincludeConshdlrSdp().

Referenced by SCIP_DECL_CONSFREE().

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopySdpRank1  )
static

copy rank 1 SDP constraint handler

Definition at line 7137 of file cons_sdp.c.

References CONSHDLRRANK1_NAME, SCIP_DECL_CONSCOPY(), and SCIPincludeConshdlrSdpRank1().

static SCIP_DECL_CONSCOPY ( consCopySdp  )
static
static SCIP_DECL_CONSPRINT ( consPrintSdp  )
static

print an SDP constraint

Definition at line 7238 of file cons_sdp.c.

References SCIP_DECL_CONSPARSE().

Referenced by SCIP_DECL_CONSCOPY().

static SCIP_DECL_CONSPARSE ( consParseSdp  )
static

parse an SDP constraint

Definition at line 7379 of file cons_sdp.c.

References PARSE_SIZEFACTOR, PARSE_STARTSIZE, SCIP_DECL_CONSGETVARS(), and setMaxRhsEntry().

Referenced by SCIP_DECL_CONSPRINT().

static SCIP_DECL_CONSGETVARS ( consGetVarsSdp  )
static

constraint method of constraint handler which returns the variables

Definition at line 7611 of file cons_sdp.c.

References SCIP_DECL_CONSGETNVARS().

Referenced by SCIP_DECL_CONSPARSE().

static SCIP_DECL_CONSGETNVARS ( consGetNVarsSdp  )
static

constraint method of constraint handler which returns the number of variables

Definition at line 7645 of file cons_sdp.c.

References SCIPincludeConshdlrSdp().

Referenced by SCIP_DECL_CONSGETVARS().

SCIP_RETCODE SCIPincludeConshdlrSdp ( SCIP *  scip)
SCIP_RETCODE SCIPincludeConshdlrSdpRank1 ( SCIP *  scip)
int SCIPconsSdpCompLowerTriangPos ( int  i,
int  j 
)

for given row and column (i,j) computes the position in the lower triangular part, if these positions are numbered from 0 to n(n+1)/2 - 1, this needs to be called for i >= j

Parameters
irow index
jcolumn index

Definition at line 7965 of file cons_sdp.c.

References SCIPconsSdpGetData().

Referenced by addRank1QuadConss(), calcRelax(), computeSdpMatrix(), diagGEzero(), expandSymMatrix(), isMatrixRankOne(), SCIPconsSdpGetLowerTriangConstMatrix(), and SCIPincludeConshdlrSdpRank1().

SCIP_RETCODE SCIPconsSdpGetData ( SCIP *  scip,
SCIP_CONS *  cons,
int *  nvars,
int *  nnonz,
int *  blocksize,
int *  arraylength,
int *  nvarnonz,
int **  col,
int **  row,
SCIP_Real **  val,
SCIP_VAR **  vars,
int *  constnnonz,
int *  constcol,
int *  constrow,
SCIP_Real *  constval,
SCIP_Bool *  rankone,
int **  maxevsubmat,
SCIP_Bool *  addedquadcons 
)

get the data belonging to a single SDP-constraint

In arraylength the length of the nvarnonz, col, row and val arrays has to be given, if it is not sufficient to store all block-pointers that need to be inserted, a debug message will be thrown and this variable will be set to the needed length. constnnonz should give the length of the const arrays, if it is too short it will also give the needed number and a debug message is thrown. rankone and maxevsubmat can be NULL-pointers, if the corresponding information is not needed.

Parameters
scipSCIP data structure
consSDP constraint to get data of
nvarspointer to store the number of variables in this SDP constraint
nnonzpointer to store the number of nonzeros in this SDP constraint
blocksizepointer to store the size of this SDP-block
arraylengthlength of the given nvarnonz, col, row and val arrays; if this is too short, this will return the needed length
nvarnonzpointer to store the number of nonzeros for each variable, also length of the arrays col/row/val are pointing to
colpointer to store the column indices of the nonzeros for each variable
rowpointer to store the row indices of the nonzeros for each variable
valpointer to store the values of the nonzeros for each variable
varspointer to store the SCIP variables present in this constraint that correspond to the indices in col/row/val
constnnonzpointer to store the number of nonzeros in the constant part of this SDP constraint, also length of the const arrays
constcolpointer to store the column indices of the constant nonzeros
constrowpointer to store the row indices of the constant nonzeros
constvalpointer to store the values of the constant nonzeros
rankonepointer to store if matrix should be rank one (or NULL, if information not necessary)
maxevsubmatpointer to store two row indices of 2x2 subdeterminant with maximal eigenvalue [-1,-1 if not yet computed] (or NULL, if information not necessary)
addedquadconspointer to store if the quadratic 2x2-minor constraints already added (in the rank1-case) (or NULL, if information not necessary)

Definition at line 7983 of file cons_sdp.c.

References SCIPconsSdpGetNNonz().

Referenced by calcRelax(), putSdpDataInInterface(), SCIP_DECL_READERWRITE(), and SCIPconsSdpCompLowerTriangPos().

SCIP_RETCODE SCIPconsSdpGetNNonz ( SCIP *  scip,
SCIP_CONS *  cons,
int *  nnonz,
int *  constnnonz 
)

gets the number of nonzeros and constant nonzeros for this SDP constraint

Either nnonz or constnnonz may be NULL if only the other one is needed.

Parameters
scipSCIP data structure
consSDP constraint to get number of nonzeros for
nnonzpointer to store the number of nonzeros in this SDP constraint
constnnonzpointer to store the number of nonzeros in the constant part of this SDP constraint

Definition at line 8090 of file cons_sdp.c.

References SCIPconsSdpGetNVars().

Referenced by calcRelax(), putSdpDataInInterface(), SCIP_DECL_READERWRITE(), and SCIPconsSdpGetData().

int SCIPconsSdpGetNVars ( SCIP *  scip,
SCIP_CONS *  cons 
)

gets the number of variables of the SDP constraint

Parameters
scipSCIP data structure
consSDP constraint to get number of variables for

Definition at line 8115 of file cons_sdp.c.

References SCIPconsSdpGetVars().

Referenced by SCIP_DECL_HEUREXEC(), and SCIPconsSdpGetNNonz().

SCIP_VAR** SCIPconsSdpGetVars ( SCIP *  scip,
SCIP_CONS *  cons 
)

gets the variables of the SDP constraint

Parameters
scipSCIP data structure
consSDP constraint to get variables for

Definition at line 8132 of file cons_sdp.c.

References SCIPconsSdpGetBlocksize().

Referenced by SCIP_DECL_HEUREXEC(), and SCIPconsSdpGetNVars().

int SCIPconsSdpGetBlocksize ( SCIP *  scip,
SCIP_CONS *  cons 
)

gets the blocksize of the SDP constraint

Parameters
scipSCIP data structure
consSDP constraint to get blocksize for

Definition at line 8149 of file cons_sdp.c.

References SCIPconsSdpGetFullAj().

Referenced by calcRelax(), SCIP_DECL_HEUREXEC(), SCIP_DECL_READERWRITE(), SCIPconsSdpGetVars(), and SCIPrelaxSdpComputeAnalyticCenters().

SCIP_RETCODE SCIPconsSdpGetFullAj ( SCIP *  scip,
SCIP_CONS *  cons,
int  j,
SCIP_Real *  Aj 
)

gets the full constraint Matrix \( A_j \) for a given variable j

Parameters
scipSCIP data structure
consSDP constraint to get matrix for
jthe variable j to get the corresponding matrix \( A_j \) for
Ajpointer to store the full matrix \( A_j \)

Definition at line 8166 of file cons_sdp.c.

References SCIPconsSdpGetFullConstMatrix().

Referenced by addRank1QuadConss(), addTwoMinorLinConstraints(), addTwoMinorProdConstraints(), addTwoMinorSOCConstraints(), addTwoMinorVarBounds(), checkVarsLocks(), computeAllmatricespsd(), constructMatrixvar(), SCIP_DECL_CONSCHECK(), SCIP_DECL_CONSLOCK(), SCIP_DECL_HEUREXEC(), SCIPconsSdpGetBlocksize(), and updateVarLocks().

SCIP_RETCODE SCIPconsSdpGetFullConstMatrix ( SCIP *  scip,
SCIP_CONS *  cons,
SCIP_Real *  mat 
)

gives an n*n-long array with the full constant matrix

Parameters
scipSCIP data structure
consSDP constraint to get matrix for
matpointer to store the full constant matrix

Definition at line 8201 of file cons_sdp.c.

References SCIPconsSdpGetLowerTriangConstMatrix().

Referenced by addTwoMinorLinConstraints(), addTwoMinorProdConstraints(), addTwoMinorSOCConstraints(), addTwoMinorVarBounds(), constructMatrixvar(), SCIP_DECL_CONSCHECK(), SCIP_DECL_CONSPRESOL(), SCIP_DECL_HEUREXEC(), SCIPconsSdpGetFullAj(), separateSol(), tightenBounds(), and tightenMatrices().

SCIP_RETCODE SCIPconsSdpGetLowerTriangConstMatrix ( SCIP *  scip,
SCIP_CONS *  cons,
SCIP_Real *  mat 
)

gives a 0.5*n*(n+1)-long array with the lower triangular part of the constant matrix indexed by SCIPconsSdpCompLowerTriangPos

Parameters
scipSCIP data structure
consSDP constraint to get data of
matpointer to store the lower triangular part of the constant matrix

Definition at line 8235 of file cons_sdp.c.

References SCIPconsSdpCompLowerTriangPos(), and SCIPconsSdpGuessInitialPoint().

Referenced by addRank1QuadConss(), diagGEzero(), and SCIPconsSdpGetFullConstMatrix().

SCIP_RETCODE SCIPconsSdpGuessInitialPoint ( SCIP *  scip,
SCIP_CONS *  cons,
SCIP_Real *  lambdastar 
)

Compute a heuristic guess for a good starting solution \( \lambda ^* \cdot I \).

The solution is computed as

\[ \lambda^* = \max \Bigg\{S \cdot \max_{i \in [m]} \{|u_i|, |l_i|\} \cdot \max_{i \in [m]} \|A_i\|_\infty + \|C\|_\infty, \frac{\max_{i \in [m]} b_i}{S \cdot \min_{i \in [m]} \min_{j, \ell \in [n]} (A_i)_{j\ell} } \Bigg\}, \]

where \( S = \frac{ | \text{nonzero-entries of all } A_i | }{0.5 \cdot \text{ blocksize } (\text{ blocksize } + 1)} \) measures the sparsity of the matrices.

Parameters
scipSCIP data structure
consthe constraint for which the initial point should be constructed
lambdastarpointer to store the guess for the initial point

Definition at line 8274 of file cons_sdp.c.

References CONSHDLR_NAME, CONSHDLRRANK1_NAME, and SCIPconsSdpGetMaxConstEntry().

Referenced by SCIP_DECL_RELAXINITSOL(), and SCIPconsSdpGetLowerTriangConstMatrix().

SCIP_Real SCIPconsSdpGetMaxConstEntry ( SCIP *  scip,
SCIP_CONS *  cons 
)

Gets maximum absolute entry of constant matrix \( A_0 \)

Parameters
scipSCIP data structure
consthe constraint to get the maximum constant matrix entry for

Definition at line 8370 of file cons_sdp.c.

References SCIPconsSdpGetMaxSdpCoef().

Referenced by SCIP_DECL_RELAXINITSOL(), and SCIPconsSdpGuessInitialPoint().

SCIP_Real SCIPconsSdpGetMaxSdpCoef ( SCIP *  scip,
SCIP_CONS *  cons 
)

Gets maximum absolute entry of all matrices \( A_i \)

Parameters
scipSCIP data structure
consthe constraint to get the maximum constant matrix entry for

Definition at line 8386 of file cons_sdp.c.

References SCIPconsSdpComputeUbSparseSdpMatrixLength().

Referenced by SCIP_DECL_RELAXINITSOL(), and SCIPconsSdpGetMaxConstEntry().

int SCIPconsSdpComputeUbSparseSdpMatrixLength ( SCIP_CONS *  cons)

Computes an upper bound on the number of nonzeros of the (dual) SDP matrix \( Z = \sum_{j=1}^n A_j y_j - A_0 \), this should be used to allocate enough memory before calling SCIPconsSdpComputeSparseSdpMatrix.

Upper bound is computed as \( \min \{ \sum_{v \leq m} \text{nvarnonz}(v) + \text{constnnonz}, n \cdot (n+1) / 2 \} \).

Parameters
consthe constraint for which the Matrix should be assembled

Definition at line 8420 of file cons_sdp.c.

References SCIPconsSdpComputeSparseSdpMatrix().

Referenced by calcRelax(), SCIPconsSdpGetMaxSdpCoef(), and SCIPrelaxSdpComputeAnalyticCenters().

SCIP_RETCODE SCIPconsSdpComputeSparseSdpMatrix ( SCIP *  scip,
SCIP_CONS *  cons,
SCIP_SOL *  sol,
int *  length,
int *  row,
int *  col,
SCIP_Real *  val 
)

Computes (dual) SDP matrix \( Z = \sum_{j=1}^n A_j y_j - A_0 \) and returns it in sparse format

Note
row, col and val should have memory allocated equal to SCIPconsSdpComputeUbSparseSdpMatrixLength(), if the memory is not sufficient, length will be set to -1 and an error will be thrown
Parameters
scipSCIP data structure
consthe constraint for which the Matrix should be assembled
solthe solution to assemble the matrix for
lengthinput: allocated memory for row/col/val arrays output: number of nonzeros of the matrix / length of row/col/val arrays
rowpointer to store row indices of SDP-matrix
colpointer to store column indices of SDP-matrix
valpointer to store values of SDP-matrix

Definition at line 8448 of file cons_sdp.c.

References SCIPconsSdpShouldBeRankOne(), and SCIPsdpVarfixerMergeArrays().

Referenced by calcRelax(), SCIPconsSdpComputeUbSparseSdpMatrixLength(), and SCIPrelaxSdpComputeAnalyticCenters().

SCIP_Bool SCIPconsSdpShouldBeRankOne ( SCIP_CONS *  cons)

returns whether the matrix should be rank one

Parameters
consthe constraint for which the existence of a rank one constraint should be checked

Definition at line 8513 of file cons_sdp.c.

References SCIPconsSdpGetMaxEVSubmat().

Referenced by SCIP_DECL_READERWRITE(), and SCIPconsSdpComputeSparseSdpMatrix().

SCIP_RETCODE SCIPconsSdpGetMaxEVSubmat ( SCIP_CONS *  cons,
int **  maxevsubmat 
)

returns two row indices of 2x2 subdeterminant with maximal eigenvalue [or -1,-1 if not available]

Parameters
consthe constraint for which the existence of a rank one constraint should be checked
maxevsubmatpointer to store the two row indices of 2x2 subdeterminant with maximal eigenvalue [or -1,-1 if not available]

Definition at line 8528 of file cons_sdp.c.

References SCIPconsSdpAddedQuadCons().

Referenced by SCIPconsSdpShouldBeRankOne().

SCIP_Bool SCIPconsSdpAddedQuadCons ( SCIP_CONS *  cons)

returns whether the quadratic 2x2-minor constraints are already added (in the rank1-case)

Parameters
consthe constraint for which it should be checked whether the quadratic 2x2-minor constraints are already added (in the rank1-case)

Definition at line 8549 of file cons_sdp.c.

References SCIPcreateConsSdp().

Referenced by SCIPconsSdpGetMaxEVSubmat().

SCIP_RETCODE SCIPcreateConsSdp ( SCIP *  scip,
SCIP_CONS **  cons,
const char *  name,
int  nvars,
int  nnonz,
int  blocksize,
int *  nvarnonz,
int **  col,
int **  row,
SCIP_Real **  val,
SCIP_VAR **  vars,
int  constnnonz,
int *  constcol,
int *  constrow,
SCIP_Real *  constval,
SCIP_Bool  removeduplicates 
)

creates an SDP-constraint

The matrices should be lower triangular.

Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
nvarsnumber of variables in this SDP constraint
nnonznumber of nonzeros in this SDP constraint
blocksizesize of this SDP-block
nvarnonznumber of nonzeros for each variable, also length of the arrays col/row/val point to
colpointer to column indices of the nonzeros for each variable
rowpointer to row indices of the nonzeros for each variable
valpointer to values of the nonzeros for each variable
varsvariables present in this SDP constraint that correspond to the indices in col/row/val
constnnonznumber of nonzeros in the constant part of this SDP constraint
constcolcolumn indices of the constant nonzeros
constrowrow indices of the constant nonzeros
constvalvalues of the constant nonzeros
removeduplicatesShould duplicate matrix entries be removed (then order of col/row/val might change)?

Definition at line 8567 of file cons_sdp.c.

References SCIPcreateConsSdpRank1(), SCIPsdpVarfixerSortRowCol(), and setMaxRhsEntry().

Referenced by propagateUpperBounds(), SCIP_DECL_CONSCOPY(), SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERREAD(), and SCIPconsSdpAddedQuadCons().

SCIP_RETCODE SCIPcreateConsSdpRank1 ( SCIP *  scip,
SCIP_CONS **  cons,
const char *  name,
int  nvars,
int  nnonz,
int  blocksize,
int *  nvarnonz,
int **  col,
int **  row,
SCIP_Real **  val,
SCIP_VAR **  vars,
int  constnnonz,
int *  constcol,
int *  constrow,
SCIP_Real *  constval,
SCIP_Bool  removeduplicates 
)

creates a rank 1 SDP-constraint

The matrices should be lower triangular.

Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
nvarsnumber of variables in this SDP constraint
nnonznumber of nonzeros in this SDP constraint
blocksizesize of this SDP-block
nvarnonznumber of nonzeros for each variable, also length of the arrays col/row/val point to
colpointer to column indices of the nonzeros for each variable
rowpointer to row indices of the nonzeros for each variable
valpointer to values of the nonzeros for each variable
varsvariables present in this SDP constraint that correspond to the indices in col/row/val
constnnonznumber of nonzeros in the constant part of this SDP constraint
constcolcolumn indices of the constant nonzeros
constrowrow indices of the constant nonzeros
constvalvalues of the constant nonzeros
removeduplicatesShould duplicate matrix entries be removed (then order of col/row/val might change)?

Definition at line 8794 of file cons_sdp.c.

References CONSHDLRRANK1_NAME, SCIPsdpVarfixerSortRowCol(), and setMaxRhsEntry().

Referenced by propagateUpperBounds(), SCIP_DECL_CONSCOPY(), SCIP_DECL_QUADCONSUPGD(), SCIP_DECL_READERREAD(), and SCIPcreateConsSdp().