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

3 ビュー (過去 30 日間)
Nikolai
Nikolai 2014 年 3 月 13 日
コメント済み: Nikolai 2014 年 3 月 13 日
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 Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by