Skip to content

Commit

Permalink
add documentation for johnson's rule
Browse files Browse the repository at this point in the history
  • Loading branch information
jbytecode committed May 17, 2024
1 parent dd566d6 commit 54150a0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/johnsons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module Johnsons

export JohnsonResult, johnsons

# TODO: Add makespan calculation

struct JohnsonResult
permutation::Vector{Int}
# makespan::Float64
Expand All @@ -10,7 +12,19 @@ end
"""
johnsons(times::Matrix)
Given a matrix of times, returns a JohnsonResult with the permutation of the jobs
Given a matrix of times, returns a JohnsonResult with the permutation of the jobs.
If number of machines is 2, it uses the Johnson's algorithm for 2 machines.
If number of machines is greater than 2, it uses the Johnson's algorithm by transforming the
problem into a 2-machine problem.
In order to reduce the original problem to a 2-machine problem, the algorithm checks if the minimum time
of the first machine is greater or equal than the maximum time of the other machines and/or if the minimum time of the
last machine is greater or equal than the maximum time of the other machines.
For example if we have 4 machines, namely, A, B, C, and D
at least one of the following conditions must be satisfied:
- min(A) >= max(B, C)
- min(D) >= max(B, C)
# Arguments
Expand Down

0 comments on commit 54150a0

Please sign in to comment.