Skip to content

Commit 834bf86

Browse files
committed
cleaning up and adding result docs and readme
1 parent 74cb79a commit 834bf86

56 files changed

Lines changed: 150 additions & 5291 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

0 Bytes
Binary file not shown.

README.md

Lines changed: 10 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ The computational bottleneck is the update kernel, which must process every occu
196196

197197
Key optimizations:
198198

199-
1. **JIT Compilation**: Core kernels use `@njit(cache=True)` for ahead-of-time compilation
199+
- **JIT Compilation**: Core kernels use `@njit(cache=True)` for ahead-of-time compilation
200200
2. **Pre-allocated Buffers**: The `PPKernel` class maintains reusable arrays to avoid allocation overhead
201201
3. **Efficient Shuffling**: Fisher-Yates shuffle implemented in Numba for random cell ordering
202202
4. **Cell Lists for PCF**: Pair correlation functions use spatial hashing for O(N) instead of O(N²) complexity
@@ -221,19 +221,6 @@ class PPKernel:
221221
self._dr = np.array([-1, 1, 0, 0], dtype=np.int32)
222222
self._dc = np.array([0, 0, -1, 1], dtype=np.int32)
223223
```
224-
225-
### Benchmark Performance
226-
227-
On typical hardware, the optimized kernels achieve:
228-
229-
| Grid Size | Random Kernel | Directed Kernel | Overhead |
230-
|-----------|---------------|-----------------|----------|
231-
| 100×100 | ~0.8 ms/step | ~1.2 ms/step | +50% |
232-
| 500×500 | ~20 ms/step | ~35 ms/step | +75% |
233-
| 1000×1000 | ~85 ms/step | ~150 ms/step | +75% |
234-
235-
The directed kernel is slower due to the two-pass neighbor scanning (count targets, then select).
236-
237224
---
238225

239226
## Analysis Methods
@@ -251,40 +238,15 @@ print(f"Largest cluster: {stats['largest']} cells")
251238
print(f"Largest fraction: {stats['largest_fraction']:.3f}")
252239
```
253240

254-
Key metrics:
255-
- **Cluster size distribution**: Power-law indicates criticality
256-
- **Largest cluster fraction**: Order parameter for percolation transition
257-
- **Percolation**: Whether any cluster spans the grid
258-
259-
### Pair Correlation Function (PCF)
260-
261-
The PCF $g(r)$ measures spatial clustering as a function of distance:
262-
263-
$$g(r) = \frac{\text{observed pairs at distance } r}{\text{expected pairs (random)}}$$
264-
265-
- $g(r) > 1$: Clustering (more pairs than random)
266-
- $g(r) = 1$: Random distribution
267-
- $g(r) < 1$: Repulsion (fewer pairs than random)
268-
269-
Three PCFs are computed:
270-
- **Prey-Prey**: Intraspecific prey clustering
271-
- **Predator-Predator**: Intraspecific predator clustering
272-
- **Prey-Predator**: Interspecific spatial relationship
273-
274-
The cell-list algorithm provides O(N) computation instead of naive O(N²).
275-
276-
### Population Time Series
277-
278-
Beyond static snapshots, the experiments collect population trajectories to analyze:
279-
- **Variance**: Fluctuation amplitude scales with system size at criticality
280-
- **Autocorrelation**: Decay time increases near critical point (critical slowing down)
281-
- **Power spectrum**: 1/f noise indicates SOC
241+
Metrics collected:
242+
- Cluster size distribution: Power-law indicates criticality
243+
- Largest cluster fraction: Order parameter for percolation transition
282244

283245
---
284246

285247
## Experimental Phases
286248

287-
The project is organized into six experimental phases, each investigating a specific aspect of the Hydra effect and SOC.
249+
The project is organized into five experimental phases, each investigating a specific aspect of the Hydra effect and SOC.
288250

289251
### Phase 1: Critical Point Identification
290252

@@ -306,40 +268,27 @@ The project is organized into six experimental phases, each investigating a spec
306268
- Convergence toward critical value
307269
- Population stability under evolution
308270

309-
**Expected**: If SOC holds, evolved parameters should cluster near the critical point.
271+
**Expected**: If SOC holds, evolved parameters should cluster near a critical point.
310272

311273
### Phase 3: Finite-Size Scaling
312274

313275
**Goal**: Confirm criticality through scaling relations.
314276

315277
**Method**: Run simulations at the critical point across multiple grid sizes (50 to 2500). Measure how observables scale with system size $L$:
316278
- Largest cluster: $S_{max} \sim L^{d_f}$ (fractal dimension)
317-
- Fluctuations: $\sigma \sim L^{\gamma/\nu}$
318-
- Correlation length: Should equal system size at criticality
319279

320280
**Output**: Critical exponents characterizing the universality class.
321281

322282
### Phase 4: Sensitivity Analysis
323283

324284
**Goal**: Map the full parameter space to understand robustness.
325285

326-
**Method**: 4D sweep over all four parameters (prey_birth, prey_death, predator_birth, predator_death). Identify:
286+
**Method**: 4D sweep over all four parameters (```prey_birth, prey_death, predator_birth, predator_death```). Identify:
327287
- Coexistence regions
328288
- Extinction boundaries
329289
- Hydra effect strength across parameter space
330290

331-
### Phase 5: Perturbation Analysis
332-
333-
**Goal**: Measure critical slowing down near the transition.
334-
335-
**Method**: At various distances from the critical point, apply population perturbations and measure:
336-
- Recovery time
337-
- Autocorrelation decay
338-
- Variance amplification
339-
340-
**Expected**: Recovery time diverges as critical point is approached.
341-
342-
### Phase 6: Model Extensions
291+
### Phase 5: Model Extensions
343292

344293
**Goal**: Compare random vs. directed hunting dynamics.
345294

@@ -375,7 +324,7 @@ print(f"Grid: {cfg.grid_size}x{cfg.grid_size}")
375324
print(f"Estimate: {cfg.estimate_runtime(n_cores=32)}")
376325
```
377326

378-
Each phase has a predefined configuration (`PHASE1_CONFIG` through `PHASE6_CONFIG`) with appropriate defaults for that analysis.
327+
Each phase has a predefined configuration (`PHASE1_CONFIG` through `PHASE5_CONFIG`) with appropriate defaults for that analysis.
379328

380329
---
381330

@@ -392,7 +341,6 @@ Each result dictionary contains:
392341
- Input parameters
393342
- Final population counts
394343
- Cluster statistics
395-
- PCF data (if collected)
396344
- Evolution statistics (if enabled)
397345
- Time series (if enabled)
398346

@@ -433,10 +381,4 @@ results/
433381

434382
---
435383

436-
## References
437-
438-
1. Abrams, P. A. (2009). When does greater mortality increase population size? The long history and diverse mechanisms underlying the hydra effect. *Ecology Letters*, 12(5), 462-474.
439-
440-
2. Bak, P., Tang, C., & Wiesenfeld, K. (1987). Self-organized criticality: An explanation of the 1/f noise. *Physical Review Letters*, 59(4), 381.
441-
442-
3. de Aguiar, M. A. M., Rauch, E. M., & Bar-Yam, Y. (2004). Invasion and extinction in the mean field approximation for a spatial host-pathogen model. *Journal of Statistical Physics*, 114(5), 1417-1451.
384+
## References

docs/GEN_AI.md

Whitespace-only changes.

docs/Mean_Field_Model.pdf

-197 KB
Binary file not shown.

docs/PREDATOR_HUNTING_FEATURE.md

Lines changed: 0 additions & 177 deletions
This file was deleted.

0 commit comments

Comments
 (0)