Skip to content

Commit 36c4aa2

Browse files
authored
Clarify solvers in README (#103)
1 parent aee87cd commit 36c4aa2

File tree

1 file changed

+37
-18
lines changed

1 file changed

+37
-18
lines changed

README.md

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,12 @@ Pkg.add("PolyJuMP")
2525

2626
## Use with JuMP
2727

28-
To use QCQP solver with JuMP, use a nonconvex QCQP solver, e.g., `Gurobi.Optimizer` and `PolyJuMP.QCQP.Optimizer`:
28+
### Polynomial nonnegativity constraints
2929

30-
```julia
31-
using JuMP, PolyJuMP, Gurobi
32-
model = Model(() -> PolyJuMP.QCQP.Optimizer(Gurobi.Optimizer))
33-
```
34-
35-
To use KKT solver with JuMP, use solver of algebraic systems of equations implementing the [SemialgebraicSets interface](https://github.com/JuliaAlgebra/SemialgebraicSets.jl), e.g., `HomotopyContinuation.SemialgebraicSetsHCSolver` and `PolyJuMP.KKT.Optimizer`:
36-
37-
```julia
38-
using JuMP, PolyJuMP, HomotopyContinuation
39-
model = Model(optimizer_with_attributes(
40-
PolyJuMP.KKT.Optimizer,
41-
"solver" => HomotopyContinuation.SemialgebraicSetsHCSolver(),
42-
))
43-
```
44-
45-
For a nonnegativity constraint on a polynomial, e.g.,
30+
`PolyJuMP` allows encoding a constraint that a polynomial should be nonnegative for all values of some
31+
symbolic variables defined with `DynamicPolynomials.@polyvar` or `TypedPolynomials.@polyvar` as follows.
32+
For instance, the following constrains the JuMP decision variable `a` to be such that
33+
`a * x * y^2 + y^3 - a * x` is nonnegative for all real values of `x` and `y`:
4634
```julia
4735
using DynamicPolynomials
4836
@polyvar x y
@@ -51,7 +39,10 @@ model = Model()
5139
@variable(model, a)
5240
@constraint(model, a * x * y^2 + y^3 >= a * x)
5341
```
54-
you need to specify how to interpret this nonnegativity constraint. To use Sum-of-Arithmetic-Geometric-Exponentials (SAGE), use
42+
Determining the nonnegativity of a multivariate polynomial is however NP-hard so sufficient conditions
43+
are used instead.
44+
You need to specify which sufficient condition is used explicitly.
45+
To use Sum-of-Arithmetic-Geometric-Exponentials (SAGE), use
5546
```julia
5647
import PolyJuMP
5748
PolyJuMP.setpolymodule!(model, PolyJuMP.SAGE)
@@ -70,6 +61,34 @@ Alternatively, the nonnegativity constraint can be explicit:
7061
```
7162
This allows mixing SAGE and SOS constraints in the same model.
7263

64+
### Polynomial optimization
65+
66+
PolyJuMP also allows solving polynomial optimization problems using the `QCQP` and `KKT` solvers.
67+
Polynomial optimization problems do not involve any symbolic variables from DynamicPolynomials or TypedPolynomials,
68+
instead all variables are JuMP decision variables.
69+
70+
The `QCQP` solver is parametrized by a nonconvex QCQP inner solver.
71+
It reformulates the polynomial optimization problem into a nonconvex `QCQP`
72+
and relies on the inner solver to solve it.
73+
For instance, to use the `QCQP` solver with JuMP with `Gurobi.Optimizer` as inner solver, use:
74+
```julia
75+
using JuMP, PolyJuMP, Gurobi
76+
model = Model(() -> PolyJuMP.QCQP.Optimizer(Gurobi.Optimizer))
77+
```
78+
79+
The `KKT` solver is parametrized by an inner solver of algebraic systems of equations implementing the [SemialgebraicSets interface](https://github.com/JuliaAlgebra/SemialgebraicSets.jl).
80+
It reformulates the polynomial optimization problem into a system of polynomial equations
81+
and relies on the inner solver to solve it.
82+
For instance, to use the `QCQP` solver with JuMP with
83+
`HomotopyContinuation.SemialgebraicSetsHCSolver` as inner solver, use:
84+
```julia
85+
using JuMP, PolyJuMP, HomotopyContinuation
86+
model = Model(optimizer_with_attributes(
87+
PolyJuMP.KKT.Optimizer,
88+
"solver" => HomotopyContinuation.SemialgebraicSetsHCSolver(),
89+
))
90+
```
91+
7392
## Documentation
7493

7594
Documentation for `PolyJuMP.jl` is included in the

0 commit comments

Comments
 (0)