babylon.engine.factories
Factory functions for creating simulation entities.
These functions provide convenient ways to create SocialClass entities with sensible defaults for class simulation. Each factory encapsulates the defaults appropriate for a specific social class.
Factories support the **kwargs pattern for extensibility while
maintaining type safety through Pydantic validation.
Sprint 3.4.3 (George Jackson Refactor): ideology parameter accepts both float (legacy) and IdeologicalProfile (new format). Float values are automatically converted to IdeologicalProfile by the SocialClass validator.
Spec-066 baseline (placeholder) per ADR043 + data-model.md section 2:
the bridged runner passes IdeologicalProfile(class_consciousness=0.1,
national_identity=0.5) to every entity. The bridge’s ternary mapping
(r = cc * (1 - ni), f = ni * (1 - cc), l = 1 - r - f) yields the target
placeholder (r=0.05, l=0.50, f=0.45) per Clarifications Q3. The rejected
high-cc / high-ni alternative (cc=0.5, ni=0.9) is theoretically dubious:
Marx treats class consciousness and national identity as antagonistic, so
co-existing high values are unstable. Per-county data-driven seeding is
deferred to a future spec; the placeholder must remain explicit and
uniform across all 83 x 2 = 166 entities until that work lands.
Functions
|
Create a bourgeoisie (exploiter class) social class. |
|
Create a ContradictionFrame for the given simulation scope. |
|
Create a labor-aristocracy (super-waged core worker) social class. |
|
Create a proletariat (exploited class) social class. |
- babylon.engine.factories.create_proletariat(id=PERIPHERY_WORKER_ID, name='Proletariat', wealth=0.5, ideology=None, organization=0.1, repression_faced=0.5, subsistence_threshold=0.3, p_acquiescence=0.0, p_revolution=0.0, description='Exploited working class', effective_wealth=0.0, unearned_increment=0.0, ppp_multiplier=1.0, county_fips=None)[source]
Create a proletariat (exploited class) social class.
The proletariat is defined by: - PERIPHERY_PROLETARIAT role (exploited in the world system) - Low default wealth (0.5) - Slightly revolutionary ideology (-0.3) - Low organization (0.1 = 10%) - Moderate repression faced (0.5)
- Parameters:
id (
str) – Unique identifier matching ^C[0-9]{3}$ pattern (default: “C001”)name (
str) – Human-readable name (default: “Proletariat”)wealth (
float) – Economic resources (default: 0.5)ideology (
float|IdeologicalProfile|None) – Ideological position. Acceptsfloat(legacy, scalar -1=revolutionary..+1=reactionary),IdeologicalProfile(spec-066 placeholder + future per-county data), orNoneto use the legacy default-0.3. The spec-066 bridged runner passesIdeologicalProfile(class_consciousness=0.1, national_identity=0.5)to every county entity to materialize the placeholder (r=0.05, l=0.50, f=0.45).organization (
float) – Collective cohesion (default: 0.1)repression_faced (
float) – State violence level (default: 0.5)subsistence_threshold (
float) – Minimum wealth for survival (default: 0.3)p_acquiescence (
float) – P(S|A) - survival through acquiescence (default: 0.0, calculated by engine)p_revolution (
float) – P(S|R) - survival through revolution (default: 0.0, calculated by engine)description (
str) – Optional description (default: “Exploited working class”)effective_wealth (
float) – PPP-adjusted wealth (default: 0.0, calculated by engine)unearned_increment (
float) – PPP bonus (default: 0.0, calculated by engine)ppp_multiplier (
float) – PPP multiplier applied to wages (default: 1.0)county_fips (str | None)
- Return type:
- Returns:
SocialClass configured as proletariat
Example
>>> worker = create_proletariat() >>> worker.role <SocialRole.PERIPHERY_PROLETARIAT: 'periphery_proletariat'> >>> worker.wealth 0.5
- babylon.engine.factories.create_labor_aristocracy(id=LABOR_ARISTOCRACY_ID, name='Labor Aristocracy', wealth=0.8, ideology=None, organization=0.05, repression_faced=0.3, subsistence_threshold=0.3, p_acquiescence=0.0, p_revolution=0.0, description='Super-waged core working class (pacified by imperial rent)', effective_wealth=0.0, unearned_increment=0.0, ppp_multiplier=1.0, county_fips=None)[source]
Create a labor-aristocracy (super-waged core worker) social class.
Per Cope (Divided World Divided Class), Amin (The Law of Worldwide Value), and the project’s Fundamental Theorem (W_c > V_c): the core working class receives wages above the value it produces, funded by imperial rent — pacifying it (P(S|A) > P(S|R)) until the rent pool decays. Defaults mirror
create_labor_aristocracy_scenarioin the legacy scenarios (well-off worker, very low organization, low repression needed).The LA is defined by:
LABOR_ARISTOCRACY role (employed producer in the Amin/Wallerstein circuit: production routes to the employer via the incoming WAGES edge; the wages phase pays back productivity + super-wage bonus)
Wealth above subsistence (default 0.8 vs threshold 0.3)
Very low organization (0.05) — the bribe substitutes for solidarity
Low repression faced (0.3) — hegemony, not force
- Parameters:
id (
str) – Unique identifier matching ^C[0-9]{3}$ pattern.name (
str) – Human-readable name.wealth (
float) – Economic resources (default 0.8 — above subsistence).ideology (
float|IdeologicalProfile|None) – Ideological position (float, IdeologicalProfile, or None for the legacy scalar default, as increate_proletariat()).organization (
float) – Collective cohesion (default 0.05).repression_faced (
float) – State violence level (default 0.3).subsistence_threshold (
float) – Minimum wealth for survival (default 0.3).p_acquiescence (
float) – P(S|A) (default 0.0, calculated by engine).p_revolution (
float) – P(S|R) (default 0.0, calculated by engine).description (
str) – Optional description.effective_wealth (
float) – PPP-adjusted wealth (calculated by engine).unearned_increment (
float) – PPP bonus (calculated by engine).ppp_multiplier (
float) – PPP multiplier applied to wages.county_fips (
str|None) – Optional 5-digit county attribution (bridged runs).
- Return type:
- Returns:
SocialClass configured as labor aristocracy.
Example
>>> worker = create_labor_aristocracy() >>> worker.role <SocialRole.LABOR_ARISTOCRACY: 'labor_aristocracy'> >>> worker.wealth > worker.subsistence_threshold True
- babylon.engine.factories.create_bourgeoisie(id=COMPRADOR_ID, name='Bourgeoisie', wealth=10.0, ideology=None, organization=0.7, repression_faced=0.1, subsistence_threshold=0.1, p_acquiescence=0.0, p_revolution=0.0, description='Capital-owning exploiter class', effective_wealth=0.0, unearned_increment=0.0, ppp_multiplier=1.0, county_fips=None)[source]
Create a bourgeoisie (exploiter class) social class.
The bourgeoisie is defined by: - CORE_BOURGEOISIE role (exploiter in the world system) - High default wealth (10.0) - Reactionary ideology (0.8) - High organization (0.7 = 70%) - Low repression faced (0.1 - protected by state)
- Parameters:
id (
str) – Unique identifier matching ^C[0-9]{3}$ pattern (default: “C002”)name (
str) – Human-readable name (default: “Bourgeoisie”)wealth (
float) – Economic resources (default: 10.0)ideology (
float|IdeologicalProfile|None) – Ideological position. Acceptsfloat(legacy, scalar -1=revolutionary..+1=reactionary),IdeologicalProfile(spec-066 placeholder + future per-county data), orNoneto use the legacy default0.8. The spec-066 bridged runner passesIdeologicalProfile(class_consciousness=0.1, national_identity=0.5)to every county entity to materialize the placeholder (r=0.05, l=0.50, f=0.45).organization (
float) – Collective cohesion (default: 0.7)repression_faced (
float) – State violence level (default: 0.1)subsistence_threshold (
float) – Minimum wealth for survival (default: 0.1)p_acquiescence (
float) – P(S|A) - survival through acquiescence (default: 0.0, calculated by engine)p_revolution (
float) – P(S|R) - survival through revolution (default: 0.0, calculated by engine)description (
str) – Optional description (default: “Capital-owning exploiter class”)effective_wealth (
float) – PPP-adjusted wealth (default: 0.0, calculated by engine)unearned_increment (
float) – PPP bonus (default: 0.0, calculated by engine)ppp_multiplier (
float) – PPP multiplier applied to wages (default: 1.0)county_fips (str | None)
- Return type:
- Returns:
SocialClass configured as bourgeoisie
Example
>>> owner = create_bourgeoisie() >>> owner.role <SocialRole.CORE_BOURGEOISIE: 'core_bourgeoisie'> >>> owner.wealth 10.0