@Appendix
    @Title { HSEval Implementation Notes }
    @Tag { hseval }
@Begin
@LP
This appendix contains implementation notes for parts of HSEval, a
program built on the KHE platform but not the solvers, which prints
timetables and evaluation tables for XHSTT and XESTT instances
and solutions.  HSEval runs both as a web server and from the
command line.
@LP
For usage information, compile KHE then type @F { "hseval.cgi -u" }.
@BeginSubAppendices

@SubAppendix
    @Title { Needed tasks }
    @Tag { hseval.needed }
@Begin
@LP
A task is @I { needed } when assignment of a resource to that task
is needed.  More concretely, a task @C { t } is needed when it is
preassigned, or when some assign resource or limit resources
monitor would have non-zero cost if @C { t } was not assigned.
If @C { t } is not needed it is @I { unneeded }.
@PP
When a task is preassigned, or monitored by an assign resource
monitor with non-zero weight, it is certainly needed.  But things
are less clear with limit resources monitors, because not all
tasks monitored by them need to be assigned.  So HSEval includes
a @I { needer module } whose job is to decide, for each task
@C { t }, whether @C { t } is needed.  It uses a heuristic method.
It tries to minimize the number of tasks it declares to be needed,
and it prefers to include tasks that are already known to be needed,
or assigned in the solution being printed.  We take this trouble
because it is usual for tasks which are both unassigned and unneeded
to be not printed at all.  That can reduce the size of timetables when
instances contain essentially useless event resources, as some do.
@PP
Care must be taken to distinguish between being needed and being
assigned.  There is no logical connection between the two
properties:  a task can be needed and unassigned, or unneeded
and assigned.  Both cases occur in practice.  The first incurs
a cost; the second does not, but may be wasteful of resource
workload.  However, the two properties are connected in a
different way:  when the needer module has a choice about which
tasks to declare to be needed, it prefers to choose assigned
tasks, to reduce the number of occurrences of these two cases.
@PP
When some unassigned tasks must be declared to be needed, because
some limit resources monitor would have a cost if they weren't, the
needer module prefers to declare tasks of lower workload to be
needed.  Adding this rule significantly reduced the total workload
of needed unassigned tasks in instance COI-MER.  This is useful, but
it does reinforce the point that the choices made by the needer
module are heuristic when limit resources monitors are present.
@PP
The interface of the needer module appears in file @C { needer.h }.
It is very simple.  It declares a private type called @C { NEEDER }
and these two functions:
@ID @C {
NEEDER NeederMake(KHE_SOLN soln, HA_ARENA a);
bool NeederTaskNeedsAssignment(NEEDER needer, KHE_TASK task);
}
The first creates a needer object for the tasks of @C { soln },
which includes deciding whether each task is needed.  The second
allows the caller to find out whether @C { task } is needed or not.
@PP
The rest of this appendix explains how @C { NeederMake } works.
@C { NeederTaskNeedsAssignment } just retrieves a Boolean
value previously set by @C { NeederMake }.
@PP
@C { NeederMake } begins by creating a needer object and
new objects representing each non-cycle task and each limit
resources monitor with non-zero weight and non-zero minimum
limit.  We'll refer to these objects as tasks
and monitors.  It then adds links from each monitor to the
tasks that it monitors, and links from each task to
the monitors that monitor it.
@PP
Each task @C { t } contains
a Boolean field saying whether @C { t } has been declared
to need assignment, which is initially @C { false }.  This
field is returned by @C { NeederTaskNeedsAssignment }.  Each
monitor @C { m } contains an integer field holding the total
duration of the tasks monitored by @C { m } that have been
declared to need assignment, which is initially 0.  By
`declaring that a task @C { t } needs assignment', we mean this:
if @C { t }'s Boolean field is not already @C { true }, then set
it to @C { true } and visit the monitors that monitor @C { t },
increasing the integer field of each by the duration of @C { t }.
@PP
Now for the main algorithm.  First, we visit each task @C { t }.
If @C { t } is preassigned, we declare that @C { t } needs
assignment.  Second, we visit each assign resource monitor
@C { m } of non-zero weight, and for each task @C { t }
monitored by @C { m } we declare that @C { t } needs assignment.
Finally, we visit each monitor (that is, each limit resources
monitor) @C { m } and try to satisfy its minimum limit, as follows.
@PP
We begin by sorting the tasks monitored by @C { m } by increasing
workload, as discussed above.  The two visits of these tasks that
we are about to carry out are done in this order.
@PP
First, we visit the tasks monitored by @C { m } which are assigned,
declaring each of them to need assignment.  Then we visit the
tasks monitored by @C { m } which are not assigned, declaring
each of them to need assignment.  At each step during both
visits, if the integer value stored in @C { m }, holding the
total duration of the tasks monitored by @C { m } which have
been declared to need assignment, is greater than or equal to
@C { m }'s minimum limit, we finish with @C { m } and move on
to the next monitor.
@End @SubAppendix

@SubAppendix
    @Title { Meshes }
    @Tag { hseval.mesh }
@Begin
@LP
HSEval's timetable printing is quite advanced, in two main respects.
First, it can produce several @I { timetable structures }, the
principle ones being the @I { planning timetable }, displaying
the timetables of all resources, with one row per resource and
one column per time or per day, and the @I { individual timetable },
displaying the timetable of one resource, with one column for each
day of the working week, and one row for each time of day.  Second,
it can vary the @I { formatting }, that is, the font used to display
the event name or names within each cell, and the background colour of
each cell of the printed table.  This can help to highlight various
things, such as constraint violations.
@PP
HSEval source file @F { timetable.c } produces these timetables,
in HTML.  It calls on HSEval modules @F { html.c } to print the
actual HTML, and @F { mesh.c } to define the timetable structure
and formatting.  This @I { mesh module } is the subject of this
subappendix.
@PP
The mesh module defines three main types.  Type @C { MESH }
represents a multi-dimensional space with at least two dimensions.
Each point in the mesh is one cell in a printed timetable.
Type @C { MESH_TIME_DIM } represents one dimension.  Each
position along the dimension is labelled by a set of times.
And type @C { MESH_RESOURCE_DIM } also represents one dimension,
but with each position labelled by a set of resources.
@PP
For example, a planning timetable with one row per resource and
one column per day is represented by a mesh with two dimensions.
The first dimension is a resource dimension with a singleton set
of resources at each position; the second dimension is a time
dimension with the set of times of one day at each position.
@PP
A mesh must contain at least two dimensions.  But it can
also contain more than two, in which case it is printed as
a sequence of two-dimensional tables.  The second-last
dimension defines the rows of each two-dimensional table;
the last dimension defines the columns of each two-dimensional
table.
@PP
To create a new mesh, call
@ID @C {
MESH MeshMake(KHE_SOLN soln, bool allow_spanning,
  bool dft_show, HTML_FONT dft_font, char *dft_colour);
}
where @C { soln } is the solution whose events are to be
printed (the mesh module is not just a container, it is
fully aware of the solution), @C { allow_spanning } is
@C { true } if entries that span two or more columns should
be included where appropriate, @C { dft_show } says whether
event names should be printed when no other indication has
been made (this will usually be @C { true }), @C { dft_font }
is the font to use when printing event names when no other
font has been indicated (this will usually be @C { HTML_ROMAN }),
and @C { dft_colour } is the cell background colour to use when
no other colour is indicated.  Type @C { HTML_FONT } is an
enumerated type, defined near the start of file @C { html.h }.
There is also a list of colours there.
@PP
Memory for the mesh object and everything in it comes from
a single arena found by calling @C { KheSolnArenaBegin(soln) }.
To delete this arena, call
@ID @C {
void MeshDelete(MESH mesh);
}
This will delete @C { mesh } and everything in it.
@PP
Instances may have @I { days } and @I { weeks }.  These are just
time groups (sets of times), labelled to mark their special
status.  XHSTT and XESTT include them as hints to software which
displays timetables.  So the mesh module pays attention to them,
and offers functions
@ID @C {
bool MeshHasDays(MESH mesh);
bool MeshHasWeeks(MESH mesh);
}
to report whether well-defined days and"/"or weeks are defined.  
The caller may choose to vary the structure of the printed
timetables depending on the values returned by these functions.
@PP
@BI { Dimensions. }
Any number of dimensions may be added, from first to last.  Function
@ID @C {
MESH_TIME_DIM MeshAddTimeDim(MESH mesh);
}
defines a time dimension and adds it to @C { mesh }.  Initially
it will have no positions, but one can then make any number of
calls to
@ID @C {
void MeshTimeDimAddTimeGroup(MESH_TIME_DIM mtd,
  KHE_TIME_GROUP tg, char *label);
}
to add one position to @C { mtd }, labelled by @C { tg } and
@C { label }; @C { label } might be @C { KheTimeGroupId(tg) }.  Similarly,
to define a resource dimension and add it to @C { mesh }, call
@ID @C {
MESH_RESOURCE_DIM MeshAddResourceDim(MESH mesh,
  MESH_RG_FN major_heading_rg_fn, MESH_RG_FN avail_rg_fn,
  void *avail_rg_impl, MESH_RG_FN after_rg_fn);
}
The last four parameters may be @C { NULL }.  Non-@C { NULL }
values are callback functions, called to add various decorations
before and after each position is printed:  a major heading
(for when each position is printed as a separate table),
information about resource availability, etc.  The details
are not currently documented.
@PP
As for time dimensions, positions are added to resource dimensions
by calls to
@ID @C {
void MeshResourceDimAddResourceGroup(MESH_RESOURCE_DIM mrd,
  KHE_RESOURCE_GROUP rg, char *label);
}
Each position is labelled by @C { rg } and @C { label };
@C { label } might be @C { KheResourceGroupId(rg) }.
@PP
Although these functions can build any mesh structure, there are
also helper functions to make the usual cases easy.  There is just
one for resource dimensions:
@ID @C {
void MeshAddResourceTypeDim(MESH mesh, KHE_RESOURCE_TYPE rt,
  MESH_RG_FN major_heading_rg_fn, MESH_RG_FN avail_rg_fn,
  void *avail_rg_impl, MESH_RG_FN after_rg_fn);
}
This is like calling @C { MeshAddResourceDim }, then calling
@C { MeshResourceDimAddResourceGroup } for each resource of type
@C { rt }.  It also has a position for unassigned tasks,
discussed below.
@PP
There are many helper functions for time dimensions:
@ID @C {
void MeshAddTimesOfCycleDim(MESH mesh);
void MeshAddTimesOfDayDim(MESH mesh);
void MeshAddDaysOfWeekDim(MESH mesh);
void MeshAddDaysOfCycleDim(MESH mesh);
void MeshAddWeeksOfCycleDim(MESH mesh);
}
As the names suggest, these add time dimensions containing the
times of the cycle, the times of one day, the days of one week,
the days of the cycle, and the weeks of the cycle.  Where
days are mentioned, @C { MeshHasDays(mesh) } must be
@C { true }, and where weeks are mentioned, @C { MeshHasWeeks(mesh) }
must be @C { true }.
@PP
For example, consider the traditional individual timetable, in which
each column represents one day of the week, and each row represents
one time of the day.  If there are weeks, we need several
two-dimensional timetables, leading to this three-dimensional mesh:
@ID @C {
MeshAddWeeksOfCycleDim(mesh);
MeshAddTimesOfDayDim(mesh);
MeshAddDaysOfWeekDim(mesh);
}
As always, columns come last.  Without weeks, a two-dimensional
mesh is wanted:
@ID @C {
MeshAddTimesOfDayDim(mesh);
MeshAddDaysOfCycleDim(mesh);
}
Either way, preceding this will be a resource dimension giving
one timetable per resource.  Some thought is needed to understand
these structures, but once understood they are easy to get.
@PP
There is also
@ID @C {
void MeshAddDummyDim(MESH mesh);
}
This adds a dummy dimension with a single position.  It is neither a
time dimension nor a resource dimension.  It solves an occasional
problem where one wants what is essentially a single-dimensional
timetable, but the mesh module expects at least two.  In practice,
if it is used at all it is always the second-last dimension, but
it does not have to be.
@PP
Suppose there are @M { k } dimensions, numbered from 1 to
@M { k }, and that dimension @M { d } contains @M { n sub d }
positions, numbered from 1 to @M { n sub d }.  Then for
each legal sequence of coordinates
@ID @Math {
( i sub 1 ,..., i sub k ) |0.5c  s.t. |0.5c
1 <= i sub 1 <= n sub 1 ,...,
1 <= i sub k <= n sub k 
}
the mesh module will print one @I { cell }, that is, a small
rectangle containing the names of zero or more events.  We
identify a cell with its sequence of coordinates
@M { ( i sub 1 ,..., i sub k ) }.
@PP
We'll see later how to add tasks to a mesh.  Supposing however
that we add a task, the effect is to add it to zero or more
cells.  We now define which cells those are.
@PP
Let @M { T( i sub 1 ,..., i sub k ) }, the
@I { times of cell @M { ( i sub 1 ,..., i sub k ) } },
be the intersection of the time groups at
position @M { i sub 1 } of @M { d sub 1 }, @M { i sub 2 } of @M { d sub 2 }, 
...  @M { i sub k } of @M { d sub k }, omitting dimensions which are not
time dimensions.  If the intersection is empty,
@M { T( i sub 1 ,..., i sub k ) } is the set of all times in the instance.
@PP
Similarly, let @M { R( i sub 1 ,..., i sub k ) }, the
@I { resources of cell @M { ( i sub 1 ,..., i sub k ) } },
be the intersection of the resource
groups at position @M { i sub 1 } of @M { d sub 1 },
@M { i sub 2 } of @M { d sub 2 }, ...
@M { i sub k } of @M { d sub k }, omitting dimensions which are not
resource dimensions.  If the intersection is empty,
@M { R( i sub 1 ,..., i sub k ) } is the set of all resources in
the instance.
@PP
Now let @C { t } be a task being added to the mesh.  Which cells
will it be added to?  Let @M { T } be the set of times that @C { t }
is running.  Let @M { R } be the set of resources assigned
to @C { t }:  either a singleton set @M { lbrace r rbrace },
or the empty set @M { emptyset }.  Then @C { t } will be added
to each cell @M { ( i sub 1 ,..., i sub k ) } such that
@M { T cap T( i sub 1 ,..., i sub k ) != emptyset }
and @M { R cap R( i sub 1 ,..., i sub k ) != emptyset }.
@PP
@C { MeshAddResourceTypeDim } has a concluding position that
unassigned tasks are added to.  To avoid making a special
case of this position, we change to @M { lbrace epsilon rbrace }
the definition of the set of resources assigned to @C { t }
when it is unassigned, where @M { epsilon } is a special value
not equal to any real resource.  We let the set of resources
at the concluding position be @M { lbrace epsilon rbrace }.
@PP
@BI { Formatting. }
As already mentioned, @I { formatting } refers to the appearance
of individual cells, and consists of a font for each event name
(we'll simply say each task) within the cell, plus a background
colour for the cell as a whole.  Furthermore, there is a way to
omit a task from the printed timetable altogether, which for
implementation convenience is considered to be part of formatting.
There is no way to omit a cell, because that would just leave a
gap in the table.
@PP
The format of each task and each cell is determined by @I { rules }
applied to the tasks and cells, each consisting of a condition and
one or more format values.  The caller loads a list of these rules;
the first one whose condition evaluates to @C { true } for a given
task or cell determines the format of that task or cell.  If none
evaluate to @C { true }, the format values passed to @C { MeshMake }
(defined above) are used as default values.
@PP
To load a rule applicable to tasks, or to cells, the functions are
@ID @C {
void MeshAddTaskRule(MESH mesh, MESH_COND sc,
  bool show, HTML_FONT font);
void MeshAddCellRule(MESH mesh, MESH_COND sc,
  char *colour);
}
This means that for each task, if @C { sc } holds for that
task, then omit the task if @C { show } is @C { false },
and print the event name in the given @C { font } otherwise.
And for each cell, if @C { sc } holds for that cell, then
set its background colour to @C { colour }.  For example,
@ID @C {
MeshAddCellRule(mesh, MESH_RESOURCE_GROUP_UNAVAIL_HARD, DarkRed);
MeshAddCellRule(mesh, MESH_RESOURCE_GROUP_UNAVAIL_SOFT, LightRed);
}
says that if any of the times represented by the cell are the
subject of a hard unavailable times constraint for any of the
resources represented by the cell, then set the background
colour to @C { DarkRed }; otherwise, if any of the times
represented are the subject of a soft unavailable times
constraint for any of the resources represented, then set the
background colour to @C { LightRed }; otherwise, set the backgrouund
colour to the default value passed in via @C { MeshMake }.
@PP
The full list of conditions supported is
@ID @C {
typedef enum {

  /* acceptable to both MeshAddTaskRule and MeshAddCellRule */
  MESH_UNASSIGNED_UNNEEDED,
  MESH_UNASSIGNED_NEEDED,
  MESH_ASSIGNED_UNNEEDED_UNDEFECTIVE,
  MESH_ASSIGNED_UNNEEDED_DEFECTIVE,
  MESH_ASSIGNED_NEEDED_UNDEFECTIVE,
  MESH_ASSIGNED_NEEDED_DEFECTIVE,	

  /* acceptable to MeshAddCellRule only */
  MESH_TIME_GROUP_EMPTY,
  MESH_TIME_GROUP_NON_EMPTY,
  MESH_RESOURCE_GROUP_UNAVAIL_HARD,
  MESH_RESOURCE_GROUP_UNAVAIL_SOFT,
  MESH_RESOURCE_GROUP_UNAVAIL_PART,
  MESH_RESOURCE_GROUP_MUST_BE_BUSY_HARD,
  MESH_RESOURCE_GROUP_MUST_BE_BUSY_SOFT,
  MESH_TASKS_NONE,
  MESH_TASKS_ONE_OR_MORE,
  MESH_TASKS_TWO_OR_MORE,
  MESH_CONSTRAINT_VIOLATED,
  MESH_CONSTRAINT_UNVIOLATED,
  MESH_CONSTRAINT_SLACK,
} MESH_COND;
}
@C { MeshAddTaskRule } accepts only the first six values;
@C { MeshAddCellRule } accepts them all.
# Only the first six may be passed to @C { MeshAddTaskRule };
# all may be passed to @C { MeshAddCellRule }.
@PP
A task @C { t } is @I { assigned } if
@C { KheTaskAsstResource(t) != NULL }; otherwise it is
@I { unassigned }.  A task @C { t } is @I { needed } if assignment
of a resource to @C { t } is needed, as explained in
Appendix {@NumberOf hseval.needed}; otherwise it is @I { unneeded }.
A task @C { t } is @I defective if it is assigned a resource that
helps a prefer resources or avoid split assignments monitor to
have non-zero cost; otherwise it is @I { undefective }.
@PP
The meaning of the first six conditions is now clear,
when they are applied to a task @C { t }:
@TaggedList

@DTI { @F MESH_UNASSIGNED_UNNEEDED } @OneRow {
@C { t } is unassigned and unneeded.  It cannot be
defective because it is unassigned.
}

@DTI { @F MESH_UNASSIGNED_NEEDED } @OneRow {
@C { t } is unassigned and needed.  It cannot be
defective because it is unassigned.
}

@DTI { @F MESH_ASSIGNED_UNNEEDED_UNDEFECTIVE } @OneRow {
@C { t } is assigned, unneeded, and undefective.
}

@DTI { @F MESH_ASSIGNED_UNNEEDED_DEFECTIVE } @OneRow {
@C { t } is assigned, unneeded, and defective.
}

@DTI { @F MESH_ASSIGNED_NEEDED_UNDEFECTIVE } @OneRow {
@C { t } is assigned, needed, and undefective.
}

@DTI { @F MESH_ASSIGNED_NEEDED_DEFECTIVE } @OneRow {
@C { t } is assigned, needed, and defective.
}

@EndList
These conditions are evaluated as each task is added.  (The
conditions must all be loaded, by calls to @C { MeshAddTaskRule },
before the first task is added.)  If the evaluation determines that
the task is not to be shown, then it is not added to any cells.
An alternative would be to add the task to the relevant cells
but to refrain from showing it; but that is not what happens.
@PP
When applied to a cell rather than to a task, these first six
conditions hold when the cell contains at least one task and the
condition holds with respect to the first task added to the cell.
@PP
The meaning of the remaining conditions, applied to a cell @C { c },
is as follows.  These conditions are evaluated after all tasks have
been added.
@TaggedList

@DTI { @F MESH_TIME_GROUP_EMPTY } @OneRow {
@C { c } represents no times.  This can happen, for example,
when the number of times per day varies.  These cells might be
coloured black, to show that they cannot have assignments.
}

@DTI { @F MESH_TIME_GROUP_NON_EMPTY } @OneRow {
@C { c } represents at least one time.
}

@DTI { @F MESH_RESOURCE_GROUP_UNAVAIL_HARD } @OneRow {
At one or more of the times represented by @C { c }, one
or more of the resources represented by @C { c } is monitored
by a hard unavailable times monitor.
}

@DTI { @F MESH_RESOURCE_GROUP_UNAVAIL_SOFT } @OneRow {
At one or more of the times represented by @C { c }, one
or more of the resources represented by @C { c } is monitored
by a soft unavailable times monitor.
}

@DTI { @F MESH_RESOURCE_GROUP_UNAVAIL_PART } @OneRow {
@I { implemented, but documentation still to do }
}

@DTI { @F MESH_RESOURCE_GROUP_MUST_BE_BUSY_HARD } @OneRow {
At one or more of the times represented by @C { c }, one
or more of the resources represented by @C { c } should be
busy because a hard limit active intervals constraint with history
says so.  For example, if a constraint requires nurses' night
shifts to occur in groups of at least four, and some nurse
has a history of 2 night shifts, then the first two days
of that nurse's timetable will satisfy this condition.
}

@DTI { @F MESH_RESOURCE_GROUP_MUST_BE_BUSY_SOFT } @OneRow {
Like @C { MESH_RESOURCE_GROUP_MUST_BE_BUSY_HARD } except that
the constraint is soft.
}

@DTI { @F MESH_TASKS_NONE } @OneRow {
@C { c } contains no tasks.
}

@DTI { @F MESH_TASKS_ONE_OR_MORE } @OneRow {
@C { c } contains one or more tasks.
}

@DTI { @F MESH_TASKS_TWO_OR_MORE } @OneRow {
@C { c } contains two or more tasks.
}

@EndList
This covers all but the last three conditions, which are used
together to highlight violations of cluster busy times constraints,
as follows:
@TaggedList

@DTI { @F MESH_CONSTRAINT_VIOLATED } @OneRow {
@I { implemented, but documentation still to do }
}

@DTI { @F MESH_CONSTRAINT_UNVIOLATED } @OneRow {
@I { implemented, but documentation still to do }
}

@DTI { @F MESH_CONSTRAINT_SLACK } @OneRow {
@I { implemented, but documentation still to do }
}

@EndList
Other conditions could be added.
@PP
@BI { Adding tasks and printing }.  After the dimensions and
formatting have been set up, we can add the tasks.  To add
one task to the mesh, call
@ID @C {
void MeshAddTask(MESH mesh, KHE_TASK task);
}
This adds @C { task } to zero or more cells, as explained above.
Helper function
@ID @C {
void MeshAddAllTasks(MESH mesh);
}
calls @C { MeshAddTask } for every non-cycle task of @C { soln }.
It is the usual way to add tasks.
@PP
Finally, to print a mesh onto an HTML file, call
@ID @C {
void MeshDisplay(MESH mesh, int *total_italic, HTML html);
}
Parameter @C { total_italic } returns the number of entries
printed in italic font.
@End @SubAppendix

@SubAppendix
  @Title { Exploration of alternative formatting ideas }
  @Tag { hseval.new_formatting }
@Begin
@LP
This section was written to explore some ideas, but I am doubtful
about it.  The implementation would be a significant effort, and
the semantics are still not clear.  Notably, the definition below
of cost arising entirely from @M { c } does not do what is wanted
for limit active intervals constraints.
@ID @C {
typedef enum {

  /* acceptable to both MeshAddTaskRule and MeshAddCellRule */
  MESH_UNASSIGNED_UNNEEDED,
  MESH_UNASSIGNED_NEEDED,
  MESH_ASSIGNED_UNNEEDED_UNDEFECTIVE,
  MESH_ASSIGNED_UNNEEDED_DEFECTIVE,
  MESH_ASSIGNED_NEEDED_UNDEFECTIVE,
  MESH_ASSIGNED_NEEDED_DEFECTIVE,	

  /* acceptable to MeshAddCellRule only */
  MESH_TIME_GROUP_EMPTY,
  MESH_TIME_GROUP_NON_EMPTY,
  MESH_TASKS_NONE,
  MESH_TASKS_ONE_OR_MORE,
  MESH_TASKS_TWO_OR_MORE,
  MESH_CONSTRAINT_WANT_FREE_SATISFIED,
  MESH_CONSTRAINT_WANT_FREE_NOT_SATISFIED,
  MESH_CONSTRAINT_WANT_BUSY_SATISFIED,
  MESH_CONSTRAINT_WANT_BUSY_NOT_SATISFIED,
  MESH_CONSTRAINT_NAMED_SATISFIED_SLACK,
  MESH_CONSTRAINT_NAMED_SATISFIED_NO_SLACK,
  MESH_CONSTRAINT_NAMED_NOT_SATISFIED,
  MESH_CONSTRAINT_UNVIOLATED,
  MESH_CONSTRAINT_SLACK,
} MESH_COND;
}
# For a given cell @M { c }, each of the conditions described in what
# follows could occur more than once.  The condition holds for @M { c }
# if it occurs at least once for @M { c }.
Each cell @M { c } represents what zero or more specific resources,
which we call the @I { resources of @M { c } }, are doing during zero
or more specific times, which we call the @I { times of @M { c } }.
A resource @M { r } of @M { c } is @I { busy during @M { c } } when
it is busy during at least one of the times of @M { c }, otherwise
it is free during @M { c }.  By @I { a cost arising entirely
from @M { c } } we mean a non-zero cost that would remain present
irrespective of changes made to the solution outside @M { c }.
@TaggedList

@DTI { @F MESH_CONSTRAINT_WANT_FREE_SATISFIED } @OneRow {
Let @M { B } be the set of all resource constraints that
incur a cost arising entirely from @M { c } when a resource
of @M { c } is busy during @M { c }.  The condition holds
when @M { B } is non-empty but no costs arising entirely
from @M { c } are incurred by the constraints of @M { B }
in the current solution.  The constraints could be avoid
unavailable times constraints, or limit busy times constraints
with maximum limit 0, or limit active intervals constraints
with history that prohibits assignments at the start of the cycle.
}

@DTI { @F MESH_CONSTRAINT_WANT_FREE_UNSATISFIED } @OneRow {
Like @C { MESH_CONSTRAINT_WANT_FREE_SATISFIED } except
that one of the constraints of @M { B } incurs a cost
arising entirely from @M { c } in the current solution.
}

@DTI { @F MESH_CONSTRAINT_WANT_BUSY_SATISFIED } @OneRow {
Let @M { B } be the set of all resource constraints that
incur a cost arising entirely from @M { c } when a resource
of @M { c } is free during @M { c }.  The condition holds
when @M { B } is non-empty but no costs arising entirely
from @M { c } are incurred by the constraints of @M { B }
in the current solution.  The constraints could be a limit
busy times constraints with minimum limit greater than 0,
or limit active intervals constraints with history that
requires assignments at the start of the cycle.
}

@DTI { @F MESH_CONSTRAINT_WANT_BUSY_NOT_SATISFIED } @OneRow {
Like @C { MESH_CONSTRAINT_WANT_BUSY_SATISFIED } except
that one or more of the constraints are not satisfied.
}

@DTI { @F MESH_CONSTRAINT_NAMED_SATISFIED_SLACK } @OneRow {
One or more resource constraints apply to one or more of the
resources of the cell which discourage assignment of those
resources at one or more of the times of the cell, and those
constraints are all satisfied.  The constraints could be
avoid unavailable times constraints, or limit busy times
constraints with maximum limit 0, or limit active intervals
constraints with history that prohibits assignments at the
start of the cycle.
}

@End @SubAppendix

@EndSubAppendices
@End @Appendix
