I’m trying to compute the best parameters of a surface using JuMP, a very basic example is:
# variables
x = linspace(1,4,100);
y = linspace(1,4,100);
# surface
U = [10 - x[i].^2 + y[j].^-2 for i=1:100, j=1:100]
# test surface
p = [10 -1.0 2.0 1.0 -2.0] + rand(1,5)
Umin = [p[1] + p[2]*x[i].^p[3] + p[4]*y[j].^p[5] for i=1:100, j=1:100] ;
# fitness parameter
minimizeit = sum(sum(abs.(U.-Umin)))
My goal is to write a code to compute all values of p - even the exponents. I’ve tried JuMP
m = Model(solver=CbcSolver())
@defVar(m, Inf <= p1 <= Inf)
@defVar(m, Inf <= p2 <= Inf)
@defVar(m, 0 <= p3 <= 3)
@defVar(m, Inf <= p4 <= Inf)
@defVar(m, -3 <= p5 <= 0)
@setObjective(m, Min, begin
Umin = [p1 + p2*x[i].^p3 + p4*y[j].^p5 for i=1:100, j=1:100] ;
return minimizeit = sum(sum(abs.(U.-Umin)))
end
)
I get a message:MethodError: no method matching ^(::Float64, ::JuMP;Variable)
How can I handle this issue ?
Thank you