StepCost#
The state cost before and after one step of Project::suggest_assignments. Each SuggestStep carries one in its cost field. StepCost isn't built by hand.
Declaration#
With the serde feature (cargo add plen-core --features serde), StepCost also implements Serialize and Deserialize, with fields before and after.
Fields#
| Field | Type | Description |
|---|---|---|
before |
f64 |
State cost before the step. Equals the previous step's after. For the first step, equals SuggestResult::baseline.cost. |
after |
f64 |
State cost after the step. The next step's before. |
Both values include the new_resource_penalty and are measured on the scoring stage, against the reference state the call started from. SuggestOptions::level selects the scoring stage. For how a state's cost is computed, see Suggesting assignments.
Example#
use SuggestResult;
// Print how much each step changed the state cost.
Related#
SuggestStep- carries this value in itscostfieldAssignTotal- the reference cost the first step starts fromSuggestProposal- the final cost the last step ends at- Suggesting assignments - shows reading per-step costs from a proposal