首先,感谢那些在这个伟大的图书馆开具发票的人。
我的限制是:
我对Java没有经验,我试图通过使用提供的示例项目发送和接收OptaPlanner来使用xml。对于客户时间窗口,我使用了"VrmTimeWindowedCustomer“,这是没有问题的。对于车辆时间窗约束,我尝试使用"VrpTimeWindowedDepot“。
我脑子里想的是:当一个仓库(ReadyTime)可用时,车辆就会从那个仓库开始工作,然后到达顾客那里。然而,在我的尝试中,OptaPlanner没有给出我期望的结果:
<depotList id="139">
<VrpTimeWindowedDepot id="140">
<id>1</id>
<location class="VrpRoadLocation" reference="3"/>
<readyTime>540000</readyTime>
<dueTime>1020000</dueTime>
</VrpTimeWindowedDepot>
<VrpTimeWindowedDepot id="141">
<id>2</id>
<location class="VrpRoadLocation" reference="5"/>
<readyTime>540000</readyTime>
<dueTime>1020000</dueTime>
</VrpTimeWindowedDepot>
</depotList>
结果是:
<VrpVehicle id="143">
<id>1</id>
<capacity>100001002</capacity>
<depot class="VrpTimeWindowedDepot" reference="140"/>
<nextCustomer class="VrpTimeWindowedCustomer" id="144">
<id>42</id>
<location class="VrpRoadLocation" reference="85"/>
<demand>206</demand>
<previousStandstill class="VrpVehicle" reference="143"/>
<nextCustomer class="VrpTimeWindowedCustomer" id="146">
...
<vehicle reference="143"/>
<readyTime>0</readyTime>
<dueTime>1440000</dueTime>
<serviceDuration>12000</serviceDuration>
<arrivalTime>22137</arrivalTime>
</nextCustomer>
<vehicle reference="143"/>
<readyTime>0</readyTime>
<dueTime>1440000</dueTime>
<serviceDuration>12000</serviceDuration>
<arrivalTime>8527</arrivalTime>
</nextCustomer>
</VrpVehicle>
ArrivalTime对客户来说是可以的,但是比那辆车的仓库ReadyTime要小。
我不知道我在这里做错了什么。我读过Optaplanner -车辆的可用性和OptaPlanner文档,但不理解和不知道该如何处理我的情况。
我也无法理解drl文件的语法,也找不到解释如何编写它的文档。
编辑- Geoffrey 的另一个问题
Geoffrey,非常感谢您的快速反应,非常感谢。我已经试过你的改变了。根据仓库的ReadyTime,现在到达的时间已经确定了。然而,仓库的DueTime可能还有另一个问题:
<VrpTimeWindowedDepot id="144">
<id>3</id>
<location class="VrpRoadLocation" reference="7"/>
<readyTime>540000</readyTime>
<dueTime>1020000</dueTime>
</VrpTimeWindowedDepot>
最后一次从这个车库拜访车辆的顾客是:
<nextCustomer class="VrpTimeWindowedCustomer" id="183">
<id>36</id>
<location class="VrpRoadLocation" reference="73"/>
<demand>187</demand>
<previousStandstill class="VrpTimeWindowedCustomer" reference="182"/>
<vehicle reference="146"/>
<readyTime>0</readyTime>
<dueTime>1440000</dueTime>
<serviceDuration>10000</serviceDuration>
<arrivalTime>1082091</arrivalTime>
</nextCustomer>
到达时间不应该少于1020000吗?)在3个仓库里有3辆车。在解决方案中,只涉及2辆车,两者都有这样的完成时间。)
我尝试把这个添加到规划师-680 JIRA问题的评论,但我无法唱歌和登录。我希望这个编辑是好的,根据Stackoverflow的格式。
发布于 2016-10-27 01:56:37
我记得在txt导入程序(请看这一行)中与车辆/仓库的适当时间有关的示例中进行了黑客攻击。它还没有被清理干净,所以XML可以穿透它。但这不是你的问题。
在ArrivalTimeUpdatingVariableListener中,这一行似乎有一个bug:
protected void updateArrivalTime(ScoreDirector scoreDirector, TimeWindowedCustomer sourceCustomer) {
Standstill previousStandstill = sourceCustomer.getPreviousStandstill();
Long departureTime = (previousStandstill instanceof TimeWindowedCustomer)
? ((TimeWindowedCustomer) previousStandstill).getDepartureTime() : null;
这并没有考虑到vehicle.getDepot().getReadyTime()
。
https://stackoverflow.com/questions/40280917
复制相似问题