Skip to main content

Heuristic

Trait Heuristic 

Source
pub trait Heuristic: Debug {
    // Required methods
    fn changes(&self, solve_state: &SolveState<'_>) -> Option<Changes>;
    fn seen_coords(&self, solve_state: &SolveState<'_>) -> CoordSet;
    fn description(&self) -> String;
}
Expand description

Represents a heuristic for solving a Queens board.

Required Methods§

Source

fn changes(&self, solve_state: &SolveState<'_>) -> Option<Changes>

What changes would this heuristic make? This returns None if the heuristic does not see any possible changes, or returns Some(Changes) containing the changes it would make.

Source

fn seen_coords(&self, solve_state: &SolveState<'_>) -> CoordSet

What coordinates did this heuristic consider?

This allows visualizations to highlight appropriate squares, or solvers to prioritize strategies that “look at” fewer coordinates.

Source

fn description(&self) -> String

A human explanation of what this heuristic does.

Important: This should always be two lines, so that animations know where to move the cursor. The recommended format is:

  1. First line – an explanation of what the heuristic saw.
  2. Second line – an explanation of what the heuristic does.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§