Pool#
The workers that SkillLayer.Slots may put on tasks, each a project resource with its skills. Create one with an object initializer and pass it to SkillLayer.Slots together with the requirements. Part of the Plen.Assign package.
Declaration#
namespace Plen.Assign;
public sealed class Pool : IDeepCloneable<Pool>, IEquatable<Pool>
Constructors#
Pool()#
public Pool()
Creates an empty pool. Set Workers in an object initializer.
Properties#
| Property | Type | Default | Description |
|---|---|---|---|
Workers |
List<Worker> |
empty | The workers, in preference order. A worker earlier in the list wins a tie between equally scored candidates. |
Each worker must name a resource of the project, and a resource can appear only once. SkillLayer.Slots checks this and throws InputException with a pool.workers[i]… path; see Errors.
Methods#
DeepClone#
public Pool DeepClone()
Returns a deep copy. The Workers list and every Worker in it are copied, so nothing is shared with the original.
Equals#
public bool Equals(Pool? other)
public override bool Equals(object? obj)
Two pools are equal when Workers holds equal workers in the same order.
GetHashCode() follows the same rule.
ToString#
public override string ToString()
Returns a readable rendering of the workers, for logging.
Example#
Three workers. ann comes first, so she's preferred over bob when both fit a slot equally well.
using Plen;
using Plen.Assign;
var pool = new Pool
{
Workers =
[
new Worker { Resource = "ann", Skills = [new Skill { Id = "backend", Value = 3 }] },
new Worker { Resource = "bob", Skills = [new Skill { Id = "backend", Value = 2 }, new Skill { Id = "frontend" }] },
new Worker { Resource = "cid", Skills = [new Skill { Id = "frontend" }] },
],
};
Console.WriteLine(pool.Workers.Count); // 3
Related#
SkillLayer.Slots- the call that reads the poolWorker- one entry of the poolRequirement- what each task needs from the poolSlot- the slots built from the pool's workers- Skills and requirements - staffing tasks by skill