Reputation: 75
I am currently working on a floor fire evacuation of a building using pedestrians that works with a click of a button. I would like to create a probability (example 0.2 for 1 exit obstruction, <0.2 for 2 and so on) when the button is clicked that a fire would obstruct 1, 2, all or none of the 3 exits (targetline) and make pedestrians move to an alternative closest exit. How can I do that with anylogic?
Upvotes: 0
Views: 216
Reputation: 972
You can use the built in probability distributions in AnyLogic to get one of your options with a required probability. In your case you could use the uniform distribution for each exit to determine if it is obstructed or not. Run this for example at model startup. As we cannot really 'obstruct' a targetLine, we go the other way round: we collect those who are not obstructed and only allow those to be choosen as destinations. To do so we save each available exit in a Collection availableExits. Later when deciding which exit to take, we will tell the decision function to only consider those in the list. Put this in the On Startup section of your Main properties:
if(uniform(0,1)<0.8){ // 20% probability of obstruction
availableExits.add(targetLine1);
}
if(uniform(0,1)<0.6){ // 40% probability of obstruction
availableExits.add(targetLine2);
}
if(uniform(0,1)<0.9){ // 10% probability of obstruction
availableExits.add(targetLine3);
}
Define the Collection availableExits like this:
For the evacuation, you can prepare a separate process flow that the Agents enter when the evacuation is trigered. This flow could be attached to the main process flow over the ccl/evacuation ports of the pedestrian library blocks.
In the separate evacuation process flow, put a moveTo block, in which the destination is beeing given by a function.
This function will iterate through all exits in your Collection availableExits and choose the closest one. Input parameter is of type Pedestrian and named ped, output parameter is of type TargetLine.
if(availableExits.size()<1){
error("No exit is available");
return null;
}
double currentDistance = ped.getPosition().distance2D(new Point(availableExits.get(0).getX(),availableExits.get(0).getY());
double minDistance = currentDistance;
TargetLine closestExit = availableExits.get(0);
for(int i=1;i<availableExits.size();i++){
currentDistance= ped.getPosition().distance2D(new Point(availableExits.get(i).getX(),availableExits.get(i).getY());
if(currentDistance<minDistance){
minDistance = currentDistance;
closestExit = availableExits.get(i);
}
}
return closestExit;
Upvotes: 1