2.2 Planning Optimiser Input
This section describes the input to the planning optimiser. The planning optimiser has two modes of operation:
- Plan: construct a new schedule of job-crew assignments of a given planning period (e.g. one week, three months etc.)
- Replan: reschedule planned jobs within an existing schedule.
There is some overlap between these two modes of operation. Both modes of operation use the same input format, which takes the form of a plan request object.
2.2.1 Plan Request Object
The input to the planning optimiser is a plan request object. It has the following fields:
- id: an identifier assigned by the client that identifies this invocation of the optimiser.
- name: a string naming this instance; may be empty or null.
- time_zone: a string giving the time zone.
- start_date: the date of the first day of the planning period.
- finish_date: the date of the last day he planning period.
- next_day: a date identifying the next day from which rescheduling is to occur. This date must be inside the start and finish dates defined in the start_date field and finish_date field respectively. For the “plan” mode of operation this field must be null.
- crews: a non-empty array of plan crew objects that describes crews and their availability.
- jobs: a non-empty array of plan job objects that describes planned jobs.
- assignments: an array of plan request assignment objects that describes any existing assignments of planned jobs to crews; may be null or empty if there are no existing assignments.
- precedences: an array of plan request precedence objects that describes rules about the minimum and / or maximum time between jobs; may be null or empty if there are no existing precedences.
2.2.2 Plan Crew Object
A plan crew object describes a single crew. It has the following fields:
- id: the unique identifier for the crew.
- name: a string giving a descriptive label for the crew; may be null.
- roster: an array of plan shift objects, giving the rostered shifts for the crew.
- start_location: the default location where the crew begins their shift; must not be null.
- finish_location: the default location at where the crew should end their shift; may be null if the crew is considered to finish their shift at the completion of their last job.
- is_subcontractor: a Boolean, if true the crew are subcontractors.
- allowed_overtime: a Boolean, if true the crew are allowed overtime.
- visit_segment_fixed_penalty: a number giving the value of the visit segment fixed penalty for this crew.
- visit_segment_distance_penalty: a number giving the value of the visit segment distance penalty for this crew.
2.2.3 Plan Shift Object
A plan shift object describes a shift in a crew’s roster. It has the following fields:
- start_time: the rostered shift start date-time of the crew; this must not be null.
- finish_time: the rostered shift finish date-time of the crew; this must not be null.
- start_location: the location where the crew begins their shift. If present, this overrides the default start location for this shift.
- finish_location: the location at where the crew should end their shift. If present, this overrides the default finish location for this shift.
2.2.4 Visit Segment Penalties
Visit segment penalties are used to affect the “shape” of a crew’s route. A segment is defined as the transit between two distinct locations at which jobs occur. Transit to and from the crew’s start or finish location (if defined) is not considered a segment.
There are two types of visit segment penalty:
- visit segment fixed penalty: applied for each segment in a crew’s route. A positive value for this penalty will have the effect of minimising the number of locations that a crew visits.
- visit segment distance penalty: a factor that is multiplied by the transit distance in each segment in crew’s route. A positive value for this penalty will have the effect of minimising the distance travelled between jobs, resulting in the jobs being clustered within “close” proximity to each other.
2.2.5 Plan Job Object
An plan job object describes a single planned job. It has the following fields:
- id: the unique identifier for the job.
- name: a string giving a descriptive label for the job; may be null.
- location: the location of the job; must not be null.
- allowed_crews: an array of allowed crew objects listing the crews capable of undertaking the job. May be null or empty if no crews is capable of undertaking the job. Crews present in this array must be present in the plan crew object array.
- required_equipment: an array of non-null and non-empty strings listing additional equipment that is required to complete the job; the array itself may be empty or null which indicates that no additional equipment is required.
- time_windows: an array of date-time windows, specifying when the job can be undertaken; may be null or empty in which case where there are no restrictions on when the job may be done. Any part of a time window that falls outside the planning period will be discarded.
2.2.6 Plan Request Assignment Object
An plan request assignment object describes the allocation of an job to a crew. It has the following fields:
- crew_id: the unique identifier of the crew.
- job_id: the unique identifier of the job.
- start_time: the date-time at which the job is scheduled to commence.
- finish_time: the date-time at which the job is scheduled to complete.
- flex: a number between 0 and 1 (inclusive), which is a measure of how much the optimiser may change the date of an assigned job. A value of 0 means that the job must be assigned on the date given by the start_time field; a value of 1 means the optimiser is completely free to reschedule the job; values between 0 and 1 control how close to the originally assigned date the job can be rescheduled.
2.2.7 Plan Request Precedences
An plan request precedence object describes a time constraint between two jobs. A precedence constrain can specify a minimum and maximum duration between jobs. These durations occur between the completion of the first job and the start of the second.
It has the following fields:
- before: the unique identifier of the first job.
- after: the unique identifier of the second job.
- minimum_gap: the minimum duration between the before and after jobs.
- maximum_gap: the maximum duration between the before and after jobs.
- same_crew: a Boolean, if true then both jobs must be assigned to the same crew.

