You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The GridDF class has been implemented as an abstract base class that extends DiscreteSpaceDF, specifically designed for grid-based spatial representations in mesa_frames. Key features and methods include:
Initialization with model object, dimensions, torus property, capacity, and neighborhood type
Grid-specific spatial operations:
get_directions: Calculate directions between grid positions or agents
get_distances: Calculate distances between grid positions or agents
get_neighbors: Find neighboring agents within a given radius on the grid
get_cells: Retrieve cell properties and agents for specified grid cells
move_agents: Place agents at specific grid positions
remove_agents: Remove agents from the grid
Grid-specific utilities:
out_of_bounds: Check if positions are outside the grid boundaries (for non-toroidal grids)
torus_adj: Adjust coordinates for toroidal grids
Internal grid management:
_calculate_differences: Calculate coordinate differences between positions or agents
_compute_offsets: Generate neighborhood offsets based on the specified type (Moore, von Neumann, or hexagonal)
_get_df_coords: Convert various input formats to a DataFrame of coordinates
_generate_empty_grid: Abstract method to create an empty grid with specified dimensions and capacity
_place_agents_df: Abstract method to place agents in the grid
Properties:
dimensions: Get the grid dimensions
neighborhood_type: Get the type of neighborhood used
torus: Check if the grid is toroidal
This implementation provides a comprehensive framework for grid-based spatial environments in agent-based models. It handles various grid types (rectangular, toroidal) and neighborhood configurations (Moore, von Neumann, hexagonal). The class manages grid coordinates, agent positions, and cell properties efficiently using DataFrames.
GridDF builds upon the DiscreteSpaceDF class, adding grid-specific functionality while maintaining compatibility with the overall mesa_frames structure. It offers methods for common grid operations like calculating distances and directions, finding neighbors, and handling boundary conditions (toroidal or non-toroidal).
The abstract methods (_generate_empty_grid and _place_agents_df) allow for customization in concrete subclasses, potentially accommodating different backend implementations or optimizations for specific use cases.
This GridDF class provides a robust foundation for implementing various types of grid-based simulations within the mesa_frames library, offering flexibility and efficiency in managing spatial aspects of agent-based models.
The text was updated successfully, but these errors were encountered:
The GridDF class has been implemented as an abstract base class that extends DiscreteSpaceDF, specifically designed for grid-based spatial representations in mesa_frames. Key features and methods include:
This implementation provides a comprehensive framework for grid-based spatial environments in agent-based models. It handles various grid types (rectangular, toroidal) and neighborhood configurations (Moore, von Neumann, hexagonal). The class manages grid coordinates, agent positions, and cell properties efficiently using DataFrames.
GridDF builds upon the DiscreteSpaceDF class, adding grid-specific functionality while maintaining compatibility with the overall mesa_frames structure. It offers methods for common grid operations like calculating distances and directions, finding neighbors, and handling boundary conditions (toroidal or non-toroidal).
The abstract methods (_generate_empty_grid and _place_agents_df) allow for customization in concrete subclasses, potentially accommodating different backend implementations or optimizations for specific use cases.
This GridDF class provides a robust foundation for implementing various types of grid-based simulations within the mesa_frames library, offering flexibility and efficiency in managing spatial aspects of agent-based models.
The text was updated successfully, but these errors were encountered: