ProgramDescriptorSet

Models & Types · AiDotNet.Evolution.Programs

A validated, ordered collection of program descriptors evaluated together.

For Beginners

This is simply the list of pigeonhole axes your run uses, bundled together with a safety check that no two axes share a name. Build one with, say, a length descriptor and a token-count descriptor, then call Compute on a candidate to get both coordinates at once. The Names property tells you which archive dimensions to declare so the two line up.

How It Works

An archive dimension is identified by name, so two descriptors that answer to the same name would silently overwrite each other’s coordinate. This set rejects duplicate names at construction rather than at the first evaluation, and Compute returns one dictionary keyed by those names, ready to hand to Completed. Every value is checked for finiteness, because a NaN coordinate would be rejected deep inside the archive with a much less helpful message.

VersionHash folds in every descriptor name and type, so adding, removing, or renaming a dimension changes the hash and a checkpoint written under the old set is refused rather than being reinterpreted against a differently shaped grid. Name and type alone do not describe how a descriptor was configured, so a descriptor that carries configuration - a diversity descriptor and its reference programs, for instance - also implements IVersionedProgramDescriptor and contributes its own version hash here. Without that, swapping a reference set would leave this hash identical and a resumed run would silently re-bin every restored elite against coordinates it never produced. A descriptor that does not implement the interface is recorded as unversioned, which is correct only when its type and name really do determine its output.

Constructors

Constructor Summary
ProgramDescriptorSet(IEnumerable<IProgramDescriptor> descriptors) Initializes a descriptor set from an explicit argument list.
ProgramDescriptorSet(IProgramDescriptor[] descriptors) Initializes a descriptor set from an explicit argument list.

Properties

Property Summary
IReadOnlyList<IProgramDescriptor> Descriptors { get; } Gets the descriptors in evaluation order.
IReadOnlyList<string> Names { get; } Gets the descriptor names, which are the archive dimension keys this set fills.
bool HasRebasableDescriptors { get; } Gets whether any descriptor in the set measures against other programs.
int Count { get; } Gets the number of descriptors in the set.
string VersionHash { get; } Gets a version hash covering every descriptor name, implementation type, and own configuration.

Methods

Method Summary
IReadOnlyDictionary<string, double> Compute(ProgramGenome genome) Computes every descriptor for one candidate program.
ProgramDescriptorSet CreateDefault(IEnumerable<string> referenceSources) Creates the standard set of built-in program descriptors.
ProgramDescriptorSet Empty() Creates an empty set, for tasks whose evaluator supplies every descriptor itself.
ProgramDescriptorSet Rebase(IReadOnlyList<ProgramGenome> references) Returns an equivalent set whose relative descriptors measure against new references.