PolyJuMP.jl

Build Status codecov

PolyJuMP.jl is a JuMP extension for formulating and solving polynomial optimization problems. This extension includes the following:

  • 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.

License

PolyJuMP.jl is licensed under the MIT license.

Installation

Install PolyJuMP using Pkg.add:

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:

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, e.g., HomotopyContinuation.SemialgebraicSetsHCSolver and PolyJuMP.KKT.Optimizer:

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

For a nonnegativity constraint on a polynomial, e.g.,

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

import PolyJuMP
PolyJuMP.setpolymodule!(model, PolyJuMP.SAGE)

To use Sum-of-Squares (SOS), use

import SumOfSquares
PolyJuMP.setpolymodule!(model, SumOfSquares)

or replace model = Model() by model = SOSModel().

Alternatively, the nonnegativity constraint can be explicit:

@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 documentation for SumOfSquares.jl.