Skip to main content

solve_with_adapter

Function solve_with_adapter 

Source
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