fslaborg / flips

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

code review: potential bug when building solution object in the or-tools codepath #107

Closed smoothdeveloper closed 3 years ago

smoothdeveloper commented 3 years ago

currently the Solution object is hardcoded to the first objective in the Model object, which seems wrong (model.Objectives.[0]):

https://github.com/matthewcrews/flips/blob/7951951714ae86f4a11397cf7af7eb3fa5fa7bd9/Flips/Solve.fs#L169-L173

If #106 gets merged, the objective value will be available to replace that expression and there won't be need to fix that hardcoded lookup.

matthewcrews commented 3 years ago

I agree that the hard coding seems wrong. It was purposeful decision at the time due to the use case. The needs have evolved and the decision no longer makes sense. We want to fix this.

matthewcrews commented 3 years ago

This feature has actually been marked as Deprecated and the new way is to use the Objective.evaluate function to get this value.