5. Norms, obligations and enforcement
This final stage adds normative behavior to the gold-miner model. The miners have a law that can create an obligation to collect gold when they believe there is a mine location. A norm named doing_job provides the behavior for that obligation and ends when the miner believes it has gold.
law working belief: mine_location new_obligation: has_gold
when: not has_obligation(has_gold) and not has_belief(has_gold)
strength: 2.0 threshold: threshold_law;
norm doing_job obligation: has_gold finished_when: has_belief(has_gold)
threshold: threshold_obligation {
// The model reuses the mine-selection and collection behavior from step 2.
}
The model also defines a share_information norm for sharing known mine locations with miners whose social link has positive liking. The threshold_norm variable is used by this norm. Enforcement is declared in perception statements: miners check the information-sharing norm when they perceive other miners, while the police agent checks the miners' working law and has_gold obligation.
The model's sanction actions change the perceived agent's gold_sold value and the global fine value for law and obligation enforcement. For the information-sharing norm, the actions adjust the social link's liking value. The full declarations and conditions are in the linked model; the excerpts here summarize its structure.
The example demonstrates how the extension connects a law, an obligation, a norm and enforcement.
The complete example is BDI tutorial 5.gaml. Return to the BDI agents tutorial.