Genetic Algorithm and FEA

1 visualización (últimos 30 días)
Lomalsvi Bischerre
Lomalsvi Bischerre el 19 de En. de 2021
Comentada: Mario Malic el 20 de En. de 2021
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 comentario
Mario Malic
Mario Malic el 20 de En. de 2021
It's hard to tell without knowing what's the error. The line with "SET" may be wrong syntax.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Genetic Algorithm en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by