# Tag Info

1

Your problem description is quiet vague. So i picked the simplest solution to his problem i can think off in modeling language JuMP. If you are more detailed about the reality you are working with a better model can be chosen. clients = 24 servers = 3 using JuMP using GLPK class = Model(with_optimizer(GLPK.Optimizer)) cost = rand(clients, servers) # cost ...

5

Introduce a supersource node $s$, a supersink node $t$, arcs from $s$ to each source, and arcs from each sink to $t$. Arc $(s,i)$ has zero cost and capacity equal to supply[i]. Arc $(i,t)$ has zero cost and capacity equal to -supply[i]. All original nodes have supply zero, $s$ has supply equal to the sum of positive supplies, and $t$ has supply equal to ...

2

One way to model this is to add a dummy arc from the sink to the source and impose flow balance of 0 at every node, including the source and sink. But if you prefer the conditional constraint, I think the proper syntax is: m.addConstrs( (flow.sum('*',j) - flow.sum(j,'*') == 0 for j in vertices if j != 2 and j != 7), "node")

Top 50 recent answers are included