Is there a way to speed up the time for calling external program?

조회 수: 1 (최근 30일)
Gifari Zulkarnaen
Gifari Zulkarnaen 2020년 8월 28일
댓글: Mario Malic 2020년 8월 30일
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:
% Optimization
x = ga(@fun,100);
% Objective function
function y = fun(x)
% writing input for external program
fprintf(fopen('input.tcl','wt'),'%s\n',x);
% running external program
!opensees.exe analysis.tcl
% read analysis result
out = fscanf(fopen('output.tcl','r'),'%f',[100 Inf]);
% objective function
y = fun2(out);
end
  댓글 수: 6
Gifari Zulkarnaen
Gifari Zulkarnaen 2020년 8월 29일
편집: Gifari Zulkarnaen 2020년 8월 29일
@per isakson: Yes I've tried to google it, but I still can't understand it, I am not from IT background.
@Mario Malic: Oh that's good idea, I will try find a way to do that. Thanks.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by