I was trying to model an agent-based anylogic model where pedestrian agents will maintain a distance of 6 feet between them when moving in the continuous space. How I can do that?
I tried to put a circle of 6 feet radius around the agent and iterated whether any other agent is within that "socialDistance" circle. If yes, then the person agent will move (current distance between agents + 6 units) to maintain social distance. I used "moveTo" & I know it's not the right command. Additionally, my distance calculation is also not right. For example, if the agents are in 5 feet distance initially, I command asks to move (5+6=11 feet), which should not be the situation. Moreover, sometimes, my code may push the agent out of the simulation area (seems to me).
So, in summary, can someone help me to model that 6 feet distance between agents? It will be a great help.
Code (wrong!) that I tried: for (person socialD : get_Main().people) {
double pedSocialX = socialD.getX() -this.getX();
double pedSocialY = socialD.getY()- this.getY();
if (this.socialDistance.contains(pedSocialX, pedSocialY))
{
double a= socialD.getX()+ 6;
double b= socialD.getY()+ 6;
moveTo( a, b);
//[this is wrong command, what should be a good command?]
traceln ("social distance not mainted");
}
else
traceln (" social Distance maintained");
errors: