0

I am trying to do a pedestrian modeling where individual pedestrian agent behavior needs to be controlled. Can I do that using the pedestrian agent's statechart?

Update: Sorry that my initial question wasn't clear enough

main

jaywalker (agent)statechart

runtime screenshot

jaywalker agent from padsource

In the first picture (main) I have a simple pedestrian model where jaywalker (pedestrian agent) moves through 2 road crossing. Initially all the jaywalker agents are in "walking" state & colored yellow (pic: 2), but whenever some agents are near another agent (near means within the triangular shown in jaywalker agent representation), they send the message "HI" to them & socialize. If someone is socialized, then they move from "walker" state to "socializing" state (and turn red) & send messages to others who are within his triangular range("field of vision" triangle). The first 11 socializing is done directly by a message from main (on model startup) & 11 jaywalker agents are receiving it & moving to "socializing" state. The problem is in my graph it's showing the first 11 socializing but during model runtime the agent's color is not changing. Secondly, after those 11 socializing, agents aren't socializing or sending any message to others who are within his triangle.

So, I am confused about how I can make my agents move from one statechart to another while modeling the movement behavior using the pedestrian library. Am I missing any step to connect the pedestrian library & agent statechart?

Tariq
  • 57
  • 6
  • Welcome to SOF. First: please check how to ask questions here, we appreciate specific technical issues ;-) https://stackoverflow.com/help/how-to-ask – Benjamin May 18 '20 at 12:49
  • You can easily use statecharts with pedestrians, as you already discovered. Please re-format and rephrase your question and add specific screenshots. What do you want to get done, what have you tried already, why is it not working, how exactly is your model setup? What code do you use? – Benjamin May 18 '20 at 12:50
  • Thanks Benjamin for your feedback. I have updated my query with some pictures. I can't attach the anylogic file here otherwise it would have been more clearer. Can you please give your feedback on that? Or you need more details? – Tariq May 19 '20 at 08:28
  • Cool. Is your PedSource creating agents with the custom agent type "JayWalker" that defines the state chart? It seems it is creating default pedestrians. – Benjamin May 19 '20 at 09:16
  • that I am confused about. How I can make sure pedSource is creating custom agent type "jaywalker" or not? I created agent "jaywalker" with 100 population initially & declared it in pedsource. But it seems, during my model runtime, more than 100 agents are created. From where they are coming & how I can make sure those are custom created jaywalker agents, not the default pedestrians? – Tariq May 19 '20 at 09:24
  • See my answer below. But please do a few tutorials as well, they explain that in detail. – Benjamin May 19 '20 at 09:25

1 Answers1

0

It looks like you did not tell PedSource to create your custom ped agents of type "JayWalker". Try this:

  1. Delete your population, not needed
  2. Make sure your JayWalker agent type is defined as pedestrians in its properties: enter image description here
  3. In your PedSource, make sure it creates "JayWalker" agents as below. (You should select JayWalker where my screen selects "MyPed") enter image description here

Optionally, you can make the PedSource add the created "MyPed" agents to a custom population, but likely not necessary for you.

PS: Please understand that PedSource is creating agents, do not use your population for that. Read some more about PedSource and populations and do some tutorials to understand these basic concepts better :-)

Benjamin
  • 10,603
  • 3
  • 16
  • 28
  • still having another issue, as I changed the agent population to agent type (no population), I can't filter my agents to look out who is within the "areaOfVision" triangle. So, s.inState(walker.walking)));> is not working while filtering the agents. It says "walkers can't be resolved or is not a field" ** jaywalker (agent population) is deleted and created new agent type walker. I am really sorry for bothering you & I greatly appreciate your help. – Tariq May 19 '20 at 09:51
  • As I said: you can make the PedSource add new agents to a custom population "walker". Just check the settings. – Benjamin May 19 '20 at 12:41