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

Parsing double inequalities #19

Open
nikos-kekatos opened this issue May 9, 2018 · 4 comments
Open

Parsing double inequalities #19

nikos-kekatos opened this issue May 9, 2018 · 4 comments

Comments

@nikos-kekatos
Copy link
Collaborator

nikos-kekatos commented May 9, 2018

In the platooning benchmark, the parsing induces the following error:

invariant -9 <= aL <= 1 in location 1 not understood

@mforets mforets changed the title Final parsing error Parsing invariant error in platooning benchmark May 9, 2018
@schillic
Copy link
Member

schillic commented May 9, 2018

Just a guess: You need to split double inequalities a <= x <= b into a <= x & x <= b.

@mforets
Copy link
Member

mforets commented May 9, 2018

At least parsing the string works as expected:

julia> SX.parse_sxmath("-1 <= x <= 1")
1-element Array{Expr,1}:
 :(-1 <= x <= 1)

@mforets
Copy link
Member

mforets commented May 9, 2018

Just a guess: You need to split double inequalities a <= x <= b into a <= x & x <= b.

Yes, i think your guess is correct. This type of expression is a :comparison and it was not been taken into account for the transformation of expressions to sets.

julia> using SX

julia> expr = SX.parse_sxmath("-9 <= aL <= 9")
1-element Array{Expr,1}:
 :(-9 <= aL <= 9)

julia> expr[1].head
:comparison

julia> expr[1].args
5-element Array{Any,1}:
 -9
   :(<=)
   :aL
   :(<=)
  9

It is easy to add a new case, checking that the args 2 and 4 are <= and then transform it into two halfspaces.

@mforets
Copy link
Member

mforets commented Oct 13, 2019

Another model with uses this conjunction notation is the linear switching SX model.

@mforets mforets changed the title Parsing invariant error in platooning benchmark Parsing double inequalities Oct 15, 2019
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

Successfully merging a pull request may close this issue.

3 participants