The travel industry is very big on price discrimination (they call it revenue management). Car rental, hotels etc do it a lot, but the most advanced ones are the airlines.
For many flights there is no single price that would allow the airline to operate the flight without making a loss. Some example for a 100 seat plane:
1. Sell all tickets at $100: Plane 100% booked, revenue $ 10,000, which is less than the cost of flight.
2. Sell all tickets at $200: Plane only 60% booked, revenue $ 12,000, better but still less than the cost of the flight.
Reality: Sell 15 tickets at $400, then sell 60 at $200 and sell 20 at $100. Now you make $ 20,000 with a 95% booked plane.
Your new problem is how to avoid the $400 people buying a $100 ticket, because that ruins your whole optimization. The way airlines do that is to make many tariff classes with a lot of rules and a limit to the number of tickets sold at a certain class. They then change that a bit based on demand once the flights gets closer to departure.
The rules are relatively simple things (this was invented in the mainframe computing time and some of those systems are still around), common examples: A minimum amount of time before departure (e.g. you can't but the $100 ticket for a flight that's tomorrow), a minimum stay time (e.g. return flight has to be at least a week after arrival, filters out business travel), only valid if the trip includes a weekend-night (again filters business), only valid on a connecting flight etc.
The optimization is not a simple thing at all, I've seen setups with large Spark/Hadoop clusters to calculate the optimal pricing for each tariff-class and the amount of tickets to allow on each flight for each tariff-class. Because that's the output of most revenue management systems. And then on the other side of things the flight booking sites or travel agents are trying to find the cheapest combination for each customer, because these tariffs are not "an SFO-JFK return" but more like "leg 1 SFO-ATL, leg 2 ATL-JFK, 5 days later leg 3 JFK-SFO" or something like that. And you can buy any combination you want as long as it fits the rules for each tariff class.
For many flights there is no single price that would allow the airline to operate the flight without making a loss. Some example for a 100 seat plane:
1. Sell all tickets at $100: Plane 100% booked, revenue $ 10,000, which is less than the cost of flight.
2. Sell all tickets at $200: Plane only 60% booked, revenue $ 12,000, better but still less than the cost of the flight.
Reality: Sell 15 tickets at $400, then sell 60 at $200 and sell 20 at $100. Now you make $ 20,000 with a 95% booked plane.
Your new problem is how to avoid the $400 people buying a $100 ticket, because that ruins your whole optimization. The way airlines do that is to make many tariff classes with a lot of rules and a limit to the number of tickets sold at a certain class. They then change that a bit based on demand once the flights gets closer to departure.
The rules are relatively simple things (this was invented in the mainframe computing time and some of those systems are still around), common examples: A minimum amount of time before departure (e.g. you can't but the $100 ticket for a flight that's tomorrow), a minimum stay time (e.g. return flight has to be at least a week after arrival, filters out business travel), only valid if the trip includes a weekend-night (again filters business), only valid on a connecting flight etc.
The optimization is not a simple thing at all, I've seen setups with large Spark/Hadoop clusters to calculate the optimal pricing for each tariff-class and the amount of tickets to allow on each flight for each tariff-class. Because that's the output of most revenue management systems. And then on the other side of things the flight booking sites or travel agents are trying to find the cheapest combination for each customer, because these tariffs are not "an SFO-JFK return" but more like "leg 1 SFO-ATL, leg 2 ATL-JFK, 5 days later leg 3 JFK-SFO" or something like that. And you can buy any combination you want as long as it fits the rules for each tariff class.