optlang icon indicating copy to clipboard operation
optlang copied to clipboard

Implement a clean API to decide whether or not to extract solver values

Open Midnighter opened this issue 6 years ago • 6 comments

Please see the source of this issue in https://github.com/opencobra/cobrapy/pull/714. Basically, we would like a clean way to decide whether or not it is okay to extract primals (and duals).

Midnighter avatar May 29 '18 20:05 Midnighter

I think I see what it is that you want. However it seems like it will always depend a lot on the specific application whether it is "okay" to get the values from a particular type of non-optimal solution? I think the only thing that can really be done in optlang is to make sure that the status classifications are consistent and meaningful, so that an application, e.g. cobrapy can decide how to handle each of the optlang statuses. This is a bit tricky though as the different solvers define different statuses that do not always translate well. Suggestions are welcome.

KristianJensen avatar May 30 '18 09:05 KristianJensen

Or is it just this has_primals = [NUMERIC, FEASIBLE, INFEASIBLE, SUBOPTIMAL, ITERATION_LIMIT] particularly that you would like to have in optlang?

KristianJensen avatar May 30 '18 09:05 KristianJensen

It would be a start. Just wanted to start a discussion on whether that's the way it should be handled or if we look at alternative ways that solve the problem in a bit more general fashion. For example, a while back we introduced the property is_integer to decide whether dual values are available or not.

Midnighter avatar May 30 '18 10:05 Midnighter

Just to be sure: Is it a question of whether it's technically possible to get the values from the solver, or is it a question of whether it's meaningful to do so?

If it's the former, I agree that it would make sense to have e.g. a has_values property on the Model, to check whether there are values available for a given status with a given solver.

KristianJensen avatar May 30 '18 10:05 KristianJensen

@cdiener can probably explain this better than I do. The question is about the latter. We don't always expect it to be a valid solution at that point but looking at the values can still be informative as to why the solver failed.

Midnighter avatar May 30 '18 10:05 Midnighter

@KristianJensen It would be the first (whether it's technically possible). This is to be able to inspect a non-optimal solution. For instance SUBOPTIMAL or even NUMERIC solutions might still be interesting to inspect since they are often very close to the optimal solution. We would still raise a warning if such a solution is requested.

cdiener avatar May 30 '18 15:05 cdiener