释放满足特定条件的代理人从等待对象中。

huangapple go评论68阅读模式
英文:

Anylogic-Releasing agents matching certain condition from Wait object

问题

我有一个生产特定产品的设施,在这个设施中,基本上有三种不同类型的产品。我正在尝试编写一个动作流程图,以便如果有特定数量的某种产品的订单进来,该产品将从“等待”对象中释放出来,然后释放的产品进入表示生产的“延迟”对象。

该产品是一个带有名称参数的代理,并且有三种产品 A、B、C。是否有一种方法可以实现这一点?
总结一下,有三种类型的产品都保存在一个“等待”对象中。我希望实现这样的功能,如果订购了 3 个产品 A,那么就会从“等待”对象中释放出 3 个产品 A。

我在这里简化了模型
我有两种类型的产品,A 和 B。因此在配送中心,产品会被存储,直到被释放为止。产品代理在配送中心流程中使用,带有一个字符串参数“type”。订单代理在订单流程中使用,带有一个字符串参数“ProductType”和一个整数参数“Quantity”。也就是说,订单包含了关于订购了哪种产品以及订购了多少产品的信息。

这就是我想编码的地方,只释放订单订购的特定产品,并且数量由订单指定
目前,我像这样编码,但是当然无法仅在“池”中找到 A 产品之类的产品... 如果我这样做,我需要为每种产品单独设置一个“等待”对象,但我想避免这样做...

英文:

I have a facility producing certain products, and in the facility, there are basically 3 kinds of distinguished products. I am trying to code an action chart so that if there is an incoming order of a certain product with a certain quantity, the product is released from a "Wait" object and the released product then goes into the Delay object, which represents production.

The product is an agent with a name parameter and there are three products A, B, C. Is there a way to implement this?
Summarizing, there are three kinds of products which are all saved in one Wait object. I want to implement such that if there is an order of product A of quantity 3, then 3 of product A are released from Wait object.

I simplified the model here
I have 2 types of products, A and B. So in the distribution center, products are stored until it is released. Product agent is used in the Distribution center flow with a string parameter "type". Order agent is used in the order flow with a string parameter "ProductType" and an integer parameter "Quantity". That is, order contains information about which product is ordered and how many of the product is ordered.

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
Currently, I coded like this but of course it is not able to find for example only A product in "pool".. If I do this way, I need to have a separate Wait object for each product but I would like to avoid it..

答案1

得分: 0

你需要创建一个订单代理,用于指定订单的信息... 这个订单将具有一个名为numProductA的参数,该参数表示订单中有多少个A产品。

然后,您可以为您的订单代理执行以下操作:

List<Product> productsA = findAll(waitBlock, w -> w.product.type.equals("A")).subList(0, agent.numProductsA);
for (Product p : productsA) {
    p.order = agent; // 您可能需要将该产品与该订单关联起来,以便以后在流程中了解。
    waitBlock.free(p);
}

在这里,我假设您的等待区块上始终有足够的产品A... 如果不是这种情况,您需要实现额外的逻辑,这可能会更或更少复杂,具体情况取决于情况。

英文:

You need to create an order agent that specifies the information of your order... this order will have a parameter called for instance numProductA which states how many products A the order has.

Then you can do for your order agent.

List &lt;Product&gt; productsA=findAll(waitBlock,w-&gt;w.product.type.equals(&quot;A&quot;)).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);
}

Here I'm assuming that you will ALWAYS have enough prodcutsA on your wait block... if that's not the case, you need to implement additional logic that might be more or less complicated depending on the case.

huangapple
  • 本文由 发表于 2020年10月23日 15:44:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/64495939.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定