41#define EXPRHDLR_NAME "log"
42#define EXPRHDLR_DESC "natural logarithm expression"
43#define EXPRHDLR_PRECEDENCE 80000
44#define EXPRHDLR_HASHKEY SCIPcalcFibHash(16273.0)
51struct SCIP_ExprhdlrData
98 coef = (log(ub) - log(lb)) / (ub - lb);
99 constant = log(ub) - coef * ub;
109 *linconstant += constant;
141 coef = 1.0 / refpoint;
142 constant = log(refpoint) - 1.0;
152 coef = log((f+1.0) / f);
153 constant = log(f) - coef * f;
163 *linconstant += constant;
201 *simplifiedexpr = expr;
239 *targetexprdata =
NULL;
340 if( childinterval.
inf < exprhdlrdata->minzerodistance && exprhdlrdata->minzerodistance > 0.0 )
345 "Check your model formulation or use option expr/" EXPRHDLR_NAME "/minzerodistance to avoid this warning.\n",
346 childinterval.
inf, exprhdlrdata->minzerodistance);
350 exprhdlrdata->warnedonpole =
TRUE;
352 childinterval.
inf = exprhdlrdata->minzerodistance;
385 lb = localbounds[0].inf;
386 ub = localbounds[0].sup;
403 if( localbounds[0].sup < 0.2 )
404 refpoint[0] = 0.5 * lb + 0.5 * ub;
452 lb =
MAX(lb,
MIN(0.5 * lb + 0.5 * ub, 0.1));
454 refpointsover[0] = lb;
461 for(
i = 0;
i < 4; ++
i )
463 if( (overest[
i] && !overestimate) || (!overest[
i] && (overestimate ||
SCIPisInfinity(
scip, ub))) )
469 coefs[*nreturned][0] = 0.0;
470 constant[*nreturned] = 0.0;
479 SCIPdebugMsg(
scip,
"init overestimate log(x) at x=%g -> %g*x+%g\n", refpointsover[
i], coefs[*nreturned][0], constant[*nreturned]);
484 addLogSecant(
scip, lb, ub, coefs[*nreturned], &constant[*nreturned], &success);
487 SCIPdebugMsg(
scip,
"init underestimate log(x) on x=[%g,%g] -> %g*x+%g\n", lb, ub, coefs[*nreturned][0], constant[*nreturned]);
522 if( childrenbounds[0].inf < exprhdlrdata->minzerodistance )
524 SCIPdebugMsg(
scip,
"Pushing child lower bound from %g to %g; upper bound remains at %g\n", childrenbounds[0].inf,
SCIPepsilon(
scip), childrenbounds[0].sup);
529 "Check your model formulation or use option expr/" EXPRHDLR_NAME "/minzerodistance to avoid this warning.\n",
530 childrenbounds[0].inf, exprhdlrdata->minzerodistance);
534 exprhdlrdata->warnedonpole =
TRUE;
537 childrenbounds[0].inf = exprhdlrdata->minzerodistance;
554 *hashkey ^= childrenhashes[0];
622 "minimal distance from zero to enforce for child in bound tightening",
635 void* ownercreatedata
#define SCIP_INTERVAL_INFINITY
#define EXPRHDLR_PRECEDENCE
static void addLogLinearization(SCIP *scip, SCIP_Real refpoint, SCIP_Bool isint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
static void addLogSecant(SCIP *scip, SCIP_Real lb, SCIP_Real ub, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
logarithm expression handler
constant value expression handler
SCIP_Bool SCIPisExprLog(SCIP *scip, SCIP_EXPR *expr)
SCIP_RETCODE SCIPcreateExprLog(SCIP *scip, SCIP_EXPR **expr, SCIP_EXPR *child, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
SCIP_RETCODE SCIPcreateExprValue(SCIP *scip, SCIP_EXPR **expr, SCIP_Real value, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
SCIP_RETCODE SCIPincludeExprhdlrLog(SCIP *scip)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
SCIP_VERBLEVEL SCIPgetVerbLevel(SCIP *scip)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
const char * SCIPexprhdlrGetName(SCIP_EXPRHDLR *exprhdlr)
void SCIPexprhdlrSetCurvature(SCIP_EXPRHDLR *exprhdlr,)
void SCIPexprhdlrSetParse(SCIP_EXPRHDLR *exprhdlr,)
SCIP_EXPRHDLRDATA * SCIPexprhdlrGetData(SCIP_EXPRHDLR *exprhdlr)
void SCIPexprhdlrSetIntEval(SCIP_EXPRHDLR *exprhdlr,)
void SCIPexprhdlrSetMonotonicity(SCIP_EXPRHDLR *exprhdlr,)
void SCIPexprhdlrSetReverseProp(SCIP_EXPRHDLR *exprhdlr,)
void SCIPexprhdlrSetHash(SCIP_EXPRHDLR *exprhdlr,)
SCIP_RETCODE SCIPincludeExprhdlr(SCIP *scip, SCIP_EXPRHDLR **exprhdlr, const char *name, const char *desc, unsigned int precedence, SCIP_DECL_EXPREVAL((*eval)), SCIP_EXPRHDLRDATA *data)
void SCIPexprhdlrSetSimplify(SCIP_EXPRHDLR *exprhdlr,)
void SCIPexprhdlrSetDiff(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRBWDIFF((*bwdiff)), SCIP_DECL_EXPRFWDIFF((*fwdiff)),)
void SCIPexprhdlrSetCopyFreeHdlr(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOPYHDLR((*copyhdlr)),)
SCIP_EXPRHDLR * SCIPfindExprhdlr(SCIP *scip, const char *name)
void SCIPexprhdlrSetCopyFreeData(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOPYDATA((*copydata)),)
void SCIPexprhdlrSetEstimate(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINITESTIMATES((*initestimates)),)
SCIP_RETCODE SCIPcreateExpr(SCIP *scip, SCIP_EXPR **expr, SCIP_EXPRHDLR *exprhdlr, SCIP_EXPRDATA *exprdata, int nchildren, SCIP_EXPR **children, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
void SCIPexprSetData(SCIP_EXPR *expr, SCIP_EXPRDATA *exprdata)
int SCIPexprGetNChildren(SCIP_EXPR *expr)
SCIP_Bool SCIPexprIsIntegral(SCIP_EXPR *expr)
SCIP_Bool SCIPisExprValue(SCIP *scip, SCIP_EXPR *expr)
SCIP_RETCODE SCIPreleaseExpr(SCIP *scip, SCIP_EXPR **expr)
SCIP_EXPRDATA * SCIPexprGetData(SCIP_EXPR *expr)
SCIP_RETCODE SCIPparseExpr(SCIP *scip, SCIP_EXPR **expr, const char *exprstr, const char **finalpos, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
SCIP_RETCODE SCIPprintExpr(SCIP *scip, SCIP_EXPR *expr, FILE *file)
SCIP_Real SCIPgetValueExprValue(SCIP_EXPR *expr)
SCIP_Real SCIPexprGetEvalValue(SCIP_EXPR *expr)
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
SCIP_INTERVAL SCIPexprGetActivity(SCIP_EXPR *expr)
void SCIPcaptureExpr(SCIP_EXPR *expr)
SCIP_EXPRHDLR * SCIPexprGetHdlr(SCIP_EXPR *expr)
SCIP_Real SCIPintervalGetInf(SCIP_INTERVAL interval)
SCIP_Bool SCIPintervalIsEmpty(SCIP_Real infinity, SCIP_INTERVAL operand)
struct SCIP_Interval SCIP_INTERVAL
void SCIPintervalLog(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
SCIP_Real SCIPintervalGetSup(SCIP_INTERVAL interval)
void SCIPintervalExp(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalSetEmpty(SCIP_INTERVAL *resultant)
#define SCIPallocClearBlockMemory(scip, ptr)
#define SCIPfreeBlockMemory(scip, ptr)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPepsilon(SCIP *scip)
assert(minobj< SCIPgetCutoffbound(scip))
struct SCIP_Expr SCIP_EXPR
#define SCIP_DECL_EXPR_OWNERCREATE(x)
#define SCIP_DECL_EXPRREVERSEPROP(x)
#define SCIP_DECL_EXPRINITESTIMATES(x)
#define SCIP_DECL_EXPRCURVATURE(x)
struct SCIP_ExprhdlrData SCIP_EXPRHDLRDATA
#define SCIP_DECL_EXPRFREEDATA(x)
#define SCIP_DECL_EXPRPARSE(x)
#define SCIP_DECL_EXPRBWDIFF(x)
#define SCIP_DECL_EXPRINTEVAL(x)
#define SCIP_DECL_EXPRMONOTONICITY(x)
struct SCIP_Exprhdlr SCIP_EXPRHDLR
#define SCIP_DECL_EXPRSIMPLIFY(x)
#define SCIP_DECL_EXPREVAL(x)
#define SCIP_DECL_EXPRHASH(x)
#define SCIP_DECL_EXPRCOPYHDLR(x)
#define SCIP_DECL_EXPRFREEHDLR(x)
#define SCIP_DECL_EXPRCOPYDATA(x)
#define SCIP_DECL_EXPRESTIMATE(x)
enum SCIP_Retcode SCIP_RETCODE