AnyLogic, resource choice with particular agent conditions

I'm using Anylogic. I have an agent Customer and five Technicians (they are resources). In agent statechart, I have to insert a list of 12 failures that can randomly occurr to customer. Each of these failures require a different combination skills (in my model exist four skills) . Each of five technicians has different combinations of skills.

Combination cases are in the figure

I model failures with an agent variable "Issue", and an option list (with class "Issue") with 12 number. It could be correct? In Main, in seize block, how can specify which technical resource to use for each agent?? I know that I have to use customize resource choice, but I need help to insert code. An another question is whether to insert population of 5 technicians in the agent-based part, or to create 5 different agents who call themselves "Technician 1", "Technician 2" and so on... Sorry for the numerous questions Thank you so much!

Upvotes: 0

Views: 431

Answers (1)

Artem P.
Artem P.

Reputation: 816

Your question has two parts:

  1. Randomly assigning one of Issue values to a property of your Customer agent - this can be done by create a parameter of type Issue in Customer agent (let's call it p_issue) and setting its default value to randomFrom(Issue.class). This way, every time a Customer class is create its p_issue parameter will be set to a random selection from range of Issue values.
  2. Matching a Customer with a technician resource - if you have 5 separate pools instead of 1 pool with 5 technicians then the simplest thing to do is to use a SelectOutput5 block. and have 5 seizes pointing at a pool each. In condition field you can put something like:
    agent.p_issue == Issue.a || agent.p_issue == Issue.b

The above case would work for matching an Customer agent with p_issue equal to a or b to a particular Seize that points to a single resource pool.


Update: you parameter should look like the image.

enter image description here

Note: this will pick issues at random, so there is no guarantee that each value is unique, i.e. if you have 10 issue values and generate a 100 customers then approx 10% of them will have p_issue=Issue.a, 10%, p_issue=Issue.b, etc.

Upvotes: 0

Related Questions