Project::suggest_assignments#
Proposes resources for requirement slots of a Project. It fills empty slots, repairs broken ones and rebalances valid ones, scoring each step like evaluate. The project is never modified: the proposal comes back as a change set.
Signature#
Takes &self. Synchronous and CPU-only.
Parameters#
| Name | Type | Description |
|---|---|---|
slots |
&[Slot] |
The slots to fill or rebalance. To build them from skills and requirements, use plen_assign::slots. To build your own, read the state with roster. |
options |
&SuggestOptions |
Targets, fixed assignments, penalty, passes and leveling stage |
Behavior#
- Greedy: slots are visited one at a time, and later slots build on earlier picks.
- It never removes an assignment. It adds one per filled slot and changes the resource of a repaired or rebalanced one.
- Commit the proposal with
apply(&result.changes), thensolve(None), orlevelwith the same leveling options when they were set.
Returns#
A SuggestResult with the proposed changes and a step log.
Errors#
| Error | When |
|---|---|
Error::Project(ProjectError::NoBaseline) |
The project is unsolved, including after apply |
Error::Project(ProjectError::StaleBaseline) |
options.baseline_id doesn't name the current baseline |
Error::Input |
Invalid options (new_resource_penalty, passes, targets[i], fixed[i], level); a cyclic accepted state (path: None); an invalid slot (paths under slots[i]) |
Options are checked before slots. The accepted values are on the SuggestOptions and Slot pages.
Example#
Fill an open position on task C, then commit the proposal.
use ;
Related#
Project- the type and its other methodsSlotandSuggestOptions- the inputSuggestResult- the returned proposal- Suggesting assignments - how picks are made, options and committing
- Skills and Requirements - generating slots from skills