Genetic Algorithm and FEA
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Mario Malic
il 20 Gen 2021
It's hard to tell without knowing what's the error. The line with "SET" may be wrong syntax.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Genetic Algorithm in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!