CandidateResult#
The score of one Candidate. Project#evaluate and Project#evaluateWith return one per candidate in EvaluateResult.candidates, in input order.
Declaration#
;
A result holds either an error or metrics, never both. Check error first.
Constructors#
CandidateResult()#
public
Creates an instance with every field set to null. The library fills the fields on every instance it returns.
Fields#
| Field | Type | Description |
|---|---|---|
id |
Id |
The candidate's id, copied unchanged. |
error |
RejectedOperation |
Set when the candidate failed: the first rejected operation of its change set, or an input error from its solve or level run. path is "" when the error has no input path. When set, scheduled, leveled and cost are null. null otherwise. |
scheduled |
Metrics |
Metrics of the scheduled stage. Set on every candidate without error. |
leveled |
LeveledMetrics |
Metrics of the leveled stage. Set only when EvaluateOptions.level is set and the scheduled stage has no cycles; null otherwise. |
cost |
Double |
The cost of the last stage present: leveled.metrics.cost when leveled is set, else scheduled.cost. Lower is better. null when error is set. |
For how cost is computed, see Metrics.cost.
Methods#
withId, withError, withScheduled, withLeveled, withCost#
public CandidateResult
public CandidateResult
public CandidateResult
public CandidateResult
public CandidateResult
Each setter assigns its field and returns this instance.
Returns: this CandidateResult.
deepClone#
public CandidateResult
Returns a deep copy: error, scheduled and leveled are copied recursively, so no list or nested object is shared with the original. null fields stay null.
Returns: a new CandidateResult.
copy#
public CandidateResult
Returns a shallow copy: the new result holds the same id, error, scheduled and leveled objects.
Returns: a new CandidateResult.
equals, hashCode, toString#
public boolean
public int
public String
Inherited from ValueRecord. Two results are equal when every field is equal, nested metrics and lists included. cost compares with Double.equals. toString() prints all fields, for logging.
Example#
Rank the scored candidates by cost and list the rejected ones separately.
;
;
;
;
Related#
EvaluateResult- the call result that holds every candidate resultMetrics- the stage metrics and how cost is computedLeveledMetrics- the leveled stage, when leveling is requestedRejectedOperation- the type oferror- Evaluating alternatives - reading failed and cyclic candidates