2012-08-08 45 views
-1

我想解决类似于旅行销售人员问题的问题,但在这种情况下,如果访问城市的成本太高,销售人员可以跳过城市。旅行商(TSP)跳过城市

请给我一些关于如何解决这个问题的方向。

+0

这功课吗?如果是这样,你应该这样标记它。 – 2012-08-08 15:05:40

+0

您有更好的机会在http://math.stackexchange.com或http://scicomp.stackexchange.com上获得很好的答案 – Ali 2012-08-08 21:10:20

回答

0

的一种方式,是复制/粘贴的Drools Plannerthis vehicle routing example和攻击它是这样的:

有两辆车:1台实车(=游)和1辆未使用的车辆(=非用于城市) 。 客户==城市。删除容量规则。

然后,更改评分细则,因此只总结了城市(=客户)的二手车的距离(而不是未使用的车辆):

rule "distanceToPreviousAppearance" 
    when 
     $customer : VrpCustomer(previousAppearance != null, $distanceToPreviousAppearance : distanceToPreviousAppearance, vehicleIsUsed == true) 
    then 
     insertLogical(new IntConstraintOccurrence("distanceToPreviousAppearance", ConstraintType.NEGATIVE_SOFT, 
       $distanceToPreviousAppearance, 
       $customer)); 
end 

rule "distanceFromLastCustomerToDepot" 
    when 
     $customer : VrpCustomer(previousAppearance != null, vehicleIsUsed == true) 
     not VrpCustomer(previousAppearance == $customer) 
    then 
     VrpVehicle vehicle = $customer.getVehicle(); 
     insertLogical(new IntConstraintOccurrence("distanceFromLastCustomerToDepot", ConstraintType.NEGATIVE_SOFT, 
       $customer.getDistanceTo(vehicle), 
       $customer)); 
end 

同样,你可以添加一个规则,对二手车所访问的每个城市的访问奖励进行总和,并尝试使用ConstraintType.POSITIVE_SOFT(加权与行进距离的加权)来最大化该奖励。

当然,你不应该这样破解它:这只是要点。相反,请根据您的要求重新命名和重新设计它。