0

In AnyLogic, my agent has integer parameters agent.size and agent.height

In a queue, I would like to select the agents with a specific size, i.e., agent.size == 5 over the other agents. In a size tie, I would like to select the one with biggest height. How can I model this?

I think I should define this in the priority-based section of the queue module. But, there I can only say agent.size and the larger size will have more priority. How can I adjust this to be able to give a hierarchy (not from a database input, but with parameters which change during the run)?

1 Answer 1

1

You should put queueing rule to be "Agent comparison".

You have to write a condition more or less like this:

agent1.size == 5  && agent1.size == agent2.size ? 
    agent1.height > agent2.height : agent1.size == 5 ?
        true : agent1.size > agent2.size
Sign up to request clarification or add additional context in comments.

1 Comment

That's great. I think it is missing though. Here, if agent1.size == 5 and agent2.size == 6 then this block code will select agent 2 since the condition ? will not hold and the one with a larger size will be chosen. I think I need to extend this to one more condition where I say: i) one of them has size 5 the other has another size, then chose the first one; ii) both of them have size 5 then your code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.