Skip to content

Slot values

supix edited this page Apr 30, 2017 · 3 revisions

Slots have a default value equal to 1. This means that, by default, all slots give the same contribution to the overall score when they happen to be busy. Anyway, in the real world, not all slots have the same importance.

For example, in the sample workshift we have 5 mornings, 5 afternoons and 4 nights. Most likely, it is not a big issue should one of the five mornings remain empty. Conversely, it is a bigger problem if one of the four nights remains empty: nights are just four, and it is important that they are all filled.

In this case SlotValue is the right guy. Let's see the following example.

  var problem = ProblemBuilder.Configure()
    ...
    .AssigningValue(5).ToSlots().From(10).To(13)
    ...

Night slots have a value of 5, thus giving an higher contribution to the overall score when filled. A possible solution is the following.

Fitness: 0,957514226436615
Evaluated solutions: 321200
 9,  1, 10,  3,  -,  0,  2,  9, 10,  5,  -,  -, 11,  8,  5,  6, 13,  -,  -,  4,  3, 12,  0,  1,  -,  -,  1,  7, 12,  5
 -,  9,  7,  6,  2, 11,  -,  -, 11,  0,  5, 10,  1,  -,  -,  4, 10,  0,  3, 13,  -,  -,  9,  6,  1,  2, 12,  -,  -, 13
 -,  4,  1,  0,  9, 10,  -,  -,  9, 11,  2,  5, 10,  -,  -, 13,  8,  3,  5,  7,  -,  -, 12,  4, 11,  1,  0,  -,  -,  8
 -,  5,  6,  9, 12,  -,  7,  3,  0,  1, 13,  -,  -, 13,  4,  8, 11, 10,  -,  -, 10,  2,  1,  7,  5,  -,  -,  2,  8,  6
11, 11,  5, 12,  1,  -,  -,  6,  4, 12,  9,  1,  -,  -,  2, 10,  0, 13,  2,  -,  -,  3,  5,  8, 13, 10,  -,  -,  6,  7
 -, 10, 11, 13,  -,  1,  6, 13,  7,  4,  -,  -, 12, 12,  3, 11,  2,  -,  -, 10,  5,  7,  8,  0,  -,  -,  3,  9,  0,  4
 1,  7,  4, 10, 11,  -,  -,  7,  3, 13, 12, 13,  -,  -,  8,  2,  3, 11,  0,  -,  -,  4,  6, 10,  9,  0,  -,  -, 13,  2
 3, 12,  -,  1,  7,  8, 11,  0,  -,  -, 10,  0, 13, 11,  9,  -,  -, 12,  7,  8, 12,  6,  -,  -,  2,  9,  5, 13,  1,  -
 4,  0,  -,  4, 13,  3, 10,  5,  -,  -,  0,  7,  9,  0, 11,  -,  -,  8, 12,  6,  6,  5,  -,  -, 12, 13, 10,  3, 10,  -
 8, 13,  9,  -,  0,  5, 12, 11,  1,  -,  -,  3,  6,  6,  7,  5,  -,  -, 10,  3,  9,  0,  7,  -,  -, 11,  7,  8,  2,  9
 5,  6,  -,  7,  4,  6,  8,  8,  -,  -,  4,  2,  7,  3, 13,  -,  -,  9,  9,  0, 11, 13,  -,  -,  6, 12,  2, 12,  9,  -
 0,  -,  8,  2,  -,  7,  1, 12,  2,  3,  -,  -,  8,  9,  0,  0,  6,  -,  -,  5,  4,  9,  2, 12,  -,  -, 13, 11, 11, 10
12,  -,  2,  -,  5, 13,  9,  4, 13,  -,  -,  9,  3, 10, 12,  3,  -,  -,  1,  2,  8, 11, 10,  -,  -,  7,  6,  5,  7,  0
 2,  8, 12,  -,  -,  4,  3, 10,  8, 10,  -,  -,  2,  7,  1,  9,  4,  -,  -,  9, 13,  1, 11,  3,  -,  -, 11,  0,  3, 11
 6,  -, 13, 11, 10, 12,  4,  -,  -,  2,  3, 12,  0,  1,  -,  -,  9,  2,  8,  1,  0,  -,  -,  5,  4,  4,  4, 10,  -,  -
 7,  2,  3,  8,  8,  -,  -,  2,  5,  9, 11, 11,  -,  -,  6, 12,  1,  1,  6,  -,  -, 10,  3, 13, 10,  5,  -,  -,  4, 12
13,  3,  -,  5,  3,  2,  0,  -,  6,  7,  7,  6,  4,  -,  -,  1, 12,  4, 13, 11,  -,  -,  4, 11,  0,  6,  8,  -,  -,  1
10,  -,  0,  -,  6,  9, 13,  1, 12,  -,  -,  4,  5,  4, 10,  7,  -,  -, 11, 12,  2,  8, 13,  -,  -,  3,  9,  1,  5,  3

All the days, no one of the four night slots (10-13) remains empty, at the expense of other shifts which are worse filled.

Clone this wiki locally