Move

Trait Move 

Source
pub trait Move<S: PlanningSolution>:
    Send
    + Sync
    + Debug {
    // Required methods
    fn is_doable<D: ScoreDirector<S>>(&self, score_director: &D) -> bool;
    fn do_move<D: ScoreDirector<S>>(&self, score_director: &mut D);
    fn descriptor_index(&self) -> usize;
    fn entity_indices(&self) -> &[usize];
    fn variable_name(&self) -> &str;
}
Expand description

A move that modifies one or more planning variables.

Moves are fully typed for maximum performance - no boxing, no virtual dispatch. Undo is handled by RecordingScoreDirector, not by move return values.

§Type Parameters

  • S - The planning solution type

§Implementation Notes

  • Moves should be lightweight
  • Use RecordingScoreDirector to wrap the score director for automatic undo
  • Moves are NEVER cloned - ownership transfers via arena indices
  • Methods are generic over D to allow use with both concrete directors and RecordingScoreDirector

Required Methods§

Source

fn is_doable<D: ScoreDirector<S>>(&self, score_director: &D) -> bool

Returns true if this move can be executed in the current state.

A move is not doable if:

  • The source value equals the destination value (no change)
  • Required entities are pinned
  • The move would violate hard constraints that can be detected early
Source

fn do_move<D: ScoreDirector<S>>(&self, score_director: &mut D)

Executes this move, modifying the working solution.

This method modifies the planning variables through the score director. Use RecordingScoreDirector to enable automatic undo via undo_changes().

Source

fn descriptor_index(&self) -> usize

Returns the descriptor index of the entity type this move affects.

Source

fn entity_indices(&self) -> &[usize]

Returns the entity indices involved in this move.

Source

fn variable_name(&self) -> &str

Returns the variable name this move affects.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S, V> Move<S> for ChangeMove<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for KOptMove<S, V>
where S: PlanningSolution, V: Clone + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for ListChangeMove<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for ListReverseMove<S, V>
where S: PlanningSolution, V: Clone + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for ListRuinMove<S, V>
where S: PlanningSolution, V: Clone + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for ListSwapMove<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for PillarChangeMove<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for PillarSwapMove<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for RuinMove<S, V>
where S: PlanningSolution, V: Clone + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for SubListChangeMove<S, V>
where S: PlanningSolution, V: Clone + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for SubListSwapMove<S, V>
where S: PlanningSolution, V: Clone + Send + Sync + Debug + 'static,

Source§

impl<S, V> Move<S> for SwapMove<S, V>
where S: PlanningSolution, V: Clone + PartialEq + Send + Sync + Debug + 'static,