pymoto.SLP
- class pymoto.SLP(variables: Signal | Iterable[Signal], responses: Signal | Iterable[Signal], function: Network, slice_network: bool = False, move=0.1, xmin=0.0, xmax=1.0, verbosity: int = 2, adaptive_movelimit: bool = True, **kwargs)
- __init__(variables: Signal | Iterable[Signal], responses: Signal | Iterable[Signal], function: Network, slice_network: bool = False, move=0.1, xmin=0.0, xmax=1.0, verbosity: int = 2, adaptive_movelimit: bool = True, **kwargs)
SLP optimization algorithm Warning: This optimizer is experimental and is not very robust (yet)
- Parameters:
variables – One or more variable Signals defining the design variables
responses – One or more response Signals, where the first is to be minimized and the others are constraints in negative null form.
function – The Network defining the optimization problem
- Keyword Arguments:
slice_network – If True, only the modules connecting variable and response signals are evaluated
move – Move limit on relative variable change per iteration (can be passed as scalar: same value for all variables, vector: each variable has a unique value, list of scalars/vectors: for each variable signal)
xmin – Minimum design variable (can be passed as scalar: same value for all variables, vector: each variable has a unique value, list of scalars/vectors: for each variable signal)
xmax – Maximum design variable (can be passed as scalar: same value for all variables, vector: each variable has a unique value, list of scalars/vectors: for each variable signal)
adaptive_movelimit (bool) – Move limit is adapted based on variable oscillation behavior. Defaults to True.
asyincr (float) – Increase of adaptive movelimit when no oscillation is present. Default is 1.2
asydecr (float) – Decrease in adaptive movelimit when variable is oscillating. Default is 0.7
asyinit (float) – Initial adaptive movelimit value. Default is 1.0
asybound (float) – Lower bound on adaptive movelimit. Default is 1e-2
Methods
__init__(variables, responses, function[, ...])SLP optimization algorithm Warning: This optimizer is experimental and is not very robust (yet)
Calculate Jacobian dg/dx
Calculate function response g(x)
optimize([maxiter, tolx, tolf, evaluate_last])Perform a gradient-based optimization
print_iteration_info(g[, ...])Print iteration information
print_variable_info([dg])Print information on variables (and sensitivities)
step(x, g, dg)Performs a single optimization step
Attributes
Set current design variable vector
- calculate_dg()
Calculate Jacobian dg/dx
- calculate_g()
Calculate function response g(x)
- optimize(maxiter: int = 100, tolx: float = 0.0001, tolf: float = 0.0001, evaluate_last: bool = False)
Perform a gradient-based optimization
- Parameters:
maxiter (int, optional) – Maximum number of iteration. Defaults to 100.
tolx (float, optional) – Stopping criterium for relative design change. Defaults to 1e-4.
tolf (float, optional) – Stopping criterium for relative objective change. Defaults to 1e-4.
- print_iteration_info(g: ndarray, report_feasibility: bool = False, xold: ndarray = None, xnew: ndarray = None)
Print iteration information
- Parameters:
g (np.ndarray) – Response values
report_feasibility (bool, optional) – Print # violated constraints and worst value. Defaults to False.
xold (np.ndarray, optional) – If provided, shows information on design change. Defaults to None.
xnew (np.ndarray, optional) – If provided, shows information on design change. Defaults to None.
- print_variable_info(dg: ndarray = None)
Print information on variables (and sensitivities)
- Parameters:
dg (np.ndarray, optional) – If provided, information on sensitivities will also be printed. Defaults to None.
- property x
Set current design variable vector
- step(x: ndarray = None, g: ndarray = None, dg: ndarray = None) -> (<class 'numpy.ndarray'>, <class 'numpy.ndarray'>, <class 'numpy.ndarray'>)
Performs a single optimization step
- Parameters:
x (np.ndarray, optional) – The design vector to evaluate. When not provided, use information set in state
g (np.ndarray, optional) – The function values to use. When not provided, will be calculated on demand
dg (np.ndarray, optional) – The sensitivity values to use. When not provided, will be calculated on demand
- Returns:
New design vector g: (Evaluated) response values dg: (Evaluated) design sensitivities
- Return type:
xnew