EvaluateResult#
Holds every candidate of one Project#evaluate or Project#evaluateWith call, each scored against the same baseline. Those calls are the only way to obtain one.
Declaration#
;
Fields#
| Field | Type | Description |
|---|---|---|
baselineId |
String |
Token of the accepted baseline the candidates were scored against. |
baseline |
Metrics |
Metrics of the reference state. Every delta in it is 0. |
candidates |
Vec<CandidateResult> |
One result per candidate, in input order. |
baselineId#
public String baselineId ;
The project's accepted baseline token at the time of the call. evaluate always sets it. When EvaluateOptions.clearFirst is true, it is still the accepted state's token. Set it as baselineId on the SchedulingChanges of the candidate you commit. Project#apply then rejects the commit if the project changed since the call.
baseline#
public Metrics baseline ;
The reference that every candidate is compared with. This is the accepted state, or its cleared copy when clearFirst is true. Its deltas are 0 by definition. baseline.cost is the cost of the baseline itself. A candidate whose CandidateResult.cost is lower scores better than leaving the plan unchanged.
candidates#
public Vec candidates ;
One CandidateResult per input candidate, in the order of the candidates argument. Sequential and parallel execution keep the same order. A failed candidate stays in the list with error set and no metrics. A call-level error throws instead (see Project#evaluate).
Methods#
withBaselineId, withBaseline, withCandidates#
public EvaluateResult
public EvaluateResult
public EvaluateResult
public EvaluateResult
Each setter assigns its field and returns this instance. The Collection overload copies the elements into a new Vec, and null sets the field to null.
Returns: this EvaluateResult.
deepClone#
public EvaluateResult
Returns a copy that shares no list or nested record with this one.
Returns: a new EvaluateResult.
Errors: NullPointerException when baseline or candidates is null. A result returned by evaluate always has both set.
copy#
public EvaluateResult
Returns a shallow copy. The new result holds the same baseline and candidates objects.
Returns: a new EvaluateResult.
equals, hashCode, toString#
public boolean
public int
public String
Inherited from ValueRecord. Two results are equal when baselineId and baseline are equal and candidates match element by element. toString() prints all fields, for logging.
Example#
Score two ways to staff task 1, then commit the one with the lowest cost:
;
;
;
Related#
Project#evaluate- the call that returns itCandidateResult- the score of one candidateMetrics- the type ofbaselineProject#apply- commits the winning candidate- Evaluating alternatives - ranking candidates and committing one