dummy-link

GLPK

GLPK wrapper module for Julia

Readme

GLPK.jl

Build Status

GLPK.jl is a wrapper for the GNU Linear Programming Kit library.

It has two components:

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

Installation

The package is registered in the General registry and so can be installed with Pkg.add.

julia> import Pkg

julia> Pkg.add("GLPK")

In addition to installing the GLPK.jl package, this will also download and install the GLPK binaries. (You do not need to install GLPK separately.) If you require a custom build of GLPK, see the "Custom Installation" instructions below.

Custom Installation

To install custom built GLPK binaries set the environmental variable JULIA_GLPK_LIBRARY_PATH and call import Pkg; Pkg.build("GLPK"). For example, if the libraries are installed in /opt/lib just call:

ENV["JULIA_GLPK_LIBRARY_PATH"] = "/opt/lib"
Pkg.build("GLPK")

If you do not want BinaryProvider to download the default binaries on install set JULIA_GLPK_LIBRARY_PATH before calling import Pkg; Pkg.add("GLPK").

To switch back to the default binaries clear JULIA_GLPK_LIBRARY_PATH and call import Pkg; Pkg.build("GLPK").

GLPK.Optimizer

Use GLPK.Optimizer to create a new optimizer object for use with MathOptInterface or JuMP.

In the following examples the time limit is set to one minute and logging is turned off.

using GLPK
model = GLPK.Optimizer()
MOI.set(model, MOI.RawParameter("tm_lim"), 60_000) #  tm_lim is in milliseconds.
MOI.set(model, MOI.RawParameter("msg_lev"), GLPK.GLP_MSG_OFF)

For JuMP, use:

using JuMP, GLPK
model = Model(GLPK.Optimizer)
set_optimizer_attribute(model, "tm_lim", 60 * 1_000)
set_optimizer_attribute(model, "msg_lev", GLPK.GLP_MSG_OFF)

First Commit

02/03/2013

Last Touched

3 days ago

Commits

245 commits