Tuesday, March 7, 2017

The Economically Impossible Optimum Faring (solved ?)

In an article in 2013, we've seen that the number of combinations is huge, but having a closer look, the number of pricing isn't that huge.



Number of flight(s) (legs) or Origin Destinations number of combination(s) Number of pricing(s) required
1 1 1
2 2 3
3 5 7
4 15 15
5 52 31
6 203 63
7 877 127
8 4'140 255
9 21'147 511
10 115'975 1'023
11 678'570 2'047
12 4'213'597 4'095
13 27'644'437 8'191
14 190'899'322 16'383
15 1'382'958'545 32'767

maybe it could open the door to something ?

code
Function pricingrequired(nombre As Integer) As Long
Dim i As Integer
i = 0
If nombre <= 1 Then
pricingrequired = 1
Else
For i = 1 To nombre Step 1
pricingrequired = pricingrequired + WorksheetFunction.Fact(nombre) / (WorksheetFunction.Fact(i) * WorksheetFunction.Fact(nombre - i))
Next i
End If

End Function

No comments:

Post a Comment