フィルターのクリア

Shortest Path calculation problem

4 ビュー (過去 30 日間)
vimal r
vimal r 2020 年 3 月 17 日
コメント済み: KSSV 2020 年 3 月 17 日
%mat = [0,10,15,20;10,0,35,25;15,35,0,30;20,25,30,0]
pkg load io
mat = xlsread('distance matrix2.xlsx')
source = 1
len = length(mat)
vertex = zeros(1,len-1)
for i=1:len-1
vertex(i)=i+1
end
minpath = intmax
num = factorial(len-1)
count=0
while(count<num)
current_pathweight=0
k=source
for i=1:len-1
current_pathweight=current_pathweight+mat(k,vertex(i))
k=vertex(i)
end
current_pathweight=current_pathweight+mat(k,source)
if(current_pathweight<minpath)
minpath=current_pathweight
end
vertex=myperms(vertex)
count = count+1
end
when i run shows error:
Undefined function or variable 'pkg'.
Error in main (line 2)
pkg load io
  1 件のコメント
KSSV
KSSV 2020 年 3 月 17 日
This is a octave code.....remove the line pkg load io

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by