ShiftSolver solution data

XML format for ShiftSolver solutions

This document describes the data format used for ShiftSolver solutions. After the rostering engine has solved the problem it returns the solution as XML. The XML schema is available here.

A solution XML file can also be opened using RosterViewer if a <ProblemFile> tag is added after the opening <Solution> tag. The ProblemFile is the path to the problem instance XML that this solution was generated from. The path can be absolute or relative to the solution file. For example:

<?xml version="1.0" encoding="UTF-8"?>
<Solution>

  <ProblemFile>..\..\ShiftSolverExample-1.xml</ProblemFile>
  
  <Employee ID="E1">...

</Solution>

The root element (opening tag) of the XML is <Solution>.

<Solution>

The root element of the document.

Attributes

None

Elements

Solution contains zero or more <Employee> elements.

Name Required Type Description
<Employee> Optional Employee Contains the assignments in the solution for an employee.

Example

<?xml version="1.0" encoding="UTF-8"?>
<Solution xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="Solution.xsd">
  <Employee ID="E1">
    <Shift>
      <Day>0</Day>
      <Start>09:00:00</Start>
      <Task WorkLength="210">
        <ID>Task1</ID>
        <Length>210</Length>
      </Task>
      <Task WorkLength="15">
        <ID>$b</ID>
        <Length>15</Length>
      </Task>
      <Task WorkLength="105">
        <ID>Task2</ID>
        <Length>105</Length>
      </Task>
    </Shift>
    <Shift>
      <Day>1</Day>
      <Start>09:00:00</Start>
      <Task WorkLength="210">
        <ID>Task3</ID>
        <Length>210</Length>
      </Task>
      <Task WorkLength="15">
        <ID>$b</ID>
        <Length>30</Length>
      </Task>
      <Task WorkLength="240">
        <ID>Task3</ID>
        <Length>240</Length>
      </Task>
    </Shift>
    <Shift>
      <Day>2</Day>
      <Start>09:00:00</Start>
      <Task WorkLength="210">
        <ID>Task2</ID>
        <Length>210</Length>
      </Task>
      <Task WorkLength="30">
        <ID>$b</ID>
        <Length>30</Length>
      </Task>
      <Task WorkLength="240">
        <ID>Task1</ID>
        <Length>240</Length>
      </Task>
    </Shift>
    <Shift>
      <Day>3</Day>
      <Start>09:00:00</Start>
      <Task WorkLength="210">
        <ID>Task1</ID>
        <Length>210</Length>
      </Task>
      <Task WorkLength="15">
        <ID>$b</ID>
        <Length>30</Length>
      </Task>
      <Task WorkLength="240">
        <ID>Task1</ID>
        <Length>240</Length>
      </Task>
    </Shift>
  </Employee>
  <Employee ID="E2">
    <Shift>
      <Day>1</Day>
      <Start>18:00:00</Start>
      <Task WorkLength="75">
        <ID>Task2</ID>
        <Length>75</Length>
      </Task>
      <Task WorkLength="30">
        <ID>$b</ID>
        <Length>30</Length>
      </Task>
      <Task WorkLength="255">
        <ID>Task2</ID>
        <Length>255</Length>
      </Task>
    </Shift>
    <Shift>
      <Day>5</Day>
      <Start>20:00:00</Start>
      <Task WorkLength="195">
        <ID>Task2</ID>
        <Length>195</Length>
      </Task>
    </Shift>
  </Employee>
</Solution>

<Employee>

Contains the assignments in the solution for an employee.

Parents : Solution

Attributes

Name Required Type Description
ID Required string The ID of this employee (defined in the problem instance).

Elements

Employee contains zero or more <Shift> elements.

Name Required Type Description
<Shift> Optional Shift A shift assignment.

Example

