|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Local approximation of the Schelling segregation model. More...
#include <tpl_ca_stochastic_rules.H>
Public Types | |
| using | engine_type = Engine |
Public Member Functions | |
| Schelling_Rule (const double threshold, const double p_move=1.0, const double p_fill=1.0, const std::uint64_t master_seed=0) | |
| Build a Schelling rule. | |
| double | threshold () const noexcept |
| double | p_move () const noexcept |
| double | p_fill () const noexcept |
| std::uint64_t | master_seed () const noexcept |
| void | set_master_seed (std::uint64_t s) noexcept |
| template<typename State , std::size_t Rank> | |
| State | operator() (const State ¤t, Neighbor_View< State > neighbours, const Cell_Context< Rank > &ctx) const |
Compute the next Schelling state for cell current. | |
Private Attributes | |
| double | threshold_ |
| double | p_move_ |
| double | p_fill_ |
| std::uint64_t | master_seed_ |
Local approximation of the Schelling segregation model.
The classical Schelling model is non-local: unhappy agents move to a vacant cell anywhere on the lattice. The CA-friendly local approximation implemented here updates each cell synchronously:
same / (same + other) is strictly below threshold. An unhappy cell vacates with probability p_move (becomes EMPTY); otherwise it stays put.p_fill. With equal counts (or no occupied neighbours), the cell stays EMPTY.This is not the canonical Schelling dynamics — it is the standard local CA approximation used in pedagogical settings (Vinkovic & Kirman, 2006, similar). It preserves the qualitative segregation behaviour while remaining fully synchronous and local.
| Engine | RNG engine; defaults to std::mt19937_64. |
Definition at line 603 of file tpl_ca_stochastic_rules.H.
| using Aleph::CA::Schelling_Rule< Engine >::engine_type = Engine |
Definition at line 611 of file tpl_ca_stochastic_rules.H.
|
inline |
Build a Schelling rule.
| [in] | threshold | minimum same-type fraction below which an agent becomes unhappy. Must be in [0, 1]. |
| [in] | p_move | probability that an unhappy agent vacates the cell (default 1.0). Must be in [0, 1]. |
| [in] | p_fill | probability that an empty cell with a strict majority of one neighbour type is filled (default 1.0). Must be in [0, 1]. |
| [in] | master_seed | master seed forwarded to cell_seed(). |
| std::domain_error | if any probability is outside [0, 1]. |
Definition at line 625 of file tpl_ca_stochastic_rules.H.
References ah_domain_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Schelling_Rule< Engine >::p_fill(), Aleph::CA::Schelling_Rule< Engine >::p_move(), and Aleph::CA::Schelling_Rule< Engine >::threshold().
|
inlinenoexcept |
Definition at line 654 of file tpl_ca_stochastic_rules.H.
References Aleph::CA::Schelling_Rule< Engine >::master_seed_.
|
inline |
Compute the next Schelling state for cell current.
| State | integral or enum-typed cell state. |
| Rank | lattice rank. |
Definition at line 669 of file tpl_ca_stochastic_rules.H.
References Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::EMPTY, Aleph::CA::Schelling_Rule< Engine >::master_seed_, Aleph::CA::Schelling_Rule< Engine >::p_fill_, Aleph::CA::Schelling_Rule< Engine >::p_move_, Aleph::CA::Schelling_Rule< Engine >::threshold_, Aleph::CA::TYPE_A, Aleph::CA::TYPE_B, and Aleph::CA::uniform_unit().
|
inlinenoexcept |
Definition at line 649 of file tpl_ca_stochastic_rules.H.
References Aleph::CA::Schelling_Rule< Engine >::p_fill_.
Referenced by Aleph::CA::Schelling_Rule< Engine >::Schelling_Rule().
|
inlinenoexcept |
Definition at line 644 of file tpl_ca_stochastic_rules.H.
References Aleph::CA::Schelling_Rule< Engine >::p_move_.
Referenced by Aleph::CA::Schelling_Rule< Engine >::Schelling_Rule().
|
inlinenoexcept |
Definition at line 659 of file tpl_ca_stochastic_rules.H.
References Aleph::CA::Schelling_Rule< Engine >::master_seed_.
|
inlinenoexcept |
Definition at line 639 of file tpl_ca_stochastic_rules.H.
References Aleph::CA::Schelling_Rule< Engine >::threshold_.
Referenced by Aleph::CA::Schelling_Rule< Engine >::Schelling_Rule().
|
private |
Definition at line 608 of file tpl_ca_stochastic_rules.H.
Referenced by Aleph::CA::Schelling_Rule< Engine >::master_seed(), Aleph::CA::Schelling_Rule< Engine >::operator()(), and Aleph::CA::Schelling_Rule< Engine >::set_master_seed().
|
private |
Definition at line 607 of file tpl_ca_stochastic_rules.H.
Referenced by Aleph::CA::Schelling_Rule< Engine >::operator()(), and Aleph::CA::Schelling_Rule< Engine >::p_fill().
|
private |
Definition at line 606 of file tpl_ca_stochastic_rules.H.
Referenced by Aleph::CA::Schelling_Rule< Engine >::operator()(), and Aleph::CA::Schelling_Rule< Engine >::p_move().
|
private |
Definition at line 605 of file tpl_ca_stochastic_rules.H.
Referenced by Aleph::CA::Schelling_Rule< Engine >::operator()(), and Aleph::CA::Schelling_Rule< Engine >::threshold().