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, PyCUTEst can be used through the Windows Subsystem for Linux, following the Linux installation instructions.

Installing CUTEst on Linux

Here we detail the new installation approach using the meson build system, alternative installation approaches (including the traditional installation approach) are described in the install docs.

You will need to install meson (apt install meson on Ubuntu) and three packages: SIFDecode, CUTEst and MASTSIF. To keep things simple, clone all three packages into the same directory:

$ mkdir cutest
$ cd cutest
$ 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.

First we need to compile and install SIFDecode (requires gfortran and gcc):

$ cd sifdecode
$ meson setup builddir
$ meson compile -C builddir
$ sudo meson install -C builddir

And SIFDecode should run from here. To test that the installation works, issue the command:

$ meson test -C builddir

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

$ cd ../cutest
$ meson setup builddir -Dmodules=false
$ meson compile -C builddir
$ sudo meson install -C builddir

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

$ meson test -C builddir

Finally set the following environment variable in your ~/.bashrc to point to the MASTSIF installation directory used above:

# CUTEst
export MASTSIF=/path/to/cutest/mastsif/

It is also possible to install SIFDecode and CUTEst to custom locations using the --prefix argument to meson setup. In this case you will also need to set the SIFDECODE and CUTEST environment variables to the install prefix.

Installing CUTEst on Mac

Here we detail the new installation approach using the meson build system, alternative installation approaches (including the traditional installation approach) are described in the install docs.

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 GCC and the meson build system:

$ brew install gcc meson

CUTEst can now be installed using the meson build system. You will need to install three packages: SIFDecode, CUTEst and MASTSIF. To keep things simple, clone all three packages into the same directory:

$ mkdir cutest
$ cd cutest
$ 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.

First we need to compile and install SIFDecode (requires Homebrew gcc):

$ cd sifdecode
$ meson setup builddir
$ meson compile -C builddir
$ sudo meson install -C builddir

And SIFDecode should run from here. To test that the installation works, issue the command:

$ meson test -C builddir

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

$ cd ../cutest
$ meson setup builddir -Dmodules=false
$ meson compile -C builddir
$ sudo meson install -C builddir

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

$ meson test -C builddir

Finally set the following environment variable in your ~/.zshrc or ~/.bashrc to point to the MASTSIF installation directory used above:

# CUTEst
export MASTSIF=/path/to/cutest/mastsif/

It is also possible to install SIFDecode and CUTEst to custom locations using the --prefix argument to meson setup. In this case you will also need to set the SIFDECODE and CUTEST environment variables to the install prefix.

Anaconda Users: please ensure that ~/.zshrc or ~/.bashrc is sourced in your conda environment (you can do this with the command source ~/.zshrc or 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 (15.0) than being linked (14.0) . To suppress these warnings please set the environment variable MACOSX_DEPLOYMENT_TARGET to your current macOS version (e.g. export MACOSX_DEPLOYMENT_TARGET=15.0 in this example, you can make this permanent by adding it to your ~/.zshrc or ~/.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.8.0.tar.gz (50.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycutest-1.8.0-py3-none-any.whl (49.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycutest-1.8.0.tar.gz
  • Upload date:
  • Size: 50.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycutest-1.8.0.tar.gz
Algorithm Hash digest
SHA256 d7b81aeb98c5357766416be5316d225cbb0c68240d23b164d398acdb74c0cc65
MD5 7bfe0a8d2d22735a69dcf510a8d2e548
BLAKE2b-256 259dade8710d0dd8f7c284fe2e068ec5525f7bc6987fc3e834b47ad2b49836f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycutest-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 49.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycutest-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28bf16346698cec1ec3e1cd01b7b3192c8f144d5b9b3aaf05199af52e24d5dfe
MD5 7f4eddea697e9f9c9a4e1379cd1cd1c0
BLAKE2b-256 3cd56ed8cfb5ba81aac8d926986eb2f68ede8feb3d23740d60a62bee09a5e9b0

See more details on using hashes here.

Supported by

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