fslaborg / flips

Fsharp LInear Programming System
https://flipslibrary.com/#/
MIT License
252 stars 32 forks source link

Update sum and sumAll to work with Decision #68

Closed matthewcrews closed 3 years ago

matthewcrews commented 3 years ago

There's a pain point when calling sum and sumAll for collections that hold Decision. The addition of the Decision type results in a LinearExpression. This does not work with the built in Sum methods which expect addition to be Monoidal.

Since SMap is the preferred container type for this library, I propose adding an override for Sum in the Slice Maps that deals with this scenario. This does not fix this for other collection types but it does for the primary use case.