0

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!

Emile Zankoul
  • 2,161
  • 2
  • 6
  • 18
  • can you show the contents of the *Issue* entity that is going to be asking for technicians and which property of *Technician* it need to match? – Artem P. Jun 26 '21 at 11:02
  • Thanks for your answer. My Issue entity is defined by an Option List with class "Issue", it has twelve values ("a" , "b" , "c" and so on...). I want to assign one of these randomly for each customer enters in process. Then in "seize technician" I have 5 resource pools (each with one technician) of type Technician. For example I want to say that if occurs Issue "a", the only good technicians are number 1 or 3 or 4; if occurs "b", the only good technicians are number 2 or 4.... and etc. How can I specify this in "customize resource choice? I would connect type of Issue with suitable technician – Stranieri Andrea Cosimo Jun 26 '21 at 11:49

1 Answers1

0

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.

Artem P.
  • 816
  • 1
  • 6
  • 8
  • Thanks for your answer. All clear. But how can I be sure that each agent entering in the model has a Issue value (I hope different values) ? Where can I specify "randomFrom(Issue.class)" in Main descrete model? I don't understand if the parameter value can change atuomatically for each customer or I have to specify it. Thanks again and sorry. – Stranieri Andrea Cosimo Jun 29 '21 at 06:28
  • I've clarified the answer – Artem P. Jun 29 '21 at 08:23