Closed jcavat closed 5 years ago
I'm not sure whether the objective should be unconditionally evaluated. There are use cases where its actual value isn't important, but just the values of the variables is of interest.
Thus, I propose to make it two step:
let (status, values) = solver.run(&problem).unwrap();
let objective = problem.eval(&values);
eval
is just the name I've used and I'm open for better suggestions. Another benefit of this approach is its backward compatibility.
Alternatively it might be a better to wrap the return value of solver.run
into its own struct (e.g. named Solution
), which then provides ways of retrieving status
, values
and objective
.
It's a good point. Returning a Solution
structure seems a good ideal. Especially if we add new features such as eval
. Maybe a Solution
should refer to a Problem
. With this, we could call eval
without giving parameters.
Create a new issue for that : #39
Provide a function that evaluate the objective function who may have been returned by the
run
function.Maybe something like: