如何根据交货地点和库存水平批量代理 [英] How to batch agents based on delivery location and inventory level

查看:19
本文介绍了如何根据交货地点和库存水平批量代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了理解我的问题,让我先介绍一下我的模型.当大约 50 个订单代理同时进入时,该过程开始.块(见图).之后,延迟块将订单延迟 1 秒,以将它们分开.然后,等待块用于创建批量大小,使其小于所选车辆的最大容量.这是通过将参数amount"与参数amount"相加来完成的.(保存在订单代理中)直到达到最大容量20(见代码).订单保存在一个名为collection"的集合中,集合的大小用作下一个块的批量大小.

问题是在查看订单的交货地点时,订单有时是不合逻辑的批处理.例如,车辆 1 和车辆 2 都去 A 地和 B 地,而如果车辆 1 去 A 地,车辆 2 去 B 地效率更高.他们彼此靠近吗?交付位置作为参数deliveryLocation"存储在订单代理中.客户类型(GIS 地图上的位置).

inventory=agent.amount+inventory;集合.添加(代理);如果(库存> = 20){batch.set_batchSize(collection.size());等待.freeAll();集合.清除();库存=0;}

解决方案

这个问题和这个问题很相似

在这个例子中,我创建了一个选项列表Location,每个订单代理都有一个位置类型的参数.因此,当他们进入等待时,我可以简单地将它们添加到等待同一位置的订单列表中,如果它们符合批次标准,则释放它们

if (!collection.containsKey(agent.location)) collection.put(agent.location, new ArrayList());collection.get(agent.location).add(agent);如果 (collection.get(agent.location).size() > batchSize) {for(订单订单:collection.get(agent.location)){等待.免费(订单);}}

并记住当它们离开等待块时将它们从集合中删除.

To understand my question let me first introduce my model. The process starts when around 50 order agents enter at the same time the "enter" block (see picture). After that, the delay block delays the orders for 1 second, to separate them. Then, the wait block is used to create batch sizes such that they are smaller than the maximum capacity of the selected vehicle. This is done by summing the parameter "amount" (saved in the order agent) until the maximum capacity of 20 is reached (see code). The orders are saved in a collection called 'collection' and the size of the collection is used as the batch size in the next block.

The problem is that when looking at the delivery location of the orders, orders are sometimes unlogical batched. For example, vehicle 1 and vehicle 2 both go to places A and B, while it's more efficient if vehicle 1 goes to place A and vehicle 2 goes to place B. Is there a way that the batches will take delivery location into account such that they are close to each other? The delivery locations are stored in the order agents as a parameter "deliveryLocation" of type Customer (location on a GIS map).

 inventory=agent.amount+inventory;
 collection.add(agent);

 if(inventory>=20){
      batch.set_batchSize(collection.size());
      wait.freeAll();

 collection.clear();
 inventory=0;
 }

解决方案

This question is very similar to this one https://stackoverflow.com/a/68917002/4019094, please review it there for an alternative way of implementation.

The example below builds on your existing logic of doing all the coding when an Order enters the wait block

In order to release orders based on their location you need to change your collection to a map with Location as a key.

For this example I created an option list Location, and each Order agent has a parameter of type location. Thus when they enter the wait I can simply add them to a list of orders waiting for the same location, and release them if they meet the batch criteria

if (!collection.containsKey(agent.location)) collection.put(agent.location, new ArrayList<Order>());
collection.get(agent.location).add(agent);

if (collection.get(agent.location).size() > batchSize) {
    for (Order order:collection.get(agent.location)) {
        wait.free(order);
    }
}


And remember to remove them from the collection when they leave the wait block.

这篇关于如何根据交货地点和库存水平批量代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