How to run an optimization that always checks the nonlcon?

3 views (last 30 days)
In my objective function, there is a 'mvnrnd' function which generates random numbers. So I need a covariance matrix for mvnrnd. The parameters of this 3x3 covariance matrix (SIGMA) are unknown, and I am currently estimating them through optimization using 'fmincon'.
As SIGMA should be semi-definite positive, I defined a nonlinear constraint in which the main function is c = -(eig(SIGMA)). That said, I expect fmincon to select only parameters that satisfy my constraint, but I see that mvnrnd cannot generate random numbers as SIGMA often becomes non semi-definite positive.
- How can I force fmincon to check the nonlcon at all of its searches/estimations? Seems like it doesn't do that during the estimation of the Jacobian or Hessian.
- If fmincon is not the right choice here, what's your suggestion?
PS: I use bounds ('lb' and 'up') with a reasonable range. The algorithm is also interior-point. Also, random seed is fixed for every run of the objective function, so my objective function returns the same outputs for the same inputs.
Would be happy to provide more info.

Accepted Answer

Matt J
Matt J on 20 Oct 2016
Edited: Matt J on 20 Oct 2016
In my objective function, there is a 'mvnrnd' function which generates random numbers....Also, random seed is fixed for every run of the objective function, so my objective function returns the same outputs for the same inputs.
If this is for ML estimation then this is an awkward way to do things. An ML estimator is a deterministic function, not a stochastic one. Use mvnrnd to generate the data first - prior and external to the optimization.
How can I force fmincon to check the nonlcon at all of its searches/estimations?
It is not an issue of fmincon not checking. FMINCON algorithms simply do not restrict themselves to sequences that satisfy nonlinear constraints at all iterations. However, you can get rid of the nonlinear constraint and instead parametrize sigma as
sigma =L*L.'
where L is an unknown and unconstrained matrix.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!