Skip to main content

run_loop_with_control

Function run_loop_with_control 

Source
pub fn run_loop_with_control<P, S, So>(
    problem: &mut Problem<P>,
    state: S,
    solver: &mut So,
    control: &mut RunControl<S>,
) -> Result<OptimizationResult<S>, So::Error>
where S: State + CountsMirror, So: Solver<P, S>,
Expand description

Drive a borrowed solver using execution budgets and application stops.

Convergence is configured on solver. Controls and convergence history reset before initialization; evaluation counts are relative to run entry. The inner state reflects only work performed in this call. Same-problem inner solves share the outer wrapper and aggregate counts automatically. For an adapter problem, use a separate wrapper and fold its counts into the outer wrapper with EvalCounts::add and Problem::counts_mut.

Execution controls run before solver convergence. Step completion and termination are independent, as in SolverStep. This borrowed driver has no executor-attached cancellation token. See RunControl for check ordering and clock semantics.