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

pydrake.symbolic.Formula and returns unexpected results #8536

Closed
RussTedrake opened this issue Apr 8, 2018 · 2 comments
Closed

pydrake.symbolic.Formula and returns unexpected results #8536

RussTedrake opened this issue Apr 8, 2018 · 2 comments

Comments

@RussTedrake
Copy link
Contributor

From underactuated piazza

``
mp = MathematicalProgram()
x = mp.NewContinuousVariables(1, 'x')
mp.AddLinearCost(x[0])
mp.AddLinearConstraint(-1 <= x[0] <= 1)
mp.Solve()
print mp.GetSolution(x)


This prints -6.17673396e+14 instead of printing -1 or throwing an exception. I understand that python doesn't allow you to override and, so AddLinearConstraint can only see one of the subexpressions (rhs if lhs is truthy, lhs if it isn't). But is there any reason why `pydrake._symbolic_py.Formula.__nonzero__` doesn't throw an exception?
@soonho-tri
Copy link
Member

I think #8500 resolves this issue as well. I'll check and add this as a test.

/cc @EricCousineau-TRI

EricCousineau-TRI added a commit to EricCousineau-TRI/drake that referenced this issue Apr 8, 2018
@EricCousineau-TRI
Copy link
Contributor

Went ahead and added it in as a two-liner to #8500. Thanks!

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

No branches or pull requests

3 participants