Is it possible to have fmincon terminate once a function value of a certain number is reached?

6 次查看(过去 30 天)
I have a function of 6 variables that returns a sum of squares differences from some ideal values. I would like fmincon to find me a local minimum that has a function value lower than a STATIC sum of squared differences value. Is this possible? From what I understand, the 'TolFun' and 'TolX' options will not do this for me. Here is what my function call looks like. The function, optimize_myfunc, is the function that returns a sum of squared differences.
lb = [x1_min, x2_min, x3_min, x4_min, x5_min, x6_min];
ub = [x1_max, x2_max, x3_max, x4_max, x5_max, x6_max];
anon_func = @(x)optimize_myfunc(x, other_var1, other_var2, other_var3);
options = optimset('Display','iter');
x_opt = fmincon(anon_func, [x1_0; x2_0; x3_0; x4_0; x5_0; x6_0], [], [], [], [], lb, ub, [], options);

回答(1 个)

Walter Roberson
Walter Roberson 2014-3-13
Yes, you can add termination criteria by adding an options structure that has OutputFcn set
Structure of the Output Function
The function definition line of the output function has the following form:
stop = outfun(x, optimValues, state)
stop is a flag that is true or false depending on whether the optimization routine should quit or continue. See Stop Flag for more information.
  1 个评论
Nikolai
Nikolai 2014-3-13
Thank you for the response, Walter.
I have a follow up question: To which field in the optimValues structure should I assign my additional termination criteria, and how would I keep fmincon from terminating before my additional criteria is met?
-Nikolai

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by