Editing
Agent Based Modeling
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''Modeling 'The Forest Fire' (A Cellular Automaton):''' <syntaxhighlight lang="python"> import random def simulate_fire(grid_size, density): """ Agents: Trees. Rule: 'If neighbor is on fire, I catch fire.' """ # Create a grid of trees (1) or empty (0) grid = [[1 if random.random() < density else 0 for _ in range(grid_size)] for _ in range(grid_size)] # Start a fire at the top row fire = [(0, i) for i in range(grid_size) if grid[0][i] == 1] burnt_count = len(fire) # Simple 'Spread' logic while fire: x, y = fire.pop(0) grid[x][y] = 2 # Burnt # Check 4 neighbors for dx, dy in [(0,1), (0,-1), (1,0), (-1,0)]: nx, ny = x+dx, y+dy if 0 <= nx < grid_size and 0 <= ny < grid_size: if grid[nx][ny] == 1: grid[nx][ny] = 2 fire.append((nx, ny)) burnt_count += 1 return burnt_count / (grid_size * grid_size) # Low Density: 40% trees print(f"Burnt area at 40%: {simulate_fire(20, 0.40) * 100:.1f}%") # High Density: 70% trees print(f"Burnt area at 70%: {simulate_fire(20, 0.70) * 100:.1f}%") # Note: The fire doesn't just grow linearly; it 'explodes' # once the density hits a critical point (~59%). </syntaxhighlight> ; ABM Landmarks : '''Conway's Game of Life''' β A 0-player game where 4 simple rules create infinite patterns, gliders, and even "computers" made of cells. : '''Sugarscape''' β A simulation that proved how inequality and wealth gaps emerge naturally even when everyone starts with the same ability. : '''Epidemiological Models (COVID)''' β Using ABM to simulate every individual in a city to see how "closing schools" vs "wearing masks" affects the hospitals. : '''Financial Market Simulators''' β Trading bots competing against each other to see how "Flash Crashes" happen. </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information