This package provides an interface to CUTEst, the Constrained and Unconstrained Test Environment with safe threads for nonlinear optimization.
This package uses NLPModels.jl, but it also gives direct access to the CUTEst functions.
CUTEst has been around for a while. It started as CUTE, then CUTEr, then CUTEr2, and finally CUTEst. The original project can be used independently of Julia.
CUTEst works by decoding a
.SIF file into other files and objects so that a user compiles links that to his code. It also gives the option of doing that for you, in which case you have to send some code to it's folder, and ask for the compilation.
CUTEst gives you about 100 methods to access the objective and constraints functions, as well as their derivatives in many different formats. It also gives access to the problem's information, like number of variables, constraints, the initial point, the bounds, an so on.
On Linux, you'll need to install
gfortran, and possibly have to fix the location of
On Ubuntu 14.04, you can do this with
sudo apt-get install wget gfortran sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/$(gfortran -dumpversion | cut -f1,2 -d.)/libgfortran.so /usr/local/lib
On Ubuntu 16.04,
sudo apt-get install wget gfortran sudo ln -s /usr/lib/x86_64-linux-gnu/libgfortran.so.3 /usr/local/lib/libgfortran.so
On Archlinux, do
sudo pacman -S wget gfortran
CUTEst does not work on Windows. To use CUTEst from Windows:
- Install Windows Subsystem for Linux (WSL);
then in WSL:
- Install gfortran;
- Install Julia for Linux.
Note, Julia for Linux can be started from VSCode for Windows. In VSCode:
- Open a terminal and type
- Start Julia.
The following command should automatically download and install CUTEst and its dependencies (Use
] to enter
pkg> add CUTEst
Check the tutorial for complete usage.
The simplest use of CUTEst is through the interface of NLPModels.jl.
using CUTEst, NLPModels nlp = CUTEstModel("ROSENBR") println("x0 = $(nlp.meta.x0)") println("fx = $( obj(nlp, nlp.meta.x0) )") println("gx = $( grad(nlp, nlp.meta.x0) )") println("Hx = $( hess(nlp, nlp.meta.x0) )") finalize(nlp)
x0 = [-1.2, 1.0] fx = 24.199999999999996 gx = [-215.59999999999997, -87.99999999999999] Hx = [1330.0 480.0; 480.0 200.0]
Check the NLPModels API for details.
You can pass parameters to sifdecoder by giving additional arguments to
CUTEstModel. For instance, to change
NH from model
using CUTEst for nh = 50:50:200 nlp = CUTEstModel("CHAIN", "-param", "NH=$nh") println("nh = $nh, nnzh = $(nlp.meta.nnzh)") finalize(nlp) end
nh = 50, nnzh = 153 nh = 100, nnzh = 303 tput: No value for $TERM and no -T specified tput: No value for $TERM and no -T specified nh = 150, nnzh = 1203 nh = 200, nnzh = 603
We also have implemented function to allow access to the CUTEst functions directly: a core API which is only a wrapper for CUTEst. For more information see the section core.