Anylogic-Releasing agents 匹配 Wait 对象的特定条件

Anylogic-Releasing agents matching certain condition from Wait object

我有一个生产某些产品的设施,在该设施中,基本上有 3 种不同的产品。我正在尝试编写一个动作图表,以便如果有特定数量的特定产品的传入订单,则该产品从“等待”对象中释放,然后释放的产品进入代表生产的延迟对象。

产品是一个带有name参数的agent,有A、B、C三个产品,请问有什么实现方法吗?
总结起来,一共有三种产品,都保存在一个Wait对象中。我想实现这样,如果有数量为 3 的产品 A 的订单,则从 Wait 对象释放 3 个产品 A。

I simplified the model here 我有两种类型的产品,A 和 B。所以在配送中心,产品一直存放到发布为止。产品代理在配送中心流程中使用,带有字符串参数“type”。订单代理在订单流中使用,带有字符串参数“ProductType”和整数参数“Quantity”。也就是说,订单包含有关订购了哪种产品以及订购了多少产品的信息。

This is where I would like to code such that only certain products ordered by an order is released with the quantity specified by the order 目前,我是这样编码的,但当然它不能在“池”中找到例如只有一个产品。如果我这样做,我需要为每个产品都有一个单独的 Wait 对象,但我想避免它..

您需要创建一个指定订单信息的订单代理...此订单将有一个名为 numProductA 的参数,它说明订单中有多少产品 A。

那您就可以为您代办订单了。

List <Product> productsA=findAll(waitBlock,w->w.product.type.equals("A")).subList(0,agent.numProductsA);
for(Product p : productsA){
     p.order=agent;//You will probably need to associate that product to that order so you can know later in the flow.
     waitBlock.free(p);
}

这里我假设您的等待块上总是有足够的 prodcutsA...如果不是这种情况,您需要实施额外的逻辑,这些逻辑可能或多或少复杂,具体取决于具体情况。