running a project using genetic algorithm
8 views (last 30 days)
Show older comments
I want to run a project using genetic algorithm and I don't know how.
This project have 4 functions that I attached this thesis here.
functions m files are in this thesis.
thank you guys.
2 Comments
Hikaru
on 7 Aug 2014
Edited: Hikaru
on 7 Aug 2014
I'm assuming that the 4 functions you meant are:
- GAmodule (pg 43-48)
- penalty2 (pg 49-50)
- bintranslate (pg 51-53)
- FEM2 (pg 54-56)
If so, it's better not to combine them. Make separate m-files, and make sure you have them all on your working directory.
If it does not work, then you should CHECK the syntax. I'm pretty sure the lines could change during copy-and-pasting. MATLAB reads code in one line, unless if there are ellipses (...) at the end to tell it to check the next line before execution. In the editor, you should see red bars that will point you to the lines with problem.
If you did all this and it still doesn't work, you should tell us what does the error message say.
You said, "does NOT worked", then tell us WHAT does not work.
Accepted Answer
Hikaru
on 7 Aug 2014
Try changing the first line in all your files.
.m should start with:
function GAmodule
And penalty2.m should start with:
function [fitness]=penalty2(chromosome,available,bc,Dof,E,f,fixedcoord,na,nb,neft,ne,vt,nl,nn,numbitCoordX,numbitCoordY,numbitEdof,numbitEp,sq,TOPGSM,xspan,yspan);
And bintranslate.m should start with:
function [Coord,Edof,Ep]=bintranslate(available,chromosome,Dof,fixedcoord,na,nb,neft,nevt,nl,nn,numbitCoordX,numbitCoordY,numbitEdof,numbitEp,xspan,yspan);
And FEM2.m should start with:
function [Ed,Ex,Ey,v1,v2,w,wrong]=FEM2(bc,Coord,Dof,E,Edof,Ep,f,neft,nevt,sq,TOPGSM);
5 Comments
Hikaru
on 11 Aug 2014
Try typing this in your command window
help coordxtr
If it says 'coordxtr not found' then it means that you don't have the functions in your MATLAB path. The function coordtxr and a few other functions called in the m-files are included in the CALFEM toolbox (see link in my previous comment). You need those to run the program.
More Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!