Changing the default tolerance for fmincon

I am doing a computation using fmincon, and it says tolfun=1e-06 and options.TolCon = 1e-06. I am trying to have a tolerance of 10^-20 instead.
I guess my question is,how do I change the tolerance for fmincon?

 採用された回答

Walter Roberson
Walter Roberson 2013 年 2 月 16 日

1 投票

options = optimset('TolCol', 1e-6);
fmincon(....., options)

2 件のコメント

Del
Del 2013 年 2 月 16 日
Thanks! It worked perfect
Rahul Bhadani
Rahul Bhadani 2021 年 1 月 4 日
編集済み: Rahul Bhadani 2021 年 1 月 4 日
This answer is no longer valid in 2020, with R2020a version.

サインインしてコメントする。

その他の回答 (2 件)

Brian B
Brian B 2013 年 2 月 16 日

1 投票

You can pass an options structure to fmincon. You create the structure using optimset.

2 件のコメント

Ehsan Khorsandnejad
Ehsan Khorsandnejad 2018 年 4 月 5 日
When I use this code fmincon(....., options), I get the following error:
Error using optimfcnchk (line 91) NONLCON must be a function.
Error in fmincon (line 410) confcn = optimfcnchk(NONLCON,'fmincon',length(varargin),funValCheck,flags.gradconst,false,true);
Error in Fitting_EIS_RQ_RC (line 39) x_final = fmincon(f,x_initial,[],[],[],[],[0,0,0,0,0,0,0,0],[10^4,10^4,10^4,10^4,10^4,10^4,10^4,1], options);
Steven Lord
Steven Lord 2018 年 4 月 5 日
You missed specifying [] for the nonlcon input between ub and the options structure.
x_final = fmincon(f,x_initial,... % fun, x0
[],[],[],[], ... % A, b, Aeq, beq
[0,0,0,0,0,0,0,0], ... % lb
[10^4,10^4,10^4,10^4,10^4,10^4,10^4,1], ... % ub
options); % this should be nonlcon, options
Make that last line:
[], options);

サインインしてコメントする。

Alan Weiss
Alan Weiss 2013 年 2 月 19 日
編集済み: John Kelly 2014 年 6 月 3 日

1 投票

Seting a tolerance of 1e-20 is the same as disabling that tolerance, or setting it to 0. See the documentation of tolerances.
Alan Weiss
MATLAB mathematical toolbox documentation

カテゴリ

質問済み:

Del
2013 年 2 月 16 日

編集済み:

2021 年 1 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by