I have the following simple code snippet which is causing me issues:
function find_common_lyapunov(system::PiecewiseLinearSystem, gamma::Float64)
@assert(gamma > 0.0)
dim = system_dim(system)
model = Model(Mosek.Optimizer)
@variable(model, P[1:dim, 1:dim], PSD)
@SDconstraint(model, P >= I)
@show(length(system.matrices))
for Ai in system.matrices
@show(Ai)
@SDconstraint(model, Ai' * P + P * Ai + gamma * P <= 0)
end
@objective(model, Min, sum(P .^ 2))
optimize!(model)
status = termination_status(model)
if status != MOI.OPTIMAL
println("TERMINATION WAS NOT OPTIMAL: $status")
return nothing
end
value.(P)
end
When I run this, I get the following:
julia> P_star = find_common_lyapunov(system, 1e-3)
length(system.matrices) = 4
Ai = [-0.3216088732749837 0.2456225325321437 0.0 0.0 0.0 0.0 0.0 0.0; -4.550258232817038 -1.0264957875870517 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 -0.01 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 -0.01 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 -0.01 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 -0.01 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 -0.01 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.01]
ERROR: StackOverflowError:
Stacktrace:
[1] mutable_operate!(::typeof(MutableArithmetics.sub_mul), ::Array{GenericAffExpr{Float64,VariableRef},2}, ::Symmetric{VariableRef,Array{VariableRef,2}}, ::Array{Float64,2}) at /Users/stephentu/.julia/packages/MutableArithmetics/ZGFsK/src/linear_algebra.jl:69 (repeats 79984 times)
This seems like too small of an SDP to run into memory issues. Any ideas?