Metrics#
The measurements of one stage, each paired with its difference from the baseline. Project#evaluate returns them in EvaluateResult.baseline, in CandidateResult.scheduled, and in LeveledMetrics.metrics for the leveled stage. In the baseline's own Metrics, every delta is 0.
Declaration#
;
Treat a returned Metrics as read-only. Call deepClone() before changing it.
Constructors#
Metrics()#
public
Creates an empty value: finish and overload are null, conflicts and cycles are new Amount(0, 0), cost is 0.0. evaluate always fills every field.
Fields#
| Field | Type | Default | Description |
|---|---|---|---|
finish |
Finish |
null |
Project finish and the finish of each focus task. Never null in a returned value. |
overload |
Overload |
null |
Resource overload of the stage, in total, per resource and per focus task. Never null in a returned value. |
conflicts |
Amount |
new Amount(0, 0) |
Number of entries in the stage's conflicts list. |
cycles |
Amount |
new Amount(0, 0) |
Number of entries in the stage's cycles list. Greater than 0 when the candidate made the plan cyclic. |
cost |
double |
0.0 |
Score of the stage. Lower is better. |
cost is computed from the other fields by one fixed formula:
cost = max(0, finish.project.delta)
+ overload.total.value
+ 1000 × (conflicts.value + cycles.value)
The finish.project term counts as 0 when finish.project is null. The 1000 × penalty ranks every stage with conflicts or cycles after every stage without them. To rank by another rule, compare the raw fields instead of cost.
Methods#
withFinish, withOverload, withConflicts, withCycles, withCost#
public Metrics
public Metrics
public Metrics
public Metrics
public Metrics
Each setter assigns its field and returns this instance. withCost stores the value as given. It doesn't recompute it from the other fields.
Returns: this Metrics.
deepClone#
public Metrics
Returns a deep copy. finish, overload, the two Amount values and every list inside them are copied.
Returns: a new Metrics.
Errors: NullPointerException when finish or overload is null.
copy#
public Metrics
Returns a shallow copy that shares finish and overload with the original. conflicts and cycles get their own Amount instances.
Returns: a new Metrics.
equals, hashCode, toString#
public boolean
public int
public String
Inherited from ValueRecord. Two values are equal when every field is equal: nested objects and lists compare element by element. toString() prints every field, for logging.
Finish#
Finish dates of the stage: the project and each task listed in EvaluateOptions.focus.
| Field | Type | Default | Description |
|---|---|---|---|
project |
Shift |
null |
Latest end over the stage's scheduled tasks. null when the project has no tasks. Its delta is measured on the global calendar and is 0 when the baseline has no tasks. |
tasks |
Vec<TaskFinish> |
empty | One entry per focus task, in focus order. Empty when focus is empty. |
Setters: withProject(Shift), withTasks(Vec<TaskFinish>) and withTasks(Collection<? extends TaskFinish>). deepClone() throws NullPointerException when tasks is null.
TaskFinish#
The finish of one focus task.
| Field | Type | Default | Description |
|---|---|---|---|
id |
Id |
null |
The focus task. |
finish |
Shift |
null |
The task's finish. null when the candidate removed the task. Its delta is measured on the task's calendar. |
Setters: withId(Id), withFinish(Shift).
Shift#
A finish date and how far it moved from the baseline finish.
| Field | Type | Default | Description |
|---|---|---|---|
date |
Moment |
new Moment(0) |
The finish date in this stage. |
delta |
double |
0.0 |
Working time from the baseline finish to date, in SchedulingConfig.durationUnit. Positive when the stage finishes later. |
Setters: withDate(Moment), withDelta(double).
Finish, TaskFinish and Shift have the same deepClone, copy, equals, hashCode and toString members as Metrics.
Example#
Score a two-day extension of task 1 and read how far the project finish moves.
;
;
Related#
Overload- the type ofoverloadCandidateResult- holds the metrics of each candidate stageEvaluateOptions- sets the focus tasks and the leveled stage- Evaluating alternatives - comparing candidates by metrics and cost
- Suggesting assignments - the metrics of a staffing proposal