Struct sudoku_variants::solver::strategy::impls::BoundedOptionsBacktrackingStrategy[][src]

pub struct BoundedOptionsBacktrackingStrategy<FO, FA, S> where
    FO: Fn(usize) -> usize,
    FA: Fn(usize) -> Option<usize>,
    S: Strategy
{ /* fields omitted */ }

A Strategy which looks for cells with few options (up to a specified maximum) and tries all of them. It then uses a wrapped strategy to find deductions in all paths. If any of those deductions hold for all options, they are stored in the metadata.

As an example, consider the following situation.

╔═══╤═══╤═══╦═══╤═══╤═══╦═══╤═══╤═══╗
║ 1 │ A │ 2 ║ 3 │ 4 │ 5 ║ 6 │ B │ 7 ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║   │   │   ║   │   │   ║   │   │   ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║   │   │   ║   │   │   ║   │   │   ║
╠═══╪═══╪═══╬═══╪═══╪═══╬═══╪═══╪═══╣
║ 2 │ 3 │ C ║   │   │   ║   │ Z │   ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║ 4 │   │ 1 ║   │   │   ║   │   │   ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║ 5 │ 6 │ 7 ║   │   │   ║   │   │   ║
╠═══╪═══╪═══╬═══╪═══╪═══╬═══╪═══╪═══╣
║   │   │   ║   │   │   ║   │   │   ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║   │   │   ║   │   │   ║   │   │   ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║   │   │   ║   │   │   ║   │   │   ║
╚═══╧═══╧═══╩═══╧═══╧═══╩═══╧═══╧═══╝

In this case, if A is an 8, then B must be a 9 by the OnlyCellStrategy, so Z cannot be a 9. If A is a 9, then C must be a 9 by the same strategy, and consequently Z cannot be a 9 aswell. So, this strategy with an options bound of at least 2 (since A can be 8 or 9), an OnlyCellStrategy as the continuation strategy, and at least 1 application, can conclude that Z cannot be a 9.

Implementations

impl<FO, FA, S> BoundedOptionsBacktrackingStrategy<FO, FA, S> where
    FO: Fn(usize) -> usize,
    FA: Fn(usize) -> Option<usize>,
    S: Strategy
[src]

pub fn new(
    max_options_computer: FO,
    max_applications_computer: FA,
    continuation_strategy: S
) -> BoundedOptionsBacktrackingStrategy<FO, FA, S>
[src]

Creates a new bounded options backtracking strategy.

Arguments

  • max_options_computer: A closure that, given the grid size, computes the maximum number of options that may be present in a cell for this strategy to consider all of them.
  • max_applications_computer: A closure that, given the grid size, computes the maximum number of times the continuation strategy may be applied for each considered option before no further inference is done. If no limit is desired, this may return None.
  • continuation_strategy: The Strategy with which each considered option is developed to find any inferences.

Trait Implementations

impl<FO: Clone, FA: Clone, S: Clone> Clone for BoundedOptionsBacktrackingStrategy<FO, FA, S> where
    FO: Fn(usize) -> usize,
    FA: Fn(usize) -> Option<usize>,
    S: Strategy
[src]

impl<FO, FA, S> Strategy for BoundedOptionsBacktrackingStrategy<FO, FA, S> where
    FO: Fn(usize) -> usize,
    FA: Fn(usize) -> Option<usize>,
    S: Strategy
[src]

Auto Trait Implementations

impl<FO, FA, S> RefUnwindSafe for BoundedOptionsBacktrackingStrategy<FO, FA, S> where
    FA: RefUnwindSafe,
    FO: RefUnwindSafe,
    S: RefUnwindSafe

impl<FO, FA, S> Send for BoundedOptionsBacktrackingStrategy<FO, FA, S> where
    FA: Send,
    FO: Send,
    S: Send

impl<FO, FA, S> Sync for BoundedOptionsBacktrackingStrategy<FO, FA, S> where
    FA: Sync,
    FO: Sync,
    S: Sync

impl<FO, FA, S> Unpin for BoundedOptionsBacktrackingStrategy<FO, FA, S> where
    FA: Unpin,
    FO: Unpin,
    S: Unpin

impl<FO, FA, S> UnwindSafe for BoundedOptionsBacktrackingStrategy<FO, FA, S> where
    FA: UnwindSafe,
    FO: UnwindSafe,
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,