Skip to content

Commit c16a172

Browse files
authored
Add solvers to README (#98)
* Add solvers to README * Add SAGE * Fix * Update
1 parent 06bc2ea commit c16a172

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55

66
[PolyJuMP.jl](https://github.com/jump-dev/PolyJuMP.jl) is a [JuMP](https://github.com/jump-dev/JuMP.jl)
77
extension for formulating and solving polynomial optimization problems.
8+
This extension includes the following:
89

9-
These problems can then be solved using [SumOfSquares.jl](https://github.com/jump-dev/SumOfSquares.jl).
10+
* Polynomial functions on JuMP decisions variables. These can be solved with the `PolyJuMP.QCQP.Optimizer` or `PolyJuMP.KKT.Optimizer`.
11+
* Constraints that a polynomial is nonnegative where the coefficients of the polynomials depend on JuMP decision variables.
12+
These nonnegativity constraints can be reformulated using sufficient conditions using `PolyJuMP.RelativeEntropy` submodule or [SumOfSquares.jl](https://github.com/jump-dev/SumOfSquares.jl).
1013

1114
## License
1215

@@ -20,6 +23,53 @@ import Pkg
2023
Pkg.add("PolyJuMP")
2124
```
2225

26+
## Use with JuMP
27+
28+
To use QCQP solver with JuMP, use a nonconvex QCQP solver, e.g., `Gurobi.Optimizer` and `PolyJuMP.QCQP.Optimizer`:
29+
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.,
46+
```julia
47+
using DynamicPolynomials
48+
@polyvar x y
49+
using JuMP
50+
model = Model()
51+
@variable(model, a)
52+
@constraint(model, a * x * y^2 + y^3 >= a * x)
53+
```
54+
you need to specify how to interpret this nonnegativity constraint. To use Sum-of-Arithmetic-Geometric-Exponentials (SAGE), use
55+
```julia
56+
import PolyJuMP
57+
PolyJuMP.setpolymodule!(model, PolyJuMP.SAGE)
58+
```
59+
To use Sum-of-Squares (SOS), use
60+
```julia
61+
import SumOfSquares
62+
PolyJuMP.setpolymodule!(model, SumOfSquares)
63+
```
64+
or replace `model = Model()` by `model = SOSModel()`.
65+
66+
Alternatively, the nonnegativity constraint can be explicit:
67+
```julia
68+
@constraint(model, a * x * y^2 + y^3 - a * x in PolyJuMP.SAGE.Polynomials())
69+
@constraint(model, a * x * y^2 + y^3 - a * x in SumOfSquares.SOSCone())
70+
```
71+
This allows mixing SAGE and SOS constraints in the same model.
72+
2373
## Documentation
2474

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

0 commit comments

Comments
 (0)