 # NLopt failed due to Forced Stop

Hi, I encountered a rather complicated constrained maximum likelihood estimation

The constraint is numerically solved from a large-scale nonlinear fixed-point problem given primitive parameters (12,800 equality constraints) . I am trying JuMP with solver Ipopt to solve the fixed points but, for some parameter values, optimal solutions couldn’t be found. So I instead use minimum distance to comprise.
In math:

\max_{\theta} \mathcal{L}(\phi(\theta)), \quad s.t. \phi(\theta) = g(\phi(\theta))

g is not differentiable because of min/max equality constraints. I sketch my code below

using NLopt, JuMP
function cmle(θ::Array{Float64,1}, nograd) ## the constrained MLE objective function
fxp =  Model(with_optimizer(Ipopt.Optimizer, tol=1.e-6, mu_strategy = "adaptive"))
....
....
@NLobjective(fixpoint,Min,sum(distance[i]^2 for i = 1:12800) ### This line just for demonstration
JuMP.optimize!(fxp)
ϕ = value.(fxp). ## the
return likelihood = f(ϕ)
end

opt = Opt(:LN_COBYLA,15)
opt.lower_bounds = lowpar
opt.upper_bounds = uppar
opt.xtol_rel = 1e-4
#opt.ftol_rel = 1e-6
opt.min_objective = cmle

(ml,θmin,ret) = optimize(opt,initial_opt = Opt(:LN_COBYLA,15)  ##using gradient-free algorithm COBYLA
opt.xtol_rel = 1e-4
opt.min_objective = cmle

(ml,θmin,ret) = optimize(opt, initial_P)
## the initial values has been provided to ensure the fixed point mapping has a numerical solution.


When I try

cmle(initial_p)


the JuMP works and it reports a correct large number as the initial likelihood.

However, the optimize output is always like, whatever gradient-free algorithm I choose

Does anyone have a clue what’s going wrong?
PS: I used mathematical programming with equilibrium constraints (MPEC) to get rid of solving the fixed point. The result didn’t look reasonable so I wanna double check with NFXP.
Thanks!

Hi there,

The most common reason for NLopt to return :FORCED_STOP is an error in the objective function (https://nlopt.readthedocs.io/en/latest/NLopt_Reference/#forced-termination). You probably need to check that fxp solved correctly before trying to return the likelihood.