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, and a brief summary of the package’s goals is available in the PyCUTEst journal article.

Requirements

PyCUTEst requires the following software to be installed:

  • Python 3 (http://www.python.org/)

  • Python 3 Headers (apt install python3-dev on Ubuntu, already included on macOS)

  • CUTEst (see below)

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):

$ source ~/.bashrc # load above environment variables
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jfowkes/pycutest/master/.install_cutest.sh)"

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.

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

Anaconda Users: please ensure that ~/.bashrc is sourced in your conda environment (you can do this with the command source ~/.bashrc ) otherwise you may encounter errors using PyCUTEst.

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) . 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 to your ~/.bashrc file).

Installing PyCUTEst

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.

Note that you can uninstall PyCUTEst as follows:

$ pip uninstall pycutest

Support

Please ask any questions or report problems using GitHub’s issue tracker.

Bugs

Please report any bugs using GitHub’s issue tracker.

Citing

To cite PyCUTEst, please use the following reference:

J. Fowkes, L. Roberts, and Á. Bűrmen, (2022). PyCUTEst: an open source Python package of optimization test problems. Journal of Open Source Software, 7(78), 4377, https://doi.org/10.21105/joss.04377

In BibTeX, the citation is:

@article{PyCUTEst2022,
    doi = {10.21105/joss.04377},
    url = {https://doi.org/10.21105/joss.04377},
    year = {2022},
    publisher = {The Open Journal},
    volume = {7},
    number = {78},
    pages = {4377},
    author = {Jaroslav Fowkes and Lindon Roberts and Árpád Bűrmen},
    title = {PyCUTEst: an open source Python package of optimization test problems},
    journal = {Journal of Open Source Software}
}

Contributing

We welcome contributions to PyCUTEst, please see CONTRIBUTING.md.

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.7.2.tar.gz (50.0 kB view details)

Uploaded Source

Built Distribution

pycutest-1.7.2-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file pycutest-1.7.2.tar.gz.

File metadata

  • Download URL: pycutest-1.7.2.tar.gz
  • Upload date:
  • Size: 50.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for pycutest-1.7.2.tar.gz
Algorithm Hash digest
SHA256 d8101f7d72107c18514bc65f084dddf144159e0579bfba04a3fbf86727ecbb43
MD5 d02069909724f1a72f62e1446f9a4e0c
BLAKE2b-256 e8afb8ca11affc4df8d5c1e6526abffdab573582c47dc9ebe0ea00d0a1378f07

See more details on using hashes here.

File details

Details for the file pycutest-1.7.2-py3-none-any.whl.

File metadata

  • Download URL: pycutest-1.7.2-py3-none-any.whl
  • Upload date:
  • Size: 48.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for pycutest-1.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8061cefcc8289b878ae164a6dd89367e363fe9a57d34fe6973124059b5a6e5f7
MD5 2b9eb730ae3857dd2d1342beec51852a
BLAKE2b-256 1c538cf19362464ef145caaf6a316b0fdf5e6198392927a78d36193137662e14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page