schrage

Function schrage 

Source
pub fn schrage(jobs: &JobList) -> SchrageJobTable
Expand description

Schrage algorithm.

§Arguments

  • jobs: A vector of jobs.

returns: JobList Returns a JobList that is sorted in the sub-optimized arrangement.

§Examples

use proc_opt::jobs::{JobList, Job, SchrageJobTable};
use proc_opt::schrage::schrage;
let expected_result = SchrageJobTable::new(JobList {
    jobs: vec![
        Job::new(0, 6, 17),  // 6
        Job::new(10, 5, 7),  // 1
        Job::new(13, 6, 26), // 2
        Job::new(11, 7, 24), // 3
        Job::new(20, 4, 21), // 4
        Job::new(30, 3, 8),  // 5
        Job::new(30, 2, 0),  // 7
    ],
});
let js = SchrageJobTable::new(JobList {
    jobs: vec![
        Job::new(10, 5, 7),  // 1
        Job::new(13, 6, 26), // 2
        Job::new(11, 7, 24), // 3
        Job::new(20, 4, 21), // 4
        Job::new(30, 3, 8),  // 5
        Job::new(0, 6, 17),  // 6
        Job::new(30, 2, 0),  // 7
    ],
});
let result = schrage(&js.job_list);
assert_eq!(result.job_list, expected_result.job_list);
assert_eq!(result.c_max(), 53);