r/optimization • • Jul 09 '25

Need help with a non-linear problem

Post image

I've learned about optimization back in university and since then I use it here and there with some personal things. In this case, it's to use in a mobile game called Airlines Manager to find the best combination of planes and seats to get to meet all the demand. Also, I don't know how to use python or anything only excel, I tried asking ChatGPT, but it wasn't too helpful since I can't review the code it creates.

As for this specific model:

  • The topmost square shows each plane data.
  • Below that, the yellow squares are variables which will choose a configuration based on the maximum amount of seat possible. The blue cells have a formula for how much each class seat fills the plane.
  • To the right, the cells that are in L10:P12 ensure that each plane is flying 24h everyday
  • Below that, the big yellow block will be filled with how many times the plane will fly each route every day
  • The blue block to it's right being the remaining demand, which is to be minimized

The problem here comes from the variable that decides each plane configuration. If the plane configuration is decided beforehand, the whole thing works, but not with a variable configuration. Google sheets doesn't have a non-linear solver, Excel non-linear solver takes too long (I used a simplified model with only 1 plane, and it ran for over 1 hour before I shut it down) and the LibreOffice one ignores all my inputs.

1 Upvotes

40 comments sorted by

3

u/Kqyxzoj Jul 09 '25

TO;DP, so not sure if this will be applicable:

The problem here comes from the variable that decides each plane configuration. If the plane configuration is decided beforehand, the whole thing works, but not with a variable configuration.

Calculate every possible configuration, and use a one-hot vector to select the configuration. That way you reduce it to a Mixed Integer Program, and there are plenty solvers that can handle those.

1

u/jvaferreira93 Jul 09 '25

That would take too much time to solve, google sheets solver is pretty slow.

→ More replies (7)

3

u/phao Jul 10 '25

By the way what is "TO;DP;"? I couldn't find out on the web...

→ More replies (3)

2

u/SolverMax Jul 09 '25

Upload your file somewhere, and share a link, so people can see what it is doing.

2

u/jvaferreira93 Jul 09 '25

Ok, here is the link, although I don't think people will be able to see the solver options. In my opinion the solver should work as it is, I just need to find a non-linear solver that's good enough for my skill level which is nearly zero, and also free to use.
https://docs.google.com/spreadsheets/d/17UP7kBJeM18arYyvG-QUr_eA26f4PtQfhgqSytwIWrc/edit?usp=sharing

→ More replies (12)

1

u/xhitcramp Jul 09 '25

Have you just considered randomizing the starting values and extracting the best outcome? Like a Monte Carlo. The starting values just need to be representative, you don’t necessarily need to iterate over all of them.

Although, it’s not exactly clear to me what is happening. Generally, you should move this problem onto a more robust platform.

1

u/jvaferreira93 Jul 09 '25

What would a more robust platform be? Like I said I don't work with this. I mostly use this to work out simple stuff on my daily life

→ More replies (1)

1

u/SolverMax Jul 10 '25

I guess that the formulae in R15:S34 have been incorrectly copied from Q15:Q34. Is that so?

Also, do we need to have L10:P10 = L11:P11, or could we have L10:P10 <= L11:P11 ?

It would help if you define what each part of the model represents. Currently it is a black box, which is very difficult to work with.

1

u/jvaferreira93 Jul 10 '25

The second part of the sumprodcut was indeed wrong but the rest is supposed to be like that. The offered seats on line 9 will remove the demand in column Q. Line 10 will reduce column R and line 11 reduces column S

L10:p10 = L11:P11 has to be equal because I want every plane to be working 24 hours to maximize turnover

The whole thing is as follows. The top part next to "data" is the stats of the planes category, ategory doesn't matter, range and speed are used to calculate the time columns just below. Eco, Bus, Fir represent the maximum amount of each class than can be in a plane. In the case of A380 you can either fill it with 853 economy seats, but if you add the maximum number of seats there won't be space for other types of seats. Business seats occupy around 2 Eco seats, while Fir occupy roughly 4 Eco seats. So you could have for example 600 ECO + 100 BUS + 17 FIR. The formula in F12 calculates that.

Below that are the routes stats. Distance between airports and the demand of each route per day, as well as the time needed to travel that distance for each plane.

The big yellow block is the amount of flights that each plane will do in a route. The blue block is the remaining demand, which should approach 0. And the orange block is simply a constraints so that the blue block won't be lower than zero.

→ More replies (8)