Genetic Algorithm and FEA

1 次查看(过去 30 天)
Lomalsvi Bischerre
Lomalsvi Bischerre 2021-1-19
I am trying to do an optimization of a structure using GEnetic Algorithm. I wrote the MATLAB code for the fitness function below but it produces an error. The structure is designed in ANSYS.
L is the variable that will be read in from an input file. The file Stress.txt is the output of the ansys code wich will be read and used by the GA solver. I tried using the GA Toolbox GUI here.
function y = fitness(l)
l1=abs(l(1));
l2=abs(l(2));
fid=fopen('length.inp');
fprintf(fid,'l1=%f\n',l1);
fprintf(fid,'l2=%f\n',l2);
fclose(fid);
SET KMP_STACKSIZE=4096k & "C:\Program Files\ANSYS Inc\v192\ansys\bin\winx64\ANSYS192.exe" -b -p -i "C:\Users\Asus\Desktop\ANSYS\ansys_files\ansys_file.txt" -o "C:\Users\Asus\Desktop\Intro to ANSYS\ansys_files\output.txt"
fid=fopen('Stress.txt','r');
stress=fscanf(fid,'%f',[1,1]);
fclose(fid);
if((stress/250)<1)
y=(stress/250);
else
y=10000000;
end
Please help me find the cause of the error
  1 个评论
Mario Malic
Mario Malic 2021-1-20
It's hard to tell without knowing what's the error. The line with "SET" may be wrong syntax.

请先登录,再进行评论。

回答(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