Skip to content

Commit 32f4c39

Browse files
committed
aesthetic change in sosdemo7
1 parent 3573e24 commit 32f4c39

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

test/sosdemo7.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33
# Section 3.7 of SOSTOOLS User's Manual
44

55
@testset "SOSDEMO7 with $solver" for solver in sdp_solvers
6-
if !isscs(solver)
7-
ndeg = 8 # Degree of Chebyshev polynomial
6+
isscs(solver) && continue
87

9-
@polyvar x
8+
ndeg = 8 # Degree of Chebyshev polynomial
109

11-
Z = monomials((x,), 0:ndeg-1)
10+
@polyvar x
1211

13-
m = SOSModel(solver = solver)
12+
Z = monomials((x,), 0:ndeg-1)
1413

15-
@variable m γ
16-
@variable m p1 Poly(Z)
14+
m = SOSModel(solver = solver)
1715

18-
p = p1 + γ * x^ndeg # the leading coeff of p is γ
16+
@variable m γ
17+
@variable m p1 Poly(Z)
1918

20-
dom = @set x >= -1 && x <= 1
21-
@constraint(m, p <= 1, domain = dom)
22-
@constraint(m, p >= -1, domain = dom)
19+
p = p1 + γ * x^ndeg # the leading coeff of p is γ
2320

24-
@objective m Max γ
21+
dom = @set x >= -1 && x <= 1
22+
@constraint(m, p <= 1, domain = dom)
23+
@constraint(m, p >= -1, domain = dom)
2524

26-
status = solve(m)
25+
@objective m Max γ
2726

28-
@test status == :Optimal
27+
status = solve(m)
2928

30-
@test isapprox(getvalue(p), 128x^8 - 256x^6 + 160x^4 - 32x^2 + 1, ztol=1e-7, atol=1e-7)
31-
@test isapprox(getvalue(γ), 128)
32-
end
29+
@test status == :Optimal
30+
31+
@test isapprox(getvalue(p), 128x^8 - 256x^6 + 160x^4 - 32x^2 + 1, ztol=1e-7, atol=1e-7)
32+
@test isapprox(getvalue(γ), 128)
3333
end

0 commit comments

Comments
 (0)