stanle / madopt

Apache License 2.0
16 stars 5 forks source link

Minus equals python operator #22

Open paul-scott opened 6 years ago

paul-scott commented 6 years ago

I have been getting some strange behaviour when using the -= python operator to construct expressions. Sometimes it works but other times the model fails to solve. Reformulating it as += -(rhs) seems to fix the problem. Looking through the python interface I see that there is an iadd but no isub. I tried to implement one to see if that would fix the issue, but it didn't.

I don't have a simple example to demonstrate this issue, only a larger problem which I can't really send. Anyway I thought I'd put this here as a warning for anyone else (or more likely myself in the future), that is trying to use the -=, /= operators that there might be some issues. From memory I also ran into this issue a long time ago, but likely didn't do anything about it at the time.