我正在尝试为01MKP实施ACO。我的输入值来自OR-Library mknap1.txt。根据我的算法,首先我随机选择一个项目。然后我计算施工图上所有其他项目的概率。概率方程取决于pheremon水平和启发式信息。
p[i]=(tau[i]*n[i]/Σ(tau[i]*n[i]).
我的pheremon矩阵的单元格在初始值(0.2)处具有常量值。因此,当我试图找到下一个项目时,由于0.2,pheremon矩阵变得无效。所以,我的概率函数确定下一个要去的项目,检查启发式信息。如您所知,启发式信息方程是
n[i]=profit[i]/Ravg.
(Ravg是资源限制的平均值)。因为这个原因我的问题。功能选择具有最大利润值的项目。 (可以说,在第一次迭代时,我的算法选择了一个随机获得600利润的项目。然后在第二次迭代中,选择2400利润值。但是,在OR-Library中,具有2400利润值的项目会导致资源违规。无论我是什么做,第二个选择的是具有2400利润的项目。
我的算法有什么问题吗?我希望知道ACO事情的人应该帮助我。提前谢谢。
输入值:
6 10 3800//no of items (n) / no of resources (m) // the optimal value
100 600 1200 2400 500 2000//profits of items (6)
8 12 13 64 22 41//resource constraints matrix (m*n)
8 12 13 75 22 41
3 6 4 18 6 4
5 10 8 32 6 12
5 13 8 42 6 20
5 13 8 48 6 20
0 0 0 0 8 0
3 0 4 0 8 0
3 2 4 0 8 4
3 2 4 8 8 4
80 96 20 36 44 48 10 18 22 24//resource capacities.
我的算法:
for i=0 to max_ant
for j=0; to item_number
if j==0
{
item=rand()%n
ant[i].value+=profit[item]
ant[i].visited[j]=item
}
else
{
calculate probabilities for all the other items in P[0..n]
find the biggest P value.
item=biggest P's item.
check if it is in visited list
check if it causes resource constraint.
if everthing is ok:
ant[i].value+=profit[item]
ant[i].visited[j]=item
}//end of else
}//next j
update pheremon matrix => tau[a][b]=rou*tau[a][b]+deltaTou
}//next i