Optimize with handling an objective function as "Black Box"
9 views (last 30 days)
Ilias Seferlis on 1 Feb 2018
Is there a way to optimize a costrained objective function without really knowing its expression? For example, say we have :
% main.m %
% starting point and costraints all previously defined
[Xopt,Fval] = fmincon(@obj,x0,A,B,Aeq,Beq,lb,ub,,options);
% End of main.m %
% Objective Function obj.m %
function [F] = obj(X)
% Write Data into File for exe
% Run Black Box exe
system('BB.exe') % where the expression of the objective function is(unknown to us)
% Read Results from exe
F = importdata('Fval.dat')
% End of obj.m %
The above example does not work,but gives the general idea The code is also attached (Run main.m) with a very simple objective function.
Sean de Wolski on 1 Feb 2018
Edited: Sean de Wolski on 1 Feb 2018
The pattern you have there looks like it should work and the idea is fine.
Though I would probably recommend patternsearch over fmincon since you likely cannot guarantee that BB.exe returns smooth continuous values.
Also note that F has to be a scalar. So maybe at the end:
F = norm(F)