Individual Assignment 2 – PyFlights
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
Individual Assignment 2 – PyFlights
Objectives
At the completion of the individual assignment, you should:
1. Develop a better understanding of how to apply the computational problem solving process to a complex problem that requires the use of appropriate data structures and algorithms.
2. Implement procedural and object-oriented programming paradigms in Python.
3. Apply appropriate user-defined data structures and algorithms.
General Requirements
You are required to develop a Python program known as PyFlights, which is essentially a flight ticket reservation system for a typical online travel agency. PyFlights allows passengers to book flight tickets from multiple airlines based on the desired criteria such as availability, time, lowest airfare, lesser number of stopovers, shortest stopover time and shortest flight time.
Commercial airlines mainly use two different types of network structure when planning and scheduling flights – hub-and-spoke network structure and point-to-point network structure.
Figure 1 – An example of a connecting hub network. (Belobaba, Odoni and Barnhart 2009, pp. 163, Figure 6.5)
In a hub-and-spoke network structure, flights are organised into multiple flight segments. Each flight segment represents an origin–destination (O-D) market, typically between two cities (or rather two airports of the two cities). A hub-and-spoke network structure allows airlines to serve many O-D markets with fewer flight departures, requiring fewer aircrafts and generating fewer ASK (Available Seat Kilometers) at lower total operating costs than in a complete point-to-point route network. An example of a simple connecting hub network with 20 flights into and 20 flights out of a single “connecting bank” at a hub airport is shown in Figure 1.
A “connecting bank” refers to a hub operation in which many aircrafts arrive at the hub airport, passengers and baggage are moved between connecting flights, and the aircrafts then depart with the connecting passengers and baggage on board. Connecting banks last from approximately 1 hour in smaller domestic hub networks to 2–3 hours in larger international hub networks.
In this example of a connecting bank with 20 arriving flights followed by 20 departing flights, each flight leg arriving or departing the hub simultaneously serves 21 O-D markets – one “local” market between the hub and the spoke, plus 20 additional “connecting” markets if we assume a single direction of passenger flow. This single connecting bank thus provides service to a total of 440 O-D markets with only 40 flight legs and as few as 20 aircraft flying through the hub. In contrast, a complete “point-to-point” network providing non-stop service to each market would require 440 flight legs and hundreds of aircrafts, depending on scheduling requirements. Of course, it is entirely possible for an airline to operate a mixture of direct flights (especially for high-value markets) and hub-and-spoke network.
In practice, each flight route consisting of an origin-destination (O-D) pair is referenced by two points. Each point refers to a specific airport identified by its IATA code located in a particular city, state/province and country. Suppose we have a hypothetical airline Merlion Airlines (IATA code: ML). Let’s take an O-D pair of Singapore Changi Airport (IATA code: SIN) and Narita International Airport in Narita, Chiba, Japan (IATA code: NRT), i.e., SIN- NRT, as an example. A passenger in Singapore could take a direct flight from Singapore to Narita, e.g., flight ML123 SIN-NRT. A passenger travelling from Sidney Airport in Sidney, New South Wales, Australia (IATA code: SYD) to Narita could take a flight ML456 SYD- SIN to Singapore before connecting to ML123 SIN-NRT to complete the entire trip SYD- SIN-NRT. It is also possible that the airline offers a direct flight from Sydney to Narita, e.g., ML789 SYD-NRT. Passengers choose between direct flight and connecting flight with one or more stopovers according to various factors such as availability, time, price, and stopover duration.
Each aircraft is configured into one or more cabin classes or booking classes, each with its own seating capacity. An airline typically offers four cabin classes, i.e., first class (F), business class (J), premium economy class (W) and economy class (Y). Each cabin class has its own seat configuration organised into one or two aisles with up to seven to ten seats abreast. For example, the economy cabin class of a wide-body aircraft is typically configured into 3-4-3 with two aisles. The left and right columns have three seats abreast and the middle column has four seats abreast. For simplicity, you may ignore booking classes for this assignment. In other words, all seats in a same cabin class would be sold at the same rate and restrictions.
Figure 2 – An Airbus A380 layout with 519 seats displayed.
Each seat is designated by a row number followed by a letter. For the purpose of this assignment, you may assume that row numbers and seat letters are sequential with no skipping. It is also not necessary to skip letters that may be confused with numbers (e.g., I, O, Q, S, or Z). In the preceding example of a 3-4-3 seating configuration, the seats in row 32 would be designated as 32A to 32J.
Figure 3 – Real-world seat designation with right-hand 3 seats skip over letter “I”
Design and Implementation of Classes
Design a set of suitable classes together with the necessary inheritance and/or association relationships to represent a set of airlines, aircraft types, flights, passengers and flight tickets to enable the online travel agency to maintain a database of flights for selling flight tickets to passengers.
For simplicity, you may assume that each airline operates a few types of aircrafts, but it is not necessary to manage the actual fleet of aircrafts. It is also not necessary to assign an aircraft to a particular flight. It would suffice to assign an aircraft type to a flight. When searching for available flights, you may assume that connecting flights must be from the same airline. In real-world context, it is possible to have connecting flights from different airlines but that would require a passenger to retrieve his/her luggage and recheck the luggage on the connecting flight with a different airline.
It is mandatory to apply the object-oriented programming paradigm to this assignment. Otherwise, you would only be awarded 50% of the marks for the use cases.
2022-11-17