<Employee ID="E1">
  <Shift>
    <Day>0</Day>
    <Start>09:00:00</Start>
    <Task WorkLength="210">
      <ID>Task1</ID>
      <Length>210</Length>
    </Task>
    <Task WorkLength="15">
      <ID>$b</ID>
      <Length>15</Length>
    </Task>
    <Task WorkLength="105">
      <ID>Task2</ID>
      <Length>105</Length>
    </Task>
  </Shift>
  <Shift>
    <Day>1</Day>
    <Start>09:00:00</Start>
    <Task WorkLength="210">
      <ID>Task3</ID>
      <Length>210</Length>
    </Task>
    <Task WorkLength="15">
      <ID>$b</ID>
      <Length>30</Length>
    </Task>
    <Task WorkLength="240">
      <ID>Task3</ID>
      <Length>240</Length>
    </Task>
  </Shift>
  <Shift>
    <Day>2</Day>
    <Start>09:00:00</Start>
    <Task WorkLength="210">
      <ID>Task2</ID>
      <Length>210</Length>
    </Task>
    <Task WorkLength="30">
      <ID>$b</ID>
      <Length>30</Length>
    </Task>
    <Task WorkLength="240">
      <ID>Task1</ID>
      <Length>240</Length>
    </Task>
  </Shift>
  <Shift>
    <Day>3</Day>
    <Start>09:00:00</Start>
    <Task WorkLength="210">
      <ID>Task1</ID>
      <Length>210</Length>
    </Task>
    <Task WorkLength="15">
      <ID>$b</ID>
      <Length>30</Length>
    </Task>
    <Task WorkLength="240">
      <ID>Task1</ID>
      <Length>240</Length>
    </Task>
  </Shift>
</Employee>

<Shift>

Shift contains a day indicating the day it starts on, a start time and then lists in order each task (and break) assigned within the shift.

Parents : Employee

Attributes

Name Required Type Description Ver.
ExternalID Optional string If the shift is a FixedAssignment and in the problem instance XML the shift has an ExternalID attribute then this attribute will be present here and will have the same value. If the shift is not a FixedAssignment or the ExternalID attribute is not used in the problem instance XML then this attribute will not be present. 1.33+
BreakDefID Optional string If the shift contains breaks and the BreakDefinition used to assign the breaks has an ID attribute then this attribute will be present here and will have the same value. If the shift does not contain breaks or the ID attribute for the BreakDefinition is not used in the problem instance XML then this attribute will not be present.
If the shift is a split-shift then the value is a comma separated list of the BreakDefinition IDs for each shift.
1.51+

Elements

Shift contains a <Day> element followed by a <Start> element followed by one or more <Task> elements.

Name Required Type Description
<Day> Required NonNegativeInteger The day in the planning period the shift starts on (the first day in the planning period is day zero).
<Start> Required time The time the shift starts. Specified in the format : hh:mm:ss.
<Task> Required Task Task contains a task ID and a duration to indicate the amount of time assigned on that task before switching to the next task or break.

Example

<Shift>
  <Day>0</Day>
  <Start>07:30:00</Start>
  <Task WorkLength="150">
    <ID>T1</ID>
    <Length>150</Length>
  </Task>
  <Task WorkLength="30">
    <ID>$b</ID>
    <Length>30</Length>
  </Task>
  <Task WorkLength="120">
    <ID>T1</ID>
    <Length>120</Length>
  </Task>
  <Task WorkLength="30">
    <ID>$b</ID>
    <Length>30</Length>
  </Task>
  <Task WorkLength="210">
    <ID>T1</ID>
    <Length>210</Length>
  </Task>
</Shift>

<Task>

Task contains a task ID and a duration to indicate the amount of time assigned on that task before switching to the next task or break.

Parents : Shift

Attributes

Name Required Type Description Ver.
WorkLength Required NonNegativeDouble The amount of time (in minutes) this task is counted as work. This may not be the same as the Length (i.e. the difference between the start and finish time) if for example it is a break which is not counted as work (see the WorkLength tag in the Breaks documentation). 1.0+
preDependentTaskID Optional string If the DependentTasks constraint is used then this attribute is included and it provides the ID of the dependent task before this task. 1.67+
preDependentTaskLength Optional NonNegativeDouble The duration in minutes of the dependent task before this task. 1.67+
postDependentTaskID Optional string If the DependentTasks constraint is used then this attribute is included and it provides the ID of the dependent task after this task. 1.67+
postDependentTaskLength Optional NonNegativeDouble The duration in minutes of the dependent task after this task. 1.67+

Elements

Task contains an <ID> element followed by a <Length> element.

Name Required Type Description
<ID> Required string The task ID (defined in the problem instance).

For breaks the ID is '$b'.

If it it is a duration without a task (for example in split-shift) the value is '-' (hyphen).
<Length> Required NonNegativeDouble The time in minutes for this task.

Example

<Task WorkLength="150">
  <ID>T1</ID>
  <Length>150</Length>
</Task>

NonNegativeDouble

NonNegativeDouble is a number greater than or equal to zero which may also be fractional. That is, it can have a decimal component. For example 0, 1, 1.333, 1.5, 10.25, 1000 are all valid values.

NonNegativeInteger

NonNegativeInteger is a whole number greater than or equal to zero (e.g. 0,1,2,..).