Unconstrained optimization problem fminunc with modified least squares
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I am trying an unconstrained optimization problem with 5 design variables (each design variable is a vector). The function evaluation is of the form (written as a separate function file):
funcVal = sumsqr(Z-z_tilde) + (1/k0)*norm(b-b0).^2 + (1/k1)*norm(c-c0).^2
Here, "b0" and "c0" are the known values and I want the optimizer to optimize the values for b and c so that they are as close as possible to b0 and c0, respectively.
z_tilde is the function that takes the data point along with 8 Gaussians with parameters (a,b,c).
The optimization setup is as shown below:
x_ = rand(30,1);
x_ (1:8) = theta_ (1:3:end) -10;
x_ (9:16) = mus - 10;
x_ (17:24) = vars - 10;
funcVal = @(x_)evalObjFunc(X, Y, Z,...
x_ (1:8), reshape(x_ (9:16),1,8), reshape(x_ (17:24),1,8), reshape(x_(25:28),1,4), reshape(x_(29:30),1,2), ...
mus,vars);
opts = optimoptions(@fminunc,'MaxIterations',10000,'MaxFunctionEvaluations',50000,'CheckGradients',true);
opts.OptimalityTolerance = 1.000000e-16;
opts.StepTolerance = 1.000000e-11;
[theta,fval,grad] = fminunc(funcVal,x_, opts);
The error I'm getting is "fminunc stopped because it cannot decrease the objective function along the current search direction."
P.S: The function definition is correct, I have checked it several times and for different values of x_ the function returns different values.
1 commentaire
Réponses (1)
Matt J
le 30 Juin 2021
The exit message looks fine. It's not an error.
2 commentaires
Matt J
le 30 Juin 2021
Modifié(e) : Matt J
le 30 Juin 2021
The exit message means fminunc thinks it succeeded. If it is terminating with every inital point that you choose, it means that it thnks every initial point is optimum. This can happen in functions that are locally flat everywhere, for example,
x=fminunc(@floor,1.3)
x=fminunc(@floor,1.5)
x=fminunc(@floor,2.7)
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!