I am trying to use minimum on a Julia Contraint but I get the following Method Error. I am 100% using the minimum() function is what causes the trouble. Any ideas on a work around?
LoadError: MethodError: no method matching isless(::GenericAffExpr{Float64,VariableRef}, ::GenericAffExpr{Float64,VariableRef})
for n = 1:numNeighborhoods
@constraint(eModel, minimum(travelTimeMatrix[n,:].*openedRooms[:]) >= maxTravelTime[n])
end
The general idea is that at least one element of an array should be less than that max.
Thanks in advance
More complete snip of code:
using JuMP, Cbc, CSV
file = "Emergency.csv"
data_import = CSV.read(file, header=true)
travelTimeMatrix = Matrix{Int}(data_import[1:10,2:13])
maxTravelTime = Array{Int}(data_import[1:10,14])
emergencyRoomCost = Array{Int}(data_import[11,2:13])
numNeighborhoods = size(maxTravelTime,1)
numEmergencyRooms = size(emergencyRoomCost,1)
eModel = Model(Cbc.Optimizer)
@variable(eModel, openedRooms[1:numEmergencyRooms], binary=true)
@objective(eModel, Min, sum(openedRooms.*emergencyRoomCost))
for n = 1:numNeighborhoods
@constraint(eModel, minimum(travelTimeMatrix[n,:].*openedRooms[:]) >= maxTravelTime[n])
end
stats = JuMP.optimize!(eModel)
result = JuMP.value.(openedRooms)
println(data_import)
println(result)