我遇到了将N个代理从有向图的源顶点'src'发送到有向图的目标顶点'dst'的问题,这些边的权重正在增加n的线性函数(n是已经通过该边缘的特工)。
图形图像:
例如:
scenario 1
Agent1 , src->A->dst , cost = 1+(-1) = 0
Agent2 , src->A->dst , cost = 2+2 = 4
Agent3 , src->A->dst , cost = 3+5 = 8
overall cost = 0 + 4 + 8 =12
scenario 2
Agent1 , src->A->B->C->A->dst , cost = 1+0+0.5+(-2)+(-1) = -1.5
Agent2 , src->A->dst , cost = 2+2 = 4
Agent3 , src->A->dst , cost = 3+5 = 8
overall cost = -1.5 + 4 + 8 = 10.5
如何找到每个代理商的路径以最大程度地降低总成本?