40 #define PRESOL_NAME "redvub" 41 #define PRESOL_DESC "detect redundant variable bound constraints" 42 #define PRESOL_PRIORITY -9000000 43 #define PRESOL_MAXROUNDS 0 44 #define PRESOL_TIMING SCIP_PRESOLTIMING_EXHAUSTIVE 46 #define MAXPAIRCOMP 1000 69 assert(matrix != NULL);
71 assert(lowthreshold != NULL);
72 assert(highthreshold != NULL);
73 assert(conidx != NULL);
74 assert(binidx != NULL);
149 assert(scip != NULL);
150 assert(matrix != NULL);
152 assert(lowthreshold != NULL);
153 assert(highthreshold != NULL);
154 assert(conidx != NULL);
155 assert(binidx != NULL);
237 assert(scip != NULL);
238 assert(matrix != NULL);
239 assert(vubs != NULL);
241 assert(lowthresholds != NULL);
242 assert(highthresholds != NULL);
243 assert(conidxs != NULL);
244 assert(binidxs != NULL);
245 assert(nvaragg != NULL);
246 assert(isvartoagg != NULL);
247 assert(aggvars != NULL);
248 assert(ndeletecons != NULL);
249 assert(deletecons != NULL);
253 uselinearscan =
TRUE;
255 uselinearscan =
FALSE;
257 for( i = 0; i < nvubs; i++ )
259 for( j = i+1; j < nvubs; j++ )
264 if( !
SCIPisEQ(scip, lowthresholds[i], lowthresholds[j]) )
279 if(
SCIPisLE(scip, highthresholds[i], highthresholds[j]) )
283 SCIPdebugMsg(scip,
"Delete variable upper bound constraint:\n");
288 isvartoagg[binidxs[j]] =
TRUE;
292 deletecons[vubs[j]] =
TRUE;
297 assert(
SCIPisGT(scip, highthresholds[i], highthresholds[j]));
300 SCIPdebugMsg(scip,
"Delete variable upper bound constraint:\n");
305 isvartoagg[binidxs[i]] =
TRUE;
309 deletecons[vubs[i]] =
TRUE;
345 assert(scip != NULL);
346 assert(matrix != NULL);
347 assert(vlbs != NULL);
349 assert(lowthresholds != NULL);
350 assert(highthresholds != NULL);
351 assert(conidxs != NULL);
352 assert(binidxs != NULL);
353 assert(nvaragg != NULL);
354 assert(isvartoagg != NULL);
355 assert(aggvars != NULL);
356 assert(ndeletecons != NULL);
357 assert(deletecons != NULL);
361 uselinearscan =
TRUE;
363 uselinearscan =
FALSE;
365 for( i = 0; i < nvlbs; i++ )
367 for( j = i+1; j < nvlbs; j++ )
372 if( !
SCIPisEQ(scip, lowthresholds[i], lowthresholds[j]) )
387 if(
SCIPisGE(scip, highthresholds[i], highthresholds[j]) )
391 SCIPdebugMsg(scip,
"Delete variable lower bound constraint:\n");
396 isvartoagg[binidxs[j]] =
TRUE;
400 deletecons[vlbs[j]] =
TRUE;
405 assert(
SCIPisLT(scip, highthresholds[i], highthresholds[j]));
408 SCIPdebugMsg(scip,
"Delete variable lower bound constraint:\n");
413 isvartoagg[binidxs[i]] =
TRUE;
417 deletecons[vlbs[i]] =
TRUE;
463 for( c = 0; c < ncols; c++ )
476 for( ; (colpnt < colend); colpnt++ )
483 if(
isVub(scip, matrix, *colpnt, &lowthreshold, &highthreshold, &conidx, &binidx) )
485 vbcons[nvbcons] = *colpnt;
486 lowthresholds[nvbcons] = lowthreshold;
487 highthresholds[nvbcons] = highthreshold;
488 conidxs[nvbcons] = conidx;
489 binidxs[nvbcons] = binidx;
496 lowthresholds, highthresholds, conidxs, binidxs,
497 nvaragg, isvartoagg, aggvars, ndeletecons, deletecons) );
504 for( ; (colpnt < colend); colpnt++ )
511 if(
isVlb(scip, matrix, *colpnt, &lowthreshold, &highthreshold, &conidx, &binidx) )
513 vbcons[nvbcons] = *colpnt;
514 lowthresholds[nvbcons] = lowthreshold;
515 highthresholds[nvbcons] = highthreshold;
516 conidxs[nvbcons] = conidx;
517 binidxs[nvbcons] = binidx;
524 lowthresholds, highthresholds, conidxs, binidxs,
525 nvaragg, isvartoagg, aggvars, ndeletecons, deletecons) );
552 assert(result != NULL);
566 if( initialized && complete )
596 for( v = 0; v < ncols; v++ )
605 assert(aggvars[v] != NULL);
607 0.0, &infeasible, &redundant, &aggregated) );
628 if( ndeletecons > 0 )
631 for( r = 0; r < nrows; r++ )
SCIP_RETCODE SCIPincludePresolBasic(SCIP *scip, SCIP_PRESOL **presolptr, const char *name, const char *desc, int priority, int maxrounds, SCIP_PRESOLTIMING timing, SCIP_DECL_PRESOLEXEC((*presolexec)), SCIP_PRESOLDATA *presoldata)
SCIP_VAR * SCIPmatrixGetVar(SCIP_MATRIX *matrix, int col)
SCIP_Bool SCIPvarsHaveCommonClique(SCIP_VAR *var1, SCIP_Bool value1, SCIP_VAR *var2, SCIP_Bool value2, SCIP_Bool regardimplics)
int SCIPmatrixGetNRows(SCIP_MATRIX *matrix)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_RETCODE SCIPincludePresolRedvub(SCIP *scip)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_CONS * SCIPmatrixGetCons(SCIP_MATRIX *matrix, int row)
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPmatrixFree(SCIP *scip, SCIP_MATRIX **matrix)
int SCIPgetNActivePricers(SCIP *scip)
enum SCIP_Retcode SCIP_RETCODE
static SCIP_RETCODE findVarAggrRedVbcons(SCIP *scip, SCIP_MATRIX *matrix, int *nvaragg, SCIP_Bool *isvartoagg, SCIP_VAR **aggvars, int *ndeletecons, SCIP_Bool *deletecons)
static SCIP_Bool isVub(SCIP *scip, SCIP_MATRIX *matrix, int row, SCIP_Real *lowthreshold, SCIP_Real *highthreshold, int *conidx, int *binidx)
static SCIP_Bool isVlb(SCIP *scip, SCIP_MATRIX *matrix, int row, SCIP_Real *lowthreshold, SCIP_Real *highthreshold, int *conidx, int *binidx)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_RETCODE SCIPmatrixCreate(SCIP *scip, SCIP_MATRIX **matrixptr, SCIP_Bool *initialized, SCIP_Bool *complete)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
int SCIPgetNContVars(SCIP *scip)
int SCIPmatrixGetRowNNonzs(SCIP_MATRIX *matrix, int row)
SCIP_Real SCIPmatrixGetRowLhs(SCIP_MATRIX *matrix, int row)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
int * SCIPmatrixGetRowIdxPtr(SCIP_MATRIX *matrix, int row)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Bool SCIPisNLPEnabled(SCIP *scip)
SCIP_Real * SCIPmatrixGetRowValPtr(SCIP_MATRIX *matrix, int row)
static SCIP_RETCODE detectDominatingVubs(SCIP *scip, SCIP_MATRIX *matrix, int nvubs, int *vubs, SCIP_Real *lowthresholds, SCIP_Real *highthresholds, int *conidxs, int *binidxs, int *nvaragg, SCIP_Bool *isvartoagg, SCIP_VAR **aggvars, int *ndeletecons, SCIP_Bool *deletecons)
#define SCIPallocBufferArray(scip, ptr, num)
static SCIP_DECL_PRESOLEXEC(presolExecRedvub)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
int * SCIPmatrixGetColIdxPtr(SCIP_MATRIX *matrix, int col)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
public methods for matrix
SCIP_Bool SCIPinProbing(SCIP *scip)
static SCIP_RETCODE detectDominatingVlbs(SCIP *scip, SCIP_MATRIX *matrix, int nvlbs, int *vlbs, SCIP_Real *lowthresholds, SCIP_Real *highthresholds, int *conidxs, int *binidxs, int *nvaragg, SCIP_Bool *isvartoagg, SCIP_VAR **aggvars, int *ndeletecons, SCIP_Bool *deletecons)
remove redundant variable upper bound constraints
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPmatrixIsRowRhsInfinity(SCIP_MATRIX *matrix, int row)
SCIP_RETCODE SCIPaggregateVars(SCIP *scip, SCIP_VAR *varx, SCIP_VAR *vary, SCIP_Real scalarx, SCIP_Real scalary, SCIP_Real rhs, SCIP_Bool *infeasible, SCIP_Bool *redundant, SCIP_Bool *aggregated)
SCIP_Bool SCIPisStopped(SCIP *scip)
int SCIPmatrixGetColNDownlocks(SCIP_MATRIX *matrix, int col)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
enum SCIP_Vartype SCIP_VARTYPE
int SCIPmatrixGetColNUplocks(SCIP_MATRIX *matrix, int col)
#define BMSclearMemoryArray(ptr, num)
int SCIPmatrixGetNColumns(SCIP_MATRIX *matrix)
int SCIPmatrixGetColNNonzs(SCIP_MATRIX *matrix, int col)