pub fn solve_with_adapter(
schema: &DecisionSchema,
objective: &dyn IntegerObjective,
adapter: &dyn SolverAdapter,
) -> Result<OptimizationResult, CombinatorialOptimizationError>Expand description
Runs adapter on schema and checks its answer.
The schema is checked with DecisionSchema::validate_variables, so the box may be of
any size: max_enumeration is an enumeration cap and does not apply to a solver that
does not enumerate. The adapter’s result is then checked: best_decision must be a point
of the box (DecisionSchema::contains), and best_objective must equal the objective
re-evaluated at best_decision to within 1e-9 relative (at least 1e-9 absolute). The
returned best_objective is that re-evaluated value; evaluated_candidates is the
adapter’s own count.
§Errors
- Any error of
DecisionSchema::validate_variables. - Any error returned by
SolverAdapter::solve, unchanged. CombinatorialOptimizationError::InvalidAdapterResultif the decision is not a point of the box, or the reported objective does not match the re-evaluated one.CombinatorialOptimizationError::ObjectiveNotFiniteif the objective at the decision is not finite, or an error ofIntegerObjective::evaluate, unchanged.