Skip to content

Commit

Permalink
Add solvers to README (#98)
Browse files Browse the repository at this point in the history
* Add solvers to README

* Add SAGE

* Fix

* Update
  • Loading branch information
blegat authored Oct 18, 2023
1 parent 06bc2ea commit c16a172
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@

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

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

## License

Expand All @@ -20,6 +23,53 @@ import Pkg
Pkg.add("PolyJuMP")
```

## Use with JuMP

To use QCQP solver with JuMP, use a nonconvex QCQP solver, e.g., `Gurobi.Optimizer` and `PolyJuMP.QCQP.Optimizer`:

```julia
using JuMP, PolyJuMP, Gurobi
model = Model(() -> PolyJuMP.QCQP.Optimizer(Gurobi.Optimizer))
```

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`:

```julia
using JuMP, PolyJuMP, HomotopyContinuation
model = Model(optimizer_with_attributes(
PolyJuMP.KKT.Optimizer,
"solver" => HomotopyContinuation.SemialgebraicSetsHCSolver(),
))
```

For a nonnegativity constraint on a polynomial, e.g.,
```julia
using DynamicPolynomials
@polyvar x y
using JuMP
model = Model()
@variable(model, a)
@constraint(model, a * x * y^2 + y^3 >= a * x)
```
you need to specify how to interpret this nonnegativity constraint. To use Sum-of-Arithmetic-Geometric-Exponentials (SAGE), use
```julia
import PolyJuMP
PolyJuMP.setpolymodule!(model, PolyJuMP.SAGE)
```
To use Sum-of-Squares (SOS), use
```julia
import SumOfSquares
PolyJuMP.setpolymodule!(model, SumOfSquares)
```
or replace `model = Model()` by `model = SOSModel()`.

Alternatively, the nonnegativity constraint can be explicit:
```julia
@constraint(model, a * x * y^2 + y^3 - a * x in PolyJuMP.SAGE.Polynomials())
@constraint(model, a * x * y^2 + y^3 - a * x in SumOfSquares.SOSCone())
```
This allows mixing SAGE and SOS constraints in the same model.

## Documentation

Documentation for `PolyJuMP.jl` is included in the
Expand Down

0 comments on commit c16a172

Please sign in to comment.