Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ca_schelling_segregation_example.cc File Reference

Phase 8 example: local Schelling segregation on a 2-D lattice. More...

#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <random>
#include <string>
#include <ca-rng.H>
#include <ca-traits.H>
#include <tpl_ca_engine.H>
#include <tpl_ca_lattice.H>
#include <tpl_ca_neighborhood.H>
#include <tpl_ca_storage.H>
#include <tpl_ca_stochastic_rules.H>
Include dependency graph for ca_schelling_segregation_example.cc:

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

Phase 8 example: local Schelling segregation on a 2-D lattice.

Builds a 48x48 toroidal lattice seeded with two agent types (A, B) and a small fraction of empty cells, and runs the local Schelling approximation:

  • An occupied cell looks at its Moore-radius-1 occupied neighbours. If the same-type fraction is below threshold, the cell vacates with probability p_move.
  • An empty cell with a strict majority of one type fills with that type with probability p_fill.

The example sweeps three intolerance thresholds (0.30, 0.50, 0.70). For each one we report a cluster-quality proxy — the fraction of same-type pairs among occupied edges of the lattice graph — at the initial frame and at the end of the simulation. The visualisation renders the final configuration with three glyphs.

Glyphs: '.' empty 'A' type A 'B' type B

Definition in file ca_schelling_segregation_example.cc.

Function Documentation

◆ main()

int main ( void  )