我是OptaPlanner的新手,并尝试根据我的需要修改现有的VRP示例。
我的问题:我想要无容量的VRP,就像在示例教程/ test / tutorial-01-uncapacitated.vrp中一样。在实际实现中,优化器大多只使用一种车辆,因为它只考虑最小化总体状态。我想更改软约束,以使最大巡视最小化。我的目标是平等利用车辆。
下面是实现的drools软约束:
//###########################################################################
// Soft constraints
// ############################################################################
rule "distanceToPreviousStandstill"
when
$customer : Customer(previousStandstill != null,$distanceFromPreviousStandstill : distanceFromPreviousStandstill)
then
scoreHolder.addSoftConstraintMatch(kcontext, - $distanceFromPreviousStandstill);
end
rule "distanceFromLastCustomerToDepot"
when
$customer : Customer(previousStandstill != null)
not Customer(previousStandstill == $customer)
then
Vehicle vehicle = $customer.getVehicle();
scoreHolder.addSoftConstraintMatch(kcontext, - $customer.getDistanceTo(vehicle));
end
我正在尝试计算每辆车的距离,并返回具有最高距离的车辆的软约束。