Penopt.jl

A Julia interface to the Penopt SDP solver
Author jump-dev
Popularity
7 Stars
Updated Last
6 Months Ago
Started In
August 2019

Penopt.jl

This repository is still under development. It is not a registered Julia package, and has not been tested on macOS or Windows.

Penopt.jl is a wrapper for the Penopt Optimizer.

It has two components:

The C API can be accessed via Penopt.penbmi functions, where the names and arguments are identical to the C API. See the /tests folder for inspiration.

Affiliation

This wrapper is maintained by the JuMP community and is not officially supported by Penopt.

License

Penopt.jl is licensed under the MIT License.

The underlying solver is a closed-source commercial product for which you must purchase a license.

Installation

You can install Penopt.jl through the Julia package manager:

] add https://github.com/jump-dev/Penopt.jl.git

then, open a terminal in the directory when Penopt is installed (find this directory by writing using Penopt; pathof(Penopt) in a Julia session).

$ mkdir -p deps/usr/lib
$ cd deps/usr/lib
$ gcc  -Wl,--no-undefined -shared -lm -lgfortran -lopenblas -llapack -o libpenbmi.so -Wl,--whole-archive /path/to/PENBMI2.1/lib/libpenbmi.a -Wl,--no-whole-archive

This will create a shared library libpenbmi.so in the directory deps/usr/lib. Then create the following file deps/deps.jl:

import Libdl
const libpenbmi = joinpath(dirname(@__FILE__), "usr/lib/libpenbmi.so")
function check_deps()
    global libpenbmi
    if !isfile(libpenbmi)
        error("$(libpenbmi) does not exist, Please re-run Pkg.build(\"Penopt\"), and restart Julia.")
    end

    if Libdl.dlopen_e(libpenbmi) == C_NULL
        error("$(libpenbmi) cannot be opened, Please re-run Pkg.build(\"Penopt\"), and restart Julia.")
    end

end

You can test the installation with using Pkg; Pkg.test("Penopt") in a Julia session.

Use with JuMP

using JuMP, Penopt
model = Model(Penopt.Optimizer)
set_attribute(model, "PBM_MAX_ITER", 100)
set_attribute(model, "TR_MODE", 1)

Options

See the Penbmi Documentation for a list and description of allowable parameters.

Accessing Penopt-specific attributes via JuMP

You can get and set Penopt-specific attributes via JuMP as follows:

@show MOI.get(model, Penopt.NumberOfOuterIterations())
@show MOI.get(model, Penopt.NumberOfNewtonSteps())
@show MOI.get(model, Penopt.NumberOfLinesearchSteps())