Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def MaxFlow():
# ==============
# Let's generate some example data; SOL has some functions to help with that.
# ==============
# A complete topology
topo = complete_topology(5)
# ingress-egress pairs, between which the traffic will flow
iePairs = [(0, 3)]
# generate a traffic matrix, in this case, a uniform traffic matrix with a million flows
trafficMatrix = provisioning.uniformTM(
iePairs, 10 ** 6)
# compute traffic classes. We will only have one class that encompasses all the traffic;
# assume that each flow consumes 2000 units of bandwidth
trafficClasses = generateTrafficClasses(iePairs, trafficMatrix, {'allTraffic': 1},
{'allTraffic': 2000})
# since our topology is "fake", provision our links and generate link capacities in our network
linkcaps = provisioning.provision_links(topo, trafficClasses, 1)
# these will be our link constraints: do not load links more than 50%
linkConstrCaps = {(u, v): .5 for u, v in topo.links()}
# ==============
# Optimization
# ==============
# Start our optimization.
# SOL automatically takes care of the path generation, but it needs the topology, traffic classes, path predicate
def MaxFlow():
# ==============
# Let's generate some example data; SOL has some functions to help with that.
# ==============
# A complete topology
topo = complete_topology(5)
# ingress-egress pairs, between which the traffic will flow
iePairs = [(0, 3)]
# generate a traffic matrix, in this case, a uniform traffic matrix with a million flows
trafficMatrix = provisioning.uniformTM(
iePairs, 10 ** 6)
# compute traffic classes. We will only have one class that encompasses all the traffic;
# assume that each flow consumes 2000 units of bandwidth
trafficClasses = generateTrafficClasses(iePairs, trafficMatrix, {'allTraffic': 1},
{'allTraffic': 2000})
# since our topology is "fake", provision our links and generate link capacities in our network
linkcaps = provisioning.provision_links(topo, trafficClasses, 1)
# these will be our link constraints: do not load links more than 50%
linkConstrCaps = {(u, v): .5 for u, v in topo.links()}
# ==============
# Optimization
# ==============
# Start our optimization.
# SOL automatically takes care of the path generation, but it needs the topology, traffic classes, path predicate