Help interpreting an error with exponentials using JuMP variables

Any help would be appreciated with this problem:

using NLopt
using JuMP

m=Model(solver=NLoptSolver(algorithm=:DIRECT))

R_=diagm([R0,R1])
R=flipdim(R_,2)
Q=diagm([Q0,Q1])

T=kron(Q,Diagonal(ones(2)))+kron(Diagonal(ones(2)),conj(Q))+kron(R,conj(R))


@variable(m,R0)
@variable(m,R1)
@variable(m,Q0)
@variable(m,Q1)

W=e^(T)


@NLobjective(m,Min,W)

status=solve(m)

Error:

MethodError: no method matching ^(::Irrational{:e}, ::Array{JuMP.GenericQuadExpr{Float64,JuMP.Variable},2})
Closest candidates are:
  ^(::Irrational{:e}, ::Irrational) at irrationals.jl:219
  ^(::Irrational{:e}, ::Rational) at irrationals.jl:219
  ^(::Irrational{:e}, ::Integer) at irrationals.jl:219

I have omitted some details and shortened functions for privacy but I could include more if necessary.

Does it help to use exp(T) ?

Unfortunately it doesn’t, it seems julia doesn’t want to take the exponential of my JuMP array, is that a usual problem? I will try to fix other parts of my code and come back to this. Thank you.

Your code seems to be out of order (the @variable statements should come before R, Q and T).

What are you trying to do? T is a 4x4 matrix. Its exponential (be it elementwise or a matrix exponential) is a 4x4 matrix, so how can that be the objective of an optimization?

1 Like

Sorry, I just didn’t include the full expression of the objective to try to minimize the code. I have fixed the order of the @variable statements. I have another thread where I have posted my updated code with a new problem help-creating-a-jump-variable-array So I won’t repost it here to reduce redundancy, however I can eventually post my full minimization expression if my problems aren’t worked out my other post. Thank you for your help!