Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in serialization of matrix variables using [] in minibex #442

Closed
raphaelchenouard opened this issue Feb 13, 2020 · 1 comment
Closed
Assignees

Comments

@raphaelchenouard
Copy link
Contributor

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.

@gchabert gchabert self-assigned this Feb 14, 2020
gchabert pushed a commit that referenced this issue Feb 14, 2020
@gchabert
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants