dreal / dreal4

Automated Reasoning in Nonlinear Theories of Reals
https://dreal.github.io
Apache License 2.0
150 stars 31 forks source link

No python extension to define a Environment #296

Closed HaomiaoLuoLlanio closed 1 year ago

HaomiaoLuoLlanio commented 1 year ago

Hi, Very appreciate the solver you guys developed! I have a question. I want to insert some value into Expression to get a real value of the expression, and I used 'Evaluate' function to complete this task. The problem comes from that this function seems like should run under a Environment. There is no Environment definition in dreal_py.cc. Can you provide some solution to cope with problem? ( I am using Python Binding) Thank you! Looking forward to your reply!

soonhokong commented 1 year ago

Hi, you can use a Python dictionary (Variable -> float). See this example, https://github.com/dreal/dreal4/blob/40aaf93735d919053b0166e09bbd310a51f9f108/dreal/test/python/symbolic_test.py#L537-L540

HaomiaoLuoLlanio commented 1 year ago

Thank you so much, it works!