How to generate nonzero x (i, j) values using loop function 1: pop_size?
Show older comments
let
c=[10 2 20 11
12 7 9 20
4 14 16 18];
s=[15
25
10];
d=[5 15 15 15];
[m,n]=size(c);
pop_size=25
gen_iter=100
phi=1:12
for ii=1:pop_size
randi_phi = randperm(length(phi))
for count = 1 : length(phi)
count
k= randi_phi(count)
i=[1+mod((k-1),m)]
j=[1+mod((k-1),n)]
x(i,j)=min(s(i),d(j))
s(i)= s(i)-x(i,j)
d(j)= d(j)-x(i,j)
end
end
I want to find x (i, j) until the loop pop_size = 25 but my math lab code results in x (i, j) = (m, n) = 0, even though if the loop uses length phi the value x (i, j) comes out or not zero. if anyone can help my mathlab code this. ? This I use a new genetic algorithm at the chromosome initialization stage
Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!