Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: error in BINARY GENETIC ALGORITHM
Replies: 1   Last Post: Nov 4, 2013 9:38 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
m1363

Posts: 1
Registered: 11/2/13
error in BINARY GENETIC ALGORITHM
Posted: Nov 2, 2013 4:55 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

hi
When I type the following:
ff='testfunction';
npar=2;
maxit=100;
mincost=-9999999;
popsize=16;
mutrate=.15;
selection=0.5;
nbits=8;
Nt=nbits*npar;
keep=floor(selection*popsize);
Create the initial population
iga=0;
pop=round(rand(popsize,Nt));
par=gadecode(pop,0,10,nbits);
cost=feval(ff,par);
[cost,ind]=sort(cost);
par=par(ind,:);pop=pop(ind,:);
minc(1)=min(cost);
meanc(1)=mean(cost);

Why do I get this error?:
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.

Error in ==> Untitled6 at 27
minc(1)=min(cost);





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.