Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. for each flight:
  2. create vertex v
  3. add v to FV(Flight Vertices)
  4.  
  5. for each pair of flights{flight1,flight2}:
  6. if flight1 and flight 2 can be executed by the same crew: //considering time (flight2 starts at least an hour after flight1 ends) and space (flight1 ends where flight2 starts) constraits
  7. create an edge e={flight1,flight2} with upper bound 1
  8.  
  9.  
  10. create vertex S, which is a source with capacity = C
  11.  
  12. create vertex T, which is a sink with capacity = C
  13.  
  14. for each vertex v in FV:
  15. //create a capacity of 1 (both lower and upper bound) for each flight node through splitting the node into two and creating an inner edge with lower and upper bound of 1
  16. create vertex in and vertex out
  17. for each edge e={v1,v2}:
  18. if v2 = v: //take all edges that are incoming to v, make them incoming to out instead
  19. e={v1,in}
  20. else if v1=v: //take all edges that are outgoing from v; mae them outgoing from out instead
  21. e={out,v2}
  22. create edge {in,out} with lower and upper bound of 1
  23.  
  24. create edge {out,T} with no bounds
  25. create edge {S,in} with upper bound of 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement