フィルターのクリア

Travelling salesman problem GA Matlab code debug

1 回表示 (過去 30 日間)
vimal r
vimal r 2020 年 5 月 5 日
clc;
tic;
x=[ 1000 225 304 236 213 339 187 197 226
225 1000 140 153 15 175 84 160 110
304 140 1000 152 132 41 121 190 108
236 153 152 1000 143 188 70 73 63
213 15 132 143 1000 166 74 145 102
339 175 41 188 166 1000 157 226 144
187 84 121 70 74 157 1000 81 43
197 160 190 73 145 226 81 1000 90
226 110 108 63 102 144 43 90 1000]
xnv=x;
x1=x;
minr= nnminr(x);
[r c ] = size(x);
for i=1:r
for j=1:c
x(i,j)=x(i,j)/minr(i);
end
end
x;
minc=nnminr(x);
for i=1:r
for j=1:c
x(j,i)=x(j,i)/minc(i);
end
end
x;
count=0;
for l=1:r
for i=1:r
for j=1:c
if x(i,j)==1
count = count+ 1;
end
end
if count <= 1
for I=i
for j=1:c
if x(I,j)==1
x(I,j)= x(I,j)*10;
end
for i=1:r
[yc yr] = find (x == 10);
l = length(yc);
for m=1:l
x(yr(m),yc(m)) = 10;
for j=1:c
if x(yr(m),j) == 10
x(yr(m),j)=0;
end
if x(j,yc(m)) == 10
x(j,yc(m))=0;
end
end
continue
end
x;
end
x;
end
end
end
count=0;
end
end
x;
for i= 1:r
for j=1:c
if x(i,j) == 0
x(i,j)=1;
end
end
end
x;
count=0;
for i=1:r
for j=1:c
if x(i,j)==1
count = count+ 1;
end
end
if count > 1
for I=i
for j=1:c
x(I,j)= x(I,j)*10;
[yc yr] = find (x == 10,1);
l = length(yc);
for m=1:l
x(yr(m),yc(m)) = 10;
for j=1:c
if x(yr(m),j) == 10
x(yr(m),j)=0;
end
if x(j,yc(m)) == 10
x(j,yc(m))=0;
end
end
continue
end
x;
end
x;
end
end
count=0;
x;
for i= 1:r
for j=1:c
if x(i,j) == 0
x(i,j)=1;
end
end
end
x;
z=xnv.*x
Minvalue=(sum(sum(z)))
plot(z)
toc;
Please debug this code showing error as
Error: File: GA1.m Line: 77 Column: 1
At least one END is missing: the statement may begin here.
and how to conver function from nnmin to MIN()

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by