Chapter 4. Create the data model for the employee rostering project
Use this section to create the data objects required to run the employee rostering sample project in Decision Central.
Prerequisite
You have completed the project set up described in Chapter 2, Set up the employee rostering sample project.
Procedure
- With your new project, either click Data Object in the project perspective, or click Create New Asset → Data Object to create a new data object.
Name the first data object
Timeslot, and selectemployeerostering.employeerosteringas the Package.Click Ok.
-
In the Data Objects perspective, click +add field to add fields to the
Timeslotdata object. -
In the id field, type
endTime. -
Click the drop-down menu next to Type and select
LocalDateTime. - Click Create and continue to add another field.
-
Add another field with the id
startTimeand TypeLocalDateTime. - Click Create.
-
Click Save in the upper-right corner to save the
Timeslotdata object. - Click the x in the upper-right corner to close the Data Objects perspective and return to the Assets menu.
Using the previous steps, create the following data objects and their attributes:
Table 4.1. Skill
id Type nameStringTable 4.2. Employee
id Type nameStringskillsemployeerostering.employeerostering.Skill[List]Table 4.3. Shift
id Type requiredSkillemployeerostering.employeerostering.Skilltimeslotemployeerostering.employeerostering.TimeslotTable 4.4. DayOffRequest
id Type dateLocalDateemployeeemployeerostering.employeerostering.EmployeeTable 4.5. ShiftAssignment
id Type employeeemployeerostering.employeerostering.Employeeshiftemployeerostering.employeerostering.Shift
For more information about creating data objects, see Getting started with decision services.
4.1. Create the employee roster planning entity
In order to solve the employee rostering planning problem, you must create a planning entity and a solver. The planning entity is defined in the domain designer using the attributes available in the Red Hat Business Optimizer dock.
Use the following procedure to define the ShiftAssignment data object as the planning entity for the employee rostering example.
Prerequisite
- You have created the relevant data objects and planning entity required to run the employee rostering example by completing the procedures in Chapter 4, Create the data model for the employee rostering project.
Procedure
-
From the project Assets menu, open the
ShiftAssignmentdata object. -
In the Data Objects perspective, open the Red Hat Business Optimizer dock by clicking the
on the right.
- Select Planning Entity.
-
Select
employeefrom the list of fields under theShiftAssignmentdata object. In the Red Hat Business Optimizer dock, select Planning Variable.
In the Value Range Id input field, type
employeeRange. This adds the@ValueRangeProviderannotation to the planning entity, which you can view by clicking theSourcetab in the designer.The value range of a planning variable is defined with the
@ValueRangeProviderannotation. A@ValueRangeProviderannotation always has a propertyid, which is referenced by the@PlanningVariablepropertyvalueRangeProviderRefs.- Close the dock and click Save to save the data object.
4.2. Create the employee roster planning solution
The employee roster problem relies on a defined planning solution. The planning solution is defined in the domain designer using the attributes available in the Red Hat Business Optimizer dock.
Prerequisite
- You have created the relevant data objects and planning entity required to run the employee rostering example by completing the procedures in Chapter 4, Create the data model for the employee rostering project and Section 4.1, “Create the employee roster planning entity”.
Procedure
-
Create a new data object with the identifier
EmployeeRoster. Create the following fields:
Table 4.6. EmployeeRoster
id Type dayOffRequestListemployeerostering.employeerostering.DayOffRequest[List]shiftAssignmentListemployeerostering.employeerostering.ShiftAssignment[List]shiftListemployeerostering.employeerostering.Shift[List]skillListemployeerostering.employeerostering.Skill[List]timeslotListemployeerostering.employeerostering.Timeslot[List]-
In the Data Objects perspective, open the Red Hat Business Optimizer dock by clicking the
on the right.
- Select Planing Solution.
-
Leave the default
Hard soft scoreas the Solution Score Type. This automatically generates ascorefield in theEmployeeRosterdata object with the solution score as the type. Add a new field with the following attributes:
id Type employeeListemployeerostering.employeerostering.Employee[List]With the
employeeListfield selected, open the Red Hat Business Optimizer dock and select the Planning Value Range Provider box.In the id field, type
employeeRange. Close the dock.- Click Save in the upper-right corner to save the asset.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.