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§
Sourcefn partition(&self, solution: &S) -> Vec<S>
fn partition(&self, solution: &S) -> Vec<S>
Splits the solution into independent partitions.
Each returned solution should be a subset of the original that can be optimized independently. The union of all partitions should cover all entities in the original solution.
§Arguments
solution- The solution to partition
§Returns
A vector of partial solutions, one per partition.
Provided Methods§
Sourcefn recommended_partition_count(&self) -> Option<usize>
fn recommended_partition_count(&self) -> Option<usize>
Returns the recommended number of partitions.
This can be used by the partitioned search phase to determine
how many threads to use. Returns None if no recommendation.