mod += sum([s[k] for k in sources]) == 1
for k in dist:
    mod += y[k] <= sum([x[t] for t in trains if t[0] == k[0] and t[1] == k[
        1] or t[1] == k[0] and t[0] == k[1]])
mod.solve()
for t in trains:
    pass
Graph with distance and travelling times: find most km's in 24 hours (with constraints)