Search code examples
javaanylogic

is there a function that can I use in condition to say (if a varaible was sent) so do something Anylogic


I would like to do a condition in my simulation that says (if the quantityToOrder was sent, then the currentStock decrement by the quantityToOrder value) I didn't know how to do it in Anylogic.

screenshot of the problem


Solution

  • Do not do it like that. Condition-based modelling is very error-prone (same for state chart conditions).

    Instead, wherever you send your orders off, you reduce the currentStock by the quantityOrdered

    At that point, you can easily add if-conditions to check if you want to order in the first place, like:

    if(weatherIsNice()) {
        currentStock -= qtyOrdered;
    }