37 #define PRESOL_NAME "dualcomp" 38 #define PRESOL_DESC "compensate single up-/downlocks by singleton continuous variables" 44 #define PRESOL_PRIORITY -50 45 #define PRESOL_MAXROUNDS -1 46 #define PRESOL_TIMING SCIP_PRESOLTIMING_EXHAUSTIVE 48 #define DEFAULT_COMP_ONLY_DIS_VARS FALSE 55 struct SCIP_PresolData
113 assert(scip != NULL);
114 assert(matrix != NULL);
118 assert(varstofix != NULL);
119 assert(nfixings != NULL);
128 for( ; rowpnt < rowend; rowpnt++ )
160 multrowbyminusone =
FALSE;
164 multrowbyminusone =
TRUE;
174 multrowbyminusone =
TRUE;
184 if( multrowbyminusone )
203 for( ; rowpnt < rowend; rowpnt++, valpnt++ )
224 if( multrowbyminusone )
225 offset += (-coef) * lb;
243 if( multrowbyminusone )
244 offset += coef * (-ub);
246 offset += (-coef) * (-ub);
263 if( multrowbyminusone )
274 offset += (-coef) * lb;
288 delta += (-coef) * (ub - lb);
302 offset += (-coef) * (-ub);
316 delta += (-coef) * (ub - lb);
324 if( multrowbyminusone )
338 offset += coef * (-ub);
353 delta += coef * (ub - lb);
376 delta += coef * (ub - lb);
390 if( multrowbyminusone )
398 offset += (-coef) * lb;
408 offset += (-coef) * (-ub);
413 if( multrowbyminusone )
421 offset += coef * (-ub);
438 if( trytofix && varstofix[col] ==
NOFIX)
443 if( deltaisinf ||
SCIPisLE(scip, lhs-offset, delta) )
452 #ifdef SCIP_MORE_DEBUG 454 SCIPdebugMsg(scip,
"%s, bds=[%.2f,%.2f], obj=%.2f, nnonzs=%d, type=%s, fix=ub, %.1f <= %.1f\n",
470 #ifdef SCIP_MORE_DEBUG 472 SCIPdebugMsg(scip,
"%s, bds=[%.2f,%.2f], obj=%.2f, nnonzs=%d, type=%s, fix=lb, %.1f <= %.1f\n",
495 assert(
scip != NULL);
496 assert(presol != NULL);
514 assert(result != NULL);
533 assert(presoldata != NULL);
539 if( initialized && complete )
562 for(i = 0; i < ncols; i++)
589 for( ; (colpnt < colend); colpnt++, valpnt++ )
647 for( ; (colpnt < colend); colpnt++, valpnt++ )
697 int numupperboundfixings;
698 int numlowerboundfixings;
699 int numcontinuousfixings;
700 int numdiscretefixings;
702 oldnfixedvars = *nfixedvars;
703 numupperboundfixings = 0;
704 numlowerboundfixings = 0;
705 numcontinuousfixings = 0;
706 numdiscretefixings = 0;
709 for( v = ncols - 1; v >= 0; --v )
738 numlowerboundfixings++;
741 numcontinuousfixings++;
743 numdiscretefixings++;
745 else if( varstofix[v] ==
FIXATUB )
767 numupperboundfixings++;
770 numcontinuousfixings++;
772 numdiscretefixings++;
776 if( *result !=
SCIP_CUTOFF && *nfixedvars > oldnfixedvars )
780 numlowerboundfixings, numupperboundfixings,
781 numcontinuousfixings, numdiscretefixings);
804 assert(presoldata != NULL);
830 "presolving/dualcomp/componlydisvars",
831 "should only discrete variables be compensated?",
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)
void SCIPmatrixPrintRow(SCIP *scip, SCIP_MATRIX *matrix, int row)
struct SCIP_PresolData SCIP_PRESOLDATA
SCIP_VAR * SCIPmatrixGetVar(SCIP_MATRIX *matrix, int col)
int SCIPmatrixGetNRows(SCIP_MATRIX *matrix)
SCIP_RETCODE SCIPsetPresolFree(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLFREE((*presolfree)))
SCIP_STAGE SCIPgetStage(SCIP *scip)
enum Fixingdirection FIXINGDIRECTION
dual compensation presolver
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
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_DECL_PRESOLFREE(presolFreeDualcomp)
SCIP_PRESOLDATA * SCIPpresolGetData(SCIP_PRESOL *presol)
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPfreeBufferArray(scip, ptr)
static SCIP_DECL_PRESOLEXEC(presolExecDualcomp)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_RETCODE SCIPmatrixCreate(SCIP *scip, SCIP_MATRIX **matrixptr, SCIP_Bool *initialized, SCIP_Bool *complete)
SCIP_RETCODE SCIPincludePresolDualcomp(SCIP *scip)
int SCIPgetNContVars(SCIP *scip)
int SCIPmatrixGetRowNNonzs(SCIP_MATRIX *matrix, int row)
static SCIP_RETCODE compensateVarLock(SCIP *scip, SCIP_MATRIX *matrix, int col, int row, SCIP_Real val, SCIP_Bool twosides, LOCKCOMPENSATION compensation, FIXINGDIRECTION *varstofix, int *nfixings)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_Real SCIPmatrixGetRowLhs(SCIP_MATRIX *matrix, int row)
enum Fixingdirection FIXINGDIRECTION
SCIP_Real * SCIPmatrixGetColValPtr(SCIP_MATRIX *matrix, int col)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPpresolSetData(SCIP_PRESOL *presol, SCIP_PRESOLDATA *presoldata)
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)
#define SCIPallocBufferArray(scip, ptr, num)
int SCIPvarGetNLocksUp(SCIP_VAR *var)
int * SCIPmatrixGetColIdxPtr(SCIP_MATRIX *matrix, int col)
const char * SCIPpresolGetName(SCIP_PRESOL *presol)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
static SCIP_DECL_PRESOLCOPY(presolCopyDualcomp)
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
#define DEFAULT_COMP_ONLY_DIS_VARS
public methods for matrix
SCIP_Bool SCIPinProbing(SCIP *scip)
enum Lockcompensation LOCKCOMPENSATION
int SCIPvarGetNLocksDown(SCIP_VAR *var)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPmatrixGetRowRhs(SCIP_MATRIX *matrix, int row)
SCIP_Bool SCIPmatrixIsRowRhsInfinity(SCIP_MATRIX *matrix, int row)
SCIP_RETCODE SCIPsetPresolCopy(SCIP *scip, SCIP_PRESOL *presol, SCIP_DECL_PRESOLCOPY((*presolcopy)))
SCIP_Bool SCIPallowDualReds(SCIP *scip)
SCIP_Bool SCIPisStopped(SCIP *scip)
int SCIPmatrixGetColNDownlocks(SCIP_MATRIX *matrix, int col)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
int SCIPmatrixGetColNUplocks(SCIP_MATRIX *matrix, int col)
#define BMSclearMemoryArray(ptr, num)
int SCIPmatrixGetNColumns(SCIP_MATRIX *matrix)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
int SCIPmatrixGetColNNonzs(SCIP_MATRIX *matrix, int col)