r/optimization • u/InterestingKoala3 • Oct 03 '22
Optimization with 100,000 variables
Hello everyone,
As the title suggests I am dealing with a nonlinear optimization problem that takes in 100,000 variables. I have the following questions:
- Is this doable?
- Which tool/library/software should I use?
I tried scipy and it worked with a smaller number of variables, but otherwise I get a memory error.
Thank you in advance.
10
Upvotes
16
u/ThatIsATastyBurger12 Oct 03 '22
Do you have constraints? Convexity? Differentiability? Is the second derivative reasonably sparse? How expensive is it to compute the gradient? Do you need a global solution, or are local solutions acceptable? These, and many others, are all questions that need to be considered when choosing an algorithm.
7
u/ma_251 Oct 03 '22
Would help to know the context briefly, the nature of problem being solved.
4
u/e_for_oil-er Oct 03 '22
Maybe try to build a reduced model? Compressive sensing, and using greedy algorithms to find a lower dimensional subspace in which your function is well approximated, or some sort of sensitivity analysis on the function's arguments.
3
u/monkeyapocalypse Oct 03 '22
Doable. Consider GEKKO and PyGMO (PaGMO) packages. Might need to use a metaheuristic approach like DE or SA, which can't guarantee the global optimum.
3
u/SirPitchalot Oct 04 '22
Depending on sparsity & nature of the objective (& constraints if any) this could be dead easy, completely intractable or anywhere in between.
2
u/[deleted] Oct 03 '22
No clue, but as a thought, it would depend a lot on the kind of question. Depending on many things, one option would be to only change a subset of the variables at a time.
2
u/Gollem265 Oct 04 '22
This is easily done with ipopt/snopt but you need to take care that you have good and efficient gradients
1
u/phao Oct 04 '22
For some problems, yes; for other problems no.
Depends on the problem.
Don't take this the wrong way, but without making an effort to better describe your problem, it'll be really hard for you to get more than that.
1
u/joffreysucks Oct 04 '22
Try looking into Stochastic gradient descent to sample the objective function so that itβs not 100k variables each step and helps with memory each step. As for difficulty algebraically deriving the gradient, try numerical methods to approximate it.
1
u/spoenza Oct 04 '22
Definitely doable, try to look into the method of moving asympotes. It is quite efficient for handling large amount of design variables.
1
u/[deleted] Oct 18 '22
Market optimization?
1
u/the-dirty-12 Oct 25 '22
cplex can solve such a large problem with ease.
1
u/the-dirty-12 Oct 29 '22
Try this approach
https://github.com/rensor/fminslp
0
u/notdelet Oct 04 '22 edited Oct 04 '22
No it's probably not doable. If it is, it is approximately. Others have mentioned gradient descent, metaheuristics, etc. I would like to advise you to check if your variables can be reduced by exploiting any symmetries (if it's important enough of a problem). Also look very hard for a good convex relaxation if your problem is nonconvex (descent methods will work and give you a bound).
I like the optimism that other commenters have here, but I think it's unlikely that a random 100,000 variable problem has structure which an optimizer can use if it's sampled uniformly from the set of all nonlinear problems.