BaseSolver

class baseclasses.BaseSolver(name, category, defaultOptions={}, options={}, immutableOptions={}, deprecatedOptions={}, comm=None, informs={}, checkDefaultOptions=True, caseSensitiveOptions=False)[source]

Abstract Class for a basic Solver Object

Solver Class Initialization

Parameters:
namestr

The name of the solver

categorydict

The category of the solver

defaultOptionsdict, optional

The default options dictionary

optionsdict, optional

The user-supplied options dictionary

immutableOptionsset of strings, optional

A set of immutable option names, which cannot be modified after solver creation.

deprecatedOptionsdict, optional

A dictionary containing deprecated option names, and a message to display if they were used.

commMPI Communicator, optional

The comm object to be used. If none, serial execution is assumed.

informsdict, optional

A dictionary of exit code: exit message mappings.

checkDefaultOptionsbool, optional

A flag to specify whether the default options should be used for error checking. This is used in cases where the default options are not the complete set, which is common for external solvers. In such cases, no error checking is done when calling setOption, but the default options are still set as options upon solver creation.

caseSensitiveOptionsbool, optional

A flag to specify whether the option names are case sensitive or insensitive.

getModifiedOptions()[source]

Prints a nicely formatted dictionary of all the modified solver options to the stdout on the root processor

getOption(name)[source]

Default implementation of getOption()

Parameters:
namestr

Name of option to get. Not case sensitive

Returns:
valuevaries

Return the current value of the option.

pp(obj, flush=True)[source]

This method prints obj (via pprint) on the root proc of self.comm if it exists. Otherwise it will just print obj.

Parameters:
objobject

Any Python object to be printed

flushbool

If True, the stream will be flushed.

printModifiedOptions()[source]

Prints a nicely formatted dictionary of all the current solver options that have been modified from the defaults to the root processor

printOptions()[source]

Prints a nicely formatted dictionary of all the current solver options to the stdout on the root processor

setOption(name, value)[source]

Default implementation of setOption()

Parameters:
namestr

Name of option to set. Not case sensitive.

valuevaries

Value to set. Type is checked for consistency.