- public void add_schema (Schema schema)
Adds a new Schema to the system.
- public Schema get_schema_from_action (Action action)
Finds a schema that matches the current world state and a provided
Action.
- public Schema get_schema_from_id (
int
id)
Retrieves a schema based on its ID
- public void remove_ignored_preconditions (WorldState preconditions)
Removes ignored sensors from a set of preconditions
- public
bool
is_ignored (int
sensor_id)
- public void remove_transitory_observations (WorldState ws)
Removes transitory observations from a WorldState
- public Schema get_schema (WorldState preconditions, Action? action, WorldState postconditions)
Retrieves an existing schema with the provided attributes.
- public Schema get_or_create_schema (WorldState preconditions, Action action, WorldState postconditions,
bool
? use_action = true)
Retrieves a schema with the specified preconditions, action and
postconditions if one exists, otherwise creates a new schema.
- public void update_world_state (WorldState new_state)
Updates the system's view of the current world state. This should be
updated once per tick.
- public
List
<Schema> get_excited_schemas (WorldState? state)
Retrieves a list schemas that are excited by the specified world
state, in descending order of excitation
- public
List
<Pair<Schema,double
?>> get_excited_schema_pairs (WorldState? state)
Retrieves a list schemas that are excited by the specified world
state, in descending order of excitation
- public
double
execute_excited_schema (WorldState? state)
Execute the most excited schema, or create a new one based on the most
excited schema if none exists that matches the current preconditions.
- public
double
get_average_excitement (WorldState? state)
Provides the average excitement of the system either in the current
state or given the state provided.
- public void generalise (Schema s)
Manually triggers generalisation
- public void take_action (Action a)
Performs the supplied action by finding a schema is satisfied by the
current world state and contains that action. If not such schema is found then a new one is created.
- public void execute (Schema s)
Executes the provided schema.
- public void execute_id (
int
id)
- public
bool
achieve_goal (WorldState target_state, List
<int
> excluded = new List
(), bool
resolving_target = false)
Executes a chain of actions to change the world into the desired
state.
- public
List
<int
> execute_sequence_step (List
<int
> sequence, WorldState target_state)
Executes a single step from a sequence of schemas and returns a list
containing the remaining steps. If a step fails the sequence is recalculated based on the supplied target state. The updated sequence
is then returned.
- public
List
<int
> find_path (WorldState start_state, WorldState target_state, List
<int
> excluded = new List
(), bool
resolving_target = false)
Finds a chain of schemas connecting two world states. If executed in
order this should result in the system achieving the target state. The path most likely to succeed is selected.
- public void print ()
Prints the state of the system in an easy to read format.
- public void print_xml ()
Prints the state of the system in XML to stdout.
- public
string
to_xml ()
Returns a string containing the current state of the framework in XML,
suitable for saving.
- public
bool
load (string
filename)
Loads a previously saved collection of schemas (as created by the
save() function).
- public void save (
string
filename) throws Error
Saves the state of the system to an XML file.
- public void parse_node (unowned
Node
* node)
Create appropriate objects from XML nodes, e.g. when loading a saved
state or potentially for sending schema data over a network.
- public Observation parse_observation (unowned
Node
* node)
- public void ignore_precondition (
int
sensor_id)
Sets a sensor to be ignored when creating preconditions.
- public
int
get_total_schemas ()
Returns the total number of schemas in the system.
- public void set_generaliser (Generaliser gen)
Set the generaliser to be used.
- public void set_excitation_calculator (ExcitationCalculator ec)
Set the excitation calculator to be used.
- public
int
observation_occurrences (Observation o)
Get the number of times an observation has been encountered
- public void associate_observations (Observation po, Observation ao)
Associate two observations with one another
- public void add_generalised_associations (Pair p)
- public Pair<Observation,Observation> get_generalised_association (Observation po, Observation ao)
Finds a generalised pair of observations that satisfies the provided
observations
- public
int
associated_observation_occurrences (Observation po, Observation ao)
Get the number of times two observations have been seen together.
- public void observation_occurred (Observation o)
Increases the occurrences of a given observation by one.
- public
List
<Observation> get_associations (Observation o)
Retrieves a list of all associations associated with a given
observation
- public void add_chain (
List
<int
> chain)
- public
List
<List
<int
>> get_chains_containing (int
id)