Skip to main content

SolutionPartitioner

Trait SolutionPartitioner 

Source
pub trait SolutionPartitioner<S: PlanningSolution>:
    Send
    + Sync
    + Debug {
    // Required methods
    fn partition(&self, solution: &S) -> Vec<S>;
    fn merge(&self, original: &S, partitions: Vec<S>) -> S;

    // Provided method
    fn recommended_partition_count(&self) -> Option<usize> { ... }
}
Expand description

Splits a solution into independent partitions for parallel solving.

Each partition should be solvable independently without affecting the correctness of other partitions. The partitioner must also be able to merge the solved partitions back into a complete solution.

§Type Parameters

  • S: The planning solution type

§Example

For a school timetabling problem, a natural partitioning might be by room or by time period, where each partition contains lessons that don’t interact with lessons in other partitions.

Required Methods§

Source

fn partition(&self, solution: &S) -> Vec<S>

Source

fn merge(&self, original: &S, partitions: Vec<S>) -> S

Provided Methods§

Implementors§

Source§

impl<S, PF, MF> SolutionPartitioner<S> for FunctionalPartitioner<S, PF, MF>
where S: PlanningSolution, PF: Fn(&S) -> Vec<S> + Send + Sync, MF: Fn(&S, Vec<S>) -> S + Send + Sync,