Skip to main content

ScoreBounder

Trait ScoreBounder 

Source
pub trait ScoreBounder<S: PlanningSolution, D: ScoreDirector<S>>: Send + Debug {
    // Required method
    fn calculate_optimistic_bound(&self, score_director: &D) -> Option<S::Score>;

    // Provided method
    fn calculate_pessimistic_bound(
        &self,
        score_director: &D,
    ) -> Option<S::Score> { ... }
}
Expand description

Calculates score bounds for exhaustive search pruning.

The bounder estimates the best possible score that can be achieved from a partial solution state. If this optimistic bound is worse than the best complete solution found so far, the branch can be pruned.

Required Methods§

Source

fn calculate_optimistic_bound(&self, score_director: &D) -> Option<S::Score>

Calculates the optimistic bound for the current solution state.

The optimistic bound is an upper bound on the score achievable from this partial solution. It should be:

  • Fast to compute
  • Greater than or equal to any actual achievable score

Returns None if no bound can be computed.

Provided Methods§

Source

fn calculate_pessimistic_bound(&self, score_director: &D) -> Option<S::Score>

Calculates the pessimistic bound for the current solution state.

The pessimistic bound is a lower bound on the score achievable from this partial solution. This is less commonly used but can help with certain heuristics.

Returns None if no bound can be computed.

Implementations on Foreign Types§

Source§

impl<S: PlanningSolution, D: ScoreDirector<S>> ScoreBounder<S, D> for ()

Source§

fn calculate_optimistic_bound(&self, _score_director: &D) -> Option<S::Score>

Implementors§

Source§

impl<S: PlanningSolution, D: ScoreDirector<S>> ScoreBounder<S, D> for FixedOffsetBounder<S>
where S::Score: Clone + Add<Output = S::Score> + Mul<i32, Output = S::Score>,

Source§

impl<S: PlanningSolution, D: ScoreDirector<S>> ScoreBounder<S, D> for SimpleScoreBounder