optiwindnet.MILP.ortools¶
Module Contents¶
- optiwindnet.MILP.ortools.make_min_length_model(A: networkx.Graph, capacity: int, *, topology: optiwindnet.MILP._core.Topology = Topology.BRANCHED, feeder_route: optiwindnet.MILP._core.FeederRoute = FeederRoute.SEGMENTED, feeder_limit: optiwindnet.MILP._core.FeederLimit = FeederLimit.UNLIMITED, balanced: bool = False, max_feeders: int = 0) tuple[ortools.sat.python.cp_model.CpModel, optiwindnet.MILP._core.ModelMetadata][source]¶
Make discrete optimization model over link set A.
Build OR-tools CP-SAT model for the collector system length minimization.
- Parameters:
A – graph with the available edges to choose from
capacity – maximum link flow capacity
topology – one of Topology.{BRANCHED, RADIAL}
feeder_route – FeederRoute.SEGMENTED -> feeder routes may be detoured around subtrees; FeederRoute.STRAIGHT -> feeder routes must be straight, direct lines
feeder_limit – one of FeederLimit.{MINIMUM, UNLIMITED, SPECIFIED, MIN_PLUS1, MIN_PLUS2, MIN_PLUS3}
max_feeders – only used if feeder_limit is FeederLimit.SPECIFIED
- optiwindnet.MILP.ortools.warmup_model(model: ortools.sat.python.cp_model.CpModel, metadata: optiwindnet.MILP._core.ModelMetadata, S: networkx.Graph) ortools.sat.python.cp_model.CpModel[source]¶
Set initial solution into model.
Changes model in-place.
- Parameters:
model – CP-SAT model to apply the solution to.
metadata – indices to the model’s variables.
S – solution topology
- Returns:
The same model instance that was provided, now with a solution.
- optiwindnet.MILP.ortools.topology_from_mip_sol(*, metadata: optiwindnet.MILP._core.ModelMetadata, solver: SolverORTools | ortools.sat.python.cp_model.CpSolver, **kwargs) networkx.Graph[source]¶
Create a topology graph from the OR-tools solution to the MILP model.
- Parameters:
metadata – attributes of the solved model
solver – solver instance that solved the model
kwargs – not used (signature compatibility)
- Returns:
Graph topology S from the solution.