hhh*_*hhh 2 matlab stdout verbosity
我想抑制fmincon的标准输出,如下所示
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Active inequalities (to within options.TolCon = 1e-06):
lower upper ineqlin ineqnonlin
1 1
2 2
3 3
4 4
5 5
6 6
7 7
Run Code Online (Sandbox Code Playgroud)
每次我使用 fmincon 查找多元函数的最小值时都会触发它。
x0=lb; %guess
A=[];
b=[];
Aeq=[];
beq=[];
global mlf1;
mlf1=mlf;
[x,fval]=fmincon(@HenriMLF.mlfEvalAtPoint,x0,A,b,Aeq,beq,lb,ub);
Run Code Online (Sandbox Code Playgroud)
那么如何抑制fmincon的stdout呢?
在调用 fmincon() 之前,您需要设置各种选项来控制函数的应用方式。
在您的情况下,您需要将“显示”设置为“关闭”,例如:
options = optimoptions('Display', 'off');
Run Code Online (Sandbox Code Playgroud)
所以在你的情况下,这样的事情应该有效:
[x,fval]=fmincon(@HenriMLF.mlfEvalAtPoint,x0,A,b,Aeq,beq,lb,ub,options);
Run Code Online (Sandbox Code Playgroud)
更多文档在这里。