cost_function.__init__
- cost_function.__init__(static_context=None, context_modifier=None, cost_evaluation=None, simulation=None, kwargs_CM={}, kwargs_S={}, kwargs_CE={}, filter=None, saver=None, file_name='cost_saver.csv', **kawrgs)[source]
Initialize a callable cost-function wrapper around context generation and simulation.
- Parameters:
static_context (Any, optional) – Serialized or in-memory simulable object used as the fixed optimization context.
context_modifier (callable, optional) – Callable mapping
(X, static_context)to a modified simulation context.cost_evaluation (callable, optional) – Callable mapping simulation results to a scalar cost.
simulation (callable, optional) – Optional custom simulation function. If omitted, the generated context is called directly.
kwargs_CM (dict, optional) – Keyword arguments forwarded respectively to the context modifier, simulation, and cost-evaluation callables.
kwargs_S (dict, optional) – Keyword arguments forwarded respectively to the context modifier, simulation, and cost-evaluation callables.
kwargs_CE (dict, optional) – Keyword arguments forwarded respectively to the context modifier, simulation, and cost-evaluation callables.
filter (callable | None, optional) – Optional preprocessing function applied to the optimization vector.
saver (callable | None, optional) – Optional callback executed after cost evaluation.
file_name (str, optional) – Default filename used by user-defined saver callbacks.
**kawrgs (dict) – Extra keyword arguments merged into the three keyword-argument dictionaries.