I would like to do the following: setting the Ipopt optimizer (used via JuMP) to terminate ONLY when max_cpu_time
is reached. Is it possible?
motivation for doing such a stupid thing:
I need to run multiple optimization in parallel on the same machine. They are completely independent. However, by setting the option max_cpu_time
via set_optimizer_attribute(model, "max_cpu_time", 100.0)
the max time is divided by the number of processes running in parallel. There is an option max_wall_time
on the ipopt documentation, but is only for future version of ipopt, not already compatible with Julia. Hence what I usually do is simply set a default value for max_cpu_time
and then multiply that value by the number of processes that I want to run in parallel. However this partially works, because if for example one optimization ends quickly, then all the others will run for too much time (to account for the time that the first one didn’t use). Hence I would like to set the termination condition only based to time, so that I avoid this issue.
Thanks!
(EDIT: add small example to work with)
function ff(x)
return x^2
end
function jumpTimeOnlyTermination()
model = Model(Ipopt.Optimizer);
set_optimizer_attribute(model, "linear_solver", "ma57")
set_optimizer_attribute(model, "max_iter", 1000)
set_optimizer_attribute(model, "max_cpu_time", 100.0)
@variable(model,xx)
register(model, :ff, 1, ff; autodiff = true)
@NLobjective(model,Min,ff(xx))
JuMP.set_start_value(xx,15)
JuMP.optimize!(model)
return model
end