Hello team,
I would like to print the values of the constraints(disT, cosT, & deaTH) of my model below. I used the following immediate commands, but it is not working. I am using Julia v0.6.4. I shall be grateful for your help. Thanks in advance.
println("Constraint disT \n:", getvalue(disT))
println("Constraint disT \n:", getvalue(cosT))
println("Constraint disT \n:", getvalue(deaTH))
using JuMP, Gurobi
## Define model & parameters:----------#
m = Model(solver = GurobiSolver(IntFeasTol=1e-9,FeasibilityTol=1e-6, TimeLimit=3600, 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
@constraint(m, disT, (value*(sum(dist[i,j]*x[i,j] for i=1:V, j=1:V )-29)/29) <= Q)
end
for (key, value) in w
@constraint(m, cosT, (value*(sum(cost[i,j]*x[i,j] for i=1:V, j=1:V )-277)/277) <= Q)
end
for (key, value) in w
@constraint(m, deaTH, (value*(sum(death[i,j]*x[i,j] for i=1:V, j=1:V )-5)/5) <= Q)
end
##printing model results;
print(m)
status = solve(m)
println("Objective value: ------> ", getobjectivevalue(m))