optiwindnet.MILP¶
Submodules¶
Package Contents¶
- class optiwindnet.MILP.FeederLimit[source]¶
Bases:
enum.StrEnumWhether to limit the number of feeders. Both
'specified'(an upper bound) and'exactly'(an exact count) require the additional kwarg'max_feeders'. Option'balanced'is only enforceable if the feeder count is pinned to a single value, i.e.'minimum','exactly', or'specified'with'max_feeders'at the minimum.Initialize self. See help(type(self)) for accurate signature.
- UNLIMITED¶
- EXACTLY¶
- SPECIFIED¶
- MINIMUM¶
- MIN_PLUS1¶
- MIN_PLUS2¶
- MIN_PLUS3¶
- DEFAULT¶
- class optiwindnet.MILP.FeederRoute[source]¶
Bases:
enum.StrEnumIf feeder routes must be
'straight'or can be detoured ('segmented').Initialize self. See help(type(self)) for accurate signature.
- STRAIGHT¶
- SEGMENTED¶
- DEFAULT¶
- class optiwindnet.MILP.ModelMetadata[source]¶
- R: int¶
- T: int¶
- capacity: int¶
- linkset: tuple[_Link, Ellipsis]¶
- link_: collections.abc.Mapping[_Link, Any]¶
- flow_: collections.abc.Mapping[_Link, Any]¶
- model_options: dict[str, Any]¶
- fun_fingerprint: dict[str, str | bytes]¶
- weight_: tuple[float, Ellipsis] = ()¶
- solution_hint: dict[Any, float]¶
- warmed_by: str = ''¶
- class optiwindnet.MILP.ModelOptions(**kwargs)[source]¶
Bases:
dictHold options for the modelling of the cable routing problem.
Use ModelOptions.help() to get the options and their permitted and default values. Use ModelOptions() without any parameters to use the defaults.
Initialize self. See help(type(self)) for accurate signature.
- hints¶
- simple¶
- exception optiwindnet.MILP.OWNSolutionNotFound[source]¶
Bases:
ExceptionCommon base class for all non-exit exceptions.
Initialize self. See help(type(self)) for accurate signature.
- exception optiwindnet.MILP.OWNWarmupFailed[source]¶
Bases:
ExceptionCommon base class for all non-exit exceptions.
Initialize self. See help(type(self)) for accurate signature.
- class optiwindnet.MILP.SolutionInfo[source]¶
- runtime: float¶
- bound: float¶
- objective: float¶
- relgap: float¶
- termination: str¶
- class optiwindnet.MILP.Solver[source]¶
Bases:
abc.ABCCommon interface to multiple MILP solvers
- name: str¶
- metadata: ModelMetadata¶
- solver: Any¶
- options: dict[str, Any]¶
- stopping: dict[str, Any]¶
- solution_info: SolutionInfo¶
- applied_options: dict[str, Any]¶
- abstractmethod set_problem(P: networkx.PlanarEmbedding, A: networkx.Graph, capacity: int, model_options: ModelOptions, warmstart: networkx.Graph | None = None)[source]¶
Define the problem geometry, available edges and tree properties
- Parameters:
P – planar embedding of the location
A – available edges for the location
capacity – maximum number of terminals in a subtree
model_options – tree properties - see ModelOptions.help()
warmstart – initial feasible solution to pass to solver
- abstractmethod solve(time_limit: float, mip_gap: float, options: dict[str, Any] = {}, verbose: bool = False) SolutionInfo[source]¶
Run the MILP solver search.
- Parameters:
time_limit – maximum time (s) the solver is allowed to run.
mip_gap – relative difference from incumbent solution to lower bound at which the search may be stopped before
time_limitis reached.options – additional options to pass to solver (see solver manual).
- Returns:
- General information about the solution search (use
get_solution()for the actual solution).
- General information about the solution search (use
- class optiwindnet.MILP.Topology[source]¶
Bases:
enum.StrEnumSet the topology of subtrees in the solution.
Initialize self. See help(type(self)) for accurate signature.
- RADIAL¶
- BRANCHED¶
- DEFAULT¶
- optiwindnet.MILP.solver_factory(solver_name: str) _core.Solver[source]¶
Create a Solver object tied to the specified external MILP solver.
Note that the only solver that is a dependency of OptiWindNet is
'ortools'. Check OptiWindNet’s documentation on how to install optional solvers.Legacy compatibility: if
solver_name == 'ortools'then the CP-SAT backend is used.- Parameters:
solver_name – one of
'ortools.cp_sat','ortools.gscip','ortools.highs','cplex','gurobi','cbc','scip','highs'.- Returns:
Solver instance that can produce solutions for the cable routing problem.