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

Simplify the expression tree #67

Open
lovasoa opened this issue Feb 10, 2021 · 2 comments
Open

Simplify the expression tree #67

lovasoa opened this issue Feb 10, 2021 · 2 comments

Comments

@lovasoa
Copy link
Contributor

lovasoa commented Feb 10, 2021

What would you think about simplifying the expression tree by

  • Removing SubExpr (and replacing it with Add(Mul(-1, expr))
  • Replacing AddExpr(left, right) by AddExpr(Vec<expr>), to avoid creating deep trees (that cause Simplify overflows the stack #37)

This is not perfect, but should be easy to implement as a workaround for now. Would you accept such a PR ?

A more ambitious refactor that we can keep for later is to implement the expression as a simple HashMap<Variable, Coefficient>.

@jcavat
Copy link
Collaborator

jcavat commented Feb 11, 2021

is it still relevant after last commits ?

This was referenced Feb 11, 2021
@lovasoa
Copy link
Contributor Author

lovasoa commented Feb 11, 2021

removing Subexpr would significantly simplify the code.
And restructuring the struct to have only a sum of multiplications would improve performance

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