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 with pytfa.relax_dgo due to sympy #47

Open
embt opened this issue Mar 3, 2021 · 2 comments
Open

Problem with pytfa.relax_dgo due to sympy #47

embt opened this issue Mar 3, 2021 · 2 comments

Comments

@embt
Copy link
Contributor

embt commented Mar 3, 2021

Hello,
first of all big thanks for supporting the package! I had a problem with the function relax_dgo and also a possible solution:
from pytfa.optim.relaxation import relax_dgo
relaxed_model, slack_model, relax_table = relax_dgo(mytfa)

The follwing Error occours:

~\AppData\Roaming\Python\Python38\site-packages\pytfa\optim\utils.py in symbol_sum(variables)
108 k=0
109 # If we encounter a zero, which is a special type, increase k
--> 110 while isinstance(variables[k], sympy.numbers.Zero) and k<len(variables):
111 k+=1
112 if k == len(variables):

AttributeError: module 'sympy' has no attribute 'numbers'

By changing sympy.numbers.Zero to sympy.core.numbers.Zero in ~\AppData\Roaming\Python\Python38\site-packages\pytfa\optim\utils.py the Error is gone.
This seems like sympy changed something there.

I'm using Python Python 3.8.5 and sympy version 1.6.2

Regards,
Emil

@psalvy
Copy link
Member

psalvy commented Mar 3, 2021

Good day Emil,

Thanks a lot for using our package!
Looks like sympy changed the behavior/location of their Zero object (this suggests maybe it was 14 months ago ?). Thanks for the quick fix you provided! Would you mind sending out a PR for this ?
Cheers,
Pierre

@embt
Copy link
Contributor Author

embt commented Mar 3, 2021

I hope I did everything right, I'm a bit new to GitHub.
Thanks!

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