pypsa.optimization.optimize.OptimizationAccessor.__call__

pypsa.optimization.optimize.OptimizationAccessor.__call__#

OptimizationAccessor.__call__(snapshots: Sequence | None = None, multi_investment_periods: bool = False, transmission_losses: int = 0, linearized_unit_commitment: bool = False, model_kwargs: dict = {}, extra_functionality: Callable | None = None, assign_all_duals: bool = False, solver_name: str = 'highs', solver_options: dict = {}, compute_infeasibilities: bool = False, **kwargs: Any) tuple[str, str]#

Optimize the pypsa network using linopy.

Parameters:
  • n (pypsa.Network)

  • snapshots (list or index slice) – A list of snapshots to optimise, must be a subset of n.snapshots, defaults to n.snapshots

  • multi_investment_periods (bool, default False) – Whether to optimise as a single investment period or to optimise in multiple investment periods. Then, snapshots should be a pd.MultiIndex.

  • transmission_losses (int, default 0) – Whether an approximation of transmission losses should be included in the linearised power flow formulation. A passed number will denote the number of tangents used for the piecewise linear approximation. Defaults to 0, which ignores losses.

  • linearized_unit_commitment (bool, default False) – Whether to optimise using the linearised unit commitment formulation or not.

  • model_kwargs (dict) – Keyword arguments used by linopy.Model, such as solver_dir or chunk.

  • extra_functionality (callable) – This function must take two arguments extra_functionality(n, snapshots) and is called after the model building is complete, but before it is sent to the solver. It allows the user to add/change constraints and add/change the objective function.

  • assign_all_duals (bool, default False) – Whether to assign all dual values or only those that already have a designated place in the network.

  • solver_name (str) – Name of the solver to use.

  • solver_options (dict) – Keyword arguments used by the solver. Can also be passed via **kwargs.

  • compute_infeasibilities (bool, default False) – Whether to compute and print Irreducible Inconsistent Subsystem (IIS) in case of an infeasible solution. Requires Gurobi.

  • **kwargs – Keyword argument used by linopy.Model.solve, such as solver_name, problem_fn or solver options directly passed to the solver.

Returns: