optiwindnet.MILP ================ .. py:module:: optiwindnet.MILP Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/optiwindnet/MILP/ortools/index /autoapi/optiwindnet/MILP/pyomo/index Package Contents ---------------- .. py:class:: FeederLimit Bases: :py:obj:`enum.StrEnum` Whether to limit the maximum number of feeders, if set to "specified", additional kwarg "max_feeders" must be given. .. 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"). .. 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 .. py:attribute:: link_ :type: Mapping .. py:attribute:: flow_ :type: Mapping .. py:attribute:: model_options :type: dict .. py:attribute:: fun_fingerprint :type: dict[str, str | bytes] .. 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. .. py:attribute:: hints .. py:attribute:: simple .. py:method:: help() :classmethod: .. 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:: solver_options :type: dict[str, Any] .. py:attribute:: solution_info :type: SolutionInfo .. py:method:: set_problem(P: networkx.PlanarEmbedding, A: networkx.Graph, capacity: int, model_options: ModelOptions) :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() .. py:method:: solve(time_limit: int, 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) -> 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. .. py:attribute:: RADIAL .. py:attribute:: BRANCHED .. py:attribute:: DEFAULT .. py:function:: solver_factory(solver_name: str) 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. :param solver_name: one of 'ortools', 'cplex', 'gurobi', 'cbc', 'scip', 'highs'. :returns: Solver instance that can produce solutions for the cable routing problem.