⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getnewpath3.m

📁 数组排序,按照数组的某个元素进行排序,使用请查看
💻 M
字号:
function y = getnewpath3(m,b,k,stages,diffs,S,X,A,B,table,tablec,tables)   
sA = size(A);
sB = size(B);
inf2 = 10^8;
i = m;
while i <= stages
            if i == 1
                if sA(1) >= tables(stages-i+1,2)- tables(stages-i+1,1) + 1   %the ith stage all have been set to inf
                    i = i + 1;
                else                       
                       path = stage3(1,stages,diffs,S,A,table,tablec,tables);  
                       if path == 0        %the value of this path is inf
                           i = i + 1; 
                       else
                               m = norm(path);
                               if m > inf2
                                    i = i + 1;
                               end
                               if m < inf2
                               C = change3(path,X,table);
                               r = check3(C,A,X,table);       
                                   if r ~= 0
                                       r = checkb3(C,B,X,table);
                                   end
                                   if r ~= 0
                                       B = [B;C];
                                       tB = size(B);
                                       if tB > 1
                                           B = arrange(B);
                                       end
                                       table = setinf3(C,table);
                                   end
                               i = i + 1;
                               end   
                       end
                end
            else
                if sA(1) >= tables(stages-i+1,2)- tables(stages-i+1,1) + 1  %the ith stage all have been set to inf
                    i = i + 1;
                else
                        path1 = stage3(i,stages,diffs,S,A,table,tablec,tables);
                        if path1 == 0      %(all have been set to inf)
                            i = i + 1;
                        else

                                for j = 1:i-1
                                    path(j) = A(sA(1),j);
                                end
                                    path = [path(1:(i-1)),path1];
                                     m = norm(path);
                                if m > inf2
                                i = i + 1;
                                end
                                if m < inf2
                                %r = checkpath3(b,path,stages,X,table);
                                 %  if r ~= 0
                                       C = change3(path,X,table);
                                       r = check3(C,A,X,table);
                                       if r ~= 0
                                         r = checkb3(C,B,X,table);
                                       end
                                       if r ~= 0
                                       B = [B;C];
                                          if tB > 1
                                              B = arrange(B);
                                          end
                                       table = setinf3(C,table);
                                       end
                                   %end
                                   i = i + 1;
                                end
                        end              
                end        
            end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -