FMINCON optimizer not plotting
显示 更早的评论
I'm working on optimizing mesh parameters in a CFD software with fmincon. I have an objective function that imports the parameter values by reading a csv file, replaces them in the cfd software, and runs the simulation. I am trying to get fmincon to optimize those values for me by comparing the simulation results to wind tunnel results. The function generates an error value between the simulated and wind tunnel data. When I run the optimizer it opens the objective function and runs the simulation but does not generate a plot with the fval and iteration it just starts another simulation once the first has completed without optimizing any of the parameters. Here's the code I am currently using.
options = optimoptions('fmincon','Display','iter','PlotFcns',@optimplotfval); parameters = [25,10,50,50,1.5,360,0]; fun = @Run_Java; A=[]; b=[]; Aeq=[]; beq=[]; lb=[]; ub=[]; nonlcon=@paramcon; [x,fval,exitflag,output]=fmincon(fun,parameters,A,b,Aeq,beq,lb,ub,nonlcon,options);
回答(1 个)
Alan Weiss
2018-1-14
0 个投票
Most likely what you are seeing is that fmincon is taking finite difference steps to estimate a gradient in order to calculate the next evaluation point. That is why, in general, the number of Feval (function evaluation points) is larger than the number of iterations.
By the way, for a simulation you might need to take larger-than-default finite differences. See Optimizing a Simulation or ODE.
Alan Weiss
MATLAB mathematical toolbox documentation
类别
在 帮助中心 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!