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,

Take a read of the first post in Please read: make it easier to help you (Don’t worry about the long thread).

In particular, it’s easier to help if you can simplify your problem to a minimal working example. Since we can’t run your example, it’s a little hard to offer advice.

The most common reason for NLopt to return :FORCED_STOP is an error in the objective function (NLopt Reference - NLopt Documentation). You probably need to check that fxp solved correctly before trying to return the likelihood.

See Query Solutions · JuMP

Also, I remembered that NLSolve isn’t compatible with the last version of JuMP

Where is the objective value at the end of optimization coming from? Do you get the likelihood reported by JuMP when you plug the solution at forced termination back into your objective function? Or is that the objective value at the starting point?
(Edited my previous response because these seem more relevant for debugging the problem.)