pockit.optimizer.scipy

def solve( system: pockit.base.systembase.SystemBase, guess: pockit.base.variablebase.VariableBase | list[typing.Union[pockit.base.variablebase.VariableBase, typing.Iterable[float]]], optimizer_options: Optional[dict] = None) -> tuple[pockit.base.variablebase.VariableBase | list[typing.Union[pockit.base.variablebase.VariableBase, typing.Iterable[float]]], typing.Any]:

Solve the system using trust-constr method of scipy.optimize.minimize().

If the system has only one phase and no static variables, guess can be a single Variable object. Otherwise, guess should be a list of Variable objects, one for each Phase, followed by an array as values of static variables.

Optimizer options should be a dictionary of options to pass to scipy.optimize.minimize(). See Scipy documentation for available options. Options will be passed verbatimly.

Arguments:
  • system: System to solve.
  • guess: Guess to the solution.
  • optimizer_options: Options to pass to scipy.optimize.minimize().
Returns:

The value returned by scipy.optimize.minimize() parsed as the same format as guess (a single Variable object or a list of Variable objects and a array for static values), and the raw output returned by scipy.optimize.minimize().