Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v92-bugfix' into v9-minor
Browse files Browse the repository at this point in the history
  • Loading branch information
scip-ci committed Dec 20, 2024
2 parents dc76d68 + 95c0d1f commit 41574ec
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Build system
Miscellaneous
-------------

- The output precision for writing CIP/POB files has been increased at several places for nonlinear constraints.

Known bugs
----------

Expand Down
12 changes: 6 additions & 6 deletions src/scip/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2584,17 +2584,17 @@ SCIP_RETCODE SCIPexprDismantle(
SCIP_VAR* var;

var = SCIPgetVarExprVar(expr);
SCIPmessageFPrintInfo(messagehdlr, file, "%s in [%g, %g]", SCIPvarGetName(var), SCIPvarGetLbLocal(var),
SCIPmessageFPrintInfo(messagehdlr, file, "%s in [%.15g, %.15g]", SCIPvarGetName(var), SCIPvarGetLbLocal(var),
SCIPvarGetUbLocal(var));
}
else if( SCIPexprIsSum(set, expr) )
SCIPmessageFPrintInfo(messagehdlr, file, "%g", SCIPgetConstantExprSum(expr));
SCIPmessageFPrintInfo(messagehdlr, file, "%.15g", SCIPgetConstantExprSum(expr));
else if( SCIPexprIsProduct(set, expr) )
SCIPmessageFPrintInfo(messagehdlr, file, "%g", SCIPgetCoefExprProduct(expr));
SCIPmessageFPrintInfo(messagehdlr, file, "%.15g", SCIPgetCoefExprProduct(expr));
else if( SCIPexprIsValue(set, expr) )
SCIPmessageFPrintInfo(messagehdlr, file, "%g", SCIPgetValueExprValue(expr));
SCIPmessageFPrintInfo(messagehdlr, file, "%.15g", SCIPgetValueExprValue(expr));
else if( SCIPexprIsPower(set, expr) || strcmp(expr->exprhdlr->name, "signpower") == 0)
SCIPmessageFPrintInfo(messagehdlr, file, "%g", SCIPgetExponentExprPow(expr));
SCIPmessageFPrintInfo(messagehdlr, file, "%.15g", SCIPgetExponentExprPow(expr));

SCIPmessageFPrintInfo(messagehdlr, file, "\n");

Expand All @@ -2614,7 +2614,7 @@ SCIP_RETCODE SCIPexprDismantle(
if( SCIPexprIsSum(set, expr) )
{
SCIPmessageFPrintInfo(messagehdlr, file, "%*s ", nspaces, "");
SCIPmessageFPrintInfo(messagehdlr, file, "[coef]: %g\n", SCIPgetCoefsExprSum(expr)[SCIPexpriterGetChildIdxDFS(it)]);
SCIPmessageFPrintInfo(messagehdlr, file, "[coef]: %.15g\n", SCIPgetCoefsExprSum(expr)[SCIPexpriterGetChildIdxDFS(it)]);
}

break;
Expand Down
6 changes: 3 additions & 3 deletions src/scip/expr_pow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1868,9 +1868,9 @@ SCIP_DECL_EXPRPRINT(printPow)

/* print closing parenthesis */
if( exponent >= 0.0 )
SCIPinfoMessage(scip, file, ")^%g", exponent);
SCIPinfoMessage(scip, file, ")^%.15g", exponent);
else
SCIPinfoMessage(scip, file, ")^(%g)", exponent);
SCIPinfoMessage(scip, file, ")^(%.15g)", exponent);

break;
}
Expand Down Expand Up @@ -2684,7 +2684,7 @@ SCIP_DECL_EXPRPRINT(printSignpower)

case SCIP_EXPRITER_LEAVEEXPR :
{
SCIPinfoMessage(scip, file, ",%g)", SCIPgetExponentExprPow(expr));
SCIPinfoMessage(scip, file, ",%.15g)", SCIPgetExponentExprPow(expr));
break;
}

Expand Down
4 changes: 2 additions & 2 deletions src/scip/expr_product.c
Original file line number Diff line number Diff line change
Expand Up @@ -1580,11 +1580,11 @@ SCIP_DECL_EXPRPRINT(printProduct)
{
if( exprdata->coefficient < 0.0 && EXPRHDLR_PRECEDENCE > parentprecedence )
{
SCIPinfoMessage(scip, file, "(%g)", exprdata->coefficient);
SCIPinfoMessage(scip, file, "(%.15g)", exprdata->coefficient);
}
else
{
SCIPinfoMessage(scip, file, "%g", exprdata->coefficient);
SCIPinfoMessage(scip, file, "%.15g", exprdata->coefficient);
}
}
break;
Expand Down
4 changes: 2 additions & 2 deletions src/scip/expr_sum.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ SCIP_DECL_EXPRPRINT(printSum)
/* print constant, if nonzero */
if( exprdata->constant != 0.0 )
{
SCIPinfoMessage(scip, file, "%g", exprdata->constant);
SCIPinfoMessage(scip, file, "%.15g", exprdata->constant);
}
break;
}
Expand Down Expand Up @@ -748,7 +748,7 @@ SCIP_DECL_EXPRPRINT(printSum)
else
{
/* force "+" sign on positive coefficient if not the first term */
SCIPinfoMessage(scip, file, (exprdata->constant != 0.0 || currentchild > 0) ? "%+g*" : "%g*", coef);
SCIPinfoMessage(scip, file, (exprdata->constant != 0.0 || currentchild > 0) ? "%+.15g*" : "%.15g*", coef);
}

break;
Expand Down
4 changes: 2 additions & 2 deletions src/scip/expr_value.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ SCIP_DECL_EXPRPRINT(printValue)
SCIP_Real v = SCIPexprGetData(expr)->value;
if( v < 0.0 && EXPRHDLR_PRECEDENCE <= parentprecedence )
{
SCIPinfoMessage(scip, file, "(%g)", v);
SCIPinfoMessage(scip, file, "(%.15g)", v);
}
else
{
SCIPinfoMessage(scip, file, "%g", v);
SCIPinfoMessage(scip, file, "%.15g", v);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/scip/reader_gms.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ SCIP_RETCODE printExpr(
if( stage == SCIP_EXPRITER_ENTEREXPR )
SCIPinfoMessage(scip, file, "power(");
else if( stage == SCIP_EXPRITER_LEAVEEXPR )
SCIPinfoMessage(scip, file, ",%g)", exponent);
SCIPinfoMessage(scip, file, ",%.15g)", exponent);
/* if power but not square, then we are no longer quadratic */
*nqcons = FALSE;
}
Expand Down
10 changes: 5 additions & 5 deletions src/scip/reader_opb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,7 @@ SCIP_RETCODE writeOpbObjective(
assert(conshdlr != NULL);

if( strcmp(SCIPconshdlrGetName(conshdlr), "linear") == 0 )
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "soft: %g;\n", SCIPgetRhsLinear(scip, topcostcons));
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "soft: %.15g;\n", SCIPgetRhsLinear(scip, topcostcons));
else if( strcmp(SCIPconshdlrGetName(conshdlr), "knapsack") == 0 )
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "soft: %" SCIP_LONGINT_FORMAT ";\n",
SCIPgetCapacityKnapsack(scip, topcostcons));
Expand Down Expand Up @@ -2311,7 +2311,7 @@ SCIP_RETCODE writeOpbObjective(

if( topcostfound )
{
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "soft: %g;\n", SCIPgetRhsLinear(scip, cons));
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "soft: %.15g;\n", SCIPgetRhsLinear(scip, cons));
appendBuffer(scip, file, linebuffer, &linecnt, buffer);
writeBuffer(scip, file, linebuffer, &linecnt);
printed = TRUE;
Expand Down Expand Up @@ -3636,7 +3636,7 @@ SCIP_RETCODE writeOpbFixedVars(
if( SCIPhashtableExists(printedfixing, (void*)var) )
continue;

(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "+1%s%s%s = %g ;\n", multisymbol, neg ? "~" : "", strstr(SCIPvarGetName(neg ? SCIPvarGetNegationVar(var) : var), "x"), lb);
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "+1%s%s%s = %.15g ;\n", multisymbol, neg ? "~" : "", strstr(SCIPvarGetName(neg ? SCIPvarGetNegationVar(var) : var), "x"), lb);
appendBuffer(scip, file, linebuffer, &linecnt, buffer);

/* add variable to the hashmap */
Expand Down Expand Up @@ -3710,7 +3710,7 @@ SCIP_RETCODE writeOpbRelevantAnds(
SCIP_CALL( SCIPgetBinvarRepresentative(scip, resvar, &var, &neg) );

assert(SCIPisFeasIntegral(scip, lb));
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "+1%s%s%s = %g ;\n", multisymbol, neg ? "~" : "", strstr(SCIPvarGetName(neg ? SCIPvarGetNegationVar(var) : var), "x"), lb);
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "+1%s%s%s = %.15g ;\n", multisymbol, neg ? "~" : "", strstr(SCIPvarGetName(neg ? SCIPvarGetNegationVar(var) : var), "x"), lb);
appendBuffer(scip, file, linebuffer, &linecnt, buffer);

/* add variable to the hashmap */
Expand Down Expand Up @@ -3743,7 +3743,7 @@ SCIP_RETCODE writeOpbRelevantAnds(
SCIP_CALL( SCIPgetBinvarRepresentative(scip, andvars[r][v], &var, &neg) ); /*lint !e613 */

assert(SCIPisFeasIntegral(scip, lb));
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "+1%s%s%s = %g ;\n", multisymbol, neg ? "~" : "", strstr(SCIPvarGetName(neg ? SCIPvarGetNegationVar(var) : var), "x"), lb);
(void) SCIPsnprintf(buffer, OPB_MAX_LINELEN, "+1%s%s%s = %.15g ;\n", multisymbol, neg ? "~" : "", strstr(SCIPvarGetName(neg ? SCIPvarGetNegationVar(var) : var), "x"), lb);
appendBuffer(scip, file, linebuffer, &linecnt, buffer);

/* add variable to the hashmap */
Expand Down

0 comments on commit 41574ec

Please sign in to comment.