Hi odow,
I followed the instructions like you recommended, and also read the documentation at -Query Solutions · JuMP - but I still keep getting errors when I try to print/access the values of the constraints of my model. At this point, I am unsure what I am doing wrong. I shall, therefore, very much appreciate your help with this task. Below is an abridged version of my working model.
Thanks in advance.
NB: I also upgraded to Julia v1.4.1
using JuMP, Gurobi
## Define model Object & Parameters:----------#
m = Model(optimizer_with_attributes(Gurobi.Optimizer, "FeasibilityTol"=>1e-6, "MIPGap"=>3e-4, "IntFeasTol"=>1e-9, "TimeLimit"=>18000, "IterationLimit"=>500))
V = 5
dist =
[999 8 4 9 9
8 999 6 7 10
4 6 999 5 6
9 7 5 999 4
9 10 6 4 999]
cost =
[999 58 59 55 56
57 999 54 60 54
59 59 999 57 57
58 56 56 999 60
55 58 54 57 999]
death =
[9 1 1 1 1
1 9 1 1 1
1 1 9 1 1
1 1 1 9 1
1 1 1 1 9]
## define Variables:------------#
@variable(m, x[i=1:V,j=1:V], Bin) #decision binary variable
@variable(m, 0.0<=Q<=1.0) #mini_max variable
#3 Assign weights:________________________________#
w = Pair{Tuple{Int64,Int64},Float64}[]
for i=1:V, j=1:V
push!( w , (i,j) => i != j ? 0.3 : 0.7)
end
## define Objective function:---------------#
@objective(m, Min, Q) #variable for the min_max weighted percentage deviation from the target values for the goals.
### MOLP/MOMP/Goal/target:________________________________#
for (key, value) in w
@constraints(m, begin
(DIST=value*(sum(dist[i,j]*x[i,j] for i=1:V, j=1:V )-29)/29) <= Q
(COST=value*(sum(cost[i,j]*x[i,j] for i=1:V, j=1:V )-277)/277) <= Q
(DEATH=value*(sum(death[i,j]*x[i,j] for i=1:V, j=1:V )-5)/5) <= Q
end)
end
##printing model results;
print(m)
status = JuMP.optimize!(m)
println("Objective value: ------> ", JuMP.objective_value(m))