Skip to main content

A Python wrapper to the CUTEst optimization test environment

Project description

PyCUTEst is a Python interface to CUTEst, a Fortran package for testing optimization software. It is based on the interface originally developed for CUTEr by Prof. Arpad Buermen.

Full details on how to use PyCUTEst are available in the documentation.

Requirements

PyCUTEst requires the following software to be installed:

Additionally, the following python packages should be installed (these will be installed automatically if using pip, see Installing PyCUTEst using pip):

Please Note: Currently PyCUTEst only supports Mac and Linux. For Windows 10 (or later), PyCUTEst can be used through the Windows Subsystem for Linux, following the Linux installation instructions.

Installing CUTEst on Linux

These instructions do not include installation of the MATLAB interface. You will need to install four packages: archdefs, SIFDecode, CUTEst and MASTSIF. To keep things simple, install all four packages in the same directory:

$ mkdir cutest
$ cd cutest
$ git clone https://github.com/ralna/ARCHDefs ./archdefs
$ git clone https://github.com/ralna/SIFDecode ./sifdecode
$ git clone https://github.com/ralna/CUTEst ./cutest
$ git clone https://bitbucket.org/optrove/sif ./mastsif

Note that mastsif contains all the test problem definitions and is therefore quite large. If you’re short on space you may want to copy only the *.SIF files for the problems you wish to test on.

Next set the following environment variables in your ~/.bashrc to point to the installation directories used above:

# CUTEst
export ARCHDEFS=/path/to/cutest/archdefs/
export SIFDECODE=/path/to/cutest/sifdecode/
export MASTSIF=/path/to/cutest/mastsif/
export CUTEST=/path/to/cutest/cutest/
export MYARCH="pc64.lnx.gfo"

Now we are ready to install CUTEst in double precision (requires gfortran and gcc):

$ cd /path/to/cutest/cutest/
$ ${ARCHDEFS}/install_optrove
Do you wish to install CUTEst (Y/n)? Y
Do you require the CUTEst-Matlab interface (y/N)? N
Select platform: 6 # PC with generic 64-bit processor
Select operating system: 3 # Linux
Would you like to review and modify the system commands (y/N)? N
Select fortran compiler: 6 # GNU gfortran compiler
Would you like to review and modify the fortran compiler settings (y/N)? N
Select C compiler: 8 # GCC
Would you like to review and modify the C compiler settings (y/N)? N
Would you like to compile SIFDecode (Y/n)? Y
Would you like to compile CUTEst (Y/n)? Y
CUTEst may be compiled in (S)ingle or (D)ouble precision or (B)oth.
Which precision do you require for the installed subset (D/s/b) ? D

And CUTEst should run from here. To test that the installation works, issue the commands:

$ cd $SIFDECODE/src ; make -f $SIFDECODE/makefiles/$MYARCH test
$ cd $CUTEST/src ; make -f $CUTEST/makefiles/$MYARCH test

Please Note: currently PyCUTEst only supports gfortran and uses the default version on your path (as returned by gfortran -v ). Please ensure this is the same version that you install CUTEst with above otherwise you may experience segmentation faults, this should be the case if you select the generic GNU gfortran compiler as the fortran compiler in the installer above.

Installing CUTEst on Mac

Install CUTEst using Homebrew as detailed below (installing CUTEst manually on Mac is not supported). First it is important to ensure that you have the latest version of Xcode Command Line Tools installed (or the latest version of Xcode), please ensure this is the case by following this guide. Now install the Homebrew package manager:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then you can easily install CUTEst:

$ brew tap optimizers/cutest
$ brew install cutest --without-single --with-matlab # if using Matlab interface
$ brew install mastsif  # if you want all the test problems
$ for f in "archdefs" "mastsif" "sifdecode" "cutest"; do \
$   echo ". $(brew --prefix $f)/$f.bashrc" >> ~/.bashrc; \
$ done

Please Note: you may see warnings such as ld: warning: object file (RANGE.o) was built for newer macOS version (11.5) than being linked (10.15) when using PyCUTEst on Mac, to suppress these warnings please set the environment variable MACOSX_DEPLOYMENT_TARGET to your current macOS version (e.g. export MACOSX_DEPLOYMENT_TARGET=11.5 in this example, you can make this permanent by adding it your ~/.bashrc file).

Installing PyCUTEst using pip

For easy installation, use pip:

$ pip install pycutest

Note that if an older install of PyCUTEst is present on your system you can use:

$ pip install --upgrade pycutest

to upgrade PyCUTEst to the latest version.

You will then need to create a folder which will store all your compiled problems:

$ mkdir pycutest_cache

And set an environment variable to tell PyCUTEst about this directory, by adding to your ~/.bashrc file:

export PYCUTEST_CACHE="/path/to/pycutest_cache"

If you do not set this environment variable, then PyCUTEst will create a cache folder of compiled problems inside your current working directory.

Manual installation of PyCUTEst

Alternatively, you can download the source code from Github and unpack as follows:

$ git clone https://github.com/jfowkes/pycutest
$ cd pycutest

PyCUTEst is written in pure Python and requires no compilation. It can be installed using:

$ pip install .

Please Note: don’t forget to set up your cache and associated environment variable (see above).

To upgrade PyCUTEst to the latest version, navigate to the top-level directory (i.e. the one containing setup.py) and re-run the installation using pip, as above:

$ git pull
$ pip install .

Testing

The documentation provides some simple examples of how to run PyCUTEst.

Uninstallation

You can uninstall PyCUTEst as follows:

$ pip uninstall pycutest

Bugs

Please report any bugs using GitHub’s issue tracker.

License

This package is released under the GNU GPL license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycutest-1.2.tar.gz (49.3 kB view hashes)

Uploaded source

Built Distribution

pycutest-1.2-py3-none-any.whl (48.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page