I am trying to run this code in Julia but I keep getting this error
MethodError: no method matching ^(::QuadExpr, ::Float64)
below is my code: I will be grateful if someone can help me correct this error. Thanks in advance
using JuMP
using Mosek
using MosekTools
model= Model(Mosek.Optimizer)
NumVar=5
#create your variables
@variable(model, x[i=1:NumVar], Bin)
@variable(model, y[i=1:NumVar], Bin)
@variable(model, z[i=1:NumVar], Bin)
@variable(model, r[i=1:NumVar], Bin)
@variable(model, a[i=1:NumVar], Bin)
@variable(model, b[i=1:NumVar], Bin)
@variable(model, X>=0)
@variable(model, Y>=0)
@variable(model, R>=0)
#Define your constraints
for i in 1:NumVar
@constraint(model, x[i] + X == a[i])
@constraint(model, y[i] + Y == b[i])
@constraint(model, z[i] + r[i] == R)
@constraint(model, z[i] >= (x[i]^2 + y[i]^2)^0.5)
end
#Specify Objective function
@objective(model, Min,R)
#Summary
@show model
print(model)
optimize!(model)
@show termination_status(model)
@show primal_status(model)
@show dual_status(model)
@show objective_value(model)
for i in 1:NumVar
println("x[$i] = ", value(x[i]))
println("y[$i] = ", value(y[i]))
println("z[$i] = ", value(z[i]))
end
@show value(X)
@show value(Y)