Project::evaluate#
Scores alternative change sets against the solved baseline of a Project. The project is never modified. Use it to compare options, such as which resource should take a task, before committing one with apply.
Signature#
Takes &self. Synchronous and CPU-only.
Parameters#
| Name | Type | Description |
|---|---|---|
candidates |
&[Candidate] |
The change sets to score |
options |
&EvaluateOptions |
Baseline check, leveling stage, focus tasks and clear_first |
Behavior#
Each candidate runs on a disposable copy of the reference state (the baseline, or its cleared copy with options.clear_first):
applythe candidate's changes.solve(None)and measure the scheduled stage.- With
options.levelset,levelwith those options and measure the leveled stage.
Every candidate starts from the reference state, never from the previous candidate. A failure inside one candidate goes into that candidate's error and doesn't fail the call. The result has scores, not dates.
Returns#
An EvaluateResult with the baseline metrics and one result per candidate, in input order.
Errors#
| Error | When |
|---|---|
Error::Project(ProjectError::NoBaseline) |
The project is unsolved, including after apply |
Error::Project(ProjectError::StaleBaseline) |
options.baseline_id or any candidate's changes.baseline_id doesn't name the current baseline |
Error::Input |
An unknown task in focus (path focus[i]); options.level is invalid for the baseline |
evaluate_with#
Same as evaluate, with a choice of Execution. Execution::Parallel runs candidates on scoped worker threads. The results are identical to evaluate and keep input order. A call-level error is the first one in input order. Errors are the same as for evaluate.
evaluate_with isn't compiled for wasm targets. Use evaluate there.
Example#
Compare leaving the plan as it is with moving task B to an idle resource.
use ;
Related#
Project- the type and its other methodsCandidateandEvaluateOptions- the inputEvaluateResult- the returned scores- Evaluating Alternatives - metrics, cost, failed candidates and committing the winner