reading file in objective function optimization

조회 수: 2 (최근 30일)
quan ng
quan ng 2022년 1월 29일
편집: Matt J 2022년 1월 29일
Im using genetic algorithm to optimize a function, but in my objective function there are xlsread, and lots of load .mat file. I try using ga, but it is very slow. After 2 hours there is still nothing yet (i use 'PlotFcn', @gaplotbestf). I searched around and did find this https://www.mathworks.com/matlabcentral/answers/602392-genetic-algorithm-run-time-and-result-analysis#comment_1031587
one of their suggestion is to avoid read file in objective function, which i have a lot, like xlsread and load .mat files. And they suggest that using pameter function, which i dont understand. Can someone suggest how to avoid reading file in objective function, or explain what did they mean when they say should use parameter function?
Thank you.

채택된 답변

Matt J
Matt J 2022년 1월 29일
편집: Matt J 2022년 1월 29일
Read the files into Matlab variables before you run your optimization. Make the variables fixed data in your objective function using anonymous or nested functions as described here:
  댓글 수: 1
quan ng
quan ng 2022년 1월 29일
Thanks, i just find out about it too and have tried it, it is much more faster

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by