I’ve implemented the evaluation and printing function here.
function print_tasks(x::Array{Int,3})
for round in axes(x)[3]
println("round ",round)
for task in axes(x)[2]
print("Task ",task,": ")
println(join(x[:,task,round]," "))
end
end
end
function evaluation(x::Array{Int,3})
occupied = falses(size(x)[2]*size(x)[1],size(x)[3])
for round in axes(x)[3], task in axes(x)[2], person in x[:,task,round]
occupied[person,task] = true
end
if !all(occupied)
return -1
end
A = Set{Tuple{Int,Int}}()
for round in axes(x)[3]
for task in axes(x)[2]
Tmp = x[:,task,round]
for i in axes(x)[1], j in axes(x)[1]
if Tmp[i]!=Tmp[j]
push!(A,(Tmp[i],Tmp[j]))
end
end
end
end
return length(A)÷2
end