tpapp / MultistartOptimization.jl

Multistart optimization methods in Julia.
Other
64 stars 10 forks source link

xtol_rel and xtol_abs are not changing. #38

Open jmcastro2109 opened 1 year ago

jmcastro2109 commented 1 year ago

Hi, I am trying to finish the local optimizers based on a time limit.

I am using the following code:

local_method = MultistartOptimization.NLoptLocalMethod(NLopt.LN_BOBYQA;  xtol_abs = 0.0, xtol_rel = 0.0, maxtime = 300.0, maxeval = 2000)

multistart_method = MultistartOptimization.TikTak(5000)

p_brute = MultistartOptimization.multistart_minimization(multistart_method, local_method, P_brute; use_threads = false)

However, when the optimization finalizes I get the following return code,

p_brute:(value = 0.004157932864387097, location = [26.98036761207386, 0.39483019850986095, 24.10020993701281, 123.12567045769113, 65.26306039580315, 0.4295685034555466], ret = :XTOL_REACHED)

How is this possible?

jmcastro2109 commented 1 year ago

Re-working the error code

tpapp commented 1 year ago

:XTOL_REACHED means that your coordinates are (practically) not changing, so the optimizer halts. Ie the new x is == the previous one.

Hard to say more without an MWE.

jmcastro2109 commented 1 year ago

Hi @tpapp thanks for the answer and sorry for the lack of clarity.

It is difficult to provide a MWE, although hopefully the following code snippet can provide some clarity on what is happening. The minimum should be 0, and for some reason whenever I increase maxeval the objective function does not change. Moreover, it does not return the termination criterium.

local_method = MultistartOptimization.NLoptLocalMethod(NLopt.LN_BOBYQA;  xtol_abs = 0.0, xtol_rel = 0.0, maxtime = 0.0, maxeval = 500)

p_brute = MultistartOptimization.multistart_minimization(multistart_method, local_method, P_brute; use_threads = false)

println("p_brute:", p_brute)

p_brute:(location = [38.04931640625, 0.4683843206787109, 59.28955078125, 93.4814453125, 66.0766604954834, 0.4233642578125], value = 0.1176349004423373)

local_method = MultistartOptimization.NLoptLocalMethod(NLopt.LN_BOBYQA;  xtol_abs = 0.0, xtol_rel = 0.0, maxtime = 0.0, maxeval = 1000)

p_brute = MultistartOptimization.multistart_minimization(multistart_method, local_method, P_brute; use_threads = false)

println("p_brute:", p_brute)

p_brute:(location = [38.04931640625, 0.4683843206787109, 59.28955078125, 93.4814453125, 66.0766604954834, 0.4233642578125], value = 0.1176349004423373)

local_method = MultistartOptimization.NLoptLocalMethod(NLopt.LN_BOBYQA;  xtol_abs = 0.0, xtol_rel = 0.0, maxtime = 0.0, maxeval = 1500)

p_brute = MultistartOptimization.multistart_minimization(multistart_method, local_method, P_brute; use_threads = false)

println("p_brute:", p_brute)

p_brute:(location = [38.04931640625, 0.4683843206787109, 59.28955078125, 93.4814453125, 66.0766604954834, 0.4233642578125], value = 0.1176349004423373)

SMALL UPDATE: it seems to be that what is happening is that when I increase maxeval beyond some number, the optimizer is reporting the smallest value from the initial global phase. `