optiwindnet.MILP ================ .. py:module:: optiwindnet.MILP Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/optiwindnet/MILP/fscip/index /autoapi/optiwindnet/MILP/ortools/index /autoapi/optiwindnet/MILP/pyomo/index /autoapi/optiwindnet/MILP/scip/index Package Contents ---------------- .. py:class:: FeederLimit Bases: :py:obj:`enum.StrEnum` Whether to limit the maximum number of feeders, if set to "specified", Initialize self. See help(type(self)) for accurate signature. .. py:attribute:: UNLIMITED .. py:attribute:: SPECIFIED .. py:attribute:: MINIMUM .. py:attribute:: MIN_PLUS1 .. py:attribute:: MIN_PLUS2 .. py:attribute:: MIN_PLUS3 .. py:attribute:: DEFAULT .. py:class:: FeederRoute Bases: :py:obj:`enum.StrEnum` If feeder routes must be "straight" or can be detoured ("segmented"). Initialize self. See help(type(self)) for accurate signature. .. py:attribute:: STRAIGHT .. py:attribute:: SEGMENTED .. py:attribute:: DEFAULT .. py:class:: ModelMetadata .. py:attribute:: R :type: int .. py:attribute:: T :type: int .. py:attribute:: capacity :type: int .. py:attribute:: linkset :type: tuple[_Link, Ellipsis] .. py:attribute:: link_ :type: collections.abc.Mapping[_Link, Any] .. py:attribute:: flow_ :type: collections.abc.Mapping[_Link, Any] .. py:attribute:: model_options :type: dict[str, Any] .. py:attribute:: fun_fingerprint :type: dict[str, str | bytes] .. py:attribute:: weight_ :type: tuple[float, Ellipsis] :value: () .. py:attribute:: solution_hint :type: dict[Any, float] .. py:attribute:: warmed_by :type: str :value: '' .. py:class:: ModelOptions(**kwargs) Bases: :py:obj:`dict` Hold 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. .. py:attribute:: hints .. py:attribute:: simple .. py:method:: help() :classmethod: .. py:exception:: OWNSolutionNotFound Bases: :py:obj:`Exception` Common base class for all non-exit exceptions. Initialize self. See help(type(self)) for accurate signature. .. py:exception:: OWNWarmupFailed Bases: :py:obj:`Exception` Common base class for all non-exit exceptions. Initialize self. See help(type(self)) for accurate signature. .. py:class:: SolutionInfo .. py:attribute:: runtime :type: float .. py:attribute:: bound :type: float .. py:attribute:: objective :type: float .. py:attribute:: relgap :type: float .. py:attribute:: termination :type: str .. py:class:: Solver Bases: :py:obj:`abc.ABC` Common interface to multiple MILP solvers .. py:attribute:: name :type: str .. py:attribute:: metadata :type: ModelMetadata .. py:attribute:: solver :type: Any .. py:attribute:: options :type: dict[str, Any] .. py:attribute:: stopping :type: dict[str, Any] .. py:attribute:: solution_info :type: SolutionInfo .. py:attribute:: applied_options :type: dict[str, Any] .. py:method:: set_problem(P: networkx.PlanarEmbedding, A: networkx.Graph, capacity: int, model_options: ModelOptions, warmstart: networkx.Graph | None = None) :abstractmethod: Define the problem geometry, available edges and tree properties :param P: planar embedding of the location :param A: available edges for the location :param capacity: maximum number of terminals in a subtree :param model_options: tree properties - see ModelOptions.help() :param warmstart: initial feasible solution to pass to solver .. py:method:: solve(time_limit: float, mip_gap: float, options: dict[str, Any] = {}, verbose: bool = False) -> SolutionInfo :abstractmethod: Run the MILP solver search. :param time_limit: maximum time (s) the solver is allowed to run. :param mip_gap: relative difference from incumbent solution to lower bound at which the search may be stopped before time_limit is reached. :param options: additional options to pass to solver (see solver manual). :returns: General information about the solution search (use get_solution() for the actual solution). .. py:method:: get_solution(A: networkx.Graph | None = None) -> tuple[networkx.Graph, networkx.Graph] :abstractmethod: Output solution topology A and routeset G. :param A: optionally replace the A given via set_problem() (if normalized A) :returns: Topology graph S and routeset G. .. py:class:: Topology Bases: :py:obj:`enum.StrEnum` Set the topology of subtrees in the solution. Initialize self. See help(type(self)) for accurate signature. .. py:attribute:: RADIAL .. py:attribute:: BRANCHED .. py:attribute:: DEFAULT .. py:function:: solver_factory(solver_name: str) -> _core.Solver 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. :param 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.