Hi everybody, i’m looking for the existence of the implementation of a tunneling algorithm in julia, or a wrapper to a solver that does that, any ideas?

# Tunneling algorithm?

**aaowens**#4

The gradient based algorithms in Optim.jl find local minima, and I think you wanted a global optimization algorithm.

You could also look at https://github.com/JuliaOpt/NLopt.jl . Some of its global optimization algorithms use the derivatives (Ex. https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/#stogo )

**mohamed82008**#5

IIUC, this should be easy to implement in Turing.jl with a custom distribution that has a custom “logpdf” value.

**longemen3000**#6

It’s weird to say this, but while the global optimization is my goal, I’m using that algorithm just as a starting point.to a bi level minimization algorithm in thermodynamics (this paper), but i will try all the available options mentioned in this post, thanks!

the tunneling is to bypass those local minima, but maintaining the best solution. in theory, all phase equilibria can be resolved with a global optimization, but the calculations are too expensive

**Tamas_Papp**#7

What is the dimensionality of your problem? In practice, these algorithms run into all the usual problems with MCMC (tuning, O(n^2) performance degradation, etc). Which is not to say that they are not useful in some cases, but in practice they can be tricky.

I did not look at the paper, but in general two-stage algorithms are usually less efficient than doing everything in a single pass.

**longemen3000**#8

the problem’s size are tipically small (2+Nspecies), where the amount of species can vary from one (pure compound) to 50 aprox (some oil mixtures). one problem is that the optimization procedure is just for one point (phase equilibria in that point) and there is a need to solve this problem multiple times with different parameters (Parametron.jl can be useful, i heard).

Also, the equations are hard to evaluate.

The mayority of phase equilibria solvers suppose ideality, so use other techniques, (inicialization using ideal gases, for example), but those fail at complicated points (like in Liquid-Liquid equilibria) and are limited to two specified phases (there are solvers for liquid-vapor and liquid-liquid, but you have to use those solvers knowing in advance what equilibrium phase you are expected to find).

The magic of the solver of the paper is that is phase independent, so only the basic starting points (a pressure, a temperature and a vector of mole fractions) are necessary.

The inicialization is to verify if the starting point is a stable phase, if the objective function in some moment is negative, then the routine starts adding addicional phases. if not, the phase is considered stable.

In this post, however, a lot of options given can be alternatives to that inicialization phase, so i will try combinations of them to see what works best