-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider transforming Status to Result #40
Comments
|
Does this mean you're planning to treat Result<Either<WithSolution, WithoutSolution>, String> I wouldn't aggregate status at this point already as this restricts the freedom of the consumer of this crate. Especially if the error cases are converted to |
I would prefer one of these solution : Result<Solution, Error>
Create our own enum Result {
Optimal(Solution),
SubOptimal(Solution),
SolutionError(String),
Error(Error)
} I would prefer solution 1 for my part |
The first proposal would mix errors originating from actually trying to run the optimization (e.g. missing optimizer executable, unable to write either input or output files) with the infeasibility to find an optimal solution, which might in some cases be a valid outcome as well (e.g. for distribution problems For the second proposal I see problems in error handling. I'm not sure, if it's easy to use My proposal would be something like: Result<Outcome, SomeErrorType or String> with enum Outcome {
Optimal(Solution),
SubOptimal(Solution),
Infeasible,
Unbounded,
} ( That way, one could use the standard error handling mechanisms and still has more fine grained control on how to interpret the actual optimization result. Usage in that case would roughly look like let solution = match solver.run(&problem)? {
Optimal(solution) | SubOptimal(solution) => solution,
_ => return Err("boo"),
} |
And putting a solution only for Optimal and Suboptimal.
This would avoid testing the context in many situation.
The text was updated successfully, but these errors were encountered: