Skip to content

Commit 0ee1bb2

Browse files
committed
Fix format
1 parent f499147 commit 0ee1bb2

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/BMSOS.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,11 @@ end
162162
function sos_decomp(p::SA.AlgebraElement; args...)
163163
d = div(MP.maxdegree(SA.basis(p)), 2)
164164
@assert MP.nvariables(MB.explicit_basis(p)) == 1
165-
a = SA.coeffs(p, MB.SubBasis{MB.Trigonometric}(MP.monomials(MP.variables(p), 0:2d)))
166-
t = TrigPolys.TrigPoly(
167-
a[1],
168-
a[2:2:2d],
169-
a[3:2:(2d+1)],
165+
a = SA.coeffs(
166+
p,
167+
MB.SubBasis{MB.Trigonometric}(MP.monomials(MP.variables(p), 0:2d)),
170168
)
169+
t = TrigPolys.TrigPoly(a[1], a[2:2:2d], a[3:2:(2d+1)])
171170
return sos_decomp(t; args...)
172171
end
173172

src/MOI_wrapper.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,20 @@ mutable struct Optimizer <: MOI.AbstractOptimizer
2222
solve_time::Float64
2323
silent::Bool
2424
function Optimizer()
25-
return new(nothing, copy(DEFAULT), nothing, nothing, nothing, NaN, false)
25+
return new(
26+
nothing,
27+
copy(DEFAULT),
28+
nothing,
29+
nothing,
30+
nothing,
31+
NaN,
32+
false,
33+
)
2634
end
2735
end
2836

37+
MOI.get(::Optimizer, ::MOI.SolverName) = "BMSOS"
38+
2939
function MOI.supports(optimizer::Optimizer, attr::MOI.RawOptimizerAttribute)
3040
return haskey(optimizer.options, attr.name)
3141
end
@@ -71,7 +81,9 @@ function MOI.add_constraint(
7181
end
7282

7383
function MOI.empty!(optimizer::Optimizer)
74-
return optimizer.poly = nothing
84+
optimizer.poly = nothing
85+
optimizer.solve_time = NaN
86+
return
7587
end
7688

7789
MOI.is_empty(optimizer::Optimizer) = optimizer.poly === nothing

0 commit comments

Comments
 (0)