Skip to main content

Module optimize

Module optimize 

Source
Expand description

Cost-evaluation vocabulary for branch-and-bound optimization.

The branch-and-bound search now lives in the unified kernel (crate::solver::search::branch_and_bound); this module owns only the cost abstraction the optimizer plugs in — DomainCostEval and its two implementors (ZeroCost, CostDomainEval).

§Deferred extensions (Phase 2 design decisions)

TieredCostEval / lazy cost evaluation — deferred because the crate::domain::CostDomain::min_cost incremental Cell cache covers the immediate bottleneck: the optimizer’s optimistic bound was calling min_cost() O(domain) per node, and the cache amortizes that to O(1). A tiered evaluator (cheap proxy lower bound + expensive actual cost with memoization) only pays its API cost when a second consumer with a genuinely non-trivial cost function appears. DomainCostEval is the extension point — implement a new evaluator type, no solver-core changes needed.

solve_with_warm_start — deferred because no consumer currently demands incremental re-solving (accepting a previous solution as the initial incumbent for tighter pruning from node zero). Land it when the first incremental consumer (e.g. a playground animation scrubber) appears.

Structs§

CostDomainEval
Evaluator that delegates to CostDomain methods.
ZeroCost
No-op evaluator: all costs are zero. Used when D doesn’t implement CostDomain.

Traits§

DomainCostEval
Cost evaluator for domains. Passed into the optimizer so the same search code works for both CostDomain and plain Domain (zero cost).