Schedules

Schedules

A schedule (in the sense of Scheduling.jl package) consists of three parts:

mutable struct Schedule
    jobs::Vector{Job}
    machines::Vector{Machine}
    assignments::Vector{JobAssignment}
end

Creating a schedule

A schedule can be created easily by assigning vectors of jobs, machines, and assignments to a structure of Schedule type.

julia> M = Machines()
A set of 0 machine(s):

julia> push!(M, Machine("M"))
A set of 1 machine(s):
    Machine M
Note

When creating a schedule, take the following guidelines into account:

  • It is highly recommended, for further compatibility purposes, that any job reference in the assignments vector is also stored in the jobs vector. The same rule applies to machines.
  • The machines vector is used when a plotting/exporting function is called. If there exists an assignment of a job to a machine, such that the reference to the machine is not stored in the machines vector, then the behavior of the plotting/exporting function may be unexpected.

Plotting/exporting a schedule

A schedule can be plotted (using PyPlot) or exported (as a $\TeX$ file).

Scheduling.plotMethod.
plot(S::Schedule;
     animate = false, sizex = 800, sizey = 500,
     output_file::String = "Schedule.gif", fps = 1)

Plots a schedule. The optional arguments are taken into account if animate is set to true. Then, a gif file is generated.

Examples

julia> Scheduling.plot(S)
julia> Scheduling.plot(S, animate = true)
source
Scheduling.TeXFunction.
TeX(S::Schedule, output_file::String = "Schedule.tex"; compile = false)

Generates a TeX file with a tikz representation of a schedule. An optional parameter compile determines whether the output file should be automatically compiled using pdflatex. If the output_file exists, then it will be replaced without any prompt. All the intermediate directories will be created if needed.

Examples

julia> Scheduling.TeX(S, "/absolute/path/to/the/file.tex")
julia> Scheduling.TeX(S, "../relative/path/to/the/file.tex", compile = true)
source
Note

If you generate a schedule for parallel jobs, then keep in mind that at the moment the plot function assumes that the machines are consecutive and that they are listed in the increasing order.

Saving/loading a schedule

A Schedule structure can be easily saved to a file and then loaded back. The Scheduling package uses the HDF5 binary files to store structures.

Scheduling.saveFunction.
save(S::Schedule, output_file::String = "Schedule.jld")

Saves a schedule to a file so it can be reloaded later.

source
Scheduling.loadFunction.
load(input_file::String = "Schedule.jld")

Loads a schedule from a file. Return a reference to a loaded schedule.

source