I am doing optimization problem. The objective function requires to call external program. But time for calling the program (0.1s) is much longer than the analysis of external program itself (0.01s). The optimization needs thousands of iteration to find optimum solution, so this takes hours. Is there a way to shorten the time for calling external program as it consumes most of required time?
Example of my script:
x = ga(@fun,100);
function y = fun(x)
fprintf(fopen('input.tcl','wt'),'%s\n',x);
!opensees.exe analysis.tcl
out = fscanf(fopen('output.tcl','r'),'%f',[100 Inf]);
y = fun2(out);
end
6 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_988943
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_988943
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_989639
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_989639
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_989741
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_989741
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_989822
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_989822
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_989963
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_989963
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_990518
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/585806-is-there-a-way-to-speed-up-the-time-for-calling-external-program#comment_990518
Sign in to comment.