50#define ROWPREP_SCALEUP_VIOLNONZERO (10.0*SCIPepsilon(scip))
51#define ROWPREP_SCALEUP_MINVIOLFACTOR 2.0
52#define ROWPREP_SCALEUP_MAXMINCOEF (1.0 / SCIPfeastol(scip))
53#define ROWPREP_SCALEUP_MAXMAXCOEF SCIPgetHugeValue(scip)
54#define ROWPREP_SCALEUP_MAXSIDE SCIPgetHugeValue(scip)
55#define ROWPREP_SCALEDOWN_MINMAXCOEF (1.0 / SCIPfeastol(scip))
56#define ROWPREP_SCALEDOWN_MINCOEF SCIPfeastol(scip)
59#define M_SQRT2 sqrt(2.0)
110 switch( rowprep->
nvars )
123 tmp1 = rowprep->
coefs[0];
125 rowprep->
coefs[1] = tmp1;
127 tmp2 = rowprep->
vars[0];
128 rowprep->
vars[0] = rowprep->
vars[1];
129 rowprep->
vars[1] = tmp2;
139 for(
i = 0;
i < rowprep->
nvars; ++
i )
162 SCIP_Real maxcoefrange
177 if( rowprep->
nvars > 0 )
183 mincoef = maxcoef = 1.0;
189 while( maxcoef / mincoef > maxcoefrange )
191 SCIPdebugMsg(
scip,
"cut coefficients have very large range: mincoef = %g maxcoef = %g\n", mincoef, maxcoef);
212 for( pos = 0; pos < 2; ++pos )
214 var = rowprep->
vars[pos ? rowprep->
nvars-1 : maxcoefidx];
215 coef = rowprep->
coefs[pos ? rowprep->
nvars-1 : maxcoefidx];
224 ref =
MAX(lb,
MIN(ub, ref));
233 loss[pos] =
REALABS(coef) * (ref - lb);
242 loss[pos] =
REALABS(coef) * (ub - ref);
246 SCIPdebugMsg(
scip,
"aggregating %g*<%s> %c= ... with <%s>[%g] %c= %g looses %g\n",
258 pos = (loss[1] ==
SCIP_INVALID || loss[1] > loss[0]) ? 0 : 1;
261 var = rowprep->
vars[pos ? rowprep->
nvars-1 : maxcoefidx];
262 coef = rowprep->
coefs[pos ? rowprep->
nvars-1 : maxcoefidx];
285 rowprep->
coefs[maxcoefidx] = 0.0;
312 for(
i = maxcoefidx;
i < rowprep->
nvars; ++
i )
314 rowprep->
vars[
i-maxcoefidx] = rowprep->
vars[
i];
317 rowprep->
nvars -= maxcoefidx;
333 SCIP_Real scalefactor;
346 if( *viol >= minviol )
367 *viol = ldexp(*viol, scaleexp);
383 SCIP_Real scalefactor;
393 if( *viol > minviol && !
SCIPisInfinity(
scip, *viol) && scalefactor * *viol < minviol )
412 *viol = ldexp(*viol, scaleexp);
453 SCIPdebugMsg(
scip,
"var with almost zero coef in boundchange-row %.15g*<%s> <=/>= %.15g; scaling up\n",
459 for(
i = 0;
i < rowprep->
nvars; ++
i )
463 if( coef != roundcoef &&
SCIPisEQ(
scip, coef, roundcoef) )
483 SCIPdebugMsg(
scip,
"var <%s> [%g,%g] has almost integral coef %.15g, round coefficient to %g and add constant %g\n",
493 SCIPdebugMsg(
scip,
"var <%s> [%g,%g] has almost integral coef %.15g, round coefficient to %g without relaxing side (!)\n",
496 rowprep->
coefs[
i] = roundcoef;
542#undef SCIProwprepGetNVars
543#undef SCIProwprepGetVars
544#undef SCIProwprepGetCoefs
545#undef SCIProwprepGetSide
546#undef SCIProwprepGetSidetype
547#undef SCIProwprepIsLocal
548#undef SCIProwprepGetName
549#undef SCIProwprepGetNModifiedVars
550#undef SCIProwprepGetModifiedVars
551#undef SCIProwprepSetCoef
552#undef SCIProwprepAddSide
553#undef SCIProwprepAddConstant
554#undef SCIProwprepSetSidetype
555#undef SCIProwprepSetLocal
556#undef SCIProwprepRecordModifications
576 (*rowprep)->sidetype = sidetype;
577 (*rowprep)->local = local;
619 (*target)->recordmodifications =
FALSE;
620 (*target)->modifiedvars =
NULL;
621 (*target)->modifiedvarssize = 0;
622 (*target)->nmodifiedvars = 0;
623 (*target)->modifiedside =
FALSE;
635 return rowprep->
nvars;
645 return rowprep->
vars;
655 return rowprep->
coefs;
665 return rowprep->
side;
685 return rowprep->
local;
695 return rowprep->
name;
742 rowprep->
coefs[idx] = newcoef;
753 rowprep->
side += side;
787 rowprep->
local = islocal;
812 if( *rowprep->
name !=
'\0' )
817 for(
i = 0;
i < rowprep->
nvars; ++
i )
845 if( *rowprep->
name !=
'\0' )
853 for(
i = 0;
i < rowprep->
nvars; ++
i )
873 violation = activity - rowprep->
side;
876 violation = rowprep->
side - activity;
988 for(
i = 0;
i < rowprep->
nvars; ++
i )
1005 if( reliable !=
NULL )
1015 if( reliable !=
NULL )
1023 term = rowprep->
coefs[
i] * val;
1033 violation = activity - rowprep->
side;
1036 violation = rowprep->
side - activity;
1045 if( reliable !=
NULL )
1047 if( violation != 0.0 )
1050 (void) frexp(maxterm / violation, &exponent);
1051 *reliable = exponent <= 50;
1057 return MAX(violation, 0.0);
1099 if( rowprep->
nvars <= 1 )
1108 while( j < rowprep->
nvars )
1110 if( rowprep->
vars[
i] == rowprep->
vars[j] )
1136 if( rowprep->
coefs[
i] == 0.0 )
1174 if( rowprep->
coefs[
i] == 0.0 )
1211 SCIP_Bool violreliable =
TRUE;
1212 SCIP_Real maxcoefrange;
1214 SCIP_Real mincoef = 1.0;
1215 SCIP_Real maxcoef = 1.0;
1231 if( rowprep->
nvars > 0 )
1249 if( rowprep->
nvars > 0 )
1291 if( coefrange !=
NULL )
1293 if( rowprep->
nvars > 0 )
1301 if( success !=
NULL )
1327 if( *success && minviol > 0.0 )
1338 else if( myviol < minviol )
1340 SCIPdebugMsg(
scip,
"rowprep violation %g is below minimal violation %g\n", myviol, minviol);
1380 SCIP_Real maxcoefbound,
1384 SCIP_Real maxcoefrange;
1386 SCIP_Real mincoef = 1.0;
1387 SCIP_Real maxcoef = 1.0;
1390 assert(maxcoefbound >= 1.0);
1405 if( rowprep->
nvars > 0 )
1419 if( rowprep->
nvars > 0 )
1435 SCIP_Real expon = 0.0;
1461 if( success !=
NULL )
1507 SCIP_Real minscaleup,
1511 SCIP_Real minfrac = 0.5;
1512 SCIP_Real minfrac0 = 0.5;
1515 SCIP_Real factor = 1.0;
1516 SCIP_Bool makeintegral =
TRUE;
1525 if(
frac < minfrac )
1528 else if(
frac < minfrac0 )
1533 for(
i = 0;
i < rowprep->
nvars; ++
i )
1540 if(
frac < minfrac )
1543 else if(
frac < minfrac0 )
1550 SCIPdebugMsg(
scip,
"minimal fractional of rowprep coefs and side is %g, max coef/side is %g\n",
MIN(minfrac, minfrac0), maxval);
1567 if( factor < minscaleup )
1568 factor = minscaleup;
1573 makeintegral =
FALSE;
1575 else if( minscaleup > 1.0 )
1577 factor = minscaleup;
1582 if( success !=
NULL )
1595 factor = pow(2.0, factor);
1601 for(
i = 0;
i < rowprep->
nvars; ++
i )
1602 rowprep->
coefs[
i] *= factor;
1605 rowprep->
side *= factor;
1609 SCIPinfoMessage(
scip,
NULL,
"scaled up rowprep by %g (minfrac=%g, minscaleup=%g), maxval is now %g\n", factor, minfrac, minscaleup, maxval);
1613 if( success !=
NULL )
1616 else if( success !=
NULL )
1639 v = frexp(factor, &expon);
1645 for(
i = 0;
i < rowprep->
nvars; ++
i )
1649 rowprep->
side = ldexp(rowprep->
side, expon);
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
#define SCIPduplicateBlockMemory(scip, ptr, source)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_RETCODE SCIPcreateEmptyRowCons(SCIP *scip, SCIP_ROW **row, SCIP_CONS *cons, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
SCIP_RETCODE SCIPcreateEmptyRowConshdlr(SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
SCIP_RETCODE SCIPcreateEmptyRowSepa(SCIP *scip, SCIP_ROW **row, SCIP_SEPA *sepa, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
SCIP_RETCODE SCIPaddVarsToRow(SCIP *scip, SCIP_ROW *row, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
SCIP_Real SCIPgetSepaMinEfficacy(SCIP *scip)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_Bool SCIPisRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisHugeValue(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPepsilon(SCIP *scip)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
int SCIPgetDepth(SCIP *scip)
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_VAR ** SCIProwprepGetVars(SCIP_ROWPREP *rowprep)
void SCIProwprepReset(SCIP_ROWPREP *rowprep)
SCIP_RETCODE SCIPcleanupRowprep2(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, SCIP_Real maxcoefbound, SCIP_Bool *success)
SCIP_Real SCIProwprepGetSide(SCIP_ROWPREP *rowprep)
SCIP_RETCODE SCIPensureRowprepSize(SCIP *scip, SCIP_ROWPREP *rowprep, int size)
void SCIPmergeRowprepTerms(SCIP *scip, SCIP_ROWPREP *rowprep)
int SCIProwprepGetNModifiedVars(SCIP_ROWPREP *rowprep)
SCIP_Real SCIPgetRowprepViolation(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, SCIP_Bool *reliable)
void SCIProwprepSetCoef(SCIP_ROWPREP *rowprep, int idx, SCIP_Real newcoef)
SCIP_Real SCIPscaleupRowprep(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real minscaleup, SCIP_Bool *success)
SCIP_Real * SCIProwprepGetCoefs(SCIP_ROWPREP *rowprep)
SCIP_VAR ** SCIProwprepGetModifiedVars(SCIP_ROWPREP *rowprep)
char * SCIProwprepGetName(SCIP_ROWPREP *rowprep)
void SCIProwprepSetSidetype(SCIP_ROWPREP *rowprep, SCIP_SIDETYPE sidetype)
SCIP_Bool SCIPisRowprepViolationReliable(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol)
SCIP_Bool SCIProwprepIsLocal(SCIP_ROWPREP *rowprep)
void SCIPprintRowprepSol(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, FILE *file)
void SCIProwprepAddConstant(SCIP_ROWPREP *rowprep, SCIP_Real constant)
SCIP_SIDETYPE SCIProwprepGetSidetype(SCIP_ROWPREP *rowprep)
SCIP_RETCODE SCIPgetRowprepRowSepa(SCIP *scip, SCIP_ROW **row, SCIP_ROWPREP *rowprep, SCIP_SEPA *sepa)
SCIP_RETCODE SCIPaddRowprepTerm(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_VAR *var, SCIP_Real coef)
SCIP_RETCODE SCIPgetRowprepRowCons(SCIP *scip, SCIP_ROW **row, SCIP_ROWPREP *rowprep, SCIP_CONS *cons)
SCIP_RETCODE SCIPgetRowprepRowConshdlr(SCIP *scip, SCIP_ROW **row, SCIP_ROWPREP *rowprep, SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPcreateRowprep(SCIP *scip, SCIP_ROWPREP **rowprep, SCIP_SIDETYPE sidetype, SCIP_Bool local)
int SCIPscaleRowprep(SCIP_ROWPREP *rowprep, SCIP_Real factor)
int SCIProwprepGetNVars(SCIP_ROWPREP *rowprep)
void SCIProwprepRecordModifications(SCIP_ROWPREP *rowprep)
SCIP_RETCODE SCIPaddRowprepTerms(SCIP *scip, SCIP_ROWPREP *rowprep, int nvars, SCIP_VAR **vars, SCIP_Real *coefs)
void SCIProwprepSetLocal(SCIP_ROWPREP *rowprep, SCIP_Bool islocal)
void SCIProwprepAddSide(SCIP_ROWPREP *rowprep, SCIP_Real side)
SCIP_RETCODE SCIPcopyRowprep(SCIP *scip, SCIP_ROWPREP **target, SCIP_ROWPREP *source)
SCIP_RETCODE SCIPcleanupRowprep(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, SCIP_Real minviol, SCIP_Real *viol, SCIP_Bool *success)
void SCIPfreeRowprep(SCIP *scip, SCIP_ROWPREP **rowprep)
void SCIPprintRowprep(SCIP *scip, SCIP_ROWPREP *rowprep, FILE *file)
void SCIPsortDownRealRealPtr(SCIP_Real *realarray1, SCIP_Real *realarray2, void **ptrarray, int len)
void SCIPsortPtrReal(void **ptrarray, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
assert(minobj< SCIPgetCutoffbound(scip))
#define BMSclearMemory(ptr)
#define BMScopyMemoryArray(ptr, source, num)
#define ROWPREP_SCALEUP_MAXSIDE
#define ROWPREP_SCALEUP_MAXMAXCOEF
#define ROWPREP_SCALEDOWN_MINMAXCOEF
static SCIP_RETCODE rowprepCleanupIntegralCoefs(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol)
#define ROWPREP_SCALEUP_MAXMINCOEF
static SCIP_RETCODE rowprepCleanupImproveCoefrange(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_SOL *sol, SCIP_Real maxcoefrange)
static void rowprepCleanupSide(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_Real *viol)
#define ROWPREP_SCALEUP_VIOLNONZERO
static SCIP_RETCODE rowprepCleanupSortTerms(SCIP *scip, SCIP_ROWPREP *rowprep)
#define ROWPREP_SCALEDOWN_MINCOEF
static SCIP_RETCODE rowprepRecordModifiedVar(SCIP *scip, SCIP_ROWPREP *rowprep, SCIP_VAR *var)
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)
#define ROWPREP_SCALEUP_MINVIOLFACTOR
public methods for message output
preparation of a linear inequality to become a SCIP_ROW
methods for sorting joint arrays of various types
public methods for problem variables
public methods for the LP relaxation, rows and columns
public methods for memory management
public methods for message handling
public methods for numerical tolerances
public methods for separator plugins
public methods for solutions
public methods for the branch-and-bound tree
SCIP_Real SCIPsetGetSepaMaxCoefRatioRowprep(SCIP_SET *set)
internal methods for global SCIP settings
char name[SCIP_MAXSTRLEN]
SCIP_Bool recordmodifications
miscellaneous datastructures
SCIP main data structure.
enum SCIP_SideType SCIP_SIDETYPE
enum SCIP_Retcode SCIP_RETCODE