Extension: gama.extension.bdi
The BDI (Belief-Desire-Intention) extension adds mental states to the language: beliefs, desires, intentions, ideals, uncertainties and obligations, each carried by a predicate and optionally associated with an emotion, together with social links between agents. It provides the operators below to build, query and update them, and the architectures simple_bdi and parallel_bdi that reason with them (see Built-in architectures).
Basic Constructs​
new_predicate(name) - New Predicate​
Creates a new predicate with a given name and additional properties (values, agent causing the predicate, whether it is true).
| Overload | Description |
|---|
new_predicate(name) | Creates a predicate with a given name |
new_predicate(name, values) | Adds a values map |
new_predicate(name, is_true) | Adds a truth value |
new_predicate(name, cause_agent) | Adds an agent that caused the predicate |
new_predicate(name, values, is_true) | Adds values and truth |
new_predicate(name, values, cause_agent) | Adds values and cause agent |
new_predicate(name, values, is_true, cause_agent) | Adds all properties |
new_emotion(name) - New Emotion​
Creates a new emotion with various combinations.
| Overload | Description |
|---|
new_emotion(name) | Just the name |
new_emotion(name, intensity) | Name and intensity |
new_emotion(name, intensity, about) | Name, intensity, predicate it is about |
new_emotion(name, about, cause_agent) | Name, predicate, and cause agent |
new_emotion(name, intensity, cause_agent) | Name, intensity, and cause agent |
new_emotion(name, intensity, about, decay) | Name, intensity, about, and decay |
new_emotion(name, intensity, about, cause_agent) | Name, intensity, about, and cause agent |
new_emotion(name, intensity, about, decay, cause_agent) | All properties |
new_mental_state(modality) - New Mental State​
Creates a new mental state with a given modality (bel, bel_em, des, int) and various properties.
| Overload | Description |
|---|
new_mental_state(modality) | Just the modality |
new_mental_state(modality, predicate) | Adds a predicate |
new_mental_state(modality, predicate, strength) | Adds strength |
new_mental_state(modality, predicate, lifetime) | Adds lifetime |
new_mental_state(modality, predicate, cause_agent) | Adds cause agent |
new_mental_state(modality, predicate, strength, lifetime) | Adds strength and lifetime |
new_mental_state(modality, predicate, strength, cause_agent) | Adds strength and cause agent |
new_mental_state(modality, predicate, lifetime, cause_agent) | Adds lifetime and cause agent |
new_mental_state(modality, predicate, strength, lifetime, cause_agent) | All properties |
new_mental_state(modality, emotion) | Adds an emotion about |
new_mental_state(modality, emotion, strength) | Adds emotion and strength |
new_mental_state(modality, emotion, lifetime) | Adds emotion and lifetime |
new_mental_state(modality, emotion, cause_agent) | Adds emotion and cause agent |
new_mental_state(modality, emotion, strength, lifetime, cause_agent) | All properties |
new_mental_state(modality, mental_state) | Adds about another mental state |
new_mental_state(modality, mental_state, strength) | Adds mental state and strength |
new_mental_state(modality, mental_state, lifetime) | Adds mental state and lifetime |
new_mental_state(modality, mental_state, cause_agent) | Adds mental state and cause agent |
new_mental_state(modality, mental_state, strength, lifetime, cause_agent) | All properties |
new_social_link(agent) - New Social Link​
Creates a new social link with another agent with optional parameters (appreciation/dominance/solidarity/familiarity values).
| Overload | Description |
|---|
new_social_link(agent) | Link to another agent |
new_social_link(agent, appreciation, dominance, solidarity, familiarity) | With all parameters |
Predicate Operators​
| Operator | Description |
|---|
predicate with_truth value | Changes the truth value of a predicate |
predicate with_values map | Changes the values map of a predicate |
predicate add_values map | Adds to the values map |
Social Link Modifiers​
All of them are infix operators on a social_link and return that link. They leave the link unchanged when the value is out of range.
| Operator | Range | Description |
|---|
link with_agent a | | Changes the agent the link points to, e.g. social_link with_agent agentA |
link with_trust v | [-1, 1] | Changes the trust value, e.g. social_link with_trust 0.4 |
link with_liking v | [0, 1] | Changes the liking value, e.g. social_link with_liking 0.4 |
link with_dominance v | [0, 1] | Changes the dominance value, e.g. social_link with_dominance 0.4 |
link with_solidarity v | [0, 1] | Changes the solidarity value, e.g. social_link with_solidarity 0.4 |
link with_familiarity v | [0, 1] | Changes the familiarity value, e.g. social_link with_familiarity 0.4 |
Mental State Modifiers​
Infix operators on a mental_state, each returning that state.
| Operator | Description |
|---|
state set_modality m | Changes the modality, e.g. mental_state set_modality belief |
state set_predicate p | Changes the predicate it carries, e.g. mental_state set_predicate pred1 |
state set_strength f | Changes the strength, e.g. mental_state set_strength 1.0 |
state set_lifetime i | Changes the lifetime of the state, e.g. mental_state set_lifetime 1 |
Emotional Modifiers​
| Operator | Description |
|---|
emotion with_agent_cause agent | Changes the cause agent of an emotion |
emotion with_intensity intensity | Changes the intensity value of an emotion |
emotion with_decay decay | Changes the decay rate of an emotion |
emotion with_about predicate | Changes the predicate an emotion is about |
Social Link Modifiers​
| Operator | Description |
|---|
social_link with_agent agent | Changes the target agent of a social link |
social_link with_liking value | Changes the liking value of a social link |
social_link with_dominance value | Changes the dominance value |
social_link with_solidarity value | Changes the solidarity value |
social_link with_familiarity value | Changes the familiarity value |
social_link with_trust value | Changes the trust value |
get_agent(social_link) | Returns the target agent of a social link |
Logical Connectives​
| Operator | Description |
|---|
p1 and p2 | Creates a composite predicate combining two as conjunctive subintentions |
p1 or p2 | Creates a composite predicate combining two as disjunctive subintentions |
not p1 | Returns a predicate with inverted truth value |
Mental State Modifiers​
| Operator | Description |
|---|
mental_state set_modality mode | Changes the modality of a mental state |
mental_state set_predicate pred | Changes the predicate of a mental state |
mental_state set_strength strength | Changes the strength of a mental state |
mental_state set_lifetime life | Changes the lifetime of a mental state |
Belief Queries​
| Operator | Description |
|---|
get_beliefs_with_name_op(agent, name) | Gets all beliefs whose predicate has a given name |
get_belief_with_name_op(agent, name) | Gets one belief whose predicate has a given name |
get_belief_op(agent, predicate) | Gets a belief by its exact predicate |
get_beliefs_op(agent, predicate) | Gets all beliefs matching a predicate |
has_belief_op(agent, predicate) | Checks if a belief exists for a given predicate |
has_belief_with_name_op(agent, name) | Checks if a belief exists with a given name |
Desire Queries​
| Operator | Description |
|---|
get_desires_with_name_op(agent, name) | Gets all desires whose predicate has a given name |
get_desire_with_name_op(agent, name) | Gets one desire whose predicate has a given name |
get_desire_op(agent, predicate) | Gets a desire by its exact predicate |
get_desires_op(agent, predicate) | Gets all desires matching a predicate |
has_desire_op(agent, predicate) | Checks if a desire exists for a given predicate |
has_desire_with_name_op(agent, name) | Checks if a desire exists with a given name |
Intention Queries​
| Operator | Description |
|---|
get_intentions_with_name_op(agent, name) | Gets all intentions whose predicate has a given name |
get_intention_with_name_op(agent, name) | Gets one intention whose predicate has a given name |
get_intention_op(agent, predicate) | Gets an intention by its exact predicate |
get_intentions_op(agent, predicate) | Gets all intentions matching a predicate |
has_intention_op(agent, predicate) | Checks if an intention exists for a given predicate |
has_intention_with_name_op(agent, name) | Checks if an intention exists with a given name |
get_current_intention_op(agent) | Gets the currently active intention of an agent |
Other Base Queries​
| Operator | Description |
|---|
get_plan_name(agent) | Returns the name of a plan |
get_uncertainties_with_name_op(agent, name) | Gets all uncertainties with a given name |
get_uncertainty_op(agent, predicate) | Gets an uncertainty by predicate |
has_uncertainty_op(agent, predicate) | Checks if an uncertainty exists |
get_ideals_with_name_op(agent, name) | Gets all ideals with a given name |
get_ideal_op(agent, predicate) | Gets an ideal by predicate |
has_ideal_op(agent, predicate) | Checks if an ideal exists |
get_obligations_with_name_op(agent, name) | Gets all obligations with a given name |
get_obligation_op(agent, predicate) | Gets an obligation by predicate |
has_obligation_op(agent, predicate) | Checks if an obligation exists |
Statement/Action Reference​
See SimpleBdiArchitecture for the full list of actions and variables provided by the BDI skill (e.g., add_belief, add_emotion, add_intention, add_desire, add_ideal, add_uncertainty, add_obligation, add_social_link, add_belief_emotion, comply, violate, instantiate_norm, enforce, sanction, make_law, etc.).
Plan Evaluation​
| Operator | Description |
|---|
eval_when(plan) | Returns the boolean value of the when facet of a plan, e.g. eval_when(plan1) |
The achieve and reduce facets have no counterpart operator: they are only read by the architecture when it selects and executes a plan.
Runnable models​
The extension ships the projects that illustrate it. They appear in the Models navigator under the category of the library (Support > Clean and update workspace... after an install if they are missing).
| Project | Models |
|---|
Recipes > Using the BDI Architecture | HelloWorld_BDI.gaml, TestBDI.gaml, GoldMiner_BDI.gaml, Firefighters_BDI.gaml, CityEscape_BDI_Emotions.gaml, and models/Tutorial/BDI tutorial 1.gaml to BDI tutorial 5.gaml |
Tests > Bdi Tests | BDIReasoningTest.gaml, BDIAdvancedTest.gaml |
HelloWorld_BDI.gaml is the shortest way to see the operators of this page in action; the five tutorial models build the same agent step by step and are described in BDI Agents.
See Also​