Machines

Machines

Another basic structure provided by the Scheduling.jl package is a Machine.

Creating a single machine

In order to create a machine, you may use the Machine constructor. Is is required to pass a machine name to the constructor, but all the other parameters are optional.

julia> Machine("M")
Machine M

Machine parameters can be set when the machine is created. However, as Machine is an immutable struct, you are not able to change any of the parameters of an existing job. The structure of the Machine struct is as follows:

struct Machine
    name::String
    params::MachineParams
end

while the default params are generated based on the following struct.

struct ClassicalMachineParams <: MachineParams
    s::Rational{UInt}   # speed (default: 1)
end

Creating a set of machines

You are provided a few functions that can generate a vector of jobs. A vector of jobs is the basic structure any scheduling algorithm works on. You can create an empty vector of jobs, a vector of a given number of identical jobs or a vector of jobs with arbitrary processing times.

Machines()

Generates an empty vector of Machine{ClassicalMachineParams} elements.

Example

julia> Machines()
A set of 0 machine(s):
source
Machines(m::Int)

Generates a set of m identical parallel machines, denoted by P_1, P_2, etc.

Example

julia> Machines(4)
A set of 4 machine(s):
    Machine P_1
    Machine P_2
    Machine P_3
    Machine P_4
source
Machines(S::Array{Rational{Int}, 1})

Generates a set of machines with speeds determined by the S array, denoted by Q_1, Q_2, etc.

Example

julia> Machines([1, 1//2, 2])
A set of 3 machine(s):
    Machine Q_1
    Machine Q_2:     [s = 1//2]
    Machine Q_3:     [s = 2]
source
Machines(S::Array{Int, 1})

Generates a set of machines with speeds determined by the S array, denoted by Q_1, Q_2, etc.

Example

julia> Machines([1, 3, 2])
A set of 3 machine(s):
    Machine Q_1
    Machine Q_2:     [s = 3]
    Machine Q_3:     [s = 2]
source

As the set of machines is a vector of Machine elements, you may always extend it by a new one.

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

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