CADETProcess.optimization.OptimizationProblem.add_variable

CADETProcess.optimization.OptimizationProblem.add_variable#

OptimizationProblem.add_variable(name: str, evaluation_objects: int | list | object | None = -1, parameter_path: str | None = None, lb: float = -inf, ub: float = inf, transform: str | None = None, indices: int | tuple[int] | None = None, significant_digits: int | None = None, pre_processing: Callable | None = None) None[source]#

Add optimization variable to the OptimizationProblem.

The function encapsulates the creation of OptimizationVariable objects in order to prevent invalid OptimizationVariables.

Parameters:
namestr

Name of the variable.

evaluation_objectsEvaluationObject or list of EvaluationObjects

Evaluation object to set parameters. If -1, all evaluation objects are used. If None, no evaluation object is associated (dummy variable). The default is -1.

parameter_pathstr, optional

Path of the parameter including the evaluation object. If None, name is used.

lbfloat

Lower bound of the variable value.

ubfloat

Upper bound of the variable value.

transform{‘auto’, ‘log’, ‘linear’, None}:

Variable transform. The default is auto.

indicesint or tuple, optional

Indices for variables that modify entries of a parameter array. If None, variable is assumed to be index independent.

significant_digitsint, optional

Number of significant figures to which variable can be rounded. If None, variable is not rounded. The default is None.

pre_processingtp.Callable, optional

Additional step to process the value before setting it. This function must accept a single argument (the value) and return the processed value.

Raises:
CADETProcessError

If the Variable already exists in the dictionary.

See also

evaluation_objects
OptimizationVariable
remove_variable