optiwindnet.MILP¶
Submodules¶
Package Contents¶
- class optiwindnet.MILP.FeederLimit[source]¶
Bases:
enum.StrEnumWhether to limit the maximum number of feeders, if set to âspecifiedâ,
Initialize self. See help(type(self)) for accurate signature.
- UNLIMITED¶
- 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_limit is 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).
- 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.