police module

class police.Police(bounds: geopandas.geodataframe.GeoDataFrame)[source]

Bases: object

distance_between(agent) → int[source]

Euclidean distance between two geographic points.

The output represents the distance referring to the geographic unit of the projection used.

Args:

agent (Crime): A crime object with the attributes x and y. Must be the same projection as self.

Returns:

int: Returns a float value of distance using the projection values.

move(crime)[source]

Move the police semi randomly, head in direction of crimes.

Police agents will move in a random direction each iteration. For each solved crime, if the police moves to an area that is further away than its previous position to a crime it will not move.

Args:

crime (List[crime.Crime]): List of crime ‘agents’ with x and y coordinates

random_movement(cur_dist: float, crime_list: List[int])[source]

Create random movement parameters for each agent.

Parameters
  • cur_dist (float) – Distance of a police agent from an active crime.

  • crime_list (List["Crime"]) – List containing all active crime agents