LevelingStep#

Selects how far leveling moves a task in one proposal when it resolves an overallocation. It's the type of LevelingOptions::step. The default is LevelingStep::Minimal.

Declaration#

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum LevelingStep {
    #[default]
    Minimal,
    Skip,
}

With the serde feature, the variants serialize as "minimal" and "skip".

Variants#

Variant Description
Minimal Default. Each proposal moves the task past one overallocated bucket. Leveling then reschedules and picks the task to move again at the next bucket.
Skip Each proposal moves the task past the whole overallocated window at once. It takes fewer rounds, but the outcome can differ from Minimal, because the buckets it jumps over don't get a new selection. If the jump doesn't fit, leveling falls back to the Minimal move for that task. A window of one bucket gives the same move as Minimal.

For when to pick Skip, see Leveling resources.

Example#

use plen_core::{LevelingOptions, LevelingStep};

fn main() {
    let options = LevelingOptions {
        step: LevelingStep::Skip,
        ..LevelingOptions::default()
    };
    assert_eq!(LevelingOptions::default().step, LevelingStep::Minimal);
    assert_eq!(options.step, LevelingStep::Skip);
}