Dynamic Model of Contingency Flight Crew Planning Extending to Crew Formation

: The creation of a ﬂight schedule and the associated crew planning are clearly among the most complicated tasks in terms of trafﬁc preparation. Even with a relatively small number of pilots and aircraft, numerous speciﬁc constraints arising from real operations must be included in the calculation, thus increasing the complexity of the planning process. However, even in a precision-planned operation, non-standard situations often occur, which must be addressed ﬂexibly. It is at this point that an operational solution must be applied, the aims of which are to stabilize the ﬂight schedule as soon as possible and minimize the ﬁnancial impacts resulting from the non-standard situation. These problems are resolved by the airline’s Operational Control Center, which also uses various software approaches to solve the problem. The problem is approached differently by large air carriers, which use software products to address it, and small and medium-sized air carriers, which resolve the issue of operational rescheduling intuitively, based on the experience of dispatchers. However, this intuitive approach can lead to inaccuracies that can lead to unnecessary ﬁnancial losses. In this paper, we present an optimization model that can serve as a tool to support the decision-making of employees of the operations centers of smaller and medium-sized air carriers.


Introduction-Motivation for Solution
Over its relatively short history, air transport has become an integral part of the globalized world. Not everyone, however, is aware that the undertaking of one regularly scheduled flight involves more than a year's work of numerous people who are responsible for ensuring all activities happen according to plan. Planning air traffic requires creating many plans. The basic type of plan is the flight schedule. During the calendar year, the flight schedule is compiled for two consecutive planning periods. The creation of the flight schedule itself consists of three basic phases-the strategic phase, the tactical phase, and the operational phase.
During the strategic phase of the preparation of the flight schedule, which begins approximately one year before its taking effect, an anticipated set of destinations is created that the carrier is interested in serving. The destinations are assigned sequences of planned flights with estimated departure and arrival times and the types of aircraft under consideration to be used to operate routes to the destinations.
During the tactical phase, the flight schedule is adjusted depending on the partner companies and airport capacities. After the coordination of all interested parties, specific aircraft are assigned to the planned flights and the flight schedule is publicly published and published in sales and distribution systems.
The final operational phase takes place 3-6 months before the start of operations according to the planned flight schedule. In this phase, crews are also assigned to individual flights, thus completing the process of creating a flight schedule [1].
Assembling the crews is a chapter all on its own in air traffic planning. However, it is very closely connected with the planning of the use of the aircraft fleet and the implementation of the flight schedule. The process of creating flight crews and their deployment consists of three steps-crew creation, crew pairing and crew rostering. In the first step, it is necessary to form permissible pairs from the set of all pilots available to the airline, which can form a crew. The creation of crews is limited by numerous restrictions, such as the composition of the crews themselves, whereas the crew, as a rule, is always made up of the captain and the first officer (FO). It is not possible for the crew to consist of two first officers. It is also not recommended that the crew consist of two captains, which could result in a threat to flight safety due to a clash of authorities. Another factor is seniority, i.e., the division of pilots depending on work experience with the employer. Seniority is mainly related to the knowledge of internal procedures and rules at the airline. Pilots are thus divided into two groups-experienced and inexperienced. The aim is to avoid having the crew made up of two pilots who are both designated as inexperienced. In addition to seniority as such, of course, experience in the form of the real flight hours of each pilot is also considered. The number of hours flown is calculated depending on the type of aircraft and depending on the position (captain vs. first officer). A limiting factor for the creation of crews is age. For safety reasons, it is not possible for the crew to consist of two pilots over the age of 60. During various training processes (e.g., when retraining for a new type of aircraft), pilots can be divided into two groups-instructor pilot and trainee pilot. The crew must always consist of a combination of the two. It is not possible for two pilots with training designation to sit side by side in the cockpit. Finally, the creation of crews and their subsequent assignment to flights depends on the destination, specifically on the category of the destination airport. Airports are divided into three categories according to the complexity of the procedures for approaches and departures-A, B, C and the crew must always consist of at least one pilot who has valid training for the relevant category of the airport. This composition is addressed in the conditions of B and C category airports because the category A concerns airports that are easy to approach and take off from, and therefore all pilots have the relevant classification. Personal and family reasons can be an important factor in assembling crews. To take these into account, the so-called Bidding process is used, with the help of which the requirements of pilots for the planning process are (can) be considered. Even pilots are only humans and there is a probability that two pilots can have an aversion to each other, which could have a negative impact on flight safety when putting together a joint crew. For the same reason, it is not recommended to create pilot crews composed of family members.
The second step of the crew formation process is crew pairing. This step involves the creation of short-term pilot plans, usually for a period of one month. This plan is made up of a sequence of flight segments starting and ending usually at the home airport. The duration of a sequence ranges from 1 to 5 days. The sequences of flight segments contain the individual flights to be served by the pilot during the interval. The objective of this step is to cover the set of all scheduled flights with a minimum number of crews.
The third step in the process of creating flight crews is crew rostering, sometimes called crew assignment. During this third step, additional activities such as training, education, study, or vacation requirements will be incorporated into the crew schedule.
In addition to the constraints mentioned above, human performance constraints, as defined in Regulation 1899/2006 of the European Parliament and of the Council (EU-OPS), Subpart Q [2], may also affect the crew formation process. The above-mentioned regulation clearly states the limits on flight duty time and time on duty. The operator must ensure that: • the crew member's total hours of service did not exceed 190 h over 28 consecutive days, • the crew member's total hours of service did not exceed 60 h over 7 consecutive days, • the total flying time on which the crew member is deployed does not exceed 900 h in a calendar year, • the total flying time on which the crew member is deployed does not exceed 100 h over 28 consecutive days.
• The regulations stipulate that the base daily flight duty time of a crew member is 13 h. In staffing pilots for duty, the regulations recommend that the distribution of flight performance over time should be as even as possible.
occur in emergency situations when an aircraft is in difficulty and surrounding flights need to be diverted. Another type of contingency is the closure of part of the airspace, which at the same time is not an exceptional event. The closure of part of the airspace may be due to military operations (however, only local airspace (TRA, TSA) is affected), but in some cases the entire airspace is also closed, such as in February 2019, when Pakistan closed the entire airspace over its territory [5]. In some extreme cases, a situation may arise when a country's airspace is closed to a particular type of aircraft, as happened in March 2019, when the Boeing B-737 MAX was restricted from entering the airspace of individual nations [6]. Some aircraft of the given type then had to land outside their final destinations and passengers were subsequently picked up by aircraft of a different type.
Other emergencies that can significantly disrupt flight plans may be strikes by airline staff, air traffic controllers, airport staff or handling staff.
Delays for other reasons (accumulation of delays) are mainly caused by traffic at takeoff and landing airports. These problems at airports usually occur during peak periods, when there is an accumulation of delays that cascade to other flights.
The situations described above make it clear that crew scheduling is a very extensive problem, with many restrictions that must be satisfied, making it a very complex task. Today, it is virtually impossible to imagine crew scheduling in the context of large airlines without the possibility of using IT, yet there are still airlines operating in the market where this was common practice still not long ago. Until the 1970s, everything was planned manually based on the experience of the employees. It took a team of eight planners several weeks to create a crew work schedule. However, a breakthrough occurred in the 1970s when IBM developed the first crew scheduling software. In the 1990s, most major airlines started using IT for crew scheduling. At the same time, there was a major development in the mathematical approaches that were used for scheduling purposes. Depending on computing power, they were able to create crew turnarounds numbering up to 7000 pilots within 14 h. Regardless of the solution, these software solutions can save an airline a lot of money. This effect is particularly evident in situations where there is an emergency that needs to be dealt with quickly, as any instability in the flight schedule can lead to large financial losses. Despite all the progress, there are still a relatively large number of small airlines that deal with the prompt rescheduling of crews in the event of an emergency manually without the use of IT. This is mainly for financial reasons. These are the relatively high acquisition costs of the software and hardware itself, as well as the costs of training personnel to work with these systems. Another problem is the interconnection of the software enabling crew planning with existing systems that the airline already uses in its operations. It is therefore often necessary to spend additional funds to create interfaces for cooperation between the systems. Therefore, many airlines prefer to incur financial losses due to imperfect handling of operational emergencies at the expense of investing in software support [7].
Staffing solutions for emergency situations depend primarily on the cause that requires crew replacement and then on the location of the emergency.
Essentially, only two causes for a crew not being able to continue can be: • Using up of the allowed daily work hours, • Health complications.
If the crew has exhausted the permitted daily time on duty, it is possible for them to resume duty after a specified period of rest. However, if a crew member has health complications, his or her early return to duty is not expected. These facts must then be considered when dealing with an emergency.
The locations in which an emergency arises can also be divided into two groups: • An emergency arising at base (the airline's home airport), • An emergency arising away from base. In the first instance, the airline's operational control center has the possibility of choosing one of the solution options: • Deploying a stand-by crew, • Deploying a crew originally scheduled for another flight, • Deploying pilots fulfilling other than their direct flight obligations at the airport (on duty), • Deploying pilots currently on personal leave.
Most airlines maintain stand-by crews to minimize the impact of emergencies. The stand-by mode can be implemented in two forms-either the pilots are available directly at the airport or they are within driving distance of the airport. Both methods have their advantages and disadvantages. The advantage of placing a backup crew directly at the airport is its immediate availability. The disadvantage is that if the pilot performs reserve duty at the airport, then the time spent by performing this standby duty is included in the time allowed on duty, which limits the possibilities of using that pilot. Conversely, if the pilot is on standby within driving distance of the airport, then the pilot's time is not counted as on duty. Time begins to count towards the time allowed on duty only at the time of the pilot's transfer to work in the event of an emergency. On the other hand, it is necessary to consider a certain loss of time associated with the transfer of the pilot to the airport and his or her preparation for the flight.
Another way to replace the crew affected by an emergency is to replace it with the crew of another flight. The airline's aim is to minimize delays, so in some situations it may be more advantageous to deploy a crew that is the most available at the current time, i.e., a crew waiting for another flight at the airport. Subsequently, upon arrival, the backup crew (considering a situation where stand-by is performed outside the airport) will replace the crew originally waiting at the airport. A limitation of this situation may be that the assigned crew may already have exhausted part of their time on duty as a result of the previous flight.
In extreme cases, to mitigate the consequences of an emergency, the airline may use pilots who are performing non-flight tasks related to their performance of duty at the airport. These are, for example, various trainings. The pilots are at the airport and are therefore theoretically available, even if they do not have scheduled flight duty. Similarly, it is possible to contact a pilot who is taking personal time off. In both cases, however, the pilot may refuse an unplanned duty deployment because he or she is not obliged to perform actions beyond his or her long-term plan submitted by the airline.
In the event of an emergency away from the airport, the operations centers are markedly limited and are as follows: • Transport of the reserve crew to the airport of departure of the delayed flight, • Deployment of a crew from another flight, • Reassignment of the crew after the compulsory rest period.
Resolving an emergency away from the base is always a complicated problem. The first option that presents itself is to send a backup crew. This entails great time and financial costs associated with the transfer of the crew to the airport of departure of the flight affected by the emergency. Depending on the distance of the airport and the possibilities of transporting the crew, the crew can be transported by another air connection, a train connection or the pilots may be transported by individual car transport. It is important, however, that the time for the transfer to the airport of departure is included in the pilots' time on duty.
Another way to solve the problem of crew replacement is to deploy another crew that has another flight scheduled in the same destination. As in the base situation, it is important that delays are not passed on to other flights due to crew rerouting. The backup crew will board the originally scheduled flight, which will reach its destination later than planned. Additionally, the airline must also solve the problem of further use of the crew from the delayed flight, which will be available at the destination (whether it will take mandatory rest or will be deployed to another flight at a later time).
The final option is to re-deploy the crew. This option is only permissible in a situation where the crew is in good health and the only reason they cannot continue is that they have exhausted the daily on duty time limit. This solution is applied in a situation where the airline does not have another reserve crew available or in a situation where the transport of the reserve crew would exceed the time the original crew needs to rest to continue the service. This applies to situations where an emergency occurs in one of the more distant destinations from the base. In such situations, the crew and passengers are accommodated in alternative accommodation and the flight is subsequently undertaken only after the expiration of the statutory rest period of the crew.
All the above operational measures carry with them additional costs, which the airline must expend to eliminate the consequences of emergencies.
As the description of the above-mentioned emergency situations, which may disrupt the scheduled operation of individual flights, shows, delays as such do not only generate time loss for passengers, but above all significant financial costs for the airline. Of course, the airline does not always have to cover these costs from its own resources. It depends on the actual cause of the incident. If it was the fault of the airline, such as a technical fault due to lack of maintenance, then all costs arising from the subsequent emergency must be paid by the airline. If the emergency is not caused by the airline and could not have been foreseen by the airline, the airline is not obliged to compensate passengers financially. However, it should also be noted that the airline is always obliged to provide care for passengers affected by the occurrence of the extraordinary event causing the delay. If the cause is not attributable to the airline, the airline shall recover the additional costs from the originator of the incident, or the costs shall be covered by the airline's insurance.
The extent of the additional operating costs incurred depends on the situation that arises. In the event of a delay on the ground, it is important to remember that the aircraft is still in operation and is only waiting to depart. This means that it is necessary to ensure the functionality of all systems on board, such as hydraulic, air or pneumatic systems. Therefore, a power source is required, which may be an engine start, an auxiliary power unit (APU) or a connected ground source. Running engines or APUs consume fuel at a certain cost. The connection of a ground source is burdened with a rental fee. If the aircraft is parked on the apron for more than a certain amount of time, the airline must subsequently pay certain charges to the airport for the occupation of that space. During extended parking periods, the aircraft must be under the constant supervision of airport ground staff and additional handling requirements may arise, such as repeated de-icing of the aircraft during the winter months. These costs may also include the cost of repeated buses to pick up or drop off passengers at the aircraft. These costs are of course eliminated when the airport is equipped with boarding bridges. If the delay is due to a technical fault, additional costs may be incurred to repair the aircraft. If the aircraft cannot be repaired at the check-in point (stand), then it must be moved to a designated repair point, which is again a chargeable service.
If a delay occurs during the flight itself, when the flight must be diverted from the original route, it is necessary, above all, to count on increased fuel costs.
In both cases, it is important to remember that regardless of the emergency situation, the aircrew is still on duty. Although the crew is on duty during the delay, it does not generate any profit for the airline by waiting for the situation to be resolved. Consequently, a proportion of the crew's salary corresponding to the length of the delay can be considered as having been expended without purpose and can therefore be regarded as additional costs incurred in connection with the incident. If the delay exceeds a certain value and the crew is in danger of exceeding the permitted daily duty time, another crew must be substituted. In such case, the cost of transporting another crew to the place of departure must be added to the additional costs. If a situation arises when the crew cannot be replaced, the flight must be rescheduled until the crew is able to fly again after sufficient rest. In such case, the airline must consider the cost of crew accommodation and travel allowances (meals, etc.).
In extreme cases, in the event of a flight delay, cancellation or re-routing due to a technical defect, the airline must consider the cost of sending a replacement aircraft.
The second group of additional costs that an airline must consider in the event of an emergency concerns the costs associated with passenger compensation. Each airline is obliged to take care of passengers on its flights in case of any problems. For example, the airline is obliged to provide passengers with refreshments to the extent adequate to the duration of the delay. In a situation where it is necessary for passengers to be accommodated, the airline must arrange their accommodation, transport them from the airport to the place of accommodation and back. In addition to providing the above services, passengers are also entitled to financial compensation for the delay.
Passengers' claims for financial compensation for delays are governed by Regulation No 261/2004 of the European Parliament and of the Council [8], which lays down common rules on compensation and assistance to air passengers in the event of denied boarding and of cancellation or long delay of flights. The level of this compensation depends on the length of the flight and the scope of the delay. The passenger is entitled to compensation if the operating airline has reasonable grounds to expect that, from scheduled departure time, the flight will be delayed by: • Two hours or more in the case of flights of 1500 km or less, or • Three hours or more in the case of all flights within the European Community longer than 1500 km and all other flights between 1500 and 3500 km, or • Four hours or more in the case of all flights not falling under (a) or (b).
The Regulation entered into force on 17 February 2005 and applies to all passengers departing from an airport located in the territory of a State to which the Treaty applies and to passengers departing from an airport located in the territory of a third country to an airport located in the territory of a Member State to which the Treaty applies, unless they have already received compensation or redress, and have not received assistance in that third country and the operating air carrier is a Community carrier [8]. The costs associated with compensations resulting from flight delays are shown in Table 1. The paper is thematically related to the publication [9]. It extends the mathematical model published in this paper in a fundamental way. While the previous mathematical model involves pre-formed crews, the model in this paper allows these crews to be formed from individual pilots while maintaining the requirements for interpersonal relationships.

Analysis of Current State of the Art
Numerous authors have dealt with the issue of flight crew scheduling, its optimization or emergency rescheduling in the literature in the past.
The paper will mainly review the approaches published in the last 10 years. The analysis performed shows that the above-mentioned authors approach crew scheduling in different ways. Some address each part separately, i.e., only crew pairing or only crew rostering. Others try to integrate both tasks into one.
The first group of authors proposes approaches that solve the two tasks separately, i.e., they solve the crew pairing task first and then, based on the results obtained, solve the crew Mathematics 2021, 9, 2138 8 of 28 rostering task. This gives the final form of the crew route schedule. The reason for using this approach is mainly to reduce the computational complexity of the proposed models. However, it is a fact that if the two tasks are addressed separately, it is not possible to fully capture all the links that exist between them. This may lead to a situation where the solution found may not be optimal. On the contrary, if the problems are solved simultaneously in a single optimization experiment, there is a higher probability of finding the optimal solution. Unfortunately, due to the nature of the problem itself, which can be classified as NP-hard, the computation times are often very high. Therefore, various heuristic methods are also used in the solution. As already mentioned in the introduction, flight schedule development and the associated crew scheduling is a chain of several interrelated tasks, which implies that they are very closely related and may influence each other. For this reason, many authors also accept an integral solution, when they solve aircraft scheduling together with crew scheduling, using a suitable heuristic method.
A separate chapter in the planning process is the handling of emergency situations. In the professional literature, authors approach the problem of resolving emergency situations in two ways. The first way is to increase the robustness of the proposed plans. This means that the resulting flight schedule or crew pairing schedule is to some extent resilient to emergencies or is to some extent able to eliminate the consequences of an emergency. The second way to eliminate the consequences of an emergency is through contingency rescheduling. The fundamental difference in both approaches is in the period when they are implemented. While increasing the robustness of the crew work schedule is implemented already during the preparation of the flight schedule, operational (contingency) rescheduling is implemented only in a situation where an emergency arises, and it is necessary to address its consequences.

Crew Scheduling
The first step in the crew scheduling process is the already mentioned crew pairing, when crews are assigned to individual flights and routes are created. The solution to this problem is dealt with, for example, in [10], where the authors formulate the problem as a business traveler task, which they then solve using the ant colony algorithm. The authors of the paper compare the different methods for solving the issue of crew pairing [11]. These are the Knowledge Based Random Algorithm (KBRA), a hybrid algorithm using genetic algorithms and the column generation method. The performance of five experiments on model tasks showed the hybrid algorithm to be the most suitable method. The method of generating columns also provided very good results. Therefore, the authors created a solution that combined the hybrid algorithm and the column generation method, when part of the results of the hybrid algorithm formed the initial solution for a solution using the column generation method. The authors of [12] build on their research published in [13] dealing with crew pairing. They modernize the approach by developing a new heuristic method using column generation and a strategy to eliminate uneconomical pairings. The economic inefficiency of the obtained pairings is evaluated according to a defined pricing model. The crew matching problem is also addressed in [14].
The second step in the crew planning process is crew rostering, when other activities that the pilot must complete are added to the crew routes, such as various educational, training or other activities within the company, or, potentially, his/her personal requirements are added to the long-term plan. Entering personal requests from pilots increases the complexity of the task. However, it is also a tool for improving the quality of the working environment, so it is necessary to take this criterion into account during crew rostering [15]. Due to specific personal requirements, some authors solve the optimization of crew rostering in direct cooperation with airlines, such as in [16], where the authors apply a heuristic method for the solution using the method of simulated annealing. The authors of [17] chose an alternative approach, following up on their work presented in [18]. The optimization criterion is an even distribution of working time among all pilots. The solution is divided into two phases. In the first phase, pilots are given duty and rest days, which will create a long-term crew pairing plan. The second phase of the solution can be described as a check, which serves to identify the feasibility of the proposed plans created in the first part. Based on the result of the second phase, there is a possible adjustment of the routes created in the first phase of the solution and the whole procedure is repeated until the created routes are feasible. The authors of the paper also deal with the distribution of uniformity of working time among all pilots [19]. An untraditional approach to solving this problem of crew rostering is offered by the authors of [20], who use the method of coloring graphs for the solution.
As already mentioned, crew pairing, and crew rostering are two interrelated processes. Therefore, many authors take an integrated solution of both processes. The authors of [21] compare three models-a model for crew pairing, a model for crew rostering and an integral model. When solving the models, the method of generating columns is used. The authors performed three series of experiments and compared the results of individual models. The experiments were carried out on a real network of several North American airlines. It turned out that the integral model is more computationally demanding (almost 7 times) but gives better results. By integrating the two problems into one model, an average saving of 3.37% of the total costs was achieved. They build on their research [22], where the issue of integral planning was first addressed by generating columns. However, it turned out that the method requires much more computational time. An integrated solution made it possible to increase the quality of the solution. This paper modernizes the above model to reduce computational time. The modernization consists in combining column generation methods with the bi-dynamic constraint aggregation method. The experiments were performed on seven real flight schedules. Using integrated planning, savings of between 4.02 and 4.76% were achieved, compared to solving both tasks separately.
As already mentioned, the issue of crew rostering is nowadays affected to a large extent by the pilots' personal preferences. In their integral approach, the authors of [23,24] take the personal preferences of pilots into consideration.

More Complex Tasks Involving Crew Pairing and Crew Rostering
In addition to the fact that individual steps of crew planning can be solved integrally, some authors also take on solving other processes together with these. This is the case, for example, in [25], where the authors combine the optimization of the maintenance plan, aircraft cycles and crew rotations. The result is a sequential heuristic method. The results of these sequential calculations are the initial solution for an integral model solved by the method of column generation. Experiments on real data have shown a cost saving of 0.6% using this method.

Addressing Emergency Situations
As already indicated in the introduction to this section, the consequences of emergency situations can be addressed in two ways-by increasing the robustness of crew pairing plans or contingency rescheduling.
The robustness of the crew pairing plan in a specific situation is addressed, for example, in [26]. This is a situation when the implementation of new flights during the already prepared flight schedule, which are not yet included in it, is anticipated. It is therefore important that the crew schedule remains robust enough before and after the inclusion of new flights. The authors propose two approaches to solving the problem of crew pairing. In the first approach, a new flight will be included, which will be included among the existing flights so as not to disrupt their scheduled departure and arrival times and will be served by a separate crew. The second approach envisages the interchangeable crewing of the original flights. Interchangeable flight crewing means that their original arrival and departure times will be maintained but will be serviced by different crews. In this situation, there will be an unproductive transfer of one crew. To apply these approaches, the authors use the method of generating columns. The experiments were performed on real data of small Turkish airlines.
The issue of crew pairing is similarly addressed in terms of the robustness of the resulting field of crew routes. For example, paper [27] deals with this, where the authors use the Lagrange relaxation to divide the originally nonlinear model into a set of linear tasks, which they then gradually solve. The robustness of the created crew rotations is subsequently verified by simulations using real data from the operation.
One of the great dangers in the event of an emergency and subsequent delay is its transmission within the flight schedule, when due to the continuity of flights operated by one crew or one aircraft, the delay accumulates and gradually increases. Therefore, for example, the authors of [28] base their approach to creating a robust crew pairing plan on their own methodology for evaluating the transmission of delays in the flight schedule. The results of the delay analysis are incorporated into a heuristic method for crew pairing, using a combination of the branch and bound method with the column generation method. The optimization criterion is the cost of assigning crews to aircraft.
One of the significant negative effects of delays is exceeding the time allowed for crews being on duty, which in combination with fatigue can lead to a significant reduction in flight safety [4]. Paper [29] deals with this issue in more detail. The authors of the article try to create a sufficiently robust plan of crew routes so that these situations are minimized. Using flight data analysis, they try to determine the dependencies between flight duration, flight times and the subsequent occurrence of delays. For this part of the research, the authors use regression analysis. By evaluating these dependencies, they can better capture the risk areas of crew rotations and thus prevent exceeding the permitted time on duty. The authors use the column generation method to design an optimized crew route plan. The proposed solution improves the reliability of decisions about the timely change of crew. Premature change of crew leads to an increase in operating costs, but also to an increase in air traffic safety.
Other authors use some planning steps to improve the results by mutual coordination. This is also the case of [30], in which the authors address the issue of increasing the robustness of the aircraft routing plan and the crew pairing plan. The article presents a stochastic model using the column generation method, which deals separately with crew pairing and separately with aircraft routing. A simulation model is also applied here, modeling the transmission of delays in the flight schedule. The simulation model was based on data on aircraft delays of European airlines during 2003 and 2006. With the help of this data, the results of the proposed models were verified. The proposed solution builds on [31], in which, however, the authors deal only with the issue of crews. Paper [32] also focuses on the integrated planning of crew routes and aircraft routes, when the authors monitor the transmission of delays during operation in the prepared plans. The resulting plans will increase the robustness of aircraft routes and crew routes, thus reducing the impact of emergencies. In the paper, the authors compare the results of the sequential approach with the integrated approach and test three different situations. In the first experiment, the plans are obtained by sequential calculation of flight schedules and then the plans of the crews, assuming a linear transmission of delay. In the second experiment, the plans are obtained again by sequential calculation of flight schedules and crew plans but predict a nonlinear delay transmission. Additionally, in the last experiment, the plans are obtained through integrated flight schedule calculations together with the crew plans, assuming a nonlinear transmission of delays in the flight schedule. The results of the experiments were the total delay times in the individual situations. The authors of the paper continue the research in [33], where they test other possible scenarios and study the transmission of delays in plans (aircraft routing, crew pairing) created based on the proposed heuristics.
The authors of [34] also focus on the creation of robust integral plans for aircraft routing and crew pairing, considering the planned maintenance downtimes. The authors try to achieve this by penalizing the creation of connections between lines with a short interval between landing and the next take-off in the proposed plan and also preferring those connections in which crews are connected to specific aircraft over the long-term (crew in one aircraft performs multiple consecutive flights). The issue is solved using a nonlinear model, where the optimization criterion is the total reward, which is formed by the difference between rewards and penalties resulting from the created plans. The goal is to maximize this reward.
One other possible way to increase the robustness of crew rotation (crew pairing) plans is to use backup crews. However, this also needs to be planned, as poor timing of their service or poor placement in the network can lead to unproductive use, which will lead to losses due to the consequences of emergencies or inefficient use of funds for unused backup crews. Conversely, properly planned and located backup crews can significantly mitigate the consequences of emergencies. To do this, the authors of [35] use predictive probability models.
Using simulation and heuristic methods, this issue is also addressed by the authors of [36]. The authors first perform a simulation of the system operation without backup crews. Based on the results, a backup crew is placed in the system and the suitability of the solution is verified by re-simulation. This determines the number of backup crews and their placement, when the criterion is to minimize delays in the simulated scenarios. The dependence of the length of the incurred delay on the number of active crews is also investigated by the authors of [37,38].
The authors of [39] also try to increase the robustness of the flight schedule by using not only human resources but also aircraft technology. For aircraft technology, they mainly focus on increasing the time windows between flights so that the incurred delays can be covered. In the case of human resources, they focus on planning backup crews to replace the originally scheduled crews in the event of an emergency. The authors implement changes in the flight schedule and crew planning based on a new approach to delay prediction. For this prediction, they applied a neural network method. The aim is to minimize the total delay times.
The issue of robustness itself is further developed by the authors of [30], who argue that robustness can be viewed from two different perspectives. It can be expressed as stability or flexibility. Stability refers to the ability of a flight schedule to remain in a feasible state under different situations. Flexibility is then seen as the ability of the plan to adapt to changing conditions. The flexibility of crew pairing schedules is further discussed in [31].
In the previous paragraphs, papers dedicated to increasing the robustness of flight schedules, aircraft turnaround plans, or crew turn-around plans to the consequences of emergencies were discussed. Sufficient robustness of plans is a good tool to protect against delays incurred. However, in practice it turns out that it is not always a sufficient tool. That is why almost every airline has an operational planning department that deals in real time with problems arising in the course of operations. Every decision in a crisis can have a major impact, which can be either positive or negative, so it is also appropriate to address these decision-making processes.
Paper [40] presents an overview of the methods used and models proposed up until 2010, dedicated to the recovery of aircraft and crew plans in the event of an emergency. A heuristic approach for the operational re-planning of aircraft equipment is presented by the authors of [41], who always offer the user several possible solutions from which he can choose the most suitable one based on the chosen optimization criterion. The problem of operational rescheduling of aircraft fleet utilization is also addressed in [42]. The authors of [43] are the first to present an integral model, simultaneously solving the recovery of aircraft and crews. However, the proposed model is not completely dynamic, because the arising of an emergency is considered before it occurs. This makes it possible to prepare for the situation and therefore is not ad-hoc re-planning as such. Thus, the models had very high computational times. An integrated model for operational rescheduling of flight and cabin crews is presented in [44].
The restoration of crew routes after an emergency is the subject of [45]. The authors use multi-criteria optimization using genetic algorithms to solve the problem, where the primary objective is to minimize the impact on the original crew turn-arounds after the optimization is completed, and the second objective is to minimize the size of the delay caused by the emergency. In the experiments, the authors observed how their approach behaves in a situation where sufficient crews are available and, in a situation, where, on the contrary, crews are lacking.
Another paper presenting an approach for dynamic crew rescheduling is, e.g., [46]. The authors present an approach consisting of two algorithms. In the first algorithm, possible crews are created from a set of pilots, who then work together throughout the implementation of the plan (the crew is therefore indivisible). In the second algorithm, the authors use a mathematical linear model. This algorithm is used to create a new set of crew pairings following an emergency.
In this paper, we present a dynamic model for operational crew rescheduling. This means that, unlike most of the above-mentioned authors, we approach the solution of emergencies at the time of their occurrence, and we can resolve them immediately. In contrast to the contributions described above (apart from [46]), the indisputable advantage of the solution we propose is its linear nature, which guarantees that an optimal solution is found when all the constraints are met. Thus, the user can avoid large financial losses caused by emergencies. The expansion of rescheduling options is also made possible by our newly designed approach, which enables an individual approach to pilots-both from the point of view of interpersonal relationships and from the point of view of the possibility of changing the assignment of pilots to the crew during daily duty (pilots can change the crew during the planning period depending on the situation). The newly designed model, in contrast to other approaches, works with the original crew pairing plan, which will allow the maximum acceleration of the return to the original plan after the occurrence of an emergency.
This paper intellectually builds on the already published paper [9], which also deals with the issue of operational re-planning of crews. However, the newly proposed model fundamentally changes the approach to solving this issue, especially in two respects. The first difference is that the newly designed model works with the crew as a pair of pilots, grouped as captain and first officer. This procedure allows an individual approach to rescheduling the routes of individual pilots. The solution proposed in this way will enable the employees of the operational planning department to have greater variability in dealing with emergency situations. The second difference compared to the already published model is the consideration of the original crew pairing plan. Indeed, if these plans are considered in rescheduling, it will allow a faster return to a stable state, as the model tries to place pilots on the flights and to the destinations they were originally supposed to serve. If pilots are deployed in a different way or operate flights other than originally planned, their actions are penalized in the objective function. This solution increases the speed of resolving an emergency and minimizes its consequences on subsequent crew pairing plans.

Proposed Optimization Approach
The advantage of the proposed approach is the fact that it will be a linear mathematical model, which in the case of sufficiently powerful computer technology will ensure finding an optimal solution. The main optimization criteria will be the costs associated with the rescheduling of the crews and the compensation paid to passengers in the event of delays, i.e., the total costs that the carrier must incur to eliminate the consequences of the emergency. This will ensure that the solution obtained is advantageous not only from the point of view of satisfying the service of all scheduled flights, but also from the point of view of the real financial impact on the airline. A great danger in the event of a delay is its uncontrollable development in the flight schedule. However, due to a suitably chosen optimization criterion, its consequences are attenuated. This is also aided by the fact that the model considers the original crew pairing plan and one of its goals is for crews to end their daily duty in the originally planned destinations as often as possible. A great advantage of the proposed solution is also an individual approach to pilots. The model works with the crew as a pair of pilots, one being the captain and the other the first officer. The crew is therefore not indivisible (as is common in published optimization approaches) and it is possible to split it if necessary, to create completely new crews. In addition to the basic limitations arising from real operation, interpersonal relationships between pilots are also considered in the creation of crews.
The proposed model also monitors the continuous status of the pilots' flight hours. This will ensure that none of the constraints are exceeded and hence a sufficient level of safety resulting from crew deployment.
In addition to the above-mentioned operational advantages, the model, after simple modification, can also offer its users the possibility of actual scheduling of crew routes with the aim of minimizing the number of crews needed to service the scheduled set of flights. This modification will be presented in the computational experiments.

Proposed Formulation of the Optimization Problem
In this section, a linear mathematical model will be formulated for the rescheduling of flight crew pairing. The model assumes that aircraft are always available and that the fleet of a given airline is homogeneous. This means that all crews created can operate any aircraft on the assigned flight.

Problem Formulation
The defined set of flights I, which have not yet flown at the time of the delay, including the delayed flight, is defined. For each flight, i ∈ I, we know the scheduled start of preflight preparation t i , the time spent by the crew in servicing it T i , including the time required to carry out all post-flight operations at the destination airport, and the number of passengers N i , who have purchased a ticket for that flight and who are entitled to compensation in the event of exceeding the allowed duration of the delay in the amount of o i .
The set of pilots R is defined. As described above, each pilot has a different level of qualification, which in turn determines whether the pilots can form a crew together. Due to the potential for a conflict of authority in the cockpit, the situation of a pilot with a captain's rating as the first officer will not be considered. Depending on this, the set of all pilots R will be separated into two disjunctive subsets, a subset of captains R c and a subset of first officers R f (it applies therefore that R = R c ∪ R f and, at the same time, that R c ∩ R f = ∅).
The subsequent permissible combination of captains from subset R c and first officers from subset R f will result in the creation of a set of crews K meeting the requirements of interpersonal relationships that the carrier can deploy to service flights. For each crew k ∈ K, the amount of time that the crew has been on duty on that day s k is known (this is the amount of time that the crew has already drawn from its daily limit). The maximum daily time on duty is determined by the constant L. Further, the model introduces three three-dimensional matrices D, P and Q.
The element d ijk , where i ∈ I ∪ {0}, j ∈ I ∪ {0} and k ∈ K, contains information about the original schedule of each crew, i.e., whether the crew k ∈ K in the original, long-term schedule, after operating the flight i ∈ I ∪ {0} will move to servicing the flight j ∈ I ∪ {0}. Deploying a crew outside the original crew pairing will be penalized. Penalties will also occur if the crew ends their duty after servicing a different flight than originally planned (these are cases where the crew terminates their service either at a different destination or at the same destination but after servicing a different flight).
The element p ijk expresses costs arising from the non-productive transfer of a crew k ∈ K to the servicing of a flight j ∈ I ∪ {0} after servicing flight i ∈ I ∪ {0} (the element of the matrix p 0jk represents costs arising from the non-productive transfer of the crew k ∈ K to the departure airport of flight j ∈ I from the base airport, and the element of the matrix p i0k represents costs arising from the non-productive transfer of the crew k ∈ K from the destination airport of the flight i ∈ I at the base airport).
The element q ijk expresses the time spent on the non-productive transfer of the crew k ∈ K to the servicing of a flight j ∈ I ∪ {0} after servicing flight i ∈ I ∪ {0} (the element of the matrix q 0jk represents the time spent on the non-productive transfer of the crew k ∈ K to the departure airport of the flight j ∈ I from the base airport, the element of the matrix q i0k represents the time spent on the non-productive transfer of the crew k ∈ K from the landing airport i ∈ I to the base airport). Elements of matrices P and Q are calculated based on data on the current placement of crews.
The task is to decide on the transfer of crews between flights so as to minimize the airline's costs associated with the transfer of crews to operate individual flights and the costs resulting from delays, including compensation for passengers who have suffered delays. At the same time, the effort is for pilots to operate the flights they had in the original route plan to the greatest extent possible, as well as to end their routes at destinations and times that were predefined in the original plan.

Mathematical Model
To solve the model, it is necessary to prepare some of the input values related to crews. This preparation is necessary due to the possibility of individual rescheduling for individual pilots. This preparation mainly concerns the creation of a set of all potential crews K and constants directly related to them. These constants are elements of matrices P, Q and D.

Preparation of the Model
To solve the given model, an incidence matrix will be created, denoted, for example, as E, which will express the possibility of creating crews between the captain i ∈ R c and first officer j ∈ R f . When the captain i ∈ R c can create a crew with the first officer j ∈ R f , then e ij = 1. Each potential crew created is assigned a serial number, thereby creating a new set of potential crews K.
We consider, for example, a situation characterized by the matrix E-see Table 2. Based on matrix E, the following set of crews arises-see Table 3. Based on the interpersonal relationships between the pilots, it will be necessary to adjust some categories of input data. As each pilot may be in a different location when it is decided to reschedule the crew routes, the input data on the time availability of potential crews as well as the costs of their creation must be adjusted. It will therefore be necessary to adjust the values of the elements of the matrices P and Q and also of the matrix D.
In the first place, it is necessary to expand all three matrices with elements representing the deployment of all possible crews.
All time values will be given in minutes in the following text, calculated from a suitably chosen time point (e.g., midnight of a given day or maximum time of the earliest time of preparation for a given flight). The time location of individual flights corresponds to the location during the day. For example, if the start of a flight is at 10:55, then this corresponds to time 655.
For example, if a potential crew is being considered, when the captain is available at time 1245 and the first officer at time 1310, then the crew created by these pilots will be available at time 1310. In the general position, therefore, the higher of the two values is selected for the matrix element P. For example, if the cost of transporting the captain to the place of departure is 500 monetary units and the cost of transporting the first officer to the place of departure is 600 monetary units, then the cost of transporting the crew to the place of departure is 1 100 monetary units. In the general position, the relevant element of the matrix Q is created as the sum of the costs of transporting both crew members to the place of departure of the flight.
Only In addition to modifying the input data, the model itself will have to be modified. Constraints must be added to ensure that two or more crews containing the same pilot, either as captain or first officer, are not deployed simultaneously. For these purposes, a set of crews K f i , containing pilots-first officers will be created for each pilot-captain i ∈ R c , with whom he can crew, and for each pilot-first officer j ∈ R f a set of crews K c j will be created containing pilots-captains with whom they can crew.
That is, the above cited example will include K f For the set of crews K, it then applies that K = ∪ i∈R c K f i or also K = ∪ j∈R f K c j , but also even K = ∪ i∈R c K f i ∪ ∪ j∈R f K c j . The resulting model will then have the following form: x jik for j ∈ I and k ∈ K (3) x ijk for j ∈ I and k ∈ K (4) t i + T i + y ij + q ijk ≤ t j + y jk + M· 1 − x ijk for i ∈ I ∪ {0}, j ∈ I and k ∈ K h k ≤ (t j − q 0jk )·x ojk + M· 1 − x 0jk for j ∈ I and k ∈ K (8) Formula (1) expresses the optimization criterion whose value is to be minimized. It consists of four terms. The first term represents the costs associated with non-productive crew relocations, the second term the costs associated with passenger compensation in the event of flight delays and the third term ensures that the gap between the upper and lower daily duty time restrictions is kept to a minimum. As the value of the difference does not fundamentally affect the resulting values of crew transfer costs and the value of compensation paid to passengers in the event of a delay exceeding the set limits (it has also a different unit), the difference is multiplied by the constant ε, when ε = 0.001. The main meaning of the constant ε is that it enables to separate the value of the third term of the objective function from the sum of the remaining terms-thanks to the chosen value of ε the value of the third term is found after the decimal point and therefore its value can be easily identified. Please note that the value of the constant does not affect the optimal solution. The final, fourth, term ensures that crew relocations during rescheduling are carried out to deviate as little as possible from the original crew pairing plan. The group of constraints (2) will ensure that each unhandled flight is serviced. The group of constraints (3) will ensure that continuity of crews is maintained after the end of the flight. The group of constraints (4) will allow moving the departure time only in the case of the deployment of a specific crew. The group of constraints (5) will ensure that each crew is deployed at most once to operate flights not yet operated. The group of constraints (6) will ensure that the compensation paid to passengers in case of exceeding the delay time is taken into account. The group of constraints (7) shall ensure that in the event of a crew transfer that is not time permissible, the transfer does not take place. The groups of constraints (8) and (9) form links to variables representing the upper and lower duty time limits of the individual crews. The group of constraints (10) will ensure that the daily working time limit is respected for each crew. The set of constraints (11) ensures that the difference between these variables is non-negative. The group of constraints (12) will provide the required logical links between the variables x ijk and w k and constraints (13) and (14) will ensure that each pilot will form a maximum of one crew. The groups of constraints (15)- (20) are obligatory and define domains of definition of all the variables used in the model.

Calculation Experiments with the Proposed Model
For experimental verification of the functionality of the proposed model, a real network of a European airline operating a homogeneous fleet was selected. The fleet consists of Embraer E195 aircraft. Within this network, traffic was monitored over a period of 24 h. The airline served nine destinations within the selected day, of which two destinations were the selected airline's hubs. These hubs were the airports in Frankfurt am Main (FRA) and Munich (MUC). Other destinations served by the airline that day were Milan (MXP), Venice (VCE), Rome (FCO), Naples (NAP), Porto (OPO), Malaga (AGP) and Stockholm (ARN). A total of 21 flights were operated during the day. The scheme of flights to be operated is shown in Figure 1. Data were obtained from the Flightradar24 server [47]. The airline has 22 pilots available to operate flights. Of these, 10 pilots are in the position of captain and 12 pilots in the position of first officer. Based on professional qualities and interpersonal relationships, it is possible to create 37 crew combinations. The procedure for creating crews was described in Section 5. These possible combinations of crews are listed in Table 4, where the rows represent the set of captains (10 pilots) and the columns represent the set of first officers (12 pilots). In a situation where the symbol x appears in the table, it means that the respective pair of pilots cannot create a crew. If there is a number in the table, it is the serial number of the possible crew. For example, crew number 13 consists of captain number 4 and first officer number 3.  The airline has 22 pilots available to operate flights. Of these, 10 pilots are in the position of captain and 12 pilots in the position of first officer. Based on professional qualities and interpersonal relationships, it is possible to create 37 crew combinations. The procedure for creating crews was described in Section 5. These possible combinations of crews are listed in Table 4, where the rows represent the set of captains (10 pilots) and the columns represent the set of first officers (12 pilots). In a situation where the symbol x appears in the table, it means that the respective pair of pilots cannot create a crew. If there is a number in the table, it is the serial number of the possible crew. For example, crew number 13 consists of captain number 4 and first officer number 3.
As described above, the model automatically ensures that multiple crews consisting of one pilot are not deployed. This prevents, for example, crews 13 and 14 from being deployed at the same time because they have the same captain.
For the purposes of experimental verification of the model's functionality, an emergency will be simulated during the flight day. These contingencies will be the delay of flight 11 from Porto (OPO) to Munich (MUC) and adverse weather at Frankfurt Airport (FRA). These events will split the flight set into two subsets. The first subset consists of flights 1-10. The second subset consists of flights 11-21. The experiment will be divided into two parts:
In the first part of the computational experiment, the process of planning crew routes using a suitably modified model will be carried out. The result of the first part of the computational experiment will be information regarding the distribution of pilots or crews within the operated network at the time of the emergency.
Based on the information regarding the current location and the current time on duty, the second part of the experiment will allow the design of an optimal crew turn-around plan for operating the remaining 11 flights (flights 11-21) that may be affected by the emergency. From this plan, it will be easy to determine the allocation of crews to the flights already served, and at which destination they should terminate their service.
The information on this original plan will then serve as a benchmark in the third part, in the operational rescheduling of the crews with the aim of restoring its original form as much as possible. Thus, the model will behave in the calculation to deploy crews to operate flights during the rescheduling so that, to the maximum extent possible, they operate the flights that were in the original crew pairing plan.
The calculations of all parts of the experiment were performed in the Xpress-IVE optimization software. The models in this software were created in the MOSEL programming language. The software was installed on a personal computer running the Windows 10 operating system, using an Intel i5-5200U processor with a frequency of 2.2 GHz and 8 GB of RAM.
To make it possible to obtain information on the specific crew positions at the time of the emergency, it is necessary to establish a crew routing plan for all flights to be operated on a given day. This can be achieved by applying existing approaches or using a model (1)- (20), in which only a partial modification will take place of the objective function-the addition of one constraint and the omission of some input values that are unnecessary for this type of calculation. The objective function for creating crew routes without delays will be in the form: This objective function contains two optimization criteria. The first criterion is the number of assigned crews and the second criterion is the cost of moving crews and pilots to operate individual flights. The number of crew assignments is multiplied by a large enough constant in the objective function to allow the results to easily distinguish between the number of crew assignments and the cost of assigning them to individual flights.
As this calculation will create a completely new pairing plan, logically there is no previous state or standard to follow and it is therefore not necessary to include matrix D in the input data to describe the original state of the system.
The final modification to be made in the model will be the replacement of the group of constraints (16) with the group of constraints (22) in the form: The stated group of constraints will not allow delay of any kind on any flight. In the initial crew pairings, individual pilots were placed at the following airports-see Table 5. The model input values are shown in Tables 6-9.    Most pilots did not yet log any activity related to the performance of duty on that day. The exception is the three crews who were completing their night flights. These were crews No. 6 (Captain No. 2, FO No. 1), 24 (Captain No. 7, FO No. 9) and 31 (Captain No. 9, FO No. 5). Depending on the pilots who took part in the flights, the current sum of the time of on duty (s k ) time for the day will also be reflected in all potential crews in which the mentioned pilots may appear-see Table 10. Other input information for the model are data from matrices P and Q. The element of matrix P expresses costs incurred from the unproductive transfer of the crew k ∈ K k to operate the flight j ∈ I ∪ {0} after operation of the flight i ∈ I ∪ {0} and the element of matrix Q expresses the time required for the unproductive transfer of the crew k ∈ K to operate the flight j ∈ I ∪ {0} after operating flight i ∈ I ∪ {0}.
The results of the experiment showed that seven crews will be needed to operate the planned set of flights. These crews are crew numbers 6, 12, 13, 19, 24, 31 and 35. The schedule of routes of these crews and their daily time on duty after completing these flights are described in Table 11. Table 11. Routes of active crews to service planned sets of flights.  Figure 2 schematically shows the routes of individual crews and the subsequent location of pilots after the end of the scheduled set of flights. After completing their daily duty, the pilots will be deployed at four airports-Frankfurt am Main, Munich, Milan and Venice. Captains' numbers are shown in bold, FO numbers are indicated in italics. The route plan and the final placement of the pilots will be the input to create a matrix , which will be used in the next part of the experiment to consider the original crew pairing plan. The input values will correspond to the moment when the airline's operations center receives information on the occurrence of an emergency. In this case, it will be the time 825, corresponding to the planned start of flight No. 11. Depending on the determination of this moment, it is necessary to adjust the input values. The rescheduling process will only apply to unhandled flights. These are therefore flights [11][12][13][14][15][16][17][18][19][20][21]. Depending on the current position of the crews, it will also be necessary to adjust the matrices P and Q, and also the values of the constant s k , which determine the daily time on duty for each crew, and hence for the pilots. As already mentioned, the input values will be supplemented by a matrix D, to minimize the deviations of the newly created crew routes from the original plan. The input values for the constants t i and T i are taken from Table 7. The input values for the constants N i , o i and b i are taken from Table 9. The values of the constant s k are shown in Table 12. Please note that matrices P, Q and D will not be presented in this paper due to their scope-they are available in the external files-see the Data Availability Statement. Table 13 provides information on the current deployment of pilot crews within the network at the time of the emergency (time 825 min). The pilots are deployed in a total of five destinations, with pilots 5 and 11, forming crew No. 19, not yet physically present in Venice, but operating flight No. 9 to this destination. Likewise, pilots 4 and 3, forming crew No. 13, are on their way to Frankfurt am Main. Pilots who are not physically at the airport at the time of the emergency are indicated in italics in the table. The results of the optimization calculation with the proposed model (1)- (20) showed that in the event all three emergencies arise, the number of active crews will increase to nine. This increase is caused by two factors, which are exhaustion of the maximum time of daily in-flight duty allowed for the crews operating delayed flights as well as efforts to minimize the costs incurred in reimbursing passengers due to flight delays.
The routes of active crews after operational re-planning are shown in Table 14. The above crew pairing plan also shows evidence that the model works with crews as a pair of pilots that can be divided during the day. Such a case occurred with crews No. 13 Figure 4 shows the output of the Xpress-IVE program, where it can be seen that the value of the total optimization criterion is 47 886.2655. The values after the decimal point are not important for the interpretation of the results, because in the calculation they only serve to ensure that the range of the beginning and end of the on-duty time of individual crews is minimal. It is therefore necessary to deal in more detail only with the value 47,886, which is the sum of the results of three partial optimization criteria.
The primary criterion is costs for non-productive transfers of crews, expressed in the objective function by the following formula: In this case, two non-productive transfers took place, and their costs added up to 370 monetary units.
Another criterion that affects the value of the objective function is the cost of compensating passengers for the occurrence of a delay. The minimum delay value at which passengers can claim compensation has been exceeded for two flights. These are the already mentioned flights flying from Frankfurt am Main. Here, the total cost of compensation was calculated at 47,500 monetary units. In the optimization criterion, this criterion is expressed by the following term: The final term affecting the value of the optimization criterion, are penalties related to non-compliance with the original schedule of crew rotations. In the optimization criterion, this criterion is expressed by the following formula: In this case, eight transfers were penalized, and the total value of the penalty was 16 monetary units. The resulting placement differs in part from the original plan. The difference is mainly in the location of the pilots of crew No. 12 (Captain No. 3 and FO No. 10) at the airport in Naples, because originally, it was not planned to end their activities here. This location is related to the delay of flight No. 12 From Frankfurt n. M. to Naples. Due to the long delay (220 min), the crew could not operate the connecting flight No. 17, which had a scheduled departure already 45 min after the arrival of flight No. 12. Therefore, a new crew was chosen to operate Flight No. 17, namely crew No. 21 (consisting of Captain No. 6 and FO No. 6). In other cases, these are only pilots located in a different way than originally planned, but while maintaining the airports, where they were deployed in the original plan of crew routes. Figure 4 shows the output of the Xpress-IVE program, where it can be seen that the value of the total optimization criterion is 47 886.2655. The values after the decimal point are not important for the interpretation of the results, because in the calculation they only serve to ensure that the range of the beginning and end of the on-duty time of individual crews is minimal. It is therefore necessary to deal in more detail only with the value 47,886, which is the sum of the results of three partial optimization criteria.
The primary criterion is costs for non-productive transfers of crews, expressed in the objective function by the following formula: In this case, two non-productive transfers took place, and their costs added up to 370 monetary units.
Another criterion that affects the value of the objective function is the cost of compensating passengers for the occurrence of a delay. The minimum delay value at which passengers can claim compensation has been exceeded for two flights. These are the already mentioned flights flying from Frankfurt am Main. Here, the total cost of compensation was calculated at 47,500 monetary units. In the optimization criterion, this criterion is expressed by the following term: The final term affecting the value of the optimization criterion, are penalties related to non-compliance with the original schedule of crew rotations. In the optimization criterion, this criterion is expressed by the following formula: In this case, eight transfers were penalized, and the total value of the penalty was 16 monetary units. By adding up the values of all the above-listed expressions, a value of 47, 886 was achieved, which corresponds to the value of the optimization criterion.
Another positive aspect of the proposed rescheduling is that the delays caused by the proposed solution were not passed on to other flights or crews. This is also evidenced by the Xpress-IVE output shown in Figure 4, where it can be seen that the variable takes on non-zero values only in situations that were deliberately set in the model.
The optimality of the found solution is confirmed in the Xpress-IVE report in Figure  5 in the Status line. The rounded value of the objective function can again be seen in the Best solution item. The computation time, indicated in the Time line, was 7.5 s.

Conclusions
All airlines encounter occasional operational emergencies during their operations. They must organize their solutions to satisfy their customers while keeping costs to a minimum. One of the issues that is usually addressed in the event of an emergency is the rescheduling of the work of flight crews. Dealing with these situations is the responsibility of the operational planning department. To solve the problems that arise, the staff of these departments of the major airlines use specialized software for the operational rescheduling of crew runs. Smaller airlines must also deal with the same issues, except in most cases they do not use expensive software they cannot afford to run or they do not have sufficient funds to integrate new software into their existing systems. Therefore, their employees rely primarily on their experience and solve the problem using intuitive decisions. However, these intuitive decisions may not always be optimal and their impact on the airline may be more negative than strictly necessary. By adding up the values of all the above-listed expressions, a value of 47, 886 was achieved, which corresponds to the value of the optimization criterion.
Another positive aspect of the proposed rescheduling is that the delays caused by the proposed solution were not passed on to other flights or crews. This is also evidenced by the Xpress-IVE output shown in Figure 4, where it can be seen that the variable takes on non-zero values only in situations that were deliberately set in the model.
The optimality of the found solution is confirmed in the Xpress-IVE report in Figure  By adding up the values of all the above-listed expressions, a value of 47, 886 was achieved, which corresponds to the value of the optimization criterion.
Another positive aspect of the proposed rescheduling is that the delays caused by the proposed solution were not passed on to other flights or crews. This is also evidenced by the Xpress-IVE output shown in Figure 4, where it can be seen that the variable takes on non-zero values only in situations that were deliberately set in the model.
The optimality of the found solution is confirmed in the Xpress-IVE report in Figure  5 in the Status line. The rounded value of the objective function can again be seen in the Best solution item. The computation time, indicated in the Time line, was 7.5 s.

Conclusions
All airlines encounter occasional operational emergencies during their operations. They must organize their solutions to satisfy their customers while keeping costs to a min- Figure 5. Reports from Xpress-IVE software.

Conclusions
All airlines encounter occasional operational emergencies during their operations. They must organize their solutions to satisfy their customers while keeping costs to a minimum. One of the issues that is usually addressed in the event of an emergency is the rescheduling of the work of flight crews. Dealing with these situations is the responsibility of the operational planning department. To solve the problems that arise, the staff of these departments of the major airlines use specialized software for the operational rescheduling of crew runs. Smaller airlines must also deal with the same issues, except in most cases they do not use expensive software they cannot afford to run or they do not have sufficient funds to integrate new software into their existing systems. Therefore, their employees rely primarily on their experience and solve the problem using intuitive decisions. However, these intuitive decisions may not always be optimal and their impact on the airline may be more negative than strictly necessary.
In this paper, we present a mathematical model that can be used as a tool to support the decision-making of operational planning department employees when operational rescheduling of crew routes is required due to an emergency arising.
The proposed mathematical model is linear, and therefore ensures finding of an optimum solution. The model's main optimization criterion is reducing costs associated with rectifying the consequences of an emergency. The optimization criterion mainly includes the costs of compensation of passengers if the statutory length of delay is exceeded, and the costs of transfers of pilots between individual destinations. Supportive optimization criteria are penalties accrued in a situation where pilots do not operate the same flights after rescheduling or do not end their duty in destinations that were in the original crew flight plan. This criterion allows the original flight schedule to be taken into account when rescheduling, thus speeding up the return to the original state. Such appropriately selected optimization criteria then in a certain way prevent the transmission of delays within the operated network of routes. Unlike other approaches, this model approaches pilots separately, and not the crew as a whole, but as a pair of pilots, being always a combination of captain and first officer. Thanks to this approach, it is possible to flexibly split the crews during rescheduling and thus, using the pilots, create optimal variants of crews for the operation of the planned set of flights, as needed. The proposed model also takes into account strict safety restrictions ensuring that pilots limit their daily time on duty. The model continually monitors the daily service time of each pilot, eliminating the possibility that the flight will be endangered by crew fatigue.
Another advantage of the model is that with a simple modification, the model can also be used for the actual planning of crews. The optimization criteria are then the cost of moving pilots between destinations and the number of deployed crews. The goal of optimization is then to minimize the values of these criteria.
To verify the functionality of the model, a computational experiment was performed in the Xpress-IVE optimization software. This experiment was divided into two parts. In the first part, based on the real network of a small airline, one operating day was monitored, when the airline operated 21 flights. Using a modified model, an admissible crew rotation plan was created to operate the planned set of flights. In the second part of the experiment, the occurrence of an emergency was simulated and the model (1)- (20) was applied for the needs of operational rescheduling of crews. The results of the first part of the experiment then served as a measure of effectiveness in trying to return to the original schedule of routes. The results confirmed the functionality of the presented model.
In the future, it would be appropriate to deal with the interconnection of the bond between crews and aircraft during operational rescheduling, because it is not a rule that aircraft are always available or in all destinations. It is also necessary to consider that the emergency may be caused by technical problems of the aircraft itself. It will also make sense to look for ways to reduce the computational complexity of the model or its application in a more user-friendly environment.

Conflicts of Interest:
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

Notation Symbol
Meaning I Set of un-serviced flights K Set of crews K c j Set of crews including captains, with whom a first officer j ∈ R f can form a crew K f i Set of crews including first officers, with whom a captain i ∈ R c can form a crew R Set of pilots R c Subset of pilots with captain qualification R f Subset of pilots with first officer qualification D Three-dimensional matrix of values of penalty constants E Incidence matrix expressing permissibility of the combination of captain and first officer P Three-dimensional matrix expressing costs for transfer of crews Q Three-dimensional matrix expressing time demand for transfer of crews b i Delay time of flight i ∈ I, which when exceeded entitles passengers to compensation d ijk Element of matrix D, penalizing deployment of crews k ∈ K between flights i ∈ I ∪ {0} and j ∈ I ∪ {0}, which deviate from the original plan e ij Element of the incidence matrix expressing link between captain i ∈ R c and the first officer j ∈ R f L Maximum permitted daily duty hours M Large enough constant N i Estimated number of passengers on flight i ∈ I o i Financial compensation of passengers for delay on flight i ∈ I p ijk Element of matrix P expresses costs generated by non-productive transfer of crew k ∈ K to operate flight j ∈ I ∪ {0} after operating flight i ∈ I ∪ {0} q ijk Element of matrix Q expresses time necessary for non-productive transfer of crew k ∈ K to operate flight j ∈ I ∪ {0} after operating flight i ∈ I ∪ {0} s k Current elapsed on duty time for the crew k ∈ K t i Planned pre-flight preparations for flight i ∈ I ∪ {0} T i Time necessary for operation of flight i h k Variable modeling delimiting the lower limit of the daily time in the crew's duty k ∈ K = h k Variable modeling delimiting the upper limit of the daily time in the crew's duty k ∈ K x ijk Variable deciding on the transfer of the crew k ∈ K after operating flight i ∈ I ∪ {0} to operate flight j ∈ I ∪ {0} y jk Variable modeling the real value of delay in arrival of flight i ∈ I, operated by the crew k ∈ K z i Variable deciding on payment of financial compensation to passengers on flight i ∈ I w k Variable deciding on crew creation k ∈ K ε Separation constant