Suggested feature: solve() should not return dictionary, rather it should return an object called Solution #76
Labels
enhancement
New feature or request
future
Plans for the future.
help wanted
Happy to accept pull requests
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.The text was updated successfully, but these errors were encountered: