You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With following model:
`
Variables
x[2][2] in [-1,1];
Minimize x[1][1]+x[0][0]; Printing the system (with cout<<sys) results in:variables:
x[2][2]
box:
([-1, 1] ; [-1, 1] ; [-1, 1] ; [-1, 1])
goal:
(x(2,:)(2)+x(1,:)(1))
`
The row index in the goal function is not printed well.
Using parenthesis instead of square brackets prints well.
In fact, current parsing creates a nested ExprIndex in an ExprIndex for the second index. The nested index has no value for the second dimension, that's why the ':' is printed.
Looking at the yacc file for the parser, there is no explicit rule for matrix index with [] (l 297), whereas there is an explicit one for () (l. 299).
Maybe just adding this rule | expr '[' expr_index ',' expr_index ']' { $$ = expr_with_index($1,$3,$5,false); }
can solve the problem, but maybe it makes the grammar inconsistent due to similar a rule for intervals.
The text was updated successfully, but these errors were encountered:
Thanks for reporting the issue and analyzing it so deep. It has been fixed.
As you guessed, it was not possible to include a simplification rule for this case directly in the parser because of a conflict with the interval definition. But a simplification at higher level (in the system factory) was actually missing for the goal function.
With following model:
`
Variables
x[2][2] in [-1,1];
Minimize x[1][1]+x[0][0];
Printing the system (with cout<<sys) results in:
variables:x[2][2]
box:
([-1, 1] ; [-1, 1] ; [-1, 1] ; [-1, 1])
goal:
(x(2,:)(2)+x(1,:)(1))
`
The row index in the goal function is not printed well.
Using parenthesis instead of square brackets prints well.
In fact, current parsing creates a nested ExprIndex in an ExprIndex for the second index. The nested index has no value for the second dimension, that's why the ':' is printed.
Looking at the yacc file for the parser, there is no explicit rule for matrix index with [] (l 297), whereas there is an explicit one for () (l. 299).
Maybe just adding this rule
| expr '[' expr_index ',' expr_index ']' { $$ = expr_with_index($1,$3,$5,false); }
can solve the problem, but maybe it makes the grammar inconsistent due to similar a rule for intervals.
The text was updated successfully, but these errors were encountered: