Nonlinear equality constraint is not met in MultiStart, but is met only using fmincon in loops?

8 vues (au cours des 30 derniers jours)
I tried to use fmincon and wrote a loop for multiple starts. There was an inequality nonlinear constraint which restrict the vector norm to be one. I also tried to use Multistart with fmincon. Both are calling the same objective and constraint function files. However, the solutions from the former one met the vector norm = 1 constraint, but the Multistart solution didn't.
Here is my code for the Multistart with fmincon. tau is the parameter I am trying to solve.
obj = @(tau)ObjFunKDE(tau, beta1Est, Xs, n, nkde);
con =@(tau) ConstFminconKDE(tau, gamma0Est, gamma1Est, Xs, n, nkde, kappa);
tau0 = [-1/sqrt(3) 1/sqrt(3) 1/sqrt(3) ]';
opts = optimset('Algorithm','interior-point');
problem = createOptimProblem('fmincon','objective', obj,'x0',tau0, 'nonlcon',con, 'options',opts);
ms = MultiStart('StartPointsToRun', 'all', 'Display','iter');
[tau,fval] = run(ms,problem,50);
The nonlinear constraint function ConstFminconKDE is
function [c, ceq] = ConstFminconKDE(tau, gamma0Est, gamma1Est, Xs, n, nkde, kappa)
w = Xs * tau;
v = Xs * gamma1Est;
wv =[w, v];
hSqr = [ n^(-2/6)*var(w) , n^(-2/6)*var(v) ];
rng(2,'twister');
wvRs = datasample(wv, nkde, 'replace', true) + mvnrnd( [0 0], hSqr, nkde);
wRs = wvRs(:, 1);
vRs = wvRs(:, 2);
meanSign = mean(sign(wRs) .* vRs);
c = meanSign + mean(Xs * gamma0Est) - kappa;
ceq = tau(1)^2 + tau(2)^2 + tau(3)^2 - 1;
end
Any insight would be appreciated!
  1 commentaire
Alan Weiss
Alan Weiss le 22 Juil 2016
I am not sure what is going on, but do you have any bounds on your tau variable? If so, perhaps you should incorporate those bounds in your problem, and ensure that MultiStart runs only those start points that are within the bounds, by setting the StartPointsToRun property to 'bounds'.
Alan Weiss
MATLAB mathematical toolbox documentation

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by