optiprofiler.set_plib_config

optiprofiler.set_plib_config#

optiprofiler.set_plib_config(plib, **kwargs)[source]#

Override configuration variables for a problem library.

Each keyword argument is translated to the environment variable <PLIB>_<VARIABLE> (all upper-case) so that subsequent calls to the library’s select function (directly or through benchmark) will pick up the new value. The override persists for the lifetime of the current Python process.

Parameters:
plibstr

Name of the problem library (e.g. 's2mpj', 'pycutest').

**kwargs

Configuration variables to set. The variable names must exist in the library’s config.txt; otherwise a ValueError is raised to prevent silent typos.

Raises:
FileNotFoundError

If the problem library does not have a config.txt file.

ValueError

If a variable name is not recognised.

Examples

from optiprofiler import set_plib_config, get_plib_config

set_plib_config('s2mpj', variable_size='min')
print(get_plib_config('s2mpj'))
# {'variable_size': 'min', 'test_feasibility_problems': 0}

set_plib_config('s2mpj',
                variable_size='all',
                test_feasibility_problems=2)