Building Test Problems

In this section, we describe the interface for finding and compiling CUTEst problems.

Finding Problems

CUTEst has a scheme for classifying problems (see here). Based on these properties, we can search for test problems using the find_problems() function. We can check the properties of a specific problem with problem_properties().

# Example: using problem classification system
import pycutest

# Find unconstrained, variable-dimension problems
probs = pycutest.find_problems(constraints='unconstrained', userN=True)
print(sorted(probs)[:5])

# Properties of problem ROSENBR
print(pycutest.problem_properties('ROSENBR'))

Which produces the output:

# List of unconstrained, variable-dimension problems
['ARGLINA', 'ARGLINB', 'ARGLINC', 'ARGTRIGLS', 'ARWHEAD']
# Properties of problem 'ROSENBR'
{'objective': 'sum of squares', 'constraints': 'unconstrained', 'regular': True, 'degree': 2, 'origin': 'academic', 'internal': False, 'n': 2, 'm': 0}

Full documentation for these functions is given below.

Building Problems

Many CUTEst problems have optional input parameters. The print_available_sif_params() function prints a list of valid parameters for a given problem. Then, we can build a problem, including optional parameters, with import_problem(). This returns an instance of the CUTEstProblem class (see next section).

# Example: building problem
import pycutest

# Print parameters for problem ARGLALE
pycutest.print_available_sif_params('ARGLALE')

# Build this problem with N=100, M=200
problem = pycutest.import_problem('ARGLALE', sifParams={'N':100, 'M':200})
print(problem)

The available parameters for this problem, as shown by PyCUTEst, are:

Parameters available for problem ARGLALE:
N = 10 (int)
N = 50 (int)
N = 100 (int)
N = 200 (int) [default]
M = 20 (int, .ge. N)
M = 100 (int, .ge. N)
M = 200 (int, .ge. N)
M = 400 (int, .ge. N) [default]
End of parameters for problem ARGLALE
# Built problem
CUTEst problem ARGLALE (params {'M': 200, 'N': 100}) with 100 variables and 200 constraints

This means that this problem has two integer parameters N and M (default 200 and 400 respectively), where N cannot be smaller than M.

Full documentation for these functions is given below.

Cache Management

PyCUTEst works by compiling each problem in its own folder inside its cache (given by the PYCUTEST_CACHE environment variable if specified, or the current working directory if not). A problem can be cleared from the cache using clear_cache(), and a list of all problems currently installed can be displayed with all_cached_problems(). Documentation for these functions is given below.

Full function documentation

Please click on a pycutest function below for full documentation:

find_problems([objective, constraints, ...])

Returns the problem names of problems that match the given requirements.

problem_properties(problemName)

Returns problem properties (based on the CUTEst problem classification string).

print_available_sif_params(problemName)

Call sifdecode on given problem to print out available parameters This function is OS dependent.

import_problem(problemName[, destination, ...])

Prepares a problem interface module, imports and initializes it.

clear_cache(problemName[, sifParams])

Deletes a saved problem.

all_cached_problems()

Return a list of all cached problems.