Skip to content

Commit f56b8c7

Browse files
authored
Re-write the MOI wrapper (#101)
* Re-write the MOI wrapper * Add Manifest for Travis * Improve status reporting and fix bug in infeasibility certificate * Add documentation * Disable preemptive_check * Implement RelativeGap * Remove benchmarking in favour of MOI.Benchmarks * Update to latest MOI master * Address mlubin's comments * Remove unneeded resetting of params * Updates (#103) * Slight fixes * Add some extra name tests * Remove Manifest.toml * Remove Manifest.toml Part-II * Bump Project.toml version * Fix handling of objective bound * Fix typo
1 parent 7aa4b0e commit f56b8c7

File tree

7 files changed

+1986
-781
lines changed

7 files changed

+1986
-781
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
Manifest.toml
2+
*.json
3+
perf/Project.toml

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name = "GLPK"
22
uuid = "60bf3e95-4087-53dc-ae20-288a0d20c6a6"
33
repo = "https://github.com/JuliaOpt/GLPK.jl.git"
4-
version = "0.10.0"
4+
version = "0.11.0"
55

66
[deps]
77
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
88
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
9-
LinQuadOptInterface = "f8899e07-120b-5979-ab1d-7b97bb9e1a48"
9+
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
1010
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1111

1212
[compat]
1313
BinaryProvider = "≥ 0.3.0"
14-
LinQuadOptInterface = "0.6"
14+
MathOptInterface = "0.9"
1515
julia = "1"
1616

1717
[extras]

README.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
Julia GLPK module
2-
=================
1+
# GLPK.jl
32

4-
5-
| **Documentation** | **Build Status** |
6-
|:-------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------:|
7-
| [![][docs-stable-img]][docs-stable-url] [![][docs-latest-img]][docs-latest-url] | [![][travis-img]][travis-url] [![][appveyor-img]][appveyor-url] [![][coveralls-img]][coveralls-url] |
3+
| **Build Status** |
4+
|:---------------------------------------------------------------------------------------------------:|
5+
| [![][travis-img]][travis-url] [![][appveyor-img]][appveyor-url] [![][coveralls-img]][coveralls-url] |
86

97

108
GLPK.jl is a wrapper for the [GNU Linear Programming Kit library](http://www.gnu.org/software/glpk).
119
It makes it possible to access nearly all of GLPK functionality from within Julia programs.
1210

13-
See also the [GLPKMathProgInterface.jl](https://github.com/JuliaOpt/GLPKMathProgInterface.jl) package for using it with
14-
[MathProgBase.jl](https://github.com/JuliaOpt/MathProgBase.jl) and [JuMP.jl](https://github.com/JuliaOpt/JuMP.jl).
15-
1611
This package is part of [the JuliaOpt project](http://www.juliaopt.org/).
1712

1813
## Installation
@@ -39,16 +34,34 @@ If you do not want BinaryProvider to download the default binaries on install se
3934

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

42-
## Documentation
37+
## `GLPK.Optimizer`
38+
39+
Use `GLPK.Optimizer` to create a new optimizer object:
40+
```julia
41+
using GLPK
42+
model = GLPK.Optimizer(tm_lim = 60.0, msg_lev = GLPK.OFF)
43+
```
44+
For JuMP, use:
45+
```julia
46+
using JuMP, GLPK
47+
model = Model(
48+
with_optimizer(GLPK.Optimizer, tm_lim = 60.0, msg_lev = GLPK.OFF)
49+
)
50+
```
4351

44-
- [**STABLE**][docs-stable-url] — **most recently tagged version of the documentation.**
45-
- [**LATEST**][docs-latest-url] — *in-development version of the documentation.*
52+
**Note: previous versions of `GLPK.jl` required you to choose either `GLPKSolverLP` or `GLPKSolverMIP`. This is no longer needed; just use `GLPK.Optimizer`.**
4653

47-
[docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg
48-
[docs-latest-url]: https://gplkjl.readthedocs.org/en/latest/glpk.html
54+
## Pre-emptive checks
4955

50-
[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg
51-
[docs-stable-url]: https://gplkjl.readthedocs.org/en/stable/glpk.html
56+
`GLPK.jl` has a lot of pre-emptive checks to catch cases where the C API might
57+
throw an uninformative error. However, in benchmarks, this takes a
58+
non-negligible amount of time (e.g. 20% in add_constraints). At the risk of
59+
possibly running into an uninformative error, you can run the following after
60+
importing GLPK to disable these checks:
61+
```julia
62+
using GLPK
63+
GLPK.jl_set_preemptive_check(false)
64+
```
5265

5366
[travis-img]: https://api.travis-ci.org/JuliaOpt/GLPK.jl.svg?branch=master
5467
[travis-url]: https://travis-ci.org/JuliaOpt/GLPK.jl
@@ -58,8 +71,3 @@ To switch back to the default binaries clear `JULIA_GLPK_LIBRARY_PATH` and call
5871

5972
[coveralls-img]: https://img.shields.io/coveralls/JuliaOpt/GLPK.jl.svg
6073
[coveralls-url]: https://coveralls.io/r/JuliaOpt/GLPK.jl
61-
62-
[pkg-0.6-img]: http://pkg.julialang.org/badges/GLPK_0.6.svg
63-
[pkg-0.6-url]: http://pkg.julialang.org/?pkg=GLPK
64-
[pkg-0.7-img]: http://pkg.julialang.org/badges/GLPK_0.7.svg
65-
[pkg-0.7-url]: http://pkg.julialang.org/?pkg=GLPK

perf/perf.jl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using GLPK
2+
3+
function print_help()
4+
println("""
5+
Usage
6+
perf.jl [arg] [name]
7+
8+
[arg]
9+
--new Begin a new benchmark comparison
10+
--compare Run another benchmark and compare to existing
11+
12+
[name] A name for the benchmark test
13+
14+
Examples
15+
git checkout master
16+
julia perf.jl --new master
17+
git checkout approach_1
18+
julia perf.jl --new approach_1
19+
git checkout approach_2
20+
julia perf.jl --compare master
21+
julia perf.jl --compare approach_1
22+
""")
23+
end
24+
25+
if length(ARGS) != 2
26+
print_help()
27+
else
28+
const Benchmarks = GLPK.MOI.Benchmarks
29+
const suite = Benchmarks.suite(() -> GLPK.Optimizer())
30+
if ARGS[1] == "--new"
31+
Benchmarks.create_baseline(
32+
suite, ARGS[2]; directory = @__DIR__, verbose = true
33+
)
34+
elseif ARGS[1] == "--compare"
35+
Benchmarks.compare_against_baseline(
36+
suite, ARGS[2]; directory = @__DIR__, verbose = true
37+
)
38+
else
39+
print_help()
40+
end
41+
end

0 commit comments

Comments
 (0)