pub trait PathScore<Task> {
// Required method
fn path_score(&self, path: &[Task]) -> Option<u64>;
// Provided method
fn insertion_scores(
&self,
path: &[Task],
task: &Task,
each: &mut dyn FnMut(usize, Option<u64>),
)
where Task: Clone { ... }
}Expand description
The value of a whole path: the tasks an agent holds, in execution order.
Wrap a path score in BestInsertion to get a Valuation that inserts each new task
where it adds the most.
Required Methods§
Sourcefn path_score(&self, path: &[Task]) -> Option<u64>
fn path_score(&self, path: &[Task]) -> Option<u64>
The value of executing path in order; None when the agent cannot execute it,
for example because a task would miss its deadline.
The empty path must be feasible.
Provided Methods§
Sourcefn insertion_scores(
&self,
path: &[Task],
task: &Task,
each: &mut dyn FnMut(usize, Option<u64>),
)where
Task: Clone,
fn insertion_scores(
&self,
path: &[Task],
task: &Task,
each: &mut dyn FnMut(usize, Option<u64>),
)where
Task: Clone,
Calls each with every insertion position of task into path, from path.len()
down to zero, and the path_score of path with task at
that position.
The default builds one scratch path and moves task through it. Override it when
the score can be computed without materializing the path, as
Timed does, to avoid the allocation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".