Search code examples
javasimulationanylogic

Seize by condition - AnyLogic


Assume I have 2 resources - x and y. How can I make conditional seize by a parameter of y?

On the seize block, the customise resource choice has been selected and the resource choice condition is:

(y)unit).parameter >= 3, but it raised an error :” can’t cast x to y “.

Any suggestions?


Solution

  • if x and y are different resource types then you can do in your resource choice

    unit instanceof Y ? ((Y)unit).parameter >= 3 : true