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
- determine C earliest flights and add them to set EF (Earliest Flights) //those will be the first flights for each crew
- create C vertices, add them to set CV (Crew Vertices)
- for each vertex i in CV and each vertex j in EF:
- create edge e={i,j} with upper bound 1
- create vertex S, which is a source with capacity = C
- for each vertex i in CV:
- create edge e={S,i} with upper bound 1
- create vertex T, which is a sink with capacity = C
- for each vertex v in FV:
- if v does not have any outgoing edges:
- create edge e={v;T} with a lower bound of 1
- else:
- create vertex in and vertex out
- for each edge e={v1,v2}:
- if v2 = v:
- e={v1,in}
- else if v1=v:
- e={out,v2}
- create edge {in,out} with lower and upper bound of 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement