I am trying to follow up [1, Example 1]. This involves semidefinite programming described in Corollary 1:
The following is what I’ve tried, and basically I think I need some specialized syntax for SDP.
Trial
Code
using Convex
using LinearAlgebra
using SCS
"""
[1, Example 1]
# Refs
[1] Khlebnikov, Mikhail V.
"Quadratic stabilization of bilinear control systems."
Automation and Remote Control 77 (2016): 980-991.
"""
function main()
A = [0 1;
1 1]
b = [0 1]'
D = [1 1;
-1 1]
n = 2
ϵ = 0.1 # TODO: variable?
μ = 0.0 # TODO: see remark of Corollary 1
P = Semidefinite(n)
y = Variable(n)
tmp = [(A*P + P*A' + b*y' + y*b' + ϵ*D*P*D') y;
y' -ϵ*I]
prob = minimize(
-eigmin(P),
isposdef(-tmp),
)
solve!(prob, SCS.Optimizer; silent_solver=true)
k = inv(evaluate(P)) * y
println(evaluate(P))
println(evaluate(k))
end
Error message
julia> main()
ERROR: MethodError: no method matching isless(::Matrix{Any}, ::Int64)
Closest candidates are:
isless(::AbstractFloat, ::Real)
@ Base operators.jl:179
isless(::ForwardDiff.Dual{Tx}, ::Integer) where Tx
@ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:144
isless(::ForwardDiff.Dual{Tx}, ::Real) where Tx
@ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:144
...
Stacktrace:
[1] <(x::Matrix{Any}, y::Int64)
@ Base ./operators.jl:343
[2] <=(x::Matrix{Any}, y::Int64)
@ Base ./operators.jl:392
[3] main()
@ Main ~/.julia/dev/DDControl/bl_ctrl_quad_stab.jl:29
[4] top-level scope
@ REPL[2]:1
[5] top-level scope
@ ~/.julia/packages/Infiltrator/LtFao/src/Infiltrator.jl:726
I followed this example provided by Convex.jl but somehow it fails.
Can anyone help me?