  ------------- Fun facts about COI-Valouxis-1 --------------------
  COI-Valouxis-1 has 28 days (1Mon-4Sun).

  There are three shifts per day:

    N (time 1), presumably Night;
    E (time 2), presumably Evening;
    D (time 3), presumably Day.

  On 1Mon the required shifts are 2 N, 2 E, and 2 D, and this is typical,
  except there are fewer shifts on weekends.  There are also optional
  shifts but they cost 1000 each so are not used by good solutions.

  There are 16 nurses:  Nurse1 to Nurse16.  They all seem to be
  interchangeable, anyway there is just one contract, Contract-Standard.

  Constraint:5   1000  Max 3 out of 4 Sundays
  Constraint:9   1000  Min 10 days off
  Constraint:10   100  Max 13 days off
  Constraint:1   1000  Unwanted pattern: N followed by E
  Constraint:2   1000  Unwanted pattern: N followed by D
  Constraint:3   1000  Unwanted pattern: E followed by D
  Constraint:4   Hard  Single assignment per day
  Constraint:6   1000  2-5 N shifts
  Constraint:7   1000  5-8 E shifts
  Constraint:8   1000  5-8 D shifts
  Constraint:11  1000  Max 3 consecutive N shifts
  Constraint:12  1000  Min 2 consecutive free days (not at start or end)
  Constraint:13  1000  Max 4 consecutive busy days
  Constraint:14   940  Min 2 consecutive busy days (not at start or end)
  Constraint:15    20  Min 4 consecutive busy days (not at start or end)

  Only Constraint:15 springs in good solutions.
  ------------- Fun facts about COI-Valouxis-1 --------------------

  ------------- Fun facts about COI-ORTEC01 --------------------
  Executive summary:  31 days, 4 shifts (E, D, L, and N).  16 nurses,
  all but four working 4-5 shifts per week, 18-20 total.  Complete
  weekends (including Friday night), max 3 working weekends (very easy).
  Limits on the number of consecutive E shifts and consecutive L shifts.
  Max 3 Night shifts, and Min 2 and Max 3 consecutive Night shifts, with
  two free days after a sequence of Night shifts (see Constraint:16 and
  Constrant:20).  Min 2 consecutive free days, 4-6 consecutive busy days.
  Virtually no availability (total 5 shifts).  In all solutions, violations
  are mainly too few shifts per week in the short Week 1 (Constraint:24,
  weight 10 quadratic) plus some Min 4 consecutive busy days (Constraint:43,
  weight 10).

  COI-ORTEC01 has 31 days (one calendar month?):  1Wed to 5Fri.

  There are four shifts per day:  E (time 1), D (time 2), L (time 3),
  and N (time 4).  Presumably these are Early, Day, Late, and Night.  On
  1Wed the required shifts are 3 E, 3 D, 3 L, and 1 N.  This is typical,
  except that Saturday and Sunday have fewer.  There are also optional
  shifts but they cost 1000 each so are not used by good solutions.

  There are 16 nurses:  Nurse1 to Nurse16.

  There are three contracts:  Contract-standard36 (12 nurses),
  Contract-standard32 (one nurse, namely Nurse15), and
  Contract-standard20 (three nurses, Nurse3, Nurse8, and Nurse9).
  Although Nurse15 is treated differently (see below), the
  Contract-standard32 resource group is not used.  Instead,
  Nurse15 is named explicitly.

  There are no unavailable times, except that one nurse (Nurse13)
  cannot take Late shifts (cost 1000).

  The following constraints apply uniformly to all resources.  The
  "after anything else" constraints are hard to comprehend.  They are
  like time windows but with only one side of the window in place.
  Good solutions don't spring them so we won't worry about them.

  Constraint      Weight   Pattern
  -------------------------------------------------------------------
  Constraint:7    1000     No night shift before a free weekend
  Constraint:8/9  1000     Complete weekends (encoded less than ideally)
  Constraint:10     50     6 consecutive E shifts after anything else
  Constraint:11     50     6 consecutive L shifts after anything else
  Constraint:12     30     5 consecutive E shifts after anything else
  Constraint:13     30     5 consecutive L shifts after anything else
  Constraint:14     10     4 consecutive E shifts after anything else
  Constraint:15     10     4 consecutive L shifts after anything else
  Constraint:16   1000     If the first day after a night shift is free,
                           then the second day must also be free
  Constraint:19      5     L cannot be followed by E or D
  Constraint:20   1000     N cannot be followed by E, D, or L
  Constraint:22   1000     Max 3 working weekends, with 5Fri4 counting as
                           one working weekend owing to Constraint:7

  The following constraints limit the number of shifts per week.
  They all have weight 10 and a quadratic cost function, except that
  Constraint:25 has weight 90 - is this a mistake?  Anyway it does
  not spring.  The terms "standard20" and "standard36" presumably
  refer to hours per week:  if shifts are 7 hours long, then the 5
  max per week is 35 hours, and the 3 max per week is 21 hours.  Two
  days have been subtracted from the minimum in the last week because
  there are two days (the non-existent 5Sat and 5Sun) omitted from
  that week.  This could have been done at the start as well but it
  has not been, even though there is no history.

  Constraint     Week        Days  Contract                      Min  Max
  -----------------------------------------------------------------------
  Constraint:24  1Wed-1Sun      5  Contract-standard36 + Nurse15   4    5
  Constraint:29  1Mon-2Sun      7  Contract-standard36 + Nurse15   4    5
  Constraint:31  2Mon-3Sun      7  Contract-standard36 + Nurse15   4    5
  Constraint:33  3Mon-4Sun      7  Contract-standard36 + Nurse15   4    5
  Constraint:25  4Mon-5Fri      5  Contract-standard36 + Nurse15   2    5
                               == 
                               31 

  Constraint:23  1Wed-1Sun      5  Contract-standard20             2    3
  Constraint:28  1Mon-2Sun      7  Contract-standard20             2    3
  Constraint:30  2Mon-3Sun      7  Contract-standard20             2    3
  Constraint:32  3Mon-4Sun      7  Contract-standard20             2    3
  Constraint:26  4Mon-5Fri      5  Contract-standard20             0    3
                               == 
                               31 
  -----------------------------------------------------------------------

  The following constraints limit the total number of shifts.  They
  all have weight 1000 and do not spring in good solutions.

  Constraint                 Contract                      Min    Max
  -------------------------------------------------------------------
  Constraint:35              Contract-standard20             0     11
  Constraint:36              Nurse15                         0     18
  Constraint:37              Contract-standard36             0     20
  -------------------------------------------------------------------

  Combining these with the previous set of constraints we find by summing
  the min per week values that the preferred number of shifts per nurse is
  fairly tight, and exact for Nurse15:

  Contract             Min   Max
  ------------------------------
  Contract-standard20    8    11
  Nurse15               18    18
  Contract-standard36   18    20
  ------------------------------

  Here are more unwanted pattern constraints, also applicable to all
  resources.  They are simpler, implemented by limit busy times constraints:

  Constraint      Weight   Pattern
  -------------------------------------------------------------------
  Constraint:1      10     Max 3 E shifts during 1Wed-1Sat
  Constraint:2      10     Max 3 L shifts during 1Wed-1Sat
  Constraint:3      30     Max 4 E shifts during 1Wed-1Sun
  Constraint:4      30     Max 4 L shifts during 1Wed-1Sun
  Constraint:5      50     Max 5 E shifts during 1Wed-1Mon
  Constraint:6      50     Max 5 L shifts during 1Wed-1Mon
  Constraint:17      1     Prefer not E shift followed by N shift next day
  Constraint:18      5     Prefer not D shift followed by E shift next day
  Constraint:21   Hard     Single assignment per day
  Constraint:34   1000     Max 3 night shifts
  -------------------------------------------------------------------

  Just one time on request (weight 100):  Nurse1 on 1Mon2.

  The following are implemented by limit active intervals constraints:

  Constraint      Weight   Contract  Pattern
  -------------------------------------------------------------------
  Constraint:38     10     All       Min 2 consecutive E shifts
  Constraint:39     10     All       Min 2 consecutive L shifts
  Constraint:40   1000     All       Min 2 and Max 3 consecutive N shifts
  Constraint:41    100     All       Min 2 consecutive free days
  Constraint:42     10     std20     Min 2 consecutive busy days
  Constraint:43     10     std36/15  Min 4 consecutive busy days
  Constraint:44     10     std20     Max 3 consecutive busy days
  Constraint:45     20     std20     Max 4 consecutive busy days
  Constraint:46     20     std20     Max 5 consecutive busy days
  Constraint:47   1000     All       Max 6 consecutive busy days
  -------------------------------------------------------------------

  The later constraints say that std36 nurses (plus Nurse15) prefer
  to have between 4 and 6 consecutive busy days, while std20 nurses
  prefer to have between 2 and 3 consecutive busy days, although
  they can work up to 6 consecutive busy days, with an increasing
  penalty as the number of consecutive busy days increases.
  ------------- Fun facts about COI-ORTEC01 --------------------

  ------------- Fun facts about COI-SINTEF --------------------
  Executive summary:  a small instance whose most significant
  constraints are the preassignment of nurses to weekends, minimum
  2 consecutive day shifts, and minimum 2 consecutive evening shifts.

  There are three weeks of 7 days each in the cycle, from 1Mon to 3Sun.
  There are five times on each day, but the shifts on each day have
  peculiar names, making it a bit hard to see what is going on.  Based
  on the names of constraints, their meaning is:

    1Mon1:  An E (evening?) shift
    1Mon2:  A night shift.  All night shift names include "26007".
    1Mon3:  A day shift
    1Mon4:  An E (evening?) shift, also called an AV shift
    1Mon5:  A day shift

  extended through the cycle.

  There are exactly enough nurses available on weekends to fill the
  demand for nurses on weekends.  The one defect in the best KHE26
  solution is where an unavailable nurse (Nurse23) is working on 3Sat.
  There is exactly one nurse (Nurse24) available but unused then.

  There are 6 contracts:  Contract-C1, Contract-C2, Contract-C3,
  Contract-C4, Contract-C4B, and Contract-C5; all are used.  The
  only difference between Contract-C4 and Contract-C4B is that
  Contract-C4B nurses are subject to Constraint:2 (No AV shifts).

  Each event has one, two, or three required tasks and several
  optional tasks.  The required tasks have soft cost 1000 and
  the optional ones have soft cost 1000, so in practice we can
  forget about the optional tasks.  On each day, four of the
  events have workload 750, the fifth has workload 975.  It's
  not clear what these numbers represent; dividing by 60 gives
  12.5 and 16.25, which seems to be too long to be hours.  Their
  greatest common divisor is 75:  75 * 10 = 750, 75 * 13 = 975.

  Workload does not seem to be in short supply.  Nine resources have
  enough availability to take one more day shift, and three of those
  have enough availability to take one more night shift.  None have
  enough availability take two more shifts.

  The weekend shifts are soft preassigned using avoid unavailable
  times constraints of cost 1.

  Limit busy times constraint Constraint:1 has name "No night shifts",
  and its time group is 1Mon2, with an applies-to that extends it to
  every day, which shows that the second time on each day is the night
  shift.  This is also the sole shift with the larger workload, 975.

  The fourth time on each day, 1Mon4 (extended to every day) is
  called an AV shift, and the C4B, C1, and C5 nurses do not take
  it (this is Constraint:2).

  Constraint:8, Constraint:9, Constraint:10:  All nurses have the same
  workload limit *per week*, namely 5400.  This comes to 7.2 day shifts
  or 5.53 night shifts, which is barely constraining.  Total workload
  limits (Constraint:11, 12, 13, 14, 15) are:

     Contract           Min limit   Max limit    Day shifts
     ----------------------------------------------------------------
     Contract-C5         1645       2820          3 - 3
     Contract-C3         4732       6000          7 - 8
     Contract-C1         6220       7395          9 - 9
     Contract-C2         7388       8563         10 - 11
     Contract-C4 & C4B	10050	   11250         14 - 15
     ----------------------------------------------------------------

  The minimum limits are either zero or one shift away from the maximum
  limits, so they are fairly constraining.

  Maximum 3 consecutive night shifts for Contract-C1 (Constraint:4)

  Max 2 consecutuve E shifts for all nurses (Constraint:5).  Here an
  E shift is either 1Mon1 or 1Mon4, extended through the cycle.  But
  the actual constraint has *min* 2 (and the non-constraining max 23).

  Maximum 2 consecutive Day shifts for all nurses (Constraint:6).
  Here a Day shift is either 1Mon3 or 1Mon5, extended through the
  cycle.  Again the actual limits are *min* 2 and max 23.

  Maximum 6 consecutive working days, all nurses.
  ------------- Fun facts about COI-SINTEF --------------------

  ------------------ Fun facts about COI-MER  -----------------
  There are 6 weeks of 7 days each in the cycle, from 1Sun to 6Sat.
  Each day has 12 times.

  There are 54 nurses, of whom 21 are senior nurses (called Skill-5).
  Other than Skill-5 there are no non-trival resource groups.

  There are hard avoid clashes and single assignment per day constraints.
  Briefly, the other constraints are:

    * Avoid unavailable times constraints (mostly day off requests),
      some soft 1000, others soft 10.  Many of these.

    * Complete weekends.

    * Some strange unwanted patterns (weight 1000), but only 15 of
      them.  There are two violations in the best Misc solution, and
      two violations in the KHHE26 solution, making cost 2000 in both
      cases, so it looks as though we have nothing to worry about here.

    * Conventional unwanted patterns:  no day shift after night shift;
      rare short shifts (D1, D2, E1, and E2) can only start busy sequences.

    * One shift on request per resource, averaging well over ten times
      each.  It's very peculiar to see so many; it's saying that half the
      shifts of each nurse are preassigned.  The Misc solution has cost
      1860 in violations of these constraints; at 10 points each, that
      comes to 186 points of application, or 186 / 45 = 4.1 violations
      per nurse.  KHE26 has plenty as well, although it's hard to find
      their cost because they are in with a lot of unwanted pattern defects.

    * Limit workload constraints (weight 100).  These apply over two-week
      intervals, and demand a specific workload (i.e. the minimum and
      maximum in each constraint are equal).  This is why almost all
      nurses are fully loaded in the solutions.  Event workloads can be
      4.0, 8.0, or 12.0, counting hours.  There are a few violations in
      both the Misc and KHE26 solution.

    * At most one consecutive busy weekend; at most one consecutive free
      weekend.  Just one violation of each in Misc.

    * Consecutive free days in sequences of at least two.

    * At most 5 consecutive night shifts, at most 5 consecutive evening
      shifts, and at most 5 consecutive day shifts.  But no limit on
      consecutive busy days, incredibly.

    * Cover constraints require at least one senior nurse at each time
      (very easy to satisfy), and exactly these numbers of nurses during
      these time intervals:

	Time interval  Nurses  Workload
	-------------------------------
	23:30 - 7:30    7      8
	07:30 - 10:00   8      4
	11:30 - 15:00  10      4
	15:30 - 19:30  10      4
	-------------------------------

      Various combinations of these intervals can be chosen to make
      up one shift, which is why there are 12 shift types.  The
      constraints here are limit resources constraints which list
      all of the shifts running during the relevant time intervals.

  Below here are the full details.

  There are 54 nurses.  There are 7 skill types, called Skill-1,
  Skill-2, Skill-3, Skill-4, Skill-5, Skill-6, and Skill-7.  These
  represent increasing degrees of seniority, i.e. a nurse with
  Skill-(k) also has Skill-(k-1) ... Skill-1.  Other than those,
  the only resource groups are individual contracts and RG:All.
  However, no nurses have Skill-6 or Skill-7, and no constraints
  refer to Skill-2, Skill-3, or Skill-4.  So that just leaves
  Skill-1 (all 54 nurses) and Skill-5 (the 21 senior nurss);
  and for Skill-5 there is just one constraint, requiring the
  presence of a senior nurse at each time, something that is
  very easy to satisfy and always satisfied in the solutions.

  Here is a tabular summary of the events on the first day, 1Sun.
  The tasks of each event are labelled X:1, X:2, ... , X:(n) where
  n is the value shown in the Tk column here.  We've omitted EG:All
  and EG:X from the lists of event groups, because EG:X seems to be
  a synonym for EG:All, and neither of them is used by constraints.

    Event Id  Time    Wk  Tk   Event groups (omitting EG:All and EG:X)
    ----------------------------------------------------------
    1Sun:D1   1Sun1    4  24   EGDC:42, EGDC:84
    1Sun:D    1Sun2    8  24   EGDC:42, EGDC:84, EGDC:210
    1Sun:D12  1Sun3   12  24   EGDC:42, EGDC:84, EGDC:210, EGDC:211
    1Sun:D22  1Sun4   12  24   EGDC:84, EGDC:168, EGDC:210, EGDC:211
    1Sun:D2   1Sun5    4  31   EGDC:210
    1Sun:D19  1Sun6    8  26   EGDC:210, EGDC:211
    1Sun:D23  1Sun7   12  24   EGDC:85, EGDC:168, EGDC:210, EGDC:211
    1Sun:E1   1Sun8    4  26   EGDC:211
    1Sun:E    1Sun9    8  24   EGDC:85, EGDC:168, EGDC:211
    1Sun:E2   1Sun10   4  24   EGDC:85, EGDC:168
    1Sun:S12  1Sun11  12  23   EG:0, EGDC:85, EGDC:168
    1Sun:N    1Sun12   8  23   EG:0
    ----------------------------------------------------------

  There is no strong correlation between task numbers and event groups.
  Events with longer Id's have workload 12, except not 1Sun:D19.

    EGDC:0   1Sun:S12, 1Sun:N
    EGDC:1   1Mon:S12, 1Mon:N
    EGDC:2   1Tue:S12, 1Tue:N

    EGDC:42  1SunD1, 1Sun:D, 1Sun:D12, DemandConstraint:1A,
             DemandConstraint:3A, DemandConstraint:3B, DemandConstraint:3C

    EGDC:84  1SunD1, 1Sun:D, 1Sun:D12, 1Sun:D22, DemandConstraint:1A,
             DemandConstraint:3A, DemandConstraint:3B, DemandConstraint:3C

  The demand constraints (limit resources constraints) have labels
  that give a good idea of what is going on.  See below for this.

  Avoid clashes constraints - all resources, hard weight 1.

  Avoid unavailable times constraints - each resource has its
  own, with soft weight 1000 in some cases and soft weight 10
  in others.  They are mostly day off requests expressed as
  time off requests for all 12 times of the day in question.

  Cluster busy times constraints - complete weekends, applies
  to all (or virtually all) resources.

  (from line 30142) strange patterns that require exactly 4
  free days in a subset of week 6, or exactly 5 free days out
  of 7, and so on.  They are queer but they have weight 1000.
  For example, Constraint:63 requires Nurse988049 to be busy
  on exactly three days from 5Tue through to 6Fri.  Why?
  These end, thank heavens, on line 30500; there are only
  15 of them, so they are not too dangerous.

  (from line 30561) Limit busy times constraints expressing
  more conventional unwanted patterns:

    1Sun1: [1Mon5, 1Mon8, 1Mon10],
    1Sun2: [1Mon1, 1Mon5, 1Mon8, 1Mon10],
    1Sun3: [1Mon1, 1Mon5, 1Mon8, 1Mon10],
    1Sun4: [1Mon1, 1Mon5, 1Mon8, 1Mon10],
    1Sun5: [1Mon1, 1Mon8, 1Mon10],
    1Sun6: [1Mon1, 1Mon5, 1Mon8, 1Mon10],
    1Sun7: [1Mon1, 1Mon5, 1Mon8, 1Mon10],
    1Sun8: [1Mon1, 1Mon5, 1Mon10],
    1Sun9: [1Mon1, 1Mon5, 1Mon8, 1Mon10],
    1Sun10:[1Mon1, 1Mon5, 1Mon8],
    1Sun11:[1Mon1, 1Mon2, 1Mon3, 1Mon4, 1Mon5, 1Mon6, 1Mon7, 1Mon8, 1Mon10],
    1Sun12:[1Mon1, 1Mon2, 1Mon3, 1Mon4, 1Mon5, 1Mon6, 1Mon7, 1Mon8, 1Mon10]

  (from line 31533) Limit busy times constraint for single assignment
  per day (hard cost 1).

  (from line 31551) Limit busy times constraint for day or shift
  on requests.  These are also quite queer, for example minimum
  one of 6Wed12, 6Thu12, and 6Sat9.  Why?  Oh wait, the minimum
  applies separately to each time group.  All have weight 10.
  There are an awful lot of these things, scattered right through
  the timetable.  They could be what the problem is with COI-MER.
  TimeOn-Nurse902088-s10 looks like a preassigned timetable,
  virtually.  It needs looking into.  It seems like most of
  the nurses have preassigned timetables.

  (from line 33074) Limit workload constraints.  These apply over
  two-week intervals, and they demand a specific amount of
  workload, i.e. they have minimum = maximum.  So they get
  satisfied, evidently, by all these optional tasks in the
  solutions; and they explain why almost all resources have
  0.0 for their available workload.

  (from line 33611) Limit active intervals constraints:

    (1) At most one consecutive free weekend (all resources),
    (2) At most one consecutive busy weekend (all resources),
    (3) At most one consecutive busy 1Sun1, 1Mon1, 1Tue1 (etc.) time.
    (4) At most one consecutive busy 1Sun5, 1Mon5, 1Tue5 (etc.) time.
    (5) At most one consecutive busy 1Sun8, 1Mon8, 1Tue8 (etc.) time.
    (6) At most one consecutive busy 1Sun10, 1Mon10, 1Tue10 (etc.) time.
    (7) At most 5 consecutive 1Sun11-12, 1Mon11-12, etc. (night shifts)
    (8) At most 5 consecutive 1Sun8-10, 1Mon8-10, 1Tue8-10 etc.
    (9) At most 5 consecutive 1Sun1-7, 1Mon1-7, 1Tue1-7 etc.
    (10) Consecutive free days in sequences of at least 2 days.

  Here (1), (2), and (10) are self-explanatory.  (3)-(6) are unwanted
  pattern constraints and are analysed below.  That leaves (7), (8) and (9):

  The times included in (7) are:

    ----------------------------------------------------------
    1Sun:S12  12  (23:30 - 7:30), (07:30 - 10:00)*
    1Sun:N     8  (23:30 - 7:30)
    ----------------------------------------------------------

  So this limits consecutive night shfts.  The times in (8) are

    ----------------------------------------------------------
    1Sun:E1    4  (15:30 - 19:30)
    1Sun:E     8  (07:30 - 10:00)*, (15:30 - 19:30)
    1Sun:E2    4  (07:30 - 10:00)*
    ----------------------------------------------------------

  These have little in common except for the names.  But let's
  call them Evening shifts.  The times in (9) are:

    ----------------------------------------------------------
    1Sun:D1    4  (07:30 - 10:00)*
    1Sun:D     8  (07:30 - 10:00)*, (11:30 - 15:00)
    1Sun:D12  12  (07:30 - 10:00)*, (11:30 - 15:00), (15:30 - 19:30)
    1Sun:D22  12  (07:30 - 10:00)*, (11:30 - 15:00), (15:30 - 19:30)
    1Sun:D2    4  (11:30 - 15:00)
    1Sun:D19   8  (11:30 - 15:00), (15:30 - 19:30)
    1Sun:D23  12  (07:30 - 10:00)*, (11:30 - 15:00), (15:30 - 19:30)
    ----------------------------------------------------------

  Let's call them Day shifts.  Then we can say "at most 5 consecutive
  night shifts, at most 5 consecutive evening shifts, and at most 5
  consecutive day shifts."  One can see this in the solutions.

  (from line 34269) Limit resources constraints

    DemandConstraint:1A
    "07:30:00--10:00:00:Skill-5, min 1", soft 100
    event groups (separate) EGDC:0, EGDC:1, ... , EGDC:293,
    roles X:1 ... X:31 (i.e. all roles)
    Skill-5 nurses

    DemandConstraint:2[ABC]
    "23:30:00--07:30:00:Skill-1, min 7, max 7", soft 1
    event groups EGDC:0, ... , EGDC:41,
    roles X:1 .. X:23
    Skill-1 nurses (all nurses have Skill-1),
    *
    "23:30:00--07:30:00:Skill-1, max 23", soft 99
    event groups (separate) EGDC:0, ... , EGDC:41.
    Skill-1 nurses (all nurses have Skill-1),
      So we want exactly 7 nurses (previous constraint) but
      it's much worse if we get more than 23.
    *
    "23:30:00--07:30:00:Skill-1, max 22", soft 84
    event groups (separate) EGDC:0 .. EGDC:41
    roles X:1 .. X:23
    Skill-1 nurses (all nurses have Skill-1),

    DemandConstraint:3[ABC]
    "07:30:00--10:00:00:Skill-1, min 8, max 8", soft 1
    event groups (separate) EGDC:42 ... EGDC:209
    roles X:1 .. X:24
    Skill-1 nurses (all nurses have Skill-1),
    *
    "07:30:00--10:00:00:Skill-1, max 24", soft 99
    event groups (separate) EGDC:42 ... EGDC:209
    roles X:1 .. X:24
    Skill-1 nurses (all nurses have Skill-1),
    *
    "7:30:00--10:00:00:Skill-1, max 23", soft 84
    event groups (separate) EGDC:42 ... EGDC:209
    roles X:1 .. X:24
    Skill-1 nurses (all nurses have Skill-1),

    DemandConstraint:4[ABC]
    "15:30:00--19:30:00:Skill-1, min 10, max 10"
    event groups (separate) EGDC:211, EGDC:213, and
    so on through odd numbers to EGDC:293.
    roles X:1 .. X:26
    *
    "15:30:00--19:30:00:Skill-1, max 26", soft 99
    event groups (separate) EGDC:211, EGDC:213, and
    so on through odd numbers to EGDC:293.
    roles X:1 .. X:26
    *
    "15:30:00--19:30:00:Skill-1, max 25", soft 84
    event groups (separate) EGDC:211, EGDC:213, and
    so on through odd numbers to EGDC:293.
    roles X:1 .. X:26

    DemandConstraint:5[ABC]
    "11:30:00--15:30:00:Skill-1, min 10, max 10", soft 1
    event groups (separate) EGDC:210, EGDC:212, and
    so on through even numbers to EGDC:292.
    roles X:1 .. X:31
    *
    "11:30:00--15:30:00:Skill-1, max 31", soft 99
    event groups (separate) EGDC:210, EGDC:212, and
    so on through even numbers to EGDC:292.
    roles X:1 .. X:31
    *
    "11:30:00--15:30:00:Skill-1, max 30", soft 79
    event groups (separate) EGDC:210, EGDC:212, and
    so on through even numbers to EGDC:292.
    roles X:1 .. X:31

  The first constraint requests at least one Skill-5 nurse on duty
  between 7:30 and 10:00.  At least, that's what it says, but in
  fact it seems to apply to every event group including some doubling
  up.  That doesn't matter because in practice it never springs.  The
  other constraints give a preferred number of nurses on duty during
  the following intervals:

    Time interval  Ns  Ct  Event groups      Shifts
    --------------------------------------------------------------------------
    23:30 - 7:30    7  2A  EGDC:0-41         S12, N
    07:30 - 10:00   8  3A  EGDC:42-209       D1*,D*,D12*,D22*,D23*,E*,E2*,S12*
    11:30 - 15:00  10  5A  EGDC:210,212-292  D, D12, D22, D2, D19, D23
    15:30 - 19:30  10  4A  EGDC:211,213-293  D12, D22, D19, D23, E1, E
    --------------------------------------------------------------------------
    * means covered more than once

  Can we work out which shifts cover which times?

    Event Id  Time    Wk  Tk   Event groups (omitting EG:All and EG:X)
    ----------------------------------------------------------
    1Sun:D1   1Sun1    4  24   EGDC:42, EGDC:84
    1Sun:D    1Sun2    8  24   EGDC:42, EGDC:84, EGDC:210
    1Sun:D12  1Sun3   12  24   EGDC:42, EGDC:84, EGDC:210, EGDC:211
    1Sun:D22  1Sun4   12  24   EGDC:84, EGDC:168, EGDC:210, EGDC:211
    1Sun:D2   1Sun5    4  31   EGDC:210
    1Sun:D19  1Sun6    8  26   EGDC:210, EGDC:211
    1Sun:D23  1Sun7   12  24   EGDC:85, EGDC:168, EGDC:210, EGDC:211
    1Sun:E1   1Sun8    4  26   EGDC:211
    1Sun:E    1Sun9    8  24   EGDC:85, EGDC:168, EGDC:211
    1Sun:E2   1Sun10   4  24   EGDC:85, EGDC:168
    1Sun:S12  1Sun11  12  23   EG:0, EGDC:85, EGDC:168
    1Sun:N    1Sun12   8  23   EG:0
    ----------------------------------------------------------

    Event Id  Wk  Time intervals
    ----------------------------------------------------------
    1Sun:D1    4  (07:30 - 10:00)*
    1Sun:D     8  (07:30 - 10:00)*, (11:30 - 15:00)
    1Sun:D12  12  (07:30 - 10:00)*, (11:30 - 15:00), (15:30 - 19:30)
    1Sun:D22  12  (07:30 - 10:00)*, (11:30 - 15:00), (15:30 - 19:30)
    1Sun:D2    4  (11:30 - 15:00)
    1Sun:D19   8  (11:30 - 15:00), (15:30 - 19:30)
    1Sun:D23  12  (07:30 - 10:00)*, (11:30 - 15:00), (15:30 - 19:30)
    1Sun:E1    4  (15:30 - 19:30)
    1Sun:E     8  (07:30 - 10:00)*, (15:30 - 19:30)
    1Sun:E2    4  (07:30 - 10:00)*
    1Sun:S12  12  (23:30 - 7:30), (07:30 - 10:00)*
    1Sun:N     8  (23:30 - 7:30)
    ----------------------------------------------------------

  So what this is saying is that these intervals have these workloads:

    Time interval     Wk  Better interval
    -------------------------------------
    (07:30 - 10:00)    4  (07:30 - 11.30)
    (11:30 - 15:00)    4  (11:30 - 15:30)
    (15:30 - 19:30)    4  (15:30 - 19:30)
                       ?  (19:30 - 23:30)
    (23:30 - 7:30)     8  (23:30 - 7:30)
    -------------------------------------

  So the workloads are roughly numbers of hours, although they
  add up to 20 rather than 24, with the four hours from 19:30
  to 23:30 missing.  It all makes sense, except for the missing
  four hours and the peculiar break in the E shift.  And the demand
  constraints ensure that the right number of nurses is working
  during each interval of time.

  Now the unwanted patterns are these:

    D1:   [    D2, E1, E2],
    D:    [D1, D2, E1, E2],
    D12:  [D1, D2, E1, E2],
    D22:  [D1, D2, E1, E2],
    D2:   [D1,     E1, E2],
    D19:  [D1, D2, E1, E2],
    D23:  [D1, D2, E1, E2],
    E1:   [D1, D2,     E2],
    E:    [D1, D2, E1, E2],
    E2:   [D1, D2, E1    ],

    S12:  [D1, D, D12, D22, D2, D19, D23, E1, E2],
    N:    [D1, D, D12, D22, D2, D19, D23, E1, E2]

  The last two say that after a night shift you can have another
  night shift, or an E shift, or nothing.  Allowing an E shift
  after a night shift seems wrong, but there are examples of it in
  the Misc solutions, so it is not a mistake of my analysis.

  The four gaps in the earlier patterns are actually covered by
  limit active intervals constraints:

    D1: At most one consecutive busy 1Sun1, 1Mon1, 1Tue1 (etc.) time.
    D2: At most one consecutive busy 1Sun5, 1Mon5, 1Tue5 (etc.) time.
    E1: At most one consecutive busy 1Sun8, 1Mon8, 1Tue8 (etc.) time.
    E2: At most one consecutive busy 1Sun10, 1Mon10, 1Tue10 (etc.) time.

  Now D1, D2, E1, and E2 are the short (workload 4) shifts, so the
  earlier patterns are saying that you can't drop back to a short
  shift after something else.  In other words, short shifts are only
  available to nurses who had the previous day off.  It's queer, but I
  can see it in the solutions.  In practice few nurses get short shifts.
  ------------------ Fun facts about COI-MER  -----------------

  ------------------ Fun facts about INRC2-4-120-1-4626 -----------------
  Times:  4 weeks, 4 times per day
  Nurses:  90 nurses + 30 trainees = 120 nurses:  HN_0 to HN_19,
    NU_20 to NU_49, CT_50 to CT_89, and TR_90 to TR_119.

  There are hard assign resource constraints, and soft ones with
  weight 30.  There are many hard (and soft) preferences for head
  nurses etc.  There is a moderate number of avoid unavailable
  times constraints; their weight is only 10.  There are hard
  unwanted patterns: no non-Night shift after a Night shift, no
  Early or Day after a Late shift.  Complete weekends, weight 30.

  There are only three contract types: Contract-FullTime,
  Contract-PartTime, and Contract-HalfTime.

                  Busy    Weekends   C-Free C-Working
          Weight:  20         30        30     30
    -------------------------------------------------
    FullTime     15-20       0-2       2-3    3-5
    PartTime     11-15       0-2       2-5    3-5
    HalfTime      7-11       0-1       4-7    4-7
    -------------------------------------------------

  Limits on consecutive same shift days are present and are the same
  for all resources:  Early 2-28, Day 2-28, Late 2-5, Night 4-5, all
  weight 15.

  There are four grades:  HeadNurse, Nurse, Caretaker, and Trainee.
  Trainee tasks and nurses are quite separate and form a separate
  instance.  Every HeadNurse is also a Nurse (but not a Caretaker);
  every Nurse (who is not a HeadNurse) is also a Caretaker.
  ------------------ Fun facts about INRC2-4-120-1-4626 -----------------

  ------------------ Fun facts about COI-Ikegami-3.1.2 -------------------
  36 days (5 weeks plus one day), although the first 6 days look suspiciously
  like fixed assignments taken over from the previous cycle (i.e. history,
  given explicitly).  So that makes 30 days to timetable, probably one
  calendar month.  Four shifts per day:  N, E, D, and O.  But the O
  shifts are few and are populated exclusively by preassigned nurses.

  25 resources divided into groups A01-A13 and B15-B25.  Some
  unavailable times but not very constraining.  The KHE solution
  has plenty of available times (53, more than 2 per resource),
  although the best Misc solution has only 10.  Unwanted patterns:

    Label	Pattern			Weight	Notes
    -------------------------------------------------------------------
    		[Night, Any, Day]	100	22 of 25 resources
    		[Night, Any, O]		100	24 of 25 resources
    		[Night, E]		100	all resources
    		[Night, D]		100	all resources
    		[Night, O]		100	all resources
    9		[E, Day]		100	all resources
    10		[E, O]			100	23 of 25 resources
    -------------------------------------------------------------------

  The first five are saying "at least two days off after a Night shift",
  except that it is allowable to have one day off after a Night shift,
  followed by an E shift, and indeed one sees this occasionally in the
  solutions.

  Workload limits, expressed as free time.  12 resources have at
  least 2 and at most 4 days off; 11 resources have at least 3 and
  at most 6 days off; one resource (B19) has at most 2 days off;
  one (A12) has exactly 2 days off (all starting from 1Wed as usual).

  23 of 25 resources have at least 4 and at most 6 E shifts.  11
  resources have at most 14 D shifts, 12 have at most 15 D shifts,
  two have at most 17 D shifts.

  There are a few time on requests.

  Minimum 6 days between Night shifts, "recoded inexactly".  Maximum
  of two consecutive Night shifts.  Minimum of two consecutive Night
  shifts, both weight 100.

  Maximum of 3 consecutive E shifts.  Maximum of 6 days between
  D shifts.  Maximum of 4 consecutive D shifts.

  Maximum of 5 consecutive free days.  Maximum of 6 consecutive
  busy days.  Minimum of 2 consecutive busy days.

  Maximum of two weekends off over weeks 2, 3, 4, and 5 (weight 100).
  At least 9 days off over the 30 days starting on 1Wed (weight 100).

  Then limit resources constraints (all weight 1):

    Label			Shift	Group	Limits
    --------------------------------------------------
    DemandConstraint:1A		E	B_SS	1-1
    DemandConstraint:2A		N	A_SS	1-1
    DemandConstraint:2A		E	A_SS	1-1
    DemandConstraint:3A		N	B_SS_s	1-1
    DemandConstraint:4A		E	B_rq_s	1-1
    DemandConstraint:5A		some D	B_SS	1-2
    DemandConstraint:6A		E	B_SS_s	1-2
    DemandConstraint:6A		some D	B_SS_s	1-2
    DemandConstraint:7A		N	GroupB	1-2
    DemandConstraint:8A		N	GroupA	1-2
    DemandConstraint:9A		D	B_SS	1-3
    DemandConstraint:10A	one D	B_SS	1-6
    DemandConstraint:11A	17 D	A_SS	2-2
    DemandConstraint:12A	4 D	B_SS_s	2-2
    DemandConstraint:13A	E	GroupB	2-2
    DemandConstraint:14A	E	GroupA	2-2
    DemandConstraint:15A	12 D	A_SS	2-3
    DemandConstraint:16A	20 D	B_SS_s	2-3
    DemandConstraint:17A	17 D	B_rq_s	2-4
    DemandConstraint:18A	one D	B_rq_s	2-5
    DemandConstraint:19A	one D	A_SS	2-6
    DemandConstraint:20A	one D	B_SS_s	2-6
    DemandConstraint:21A	12 D	B_rq_s	2-6
    DemandConstraint:22A	N	all	3-3
    DemandConstraint:23A	9 D	GroupB	3-6
    DemandConstraint:24A	4 D	GroupA	3-6
    DemandConstraint:25A	E	all	4-4
    DemandConstraint:26A	20 D	GroupB	4-6
    DemandConstraint:27A	25 D	GroupA	4-6
    DemandConstraint:28A	1 D	GroupB	5-9
    DemandConstraint:29A	1 D	GroupA	6-9
    DemandConstraint:30A	8 D	all	7-11
    DemandConstraint:31A	21 D	all	8-11
    DemandConstraint:32A	1 D	all	13-18
    DemandConstraint:33A	N	1_9	0-1
    DemandConstraint:33A	E	1_9	0-1
    DemandConstraint:34A	N	B_SS	0-1
    DemandConstraint:34A	5 D	B_SS	0-1
    DemandConstraint:35A	D	1_9	0-2
    DemandConstraint:36A	N	B_rq_s	0-2
    --------------------------------------------------

  Incidence of resources and resource groups:

	GroupA	A_SS	GroupB	B_SS	B_SS_s	B_rq_s	1_9
    ---------------------------------------------------------
    A01	*	*					*
    A02	*	*
    A03	*	*
    A04	*	*
    A05	*	*
    A06	*	*
    A07	*
    A08	*
    A09	*						*
    A10	*
    A11	*
    A12	*
    A13	*
    B14			*	*	*
    B15			*	*	*
    B16			*	*	*
    B17			*	*	*
    B18			*	*	*
    B19			*			*
    B20			*			*
    B21			*			*
    B22			*			*
    B23			*			*
    B24			*			*
    B25			*		*	*
    ---------------------------------------------------------

  So now we know what SkillGroup-1_9 stands for:  just two nurses,
  A01 an A09, are in it.  There is just one small difference between
  B_SS and B_SS_s.  All recently qualified nurses are in Group B,
  although Group A also has more senior and less senior nurses.
  ------------------ Fun facts about COI-Ikegami-3.1.2 -------------------

  ------------------ Fun facts about COI-Ikegami-2.1 -------------------
  Four weeks plus two days, starting on a Friday.
  Three times per day: N (time 1), D (time 2), and O (time 3).
  Nurses A01-A10, B11-B19, C20-C28, with complex contracts and skills.
  Some of the O events have preassigned resources; in fact they all
  do, so the O events are looking like unbreakable day off requests.
  There are also soft day/shift off constraints, per resource, and
  some unwanted pattern constraints with maximum 0, which means they
  too are time off requests, oddly expressed.  Some odd unwanted
  pattern constraints concerned with weekends, e.g. for four resources,
  one of 1Fri, 1Sat, 1Sun, and 1Mon must be busy.
  Workload limits, expressed as lower limits on free times.
  There are also day and shift on requests.
  Constraint:43 is Max 3 consecutive Day shifts.
  Constraint:44 is Max 5 consecutive free days.
  Constraint:45 is Max 6 consecutive busy days.

  Constraint:28 is max 2 weekends off (all resources)
  Constraint:29 is min 1 weekend off (all resources)
  Constraint:30 is max 6 shifts per week (all resources, each week)
  Constraint:38 and thereabouts:  limits on total day and night shifts
  TimeOn-B16-s100 etc.:  time on requests

  Resouce group Skill-Skilled:  A01, A02, A03, B11, B12, C20, C21.

  Constraint:21 prohibits Night-Any-Any-Any-Night
  Constraint:22 prohibits Free-Day-free-Day-Free
  Constraint:23 prohibits Night-Any-Any-Night
  Constraint:24 prohibits Night-Any-{Night or Day)
  Constraint:25 prohibits Night-(Night or Day)

  Basically once you've had a Night shift, you can't have another
  busy day the next day or (except for O) the day after, and you
  can't have another Night shift in the following three days.  And
  although a single free day is allowed, two single free days close
  together are not.

  Limit resources constraints
  ---------------------------
  DemandConstraint:2A/1Sat:N limits the number of resources assigned
  event 1Sat:N with skill "Skill-Skilled" to between 1 and 2.  The defect
  above must have 0 such resources.  The Skill-Skilled resources are:
  A01, A02, A03, B11, B12, C20, C21.  Sure enough, none of these are
  assigned to event 1Sat:N.  It looks as though it would be *really*
  easy to assign A02 to this shift, which is what the KHE solution
  does.  Is that being tried?

  DemandConstraint:21A/2Tue:D limits the number of resources assigned
  to event 2Tue:D with skill Skill-GroupB to between 3 and 4.  The
  defect above must have 2 such resources.
  ------------------ Fun facts about COI-Ikegami-2.1 -------------------

  ------------- Fun facts about COI-QMC-1 -----------------------
  Nine shifts per day.  19 nurses, called A, B, ... S.  Each has
  their own contract (Contract-A, Contract-B, etc.).  There
  are two skill levels, Skill-RegisteredNurse and Skill-EyeTrained.
  These are not used directly (the only prefer resources constraints have
  empty resource groups, giving a cost for assigning any resource),
  but Constraint:15 and Constraint:16 say "no registered nurse shifts"
  and "no eye-trained shifts".  So as usual with this instance we
  have some unnecessarily complicated encodings.

  The first time on each day (e.g. 1Mon1) actually represents free
  time.  Most nurses are busy at every time, but quite a lot of
  their busyness consists of attending the special events at this
  first time, whose tasks do not have constraints attached.

  Apart from the O events, all tasks either have non-assign cost
  1000 or assign cost 1000.  So in practice the number of tasks
  on each shift is fixed.  The tasks have varying wokloads:  Early
  (three shift types) and Late (also three shift types) have
  workload 75; Night (two shift types) has workload 100.

  There are avoid unavailable times constraints for more than
  half of the resources (the pink ones in the table).

  Min 2 consecutive N shifts, expressed rather oddly (by time
  windows, I think it is).  Complete weekends, also expressed
  rather oddly.  No E or L shift following N.  No registered
  nurse attends an L shifts.  Max 3 busy weekends.  Consecutive
  busy days:  min 2, max 6 for some, min 0, max 6 for others.

  There are limit workload constraints, with several different
  limits, all maximum limits.  Each task has workload 75 or 100,
  and many resources have 300 or more available workload, so
  it seems that workload limits, while constraining for some
  resources, are not a big issue oversll.

  Lots and lots and lots of day or shift on requests, for all
  nurses, some with weight 1, others with weight 1000.  These
  are the only constraints violated in good solutions.  Many
  of these requests are for the first time of the day, that is,
  they are requests for O, which means that in fact they are
  requests to have the day off.  All very convoluted.
  ------------- Fun facts about COI-QMC-1 -----------------------

  ------------ Fun facts about COI-GPost.xml ------------------
  This instance has 28 days with two shifts per day, called D
  (Day) and N (Night).  There are two contract types, full-time
  (nurses A, B, C, and D) and part-time (nurses E, F, G, and H)
  and no skill levels.  Each task either has
  non-assignment cost 1000 or soft assignment cost 1000, so
  there is no doubt about which tasks are required and which
  are not, and no flexibility there.  Complete weekends (weight
  100), no night shift before a free weekend (weight 1000),
  at least 2 free days after a night shift (weight 1000),
  2 or 3 shifts per week (part-time), 4 or 5 shifts pere
  week (full-time), where a week is Mon-Sun.  Maximum number
  of shifts is 18 (full-time) or 10 (part-time).  Demand is
  such that every nurse must work up to its workload limit.
  No day shift follows a night shift.  Max 4 night shifts.
  A few shift on requests.  At most 2 consecutive busy weekends.
  Night shifts to occur in sequences of 2 or 3.  So combined
  with a previous constraint, this is at most NN plus NN or
  else NNN, and demand for nurses on night shifts is such that
  every nurse has either NN plus NN or else NNN.  Free shifts
  to occur in sequences of 2 or more (weight 10).  Sequences of
  busy days to have length 2 or more.  Sequences of busy days of
  length at most 3 (part-time), sequences of busy days of length
  at most 6 (all resources, weight 1000).
  ------------ Fun facts about COI-GPost.xml ------------------

  ------------ Fun facts about COI-Azaiez.xml ------------------
  This instance has 28 days with two shifts per day, called 1 or
  D (Day) and 2 or N (Night).  A day shift cannot follow a night
  shift, and a night shift cannot follow a day shift.
  There is one contract type and three skill levels (0, 1, and 2):

    Skill-0: Nurse1 Nurse2 Nurse3 Nurse4 Nurse5 
    Skill-1: Nurse6 Nurse7 Nurse8 Nurse9 Nurse10 Nurse11 Nurse12
    Skill-2: Nurse13

  Some required slots prefer Skill-0 or Skill-1, but most don't,
  and optional slots never have preferred resources.  So these
  preferences are not very constraining.

  Max four weekend days.  Min 12 days off, max 14 days off.  Max
  15 days on (but also min 28 - 14 = 14 days on).  Min & Max 8 D
  shifts, Min & Max 7 N shifts.  Min 2 consecutive busy days, max
  4 consecutive busy days.  Min 2 consecutive free days, no max.

  In the solutions, all resources are busy for exactly 15 times.
  This is because of the requirement for exactly 8 D shifts and
  exactly 7 N shifts.
  ------------ Fun facts about COI-Azaiez.xml ------------------

  ------------- Fun facts about INRC2-4-100-0-1108 --------------------
  Times:  4 weeks, 4 times per day
  Nurses:  75 nurses + 25 trainees = 100 nurses

  There are hard assign resource constraints, and soft ones with
  weight 30.  There are many hard preferences for head nurses etc.
  There is a moderate number of avoid unavailable times constraints;
  their weight is only 10.  There are hard unwanted patterns:
  no non-Night shift after a Night shift, no Early or Day after
  a Late shift.  Complete weekends, weight 30.

                  Busy    Weekends   C-Free C-Working
          Weight:  20         30        30     30
    -------------------------------------------------
    FullTime     14-20       0-2       2-3    3-5
    PartTime      7-15       0-2       3-4    4-7
    HalfTime      7-10       0-1       3-7    3-5
    20Percent     3-6        0-1       2-7    2-5
    -------------------------------------------------

  Limits on consecutive same shift days are present and are the same
  for all resources:  Early 2-5, Day 2-28, Late 2-5, Night 4-5, all
  weight 15.  Unavailable times have weight 10.

  There are four grades:  HeadNurse, Nurse, Caretaker, and Trainee.
  Trainee tasks and nurses are quite separate and form a separate
  instance.  Every HeadNurse is also a Nurse (but not a Caretaker);
  every Nurse (who is not a HeadNurse) is also a Caretaker.
  ------------- Fun facts about INRC2-4-100-0-1108 --------------------

  ------------- Fun facts about INRC2-4-120-1-5698 --------------------
  Times:  4 weeks, 4 times per day
  Nurses:  90 nurses + 30 trainees = 120 nurses

  There are hard assign resource constraints, and soft ones with
  weight 30.  There are many hard preferences for head nurses etc.
  There is a moderate number of avoid unavailable times constraints;
  their weight is only 10.  There are hard unwanted patterns:
  no non-Night shift after a Night shift, no Early or Day after
  a Late shift.  Complete weekends, weight 30.

  There are no 20Percent nurses in this instance.

                  Busy    Weekends   C-Free C-Working
          Weight:  20         30        30     30
    -------------------------------------------------
    FullTime     15-20       0-2       2-3    3-5
    PartTime     11-15       0-2       2-5    3-5
    HalfTime      7-11       0-1       4-7    4-7
    -------------------------------------------------

  Limits on consecutive same shift days are present and are the same
  for all resources:  Early 2-28, Day 2-28, Late 2-5, Night 4-5, all
  weight 15.

  There are four grades:  HeadNurse, Nurse, Caretaker, and Trainee.
  Trainee tasks and nurses are quite separate and form a separate
  instance.  Every HeadNurse is also a Nurse (but not a Caretaker);
  every Nurse (who is not a HeadNurse) is also a Caretaker.
  ------------- Fun facts about INRC2-4-120-1-5698 --------------------

  ------------- Fun facts about INRC2-4-110-0-1935 --------------------
  This instance differs from INRC2-4-100-0-1108 only in the number of
  nurses (and presumably tasks) and in the limits on number of busy days.

  Times:  4 weeks, 4 times per day
  Nurses:  80 nurses + 30 trainees = 110 nurses

  There are hard assign resource constraints, and soft ones with
  weight 30.  There are many hard preferences for head nurses etc.
  There is a moderate number of avoid unavailable times constraints;
  their weight is only 10.  There are hard unwanted patterns:
  no non-Night shift after a Night shift, no Early or Day after
  a Late shift.  Complete weekends, weight 30.

                  Busy    Weekends   C-Free C-Working
          Weight:  20         30        30     30
    -------------------------------------------------
    FullTime     15-22       0-2       2-3    3-5
    PartTime      7-15       0-2       3-4    4-7
    HalfTime      7-11       0-1       3-7    3-5
    20Percent     2-5        0-1       2-7    2-5
    -------------------------------------------------

  Limits on consecutive same shift days are present and are the same
  for all resources:  Early 2-5, Day 2-28, Late 2-5, Night 4-5, all
  weight 15.  All these limits are as for INRC2-4-100-0-1108 except
  that the total busy days limits are slightly different.

  As for INRC2-4-100-0-1108, there are four grades:  HeadNurse, Nurse,
  Caretaker, and Trainee.  Trainee tasks and nurses are quite separate
  and form a separate instance.  Every HeadNurse is also a Nurse (but not
  a Caretaker); every Nurse (who is not a HeadNurse) is also a Caretaker.
  ------------- Fun facts about INRC2-4-110-0-1935 --------------------

  ------------- Fun facts about CQ14-13 --------------------
  * A four-week instance (1Mon to 4Sun) with 18 times per day:

      a1 (1),  a2 (2),  a3 (3),  a4 (4),  a5 (5),
      d1 (6),  d2 (7),  d3 (8),  d4 (9),  d5 (10),
      p1 (11), p2 (12), p3 (13), p4 (14), p5 (15),
      n1 (16), n2 (17), n3 (18)

    There are workloads, presumably in minutes, that vary quite a bit:

      a1 (480),  a2 (480),  a3 (480),  a4 (600),  a5 (720),
      d1 (480),  d2 (480),  d3 (480),  d4 (600),  d5 (720),
      p1 (480),  p2 (480),  p3 (480),  p4 (600),  p5 (720),
      n1 (480),                        n2 (600),  n3 (720)

    480 minutes is an 8-hour shift, 720 minutes is 12 hours.

  * 120 resources, with many hard preferences for certain shifts:

      Preferred-a1 Preferred-a2 Preferred-a3 Preferred-a4 Preferred-a5
      Preferred-d1 Preferred-d2 Preferred-d3 Preferred-d4 Preferred-d5
      Preferred-p1 Preferred-p2 Preferred-p3 Preferred-p4 Preferred-p5
      Preferred-n1 Preferred-n2 Preferred-n3

    although most resources have plenty of choices from this list.
    Anyway this leads to a huge number of prefer resources constraints.

  * There are also many avoid unavailable times constraints, some for
    whole days, many others for individual times; hard and soft.

  * Unwanted patterns (hard).  In these patterns, a stands for
    [a1a2a3a4a5] and so on.

      [d4][a]
      [p5][adp4-5]
      [n1][adp]
      [n2-3][adpn3]
      [d1-3][a1-4]
      [a5d5p1-4][ad]

    This is basically "day off after a sequence of night shifts",
    with some other stuff that probably matters less; a lot of it
    is about the 480 and 720 minute shifts.

  * MaxWeekends (hard) for most resources is 2, for some it is 1 or 3.

  * MaxSameShiftDays (hard) varies a lot, with fewer of the long
    workload shifts allowed.  NB this is not consecutive, this is
    total.  About at most 10 of the shorter, 3 of the longer.
    Doesn't seem very constraining, given that typical workloads
    are 15 or 16 shifts.

  * Many day or shift on requests, soft with varying weights (1-3).

  * Minimum and maximum workload limits in minutes (hard), e.g.

      Minutes           480-minute shifts
      -----------------------------------------------------------
      3120 - 3840
      4440 - 5160
      7440 - 8160        15.5 - 17.0
      7920 - 8640        16.5 - 18.0

    The last two ranges cover the great majority of resources.
    These ranges are quite tight, especially for hard constraints.

  * MinConsecutiveFreeDays 2 (hard) for most resources, 3 (hard)
    for a few.

  * MaxConsecutiveBusyDays 5 (hard) for most resources, 6 (hard)
    for a few.

  * MinConsecutiveBusyDays 2 (hard), for all or most resources.
  ------------- Fun facts about CQ14-13 --------------------

  ------------- Fun facts about INRC1-ML02 --------------------
    * 4 weeks 1Fri to 4Thu

    * 4 shifts per day: E (1), L (2), D (3), and N (4).  But there are
      only two D shifts each day, so this is basically a three-shift
      system of Early, Late, and Night shifts.

    * 30 Nurses:
  
        Contract-0  Nurse0  - Nurse7
        Contract-1  Nurse8  - Nurse26
        Contract-2  Nurse27 - Nurse29

    * Many day and shift off requests, all soft 1 but challenging.
      I bet this is where the cost is incurred.

    * Complete weekends (soft 2), no night shift before free
      weekend (soft 1), identical shift types during weekend (soft 1),
      unwanted patterns [L][E], [L][D], [D][N], [N][E], [N][D],
      [D][E][D], all soft 1

    * Contract constraints         Contract-0    Contract-1   Contract-2
      ----------------------------------------------------------------
      Assignments                    10-18        6-14          4-8
      Consecutive busy weekends       2-3     unconstrained     2-3
      Consecutive free days           2-4         3-5           4-6
      Consecutive busy days           3-5         2-4           3-4
      ----------------------------------------------------------------

      Workloads are tight, there are only 6 shifts to spare, or 8 if
      you ignore the overloads in Nurse28 and Nurse29, which both
      GOAL and KHE18x8 have, so presumably they are inevitable.
  ------------- Fun facts about INRC1-ML02 --------------------

  ------------- Fun facts about COI-Musa --------------------
  * 2 weeks, one shift per day, 11 nurses (skills RN, LPN, NA)

  * RN nurses:  Nurse1, Nurse2, Nurse3,
    LPN nurses: Nurse4, Nurse5, 
    NA nurses:  Nurse6, Nurse7, Nurse8, Nurse9, Nurse10, Nurse11
  ------------- Fun facts about COI-Musa --------------------

  ------------- Fun facts about COI-HED01 --------------------
    * 31 days, 5 shifts per day: 1=M, 2=D, 3=H, 4=A, 5=N

    * Weekend days are different, they use the H shift.  There
      is also something peculiar about 3Tue, it also uses the
      H shift.  It seems to be being treated like a weekend day.
      This point is reflected in other constraints, which treat
      Week 3 as though it had only four days.

    * All demand expressed by limit resources constraints,
      except for the D shift, which has two tasks subject
      to assign resource and prefer resources constraints.
      The other shifts vary between about 7 and 9 tasks.  But
      my new converter avoids all limit resources constraints.

    * There are 16 "OP" nurses and 4 "Temp" nurses.
      Three nurses have extensive sequences of days off.
      There is one skill, "Skill-0", but it contains the
      same nurses as the OP nurses.

    * The constraints are somewhat peculiar, and need attention
      (e.g. how do they affect combinatorial grouping?)
    
        [D][0][not N]  (Constraint:1)
          After a D, we want a day off and then a night shift (OP only).
	  Only one nurse has a D at any one time, so making this should
	  not be very troublesome.

	[not M][D]  (Constraint:2)
	  Prefer M before D (OP only), always seems to get ignored,
	  even in the best solutions.  This is because during the
	  week that D occurs, we can't have a week full of M's.
	  So really this constraint contradicts the others.

	[DHN][MDHAN]  (Constraint:3)
	  Prefer day off after D, H, or N.  Always seems to be
	  satisfied.  Since H occurs only on weekends, plus 3Tue,
	  each resource can work at most one day of the weekend,
	  and if that day is Sunday, the resource cannot work
	  M or A shifts the following week (since that would
	  require working every day).  Sure enough, in the
	  best solution, when an OP nurse works an H shift on
	  a Sunday, the following week contains N shifts and
	  usually a D shift.  And all of the H shifts assigned
	  to Temp nurses are Sunday or 3Tue ones.

	Constraint:4 says that Temp nurses should take H and
	D shifts only.  It would be better expressed by a
	prefer resources constraint but KHE seems happy
	enough with it.

	Constraint:5 says that assigning any shift at all to
	a Temp nurse is to be penalized.  Again, a prefer
	resources constraint would have been better, but at
	present both KHE and the best solution assign 15 shifts
	to Temp nurses, so that's fine.

	The wanted pattern is {M}{A}{ND}{M}{A}{ND}..., where
	{X} means that X only should occur during a week.
	This is for OP nurses only.  It is expressed rather
	crudely:  if 1 M in Week X, then 4 M in Week X.
	This part of it does not apply to N, however; it says
	"if any A in Week X, then at least one N in Week X+1".
	So during N weeks the resource usually has less than
	4 N shifts, and this is its big chance to take a D.

	OP nurses should take at least one M, exactly one D,
	at least one H, at most 2 H, at least one A, at least
	one N.  These constraints are not onerous.

    * Assign resource and prefer resources constraints specify:

        - There is one D shift per day

    * Limit resources constraints specify 

        Weekdays excluding 3Tue

        - Each N shift must have exactly 2 Skill-0 nurses.

	- Each M shift and each A shift must have exactly 4
	  Skill-0 nurses

	- There are no H shifts

	Weekend days, including 3Tue

	- Each H shift must have at least 2 Skill-0 nurses

	- Each H shift must have exactly 4 nurses altogether

	- There are no M, A, or N shifts on 3Tue

	- There are no M, A, or N shifts on weekend days

    * The new converter is expressing all demands with assign
      resource and prefer resources constraints, as follows:

      D shifts:

        <R>NA=s1000:1</R>
	<R>A=s1000:1</R>

	So one resource, any skill.

      H shifts (weekends and 3Tue):

        <R>NA=s1000+NW0=s1000:1</R>
	<R>NA=s1000+NW0=s1000:2</R>
	<R>NA=s1000:1</R>
	<R>NA=s1000:2</R>
	<R>A=s1000:1</R>

	So 2 Skill-0 and 2 arbitrary, as above

      M and A shifts (weekdays not 3Tue):

        <R>NA=s1000+NW0=s1000:1</R>
	<R>NA=s1000+NW0=s1000:2</R>
	<R>NA=s1000+NW0=s1000:3</R>
	<R>NA=s1000+NW0=s1000:4</R>
	<R>W0=s1000:1</R>
	<R>W0=s1000:2</R>
	<R>W0=s1000:3</R>
	<R>W0=s1000:4</R>
	<R>W0=s1000:5</R>

	So exactly 4 Skill-0, no limits on Temp nurses

      N shifts (weekday example)

        <R>NA=s1000+NW0=s1000:1</R>
	<R>NA=s1000+NW0=s1000:2</R>
	<R>W0=s1000:1</R>
	<R>W0=s1000:2</R>
	<R>W0=s1000:3</R>
	<R>W0=s1000:4</R>
	<R>W0=s1000:5</R>

      Exactly 2 Skill-0, no limits on Temp nurses.
  ------------- Fun facts about COI-HED01 --------------------

  ------------- Fun facts about CQ14-05 --------------------
    * 28 days, 2 shifts per day (E and L), whose demand is:

           1Mon 1Tue 1Wed 1Thu 1Fri 1Sat 1Sun 2Mon 2Tue 2Wed 2Thu
        ---------------------------------------------------------
        E   5    7    5    6    7    6    6    6    6    6    5
        L   4    4    5    4    3    3    4    4    4    6    4
        ---------------------------------------------------------
        Tot 9   11   10   10   10    9   10   10   10   12    9

      Uncovered demands (assign resources defects) make up the
      bulk of the cost (1500 out of 1543).  Most of this (14 out
      of 15) occurs on the weekends.

    * 16 resources named A, B, ... P.  There is a Preferred-L
      resource group containing {C, D, F, G, H, I, J, M, O, P}.
      The resources in its complement, {A, B, E, K, L, N}, are
      not allowed to take late shifts.

    * Max 2 busy weekends (max 3 for for resources K to P)

    * Unwanted pattern [L][E]

    * Max 14 same-shift days (not consecutive).  Not hard to
      ensure given that resource workload limits are 16 - 18.

    * Many day or shift on requests.  These basically don't
      matter because they have low weight and my current best
      solution has about the same number of them as Curtois'

    * Workload limits (all resources) min 7560, max 8640
      All events (both E and L) have workload 480;
      7560 / 480 = 15.7, 8640 / 480 = 18.0, so every resurce
      needs between 16 and 18 shifts.  The Avail column agrees.

    * Min 2 consecutive free days (min 3 for resources K to P)

    * Max 5 consecutive busy days (max 6 for resources K to P)

    * Curtois' best is 1143.  This represents 2 fewer unassigned
      shifts (costing 100 each) and virtually the same other stuff.
  ------------- Fun facts about CQ14-05 --------------------

  ------------- Fun facts about COI-BCDT-Sep --------------------
    * 4 weeks and 2 days, starting on a Wednesday

    * Shifts: 1 V (vacation), 2 M (morning), 3 A (afternoon), 4 N (night).

    * All cover constraints are limit resources constraints.  But they
      are quite strict and hard.  Could they be replaced by assign
      resource constraints?  (Yes, they have been.)

	  Constraint            Shifts               Limit    Cost
	  --------------------------------------------------------
          DemandConstraint:1A   N                    max 4      10
	  DemandConstraint:2A   all A; weekend M     max 4     100
	  DemandConstraint:3A   weekdays M           max 5     100
	  DemandConstraint:4A   all A, N; weekend M  max 5    hard
	  DemandConstraint:5A   weekdays M           max 6    hard
	  DemandConstraint:6A   all A, N; weekend M  min 3    hard
	  DemandConstraint:7A   all N                min 4      10
	  DemandConstraint:8A   all A; weekend M     min 4     100
	  DemandConstraint:9A   weekday M            min 4    hard
	  DemandConstraint:10A  weekday M            min 5     100
	  --------------------------------------------------------

      Weekday M:   min 4 (hard), min 5 (100), max 5 (100), max 6 (hard),
      Weekend M:   min 3 (hard), min 4 (100), max 4 (100), max 5 (hard) 
      All A:       min 3 (hard), min 4 (100), max 4 (100), max 5 (hard)
      All N:       min 3 (hard), min 4 (10),  max 4 (10),  max 5 (hard)

    * There are day and shift off constraints, not onerous

    * Avoid A followed by M

    * Night shifts are to be assigned in blocks of 3, although
      a four block is allowed to avoid fri N and sat free.  There
      are hard constraints requiring at least 2 and at most 4
      night shifts in a row.

    * At least six days between sequences of N shifts; the
      implementation here could be better, possibly.

    * At least two days off after five consecutive shifts

    * At least two days off after night shift

    * Prefer at least two morning shifts before a vacation period and
      at least one night shift afterwards

    * Between 4 and 8 weekend days

    * At least 10 days off

    * 5-7 A (afternoon) shifts, 5-7 N (night) shifts

    * Days shifts (M and A, taken together) in blocks of exactly 3

    * At most 5 working days in a row.
  ------------- Fun facts about COI-BCDT-Sep --------------------
