Skip to content

Commit 45ed2f3

Browse files
committed
Fixes
1 parent 0ae3609 commit 45ed2f3

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
${{ runner.os }}-test-${{ env.cache-name }}-
4141
${{ runner.os }}-test-
4242
${{ runner.os }}-
43+
- name: PolyJuMP
44+
shell: julia --project=@. {0}
45+
run: |
46+
using Pkg
47+
Pkg.add(PackageSpec(url="https://github.com/jump-dev/PolyJuMP.jl.git", rev="bl/qcqp"))
4348
- uses: julia-actions/julia-buildpkg@v1
4449
- uses: julia-actions/julia-runtest@v1
4550
with:

docs/src/tutorials/Polynomial Optimization/polynomial_optimization.jl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ p(x=>1, y=>0), p(x=>1//2, y=>1//2), p(x=>0, y=>1)
3232

3333
import Ipopt
3434
model = Model(Ipopt.Optimizer)
35-
@variable(model, a >= 0)
36-
@variable(model, b >= 0)
35+
@variable(model, 0 <= a)
36+
@variable(model, 0 <= b)
3737
@constraint(model, a + b >= 1)
38-
@NLobjective(model, Min, a^3 - a^2 + 2a*b - b^2 + b^3)
38+
@objective(model, Min, a^3 - a^2 + 2a*b - b^2 + b^3)
3939
optimize!(model)
4040

4141
# As we can see below, the termination status is `LOCALLY_SOLVED` and not of `OPTIMAL`
@@ -95,7 +95,7 @@ value(a), value(b)
9595

9696
# ## QCQP approach
9797

98-
import Alpine, HiGHS, Pavito
98+
import Alpine, HiGHS, Ipopt, Pavito
9999
ipopt = optimizer_with_attributes(
100100
Ipopt.Optimizer,
101101
MOI.Silent() => true,
@@ -120,9 +120,16 @@ alpine = optimizer_with_attributes(
120120
"mip_solver" => pavito,
121121
)
122122
set_optimizer(model, () -> PolyJuMP.QCQP.Optimizer(alpine))
123-
@NLobjective(model, Min, a^3 - a^2 + 2a*b - b^2 + b^3)
124123
optimize!(model)
125124

125+
# We can see the summary here:
126+
127+
solution_summary(m)
128+
129+
# It found the optimal solution
130+
131+
value(a), value(b)
132+
126133
# ## Sum-of-Squares approach
127134

128135
# We will now see how to find the optimal solution using Sum of Squares Programming.

0 commit comments

Comments
 (0)