ConstraintsFunc

class pyoptex.doe.constraints.ConstraintsFunc(fn, **kwargs)[source]

Extension of python functools.partial with lazy evaluation of the function string for the constraints. On first call, the function string is evaluated and the resulting function is cached.

Attributes

fnstr or callable

The function string to evaluate, or a callable function if the function has been called before.

kwargsdict

The keyword arguments to pass to the function.

evaluatedbool

Whether the function has been evaluated. This determines the type of the fn attribute.

__init__(fn, **kwargs)[source]

Creation of the function object.

Parameters

fnstr

The function string to evaluate on first call.

kwargsdict

The keyword arguments to pass to the function.

Methods

ConstraintsFunc.__call__(*args, **kwargs)

Calls the function and evaluates it if necessary.

ConstraintsFunc.clear()

Removes the pre-compiled (and cached) function.