Configuration¶
PolicyFlux configuration is built around three composable objects that map directly to simulation behavior.
-
Integration-level control
Define global model shape, runtime strategy, and top-level execution options.
-
Layer-level control
Enable or disable political influence layers and tune their intensity.
-
Actor-level control
Configure advanced institutional actors such as lobbyists, whips, and executive behavior.
Configuration model¶
IntegrationConfigLayerConfigAdvancedActorsConfig
Scope by object¶
| Object | Scope | Typical use |
|---|---|---|
IntegrationConfig |
top-level simulation settings | actor count, dimensions, iterations, seed, aggregation |
LayerConfig |
political influence composition | layer toggles and strengths |
AdvancedActorsConfig |
institutional/special actor mechanics | lobbyists, whips, executive behavior |
IntegrationConfig¶
IntegrationConfig is the top-level container for simulation setup.
Common fields include:
num_actorspolicy_dimiterationsseedlayer_configactors_configaggregation_strategyaggregation_weights
Reproducibility
Keep seed fixed across comparative runs to isolate the effect of configuration changes.
LayerConfig¶
LayerConfig controls which influence layers are active and how strongly they affect decisions.
Common toggles:
include_ideal_pointinclude_public_opinioninclude_lobbyinginclude_media_pressureinclude_party_disciplineinclude_government_agendainclude_neural
Each layer also exposes strength and intensity parameters.
Use explicit layer ordering and overrides when you need deterministic composition:
layer_nameslayer_overrides
AdvancedActorsConfig¶
AdvancedActorsConfig enables additional actor mechanics, such as:
- lobbyists,
- party whips,
- executive-specific behavior.
These controls are most useful in institutional comparison experiments.
Flat configuration API¶
IntegrationConfig supports a flat configuration style that maps fields across nested configs.
from policyflux import IntegrationConfig, build_engine
config = IntegrationConfig.from_flat(
num_actors=140,
include_public_opinion=False,
public_support=0.63,
n_lobbyists=2,
lobbyist_strength=0.71,
aggregation_strategy="average",
)
engine = build_engine(config)
engine.run()
You can also update an existing config:
Unknown flat keys raise ValueError.
Recommended workflow¶
- Start with preset or minimal
IntegrationConfig. - Introduce one layer change at a time.
- Add advanced actor mechanics only after baseline calibration.
- Run deterministic + Monte Carlo for both central estimate and variance.
Practical tips¶
- Keep
seedfixed to make scenario comparisons reproducible. - Start with presets for baseline experiments, then refine with explicit configs.
- Change one layer at a time when analyzing causal effects.
For configuration examples in context, see Getting Started and API Overview.