200904网友求助《程序排错》
本帖最后由 为你奋斗 于 2009-12-3 14:20 编辑flag=0;<BR>while flag==0;<BR>for k=1:568<BR>R=inf; <BR>while sum(R)~=1<BR>R=round(rand(1,40)); <BR>end <BR>N(:,k)=R'; <BR>end <BR>flag=1;<BR>for i=1:40<BR> for j=1:568<BR> s1(i)=s1(i)+N(i,j);<BR> end <BR> end<BR> for i=1:40<BR> if s1(i)<4|s1(i)>30<BR> flag=0;<BR> end<BR> end<BR>end<BR>%......<BR>%......<BR>while flag==3<BR>s=zeros(1,32);j=1;<BR>flag=0;<BR>while flag==0;<BR>for k=1:568<BR>R=1; <BR>while sum(R)~=4<BR>R=round(rand(1,32)); <BR>end <BR>M(:,k)=R'; <BR>end <BR>flag=1;<BR>for i=1:32<BR> for j=1:568<BR> s(i)=s(i)+M(i,j);<BR> end <BR> end<BR> for i=1:32<BR> if s(i)<66|s(i)>76<BR> flag=0;<BR> end<BR> end<BR>end<BR>%......<BR>%......<BR>R=1; <BR>while sum(R)~=32<BR>R=round(rand(1,40)); <BR>end <BR>f1=find(R);<BR>%.......<BR>for j=1:568<BR> for i=1:40<BR> if N(i,j)==1<BR> p(j)=i;<BR> end<BR> end<BR>end<BR>for j=1:568<BR> for i=1:32<BR> if M(i,j)==1 <BR> if f1(i)==p(j)<BR> flag=3;<BR> end<BR> end<BR> end<BR>end %........<BR>end<BR>disp(['评委的编号',blanks(6),'评委来自的学校',blanks(6),'评委查看的试卷'])<BR>for i=1:32;<BR> for j=1:568<BR> if M(i,j)==1<BR> disp()<BR>end<BR>end<BR>end<BR> 本MATLAB程序存在不合理性,其原理没什么错误,但存在搜索不可实现性(时间),即可行性问题。求高手指教怎么加速搜索,优化搜索。 强。。。。。。。。。。。。。。。 ?????????????????????????
页:
[1]