Open cmower opened 1 year ago
Yeah, i agree. This month i am already packed so i would propose that we start a branch in March to add this.
If this has time and you are happy with it, I can start the branch directly in the repo (not sure about permission).
Additionally, I would suggest also to include the parameters used to solve the problem in the returned solution class, and the respective methods to access them by name. (whether they are model parameters or parameters defined by the user)
Cool, will keep in mind.
I can do the main implementation. Then you can check out once it is done when ever you have time.
Currently, the
solve()
method returns a dictionary containing the solution. I'm proposing here that we should implement a solution class that has the solution data packed inside but also comes with some useful methods.For example, it could look something like the following.
This would be a little re-work but I think it would help optas become more extensible. I think this would be worthwhile. @joaomoura24, if this means a lot of hassle you're end. We could still incorporate the feature but put a flag in the
Solver
class interface. E.g. we put a flag sayingsolution_return_type='dict'
by default (and the return type is what it is currently), and if the user wants to get the solution as theSolution
class (something like above) perhaps they putsolution_return_type='soln_cls'
or something. I prefer not to do this but happy to if it means a lot of work your end.I've not been a fan of having to do
solution[f'{self.name}/q']
all the time, and alsosolver.interpolate
doesn't make so much sense so would be good to put that functionality in a place that makes more sense.