public static class CandidateScoringThe one place a set of factors becomes one number, and the one place a winner is picked.
Remarks
Doc 37 § D14's shared scorer. A utility action's considerations and an environment query test's readings arrive here by different routes and are combined by the same code: the weighted geometric mean, with the zero rule intact. Combine is the same arithmetic given a span that is already full; this is the streaming form, which is what lets a veto stop the reads.
⚠ It stops at the first zero unless somebody asked for the detail. A veto makes the rest of the list irrelevant, and the rest of the list is where the reads of the world are — so a query point that fails its cheapest test does not pay for a trace. The editor and the debug overlay pass a span and get every number, because "why is this scoring zero" is the question they exist to answer.
Methods (4)
public static float Combine(ReadOnlySpan<float> factors, float weight = 1)Combines factors that have already been read.
public static float Score<TSource>(scoped ref readonly TSource source, float weight, Span<float> detail = default(Span<float>)) where TSource : struct, IFactorSource, allows ref structCombines one candidate's factors, reading them one at a time.
public static int ScoreAll<T>(IScoredCandidateSet<T> set, in AgentContext context, Span<float> scores)Scores every candidate of a set.
public static int Best(ReadOnlySpan<float> scores)The best-scoring candidate.
Used by (4)
- EnvironmentQueryVixen.Ai
- QueryScorerExitCriteriaTestsVixen.Ai.Tests
- UtilityActionVixen.Ai
- UtilityScoringVixen.Ai