You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This [Julia](https://github.com/JuliaLang/julia) package is an interface between [MathOptInterface.jl](https://github.com/jump-dev/MathOptInterface.jl) and [AMPL-enabled](http://www.ampl.com)[solvers](http://ampl.com/products/solvers/all-solvers-for-ampl/). It is similar in nature to [CoinOptServices.jl](https://github.com/tkelman/CoinOptServices.jl), but instead uses AMPL's low-level [.nl](https://en.wikipedia.org/wiki/Nl_%28format%29) file format.
3
+
This [Julia](https://github.com/JuliaLang/julia) package is an interface between
4
+
[MathOptInterface.jl](https://github.com/jump-dev/MathOptInterface.jl) and
AmplNLWriter.jl can be installed using the Julia package manager with the following command:
16
+
AmplNLWriter.jl can be installed using the Julia package manager with the
17
+
following command:
25
18
26
19
```julia
20
+
import Pkg
27
21
Pkg.add("AmplNLWriter")
28
22
```
29
23
30
24
## Usage
31
25
32
-
AmplNLWriter.jl provides ``AmplNLWriter.Optimizer`` as a usable solver in JuMP. The following Julia code uses the Bonmin solver in JuMP via AmplNLWriter.jl:
26
+
AmplNLWriter.jl provides `AmplNLWriter.Optimizer` as a usable solver in JuMP.
27
+
The following Julia code uses the Bonmin solver in JuMP via AmplNLWriter.jl:
28
+
29
+
```julia
30
+
using JuMP, AmplNLWriter
31
+
model =Model(() -> AmplNLWriter.Optimizer("bonmin"))
32
+
```
33
+
34
+
You can then model and solve your optimization problem as usual. See
35
+
[JuMP.jl](https://github.com/jump-dev/JuMP.jl/blob/master/README.md) for more
36
+
details.
37
+
38
+
The `AmplNLWriter.Optimizer()` constructor requires as the first argument the
39
+
name of the solver command needed to run the desired solver.
33
40
34
-
julia> using JuMP, AmplNLWriter
35
-
julia> m = Model(() -> AmplNLWriter.Optimizer("bonmin"))
41
+
For example, if the `bonmin` executable is on the system path, you can use
42
+
this solver using `AmplNLWriter.Optimizer("bonmin")`. If the solver is not on
43
+
the path, the full path to the solver will need to be passed in. This solver
44
+
executable must be an AMPL-compatible solver.
36
45
37
-
You can then model and solve your optimization problem as usual. See [JuMP.jl](https://github.com/jump-dev/JuMP.jl/blob/master/README.md) for more details.
46
+
The second (optional) argument to `AmplNLWriter.Optimizer()` is a
47
+
`Vector{String}` of solver options. These options are appended to the solve
48
+
command separated by spaces, and the required format depends on the solver that
49
+
you are using. Generally, they will be of the form `"key=value"`, where `key` is
50
+
the name of the option to set and `value` is the desired value.
38
51
39
-
The ``AmplNLWriter.Optimizer()`` constructor requires as the first argument the name of the solver command needed to run the desired solver. For example, if the ``bonmin`` executable is on the system path, you can use this solver using ``AmplNLWriter.Optimizer("bonmin")``. If the solver is not on the path, the full path to the solver will need to be passed in. This solver executable must be an AMPL-compatible solver.
52
+
For example, to set the NLP log level to 0 in Bonmin, you would run
The second (optional) argument to ``AmplNLWriter.Optimizer()`` is a ``Vector{ASCIIString}`` of solver options. These options are appended to the solve command separated by spaces, and the required format depends on the solver that you are using. Generally, they will be of the form ``"key=value"``, where ``key`` is the name of the option to set and ``value`` is the desired value. For example, to set the NLP log level to 0 in Bonmin, you would run ``AmplNLWriter.Optimizer("bonmin", ["bonmin.nlp_log_level=0"])``. For a list of options supported by your solver, check the solver's documentation, or run ``/path/to/solver -=`` at the command line e.g. run ``bonmin -=`` for a list of all Bonmin options.
55
+
For a list of options supported by your solver, check the solver's
56
+
documentation, or run `/path/to/solver -=` at the command line, e.g., run
57
+
`bonmin -=` for a list of all Bonmin options.
42
58
43
-
Note that some of the options don't seem to take effect when specified using the command-line options (especially for Couenne), and instead you need to use an ``.opt`` file. The ``.opt`` file takes the name of the solver, e.g. ``bonmin.opt``, and each line of this file contains an option name and the desired value separated by a space. For instance, to set the absolute and relative tolerances in Couenne to 1 and 0.05 respectively, the ``couenne.opt`` file should be
59
+
Note that some of the options don't seem to take effect when specified using the
60
+
command-line options (especially for Couenne), and instead you need to use an
61
+
`.opt` file.
44
62
63
+
The `.opt` file takes the name of the solver, e.g. `bonmin.opt`, and each line
64
+
of this file contains an option name and the desired value separated by a space.
65
+
For instance, to set the absolute and relative tolerances in Couenne to 1 and
66
+
0.05 respectively, the `couenne.opt` file should be
45
67
```
46
68
allowable_gap 1
47
69
allowable_fraction_gap 0.05
48
70
```
49
71
50
-
In order for the options to be loaded, this file must be located in the current working directory whenever the model is solved.
72
+
In order for the options to be loaded, this file must be located in the current
73
+
working directory whenever the model is solved.
51
74
52
-
A list of available options for the respective ``.opt`` files can be found here:
75
+
A list of available options for the respective `.opt` files can be found here:
@@ -59,21 +82,32 @@ A list of available options for the respective ``.opt`` files can be found here:
59
82
60
83
### Bonmin/Couenne/Ipopt
61
84
62
-
**NOTE: AmplNLWriter v0.4.0 introduced a breaking change by removing `BonminNLSolver`, `CouenneNLSolver`, and `IpoptNLSolver`. Users are now expected
85
+
**NOTE: AmplNLWriter v0.4.0 introduced a breaking change by removing
86
+
`BonminNLSolver`, `CouenneNLSolver`, and `IpoptNLSolver`. Users are now expected
63
87
to pass the path of the solver executable to `AmplNLWriter.Optimizer`.**
64
88
65
-
The easiest way to obtain a solver executable for Bonmin, Couenne, or Ipopt is to download one from [AMPL](https://ampl.com/products/solvers/open-source/).
89
+
The easiest way to obtain a solver executable for Bonmin, Couenne, or Ipopt is
90
+
to download one from [AMPL](https://ampl.com/products/solvers/open-source/).
66
91
67
92
### SCIP
68
93
69
-
To use SCIP with AmplNLWriter.jl, you must first compile the ``scipampl`` binary which is a version of SCIP with support for the AMPL .nl interface. To do this, you can follow the instructions [here](http://zverovich.net/2012/08/07/using-scip-with-ampl.html), which we have tested on OS X and Linux.
94
+
To use SCIP with AmplNLWriter.jl, you must first compile the `scipampl` binary
95
+
which is a version of SCIP with support for the AMPL .nl interface. To do this,
96
+
you can follow the instructions [here](http://zverovich.net/2012/08/07/using-scip-with-ampl.html),
97
+
which we have tested on OS X and Linux.
70
98
71
-
After doing this, you can access SCIP through ``AmplNLWriter.Optimizer("/path/to/scipampl")``. Options can be specified for SCIP using a ``scip.set`` file, where each line is of the form ``key = value``. For example, the following `scip.set` file will set the verbosity level to 0:
72
-
73
-
display/verblevel = 0
99
+
After doing this, you can access SCIP through
100
+
`AmplNLWriter.Optimizer("/path/to/scipampl")`. Options can be specified for SCIP
101
+
using a `scip.set` file, where each line is of the form `key = value`. For
102
+
example, the following `scip.set` file will set the verbosity level to 0:
103
+
```
104
+
display/verblevel = 0
105
+
```
74
106
75
107
A list of valid options for the file can be found [here](http://plato.asu.edu/milp/scip.set).
76
108
77
-
To use the ``scip.set`` file, you must pass the path to the ``scip.set`` file as the first (and only) option to the solver:
0 commit comments