필터 지우기
필터 지우기

Matlab GA toolbox coupling with external simulation code.

조회 수: 2 (최근 30일)
Yro
Yro 2020년 10월 12일
댓글: Star Strider 2020년 10월 13일
I have the following problem when using GA tool for optimization. My objective function is the result of simulating each population in an external code. My question is: how can I handle the evaluation of the objective function for each population, running the simulation code for each individual.
  댓글 수: 2
Ameer Hamza
Ameer Hamza 2020년 10월 12일
Are you able to call the external simulation code from MATLAB, pass it some parameters, and get the output in return?
Yro
Yro 2020년 10월 12일
Thanks for your reply.
Yes, I can execute the code from Matlab, which for each individual in the population I have to execute the code, so I want how I can handle the evaluation of the objective function in Matlab.

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

답변 (2개)

Star Strider
Star Strider 2020년 10월 12일
See if the approach in Parameter Estimation for a System of Differential Equations will do what you want. It uses the ga function to optimise the parameters for differential equations integrated using ode45.
  댓글 수: 8
Yro
Yro 2020년 10월 13일
Thank you very much for your explanation. I am attaching a diagram of the problem I want to solve. In each iteration, for each individual in the population, I have to execute the external code (ERANOS code, for example with the system function) to evaluate and return to Matlab the result obtained for the objective function. The results using ga for an arbitrary function is the value its best value in each generation. So I have no information or how you evaluate each solution.
Thanks.
Star Strider
Star Strider 2020년 10월 13일
The diagram simply outlines the essence of the genetic algorithm.
You can likely substitute ‘ERANOS’ for ‘kinetics’ in my code, obviously with the appropriate changes. (I have no idea what ‘ERANOS’ is, so I cannot help you with it.)

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


Ameer Hamza
Ameer Hamza 2020년 10월 13일
편집: Ameer Hamza 2020년 10월 13일
You can write a MATLAB function wrapper around the call to the external simulator. Something like this
function f = objFun(x)
% call your external simulation here, pass value of x
% and return the objective function value y.
y = call_external_simulation(x);
end

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by