Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for each flight:
- create vertex v
- add v to FV(Flight Vertices)
- for each pair of flights{flight1,flight2}:
- 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
- create an edge e={flight1,flight2} with upper bound 1
- create vertex S, which is a source with capacity = C
- create vertex T, which is a sink with capacity = C
- for each vertex v in FV:
- //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
- create vertex in and vertex out
- for each edge e={v1,v2}:
- if v2 = v: //take all edges that are incoming to v, make them incoming to out instead
- e={v1,in}
- else if v1=v: //take all edges that are outgoing from v; mae them outgoing from out instead
- e={out,v2}
- create edge {in,out} with lower and upper bound of 1
- create edge {out,T} with no bounds
- create edge {S,in} with upper bound of 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement