Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v90-bugfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
scip-ci committed Dec 19, 2023
2 parents 645d8fd + f853c59 commit 89401e1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Features
- added a new separator sepa_lagromory to generate Lagromory cuts in a relax-and-cut framework, i.e., GMI cuts generated
at different bases that are explored in the process of solving the Lagrangian dual problem at a node. This separator
is OFF by default.
- when parsing nonlinear constraints from CIP files, the * after the number in a term is now optional if followed by a variable,
i.e., instead of 3*<x>*<y>, now also 3<x>*<y> can be read, but 3<x><y> is not supported;
this allows to read some CIP files that were written with SCIP < 8

Performance improvements
------------------------
Expand Down
21 changes: 15 additions & 6 deletions src/scip/scip_expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,19 +574,28 @@ SCIP_RETCODE parseExpr(
{
SCIP_CALL( SCIPskipSpace((char**)newpos) );

if( **newpos != '*' )
if( **newpos == '<' )
{
/* no '*', so fall back to parsing term after sign */
coef = (*expr == '+') ? 1.0 : -1.0;
++expr;
/* found variable name ('*' is considered optional);
* keep coefficient in coef and continue parsing term after coefficient
*/
expr = *newpos;

SCIP_CALL( SCIPskipSpace((char**)&expr) );
}
else
else if( **newpos == '*' )
{
/* keep coefficient in coef and continue parsing term after coefficient */
expr = (*newpos)+1;

SCIP_CALL( SCIPskipSpace((char**)&expr) );
}
else
{
/* term consists of single value; let parseTerm() below parse it */
coef = (*expr == '+') ? 1.0 : -1.0;
++expr;
}
}
else
{
Expand Down Expand Up @@ -1358,7 +1367,7 @@ SCIP_RETCODE SCIPcopyExpr(
*
* The actual definition:
* <pre>
* Expression -> ["+" | "-"] Term { ("+" | "-" | "number *") ] Term }
* Expression -> ["+" | "-"] Term { [ ("+" | "-" | "number *") Term | ("number" <varname>) ] }
* Term -> Factor { ("*" | "/" ) Factor }
* Factor -> Base [ "^" "number" | "^(" "number" ")" ]
* Base -> "number" | "<varname>" | "(" Expression ")" | Op "(" OpExpression ")
Expand Down
2 changes: 1 addition & 1 deletion src/scip/scip_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ SCIP_RETCODE SCIPcopyExpr(
*
* The actual definition:
* <pre>
* Expression -> ["+" | "-"] Term { ("+" | "-" | "number *") ] Term }
* Expression -> ["+" | "-"] Term { [ ("+" | "-" | "number *") Term | ("number" <varname>) ] }
* Term -> Factor { ("*" | "/" ) Factor }
* Factor -> Base [ "^" "number" | "^(" "number" ")" ]
* Base -> "number" | "<varname>" | "(" Expression ")" | Op "(" OpExpression ")
Expand Down

0 comments on commit 89401e1

Please sign in to comment.