Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 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. determine C earliest flights and add them to set EF (Earliest Flights) //those will be the first flights for each crew
  10.  
  11. create C vertices, add them to set CV (Crew Vertices)
  12.  
  13. for each vertex i in CV and each vertex j in EF:
  14. create edge e={i,j} with upper bound 1
  15.  
  16. create vertex S, which is a source with capacity = C
  17.  
  18. for each vertex i in CV:
  19. create edge e={S,i} with upper bound 1
  20.  
  21. create vertex T, which is a sink with capacity = C
  22.  
  23. for each vertex v in FV:
  24. if v does not have any outgoing edges:
  25. create edge e={v;T} with a lower bound of 1
  26. else:
  27. create vertex in and vertex out
  28. for each edge e={v1,v2}:
  29. if v2 = v:
  30. e={v1,in}
  31. else if v1=v:
  32. e={out,v2}
  33. create edge {in,out} with lower and upper bound of 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement