I am modelling an Agent based model in AnyLogic. I am trying to count the number of agents in a statechart with similer fill color as the agents will be assigned different fill colors as they enter different states using the setFillColor()
command. I have tried the command item.statechart.equals(Color.red)
but its not bringing up any value
I would suggest making use of a variable, even if it is a variable of type Color and rather count agents with the variable set to a specific color. It will be easier to count e.g
agents.stream().filter(e -> colorVariable.equals(blue)).count()
but you can also do this with the rectangle
agents.stream().filter(e -> e.rectangle.getFillColor().equals(blue)).count()