Note#
A non-fatal note about the input of a scheduling call: a task, link or assignment that was left out of the plan, or a field that repair validation changed. Notes are listed in ScheduleResult.Notes. Nothing is thrown for them.
Note is a closed union: an abstract record with one sealed record per variant. Read it with switch pattern matching on the nested types. The records are immutable and compare by value.
Declaration#
namespace Plen;
public abstract record Note
{
public sealed record DroppedLink(Id Link, string Reason) : Note;
public sealed record DroppedTask(Id Task, string Reason) : Note;
public sealed record DroppedAssignment(Id Assignment, string Reason) : Note;
public sealed record Repaired(string Path, string Message) : Note;
}
The constructor of Note is private, so these four records are the only variants.
Variants#
| Variant | When it occurs |
|---|---|
DroppedLink |
A link isn't part of the plan, for example because one of its tasks is unscheduled. |
DroppedTask |
A task isn't part of the plan because it's unscheduled. |
DroppedAssignment |
An assignment isn't part of the plan because its task is unscheduled. |
Repaired |
Validation.Repair changed an input field. |
DroppedLink#
public sealed record DroppedLink(Id Link, string Reason) : Note;
| Property | Type | Description |
|---|---|---|
Link |
Id |
Id of the dropped link. |
Reason |
string |
Human-readable reason, e.g. target task "3" is unscheduled. |
DroppedTask#
public sealed record DroppedTask(Id Task, string Reason) : Note;
| Property | Type | Description |
|---|---|---|
Task |
Id |
Id of the dropped task. |
Reason |
string |
Human-readable reason: unscheduled. |
A task is unscheduled when TaskData.Unscheduled is true.
DroppedAssignment#
public sealed record DroppedAssignment(Id Assignment, string Reason) : Note;
| Property | Type | Description |
|---|---|---|
Assignment |
Id |
Id of the dropped assignment. |
Reason |
string |
Human-readable reason, e.g. task "3" is unscheduled. |
Repaired#
public sealed record Repaired(string Path, string Message) : Note;
| Property | Type | Description |
|---|---|---|
Path |
string |
Input path of the changed field, in wire spelling, e.g. tasks[1].start_date. |
Message |
string |
What was wrong and how it was fixed. |
Only a project created with Validation.Repair reports Repaired notes. The list of fixes and their paths is on Validation.
Example#
using Plen;
var monday = Moment.FromYmdHm(2026, 8, 10, 8, 0) ?? throw new InvalidOperationException("invalid date");
var data = new ProjectData
{
Tasks =
[
new TaskData(1) { StartDate = monday, Duration = 1.0 },
new TaskData(2) { StartDate = monday, Duration = 1.0, Unscheduled = true },
],
Links =
[
new LinkData { Id = 10, Source = 1, Target = 2 },
],
};
var result = Engine.Schedule(data, new SolveOptions());
foreach (var note in result.Notes)
{
var line = note switch
{
Note.DroppedLink n => $"link {n.Link} dropped: {n.Reason}",
Note.DroppedTask n => $"task {n.Task} dropped: {n.Reason}",
Note.DroppedAssignment n => $"assignment {n.Assignment} dropped: {n.Reason}",
Note.Repaired n => $"repaired {n.Path}: {n.Message}",
_ => note.ToString(),
};
Console.WriteLine(line);
}
// task 2 dropped: unscheduled
// link 10 dropped: target task "2" is unscheduled
Related#
ScheduleResult- the result whoseNoteslist carries themValidation- the repair mode that reportsRepairednotesEngine.Schedule- a scheduling call that returns notes- Reading results - handling each diagnostic of a result
- Project data - unscheduled tasks and the input rules