Skill#

One skill a Worker has, with its value. Use 0/1 for skills a worker either has or doesn't, and an integer grade for skills with levels. Create skills with an object initializer and put them in Worker.Skills.

A SkillMatch compares this value when SkillLayer.Slots picks candidates. A skill the worker doesn't list counts as 0 there.

Declaration#

namespace Plen.Assign;

public sealed class Skill : IDeepCloneable<Skill>, IEquatable<Skill>

Id is required, so set it in the object initializer.

Properties#

Property Type Default Description
Id Id required Skill id. Must be unique within one worker's Skills.
Value double 1.0 Skill value: 0/1 for a yes/no skill, an integer grade otherwise. Must be finite.

SkillLayer.Slots rejects a duplicate Id or a non-finite Value with an InputException at pool.workers[i].skills[j].id or .value. See Errors.

Methods#

DeepClone#

public Skill DeepClone()

Returns a copy with the same Id and Value.

Equals#

public bool Equals(Skill? other)
public override bool Equals(object? obj)

Two skills are equal when their Ids are equal and their Values are equal by ==. GetHashCode() follows the same rule.

ToString#

public override string ToString()

Returns a readable rendering of Id and Value, for logging.

Example#

using Plen.Assign;

var bob = new Worker
{
    Resource = "bob",
    Skills =
    [
        new Skill { Id = "backend" },          // has the skill (Value = 1.0)
        new Skill { Id = "qa", Value = 2 },    // QA grade 2
    ],
};