Soar Kernel
9.3.2 08-06-12
|
#include <portability.h>
#include <stdlib.h>
#include "gdatastructs.h"
#include "instantiations.h"
#include "kernel.h"
#include "mem.h"
#include "symtab.h"
#include "agent.h"
#include "prefmem.h"
#include "rhsfun.h"
#include "rete.h"
#include "print.h"
#include "production.h"
#include "wmem.h"
#include "osupport.h"
#include "recmem.h"
#include "tempmem.h"
#include "reinforcement_learning.h"
#include "wma.h"
#include "xml.h"
#include "utilities.h"
#include "soar_TraceNames.h"
#include "consistency.h"
#include "misc.h"
#include "soar_module.h"
#include "assert.h"
#include <string>
#include <list>
Go to the source code of this file.
Typedefs | |
typedef std::list< condition *, soar_module::soar_memory_pool_allocator < condition * > > | cond_mpool_list |
typedef std::list < instantiation *, soar_module::soar_memory_pool_allocator < instantiation * > > | inst_mpool_list |
Variables | |
wme * | glbDeepCopyWMEs = NULL |
typedef std::list< condition*, soar_module::soar_memory_pool_allocator< condition* > > cond_mpool_list |
Definition at line 63 of file recmem.cpp.
typedef std::list< instantiation*, soar_module::soar_memory_pool_allocator< instantiation* > > inst_mpool_list |
Definition at line 62 of file recmem.cpp.
void assert_new_preferences | ( | agent * | thisAgent, |
pref_buffer_list & | bufdeallo | ||
) |
Definition at line 1140 of file recmem.cpp.
References add_preference_to_tm(), instantiation_struct::in_ms, insert_at_head_of_dll, preference_struct::inst_next, production_struct::instantiations, production_struct::name, agent_struct::newly_created_instantiations, instantiation_struct::next, multi_attributes_struct::next, preference_struct::next, preference_struct::next_clone, NIL, preference_struct::o_supported, preference_add_ref(), preference_remove_ref(), instantiation_struct::preferences_generated, preference_struct::prev_clone, print_with_symbols(), process_o_rejects_and_deallocate_them(), instantiation_struct::prod, REJECT_PREFERENCE_TYPE, agent_struct::soar_verbose_flag, symbol_to_string(), TRUE, preference_struct::type, wma_activate_wmes_in_pref(), wma_enabled(), and xml_generate_verbose().
Referenced by do_preference_phase().
void build_prohibits_list | ( | agent * | thisAgent, |
instantiation * | inst | ||
) |
Definition at line 83 of file recmem.cpp.
References condition_struct::bt, find_clone_for_level(), preference_struct::in_tm, preference_struct::inst, instantiation_struct::match_goal_level, preference_struct::next, condition_struct::next, NIL, POSITIVE_CONDITION, preference_add_ref(), slot_struct::preferences, PROHIBIT_PREFERENCE_TYPE, bt_info_struct::prohibits, push(), preference_struct::slot, instantiation_struct::top_of_instantiated_conditions, bt_info_struct::trace, and condition_struct::type.
Referenced by create_instantiation().
void create_instantiation | ( | agent * | thisAgent, |
production * | prod, | ||
struct token_struct * | tok, | ||
wme * | w | ||
) |
Definition at line 581 of file recmem.cpp.
References production_struct::action_list, wme_struct::attr, BINARY_INDIFFERENT_PREFERENCE_TYPE, instantiation_struct::bottom_of_instantiated_conditions, condition_struct::bt, build_prohibits_list(), chunk_instantiation(), variable_struct::common_symbol_info, deallocate_wme(), DECLARED_I_SUPPORT, DECLARED_O_SUPPORT, production_struct::declared_support, execute_action(), FALSE, fill_in_new_instantiation_stuff(), agent_struct::firer_highest_rhs_unboundvar_index, FIRING_CALLBACK, production_struct::firing_count, agent_struct::FIRING_TYPE, cons_struct::first, FLOAT_CONSTANT_SYMBOL_TYPE, instantiation_struct::GDS_evaluated_already, get_printer_output_column(), glbDeepCopyWMEs, wme_struct::id, symbol_union::id, instantiation_struct::in_ms, insert_at_head_of_dll, preference_struct::inst, preference_struct::inst_next, agent_struct::instantiation_pool, INT_CONSTANT_SYMBOL_TYPE, JUSTIFICATION_PRODUCTION_TYPE, identifier_struct::level, bt_info_struct::level, make_preference(), production_struct::name, agent_struct::newly_created_instantiations, instantiation_struct::next, wme_struct::next, action_struct::next, condition_struct::next, NIL, instantiation_struct::nots, NUMERIC_INDIFFERENT_PREFERENCE_TYPE, preference_struct::o_supported, production_struct::p_node, p_node_to_conditions_and_nots(), PE_PRODS, POSITIVE_CONDITION, wme_struct::preference, action_struct::preference_type, instantiation_struct::preferences_generated, print(), print_instantiation_with_wmes(), print_preference(), print_with_symbols(), instantiation_struct::prod, agent_struct::production_being_fired, agent_struct::production_firing_count, preference_struct::referent, instantiation_struct::reliable, cons_struct::rest, instantiation_struct::rete_token, instantiation_struct::rete_wme, production_struct::rhs_unbound_variables, agent_struct::rhs_variable_bindings, rl_build_template_instantiation(), soar_invoke_callbacks(), agent_struct::soar_verbose_flag, symbol_to_string(), symbol_common_data_struct::symbol_type, agent_struct::sysparams, agent_struct::system_halted, TEMPLATE_PRODUCTION_TYPE, instantiation_struct::top_of_instantiated_conditions, bt_info_struct::trace, trace_firings_of_inst(), TRACE_FIRINGS_PREFERENCES_SYSPARAM, TRACE_FIRINGS_WME_TRACE_TYPE_SYSPARAM, TRUE, production_struct::type, preference_struct::type, condition_struct::type, wme_struct::value, symbol_union::var, bt_info_struct::wme_, xml_generate_verbose(), and xml_object().
Referenced by do_preference_phase().
void deallocate_instantiation | ( | agent * | thisAgent, |
instantiation * | inst | ||
) |
Definition at line 842 of file recmem.cpp.
References preference_struct::attr, condition_struct::bt, deallocate_condition_list(), deallocate_list_of_nots(), deallocate_preference(), cons_struct::first, free_list(), preference_struct::id, symbol_union::id, instantiation_struct::in_ms, preference_struct::inst, agent_struct::instantiation_pool, instantiation_struct::match_goal, instantiation_struct::match_goal_level, production_struct::name, multi_attributes_struct::next, condition_struct::next, preference_struct::next_clone, NIL, instantiation_struct::nots, preference_struct::on_goal_list, POSITIVE_CONDITION, preference_is_binary(), agent_struct::preference_pool, preference_remove_ref(), identifier_struct::preferences_from_goal, instantiation_struct::preferences_generated, preference_struct::prev_clone, print_with_symbols(), instantiation_struct::prod, production_remove_ref(), bt_info_struct::prohibits, preference_struct::reference_count, preference_struct::referent, remove_from_dll, cons_struct::rest, symbol_remove_ref(), TOP_GOAL_LEVEL, instantiation_struct::top_of_instantiated_conditions, bt_info_struct::trace, preference_struct::type, condition_struct::type, preference_struct::value, preference_struct::wma_o_set, wma_remove_pref_o_set(), bt_info_struct::wme_, and wme_remove_ref().
Referenced by possibly_deallocate_instantiation().
void do_preference_phase | ( | agent * | thisAgent | ) |
Definition at line 1293 of file recmem.cpp.
References agent_struct::active_goal, agent_struct::active_level, AFTER_HALT_SOAR_CALLBACK, APPLY_PHASE, assert_new_preferences(), agent_struct::change_level, consume_last_postponed_assertion(), create_instantiation(), agent_struct::current_phase, FALSE, agent_struct::FIRING_TYPE, get_next_nil_goal_retraction(), get_next_retraction(), agent_struct::highest_active_goal, highest_active_goal_apply(), highest_active_goal_propose(), agent_struct::highest_active_level, symbol_union::id, IE_PRODS, agent_struct::inner_e_cycle_count, JUSTIFICATION_PRODUCTION_TYPE, identifier_struct::level, identifier_struct::lower_goal, agent_struct::max_chunks_reached, agent_struct::newly_created_instantiations, agent_struct::next_change_level, NIL, agent_struct::nil_goal_retractions, PE_PRODS, postpone_assertion(), preference_remove_ref(), print(), print_with_symbols(), PROPOSE_PHASE, restore_postponed_assertions(), retract_instantiation(), shouldCreateInstantiation(), soar_invoke_callbacks(), agent_struct::sysparams, agent_struct::system_halted, TRACE_PHASES_SYSPARAM, TRACE_WATERFALL_SYSPARAM, TRUE, production_struct::type, token_struct::w, wma_activate_wmes_tested_in_prods(), wma_enabled(), xml_att_val(), xml_begin_tag(), and xml_end_tag().
Referenced by do_one_top_level_phase(), and reinitialize_soar().
preference* execute_action | ( | agent * | thisAgent, |
action * | a, | ||
struct token_struct * | tok, | ||
wme * | w | ||
) |
Definition at line 341 of file recmem.cpp.
References ACCEPTABLE_PREFERENCE_TYPE, action_struct::attr, first_letter_from_symbol(), FUNCALL_ACTION, action_struct::id, symbol_union::id, IDENTIFIER_SYMBOL_TYPE, instantiate_rhs_value(), identifier_struct::isa_goal, identifier_struct::level, make_preference(), NIL, agent_struct::operator_symbol, preference_is_binary(), action_struct::preference_type, print_with_symbols(), action_struct::referent, REJECT_PREFERENCE_TYPE, symbol_remove_ref(), action_struct::type, multi_attributes_struct::value, and action_struct::value.
Referenced by create_instantiation().
void fill_in_new_instantiation_stuff | ( | agent * | thisAgent, |
instantiation * | inst, | ||
Bool | need_to_do_support_calculations | ||
) |
Definition at line 418 of file recmem.cpp.
References instantiation_struct::backtrace_number, condition_struct::bt, calculate_support_for_instantiation_preferences(), DECLARED_I_SUPPORT, DECLARED_O_SUPPORT, production_struct::declared_support, destructively_reverse_list(), dougs_calculate_support_for_instantiation_preferences(), FALSE, find_clone_for_level(), find_match_goal(), cons_struct::first, free_cons(), symbol_union::id, insert_at_head_of_dll, preference_struct::inst, preference_struct::inst_next, instantiation_struct::match_goal, instantiation_struct::match_goal_level, production_struct::name, condition_struct::next, NIL, agent_struct::o_support_calculation_type, preference_struct::o_supported, preference_struct::on_goal_list, POSITIVE_CONDITION, preference_add_ref(), identifier_struct::preferences_from_goal, instantiation_struct::preferences_generated, print_with_symbols(), instantiation_struct::prod, production_add_ref(), push(), cons_struct::rest, TOP_GOAL_LEVEL, instantiation_struct::top_of_instantiated_conditions, bt_info_struct::trace, TRUE, condition_struct::type, bt_info_struct::wme_, and wme_add_ref().
Referenced by chunk_instantiation(), and create_instantiation().
preference* find_clone_for_level | ( | preference * | p, |
goal_stack_level | level | ||
) |
Definition at line 123 of file recmem.cpp.
References preference_struct::inst, instantiation_struct::match_goal_level, preference_struct::next_clone, NIL, and preference_struct::prev_clone.
Referenced by build_prohibits_list(), fill_in_new_instantiation_stuff(), trace_locals(), and trace_ungrounded_potentials().
void find_match_goal | ( | instantiation * | inst | ) |
Definition at line 162 of file recmem.cpp.
References ATTRIBUTE_IMPASSE_LEVEL, condition_struct::bt, wme_struct::id, symbol_union::id, identifier_struct::isa_goal, bt_info_struct::level, instantiation_struct::match_goal, instantiation_struct::match_goal_level, condition_struct::next, NIL, POSITIVE_CONDITION, instantiation_struct::top_of_instantiated_conditions, condition_struct::type, and bt_info_struct::wme_.
Referenced by fill_in_new_instantiation_stuff().
void init_firer | ( | agent * | thisAgent | ) |
Definition at line 552 of file recmem.cpp.
References init_memory_pool(), and agent_struct::instantiation_pool.
Referenced by init_soar_agent().
Symbol* instantiate_rhs_value | ( | agent * | thisAgent, |
rhs_value | rv, | ||
goal_stack_level | new_id_level, | ||
char | new_id_letter, | ||
struct token_struct * | tok, | ||
wme * | w | ||
) |
Definition at line 208 of file recmem.cpp.
References allocate_cons(), identifier_struct::common_symbol_info, rhs_function_struct::f, FALSE, agent_struct::firer_highest_rhs_unboundvar_index, cons_struct::first, free_list(), get_symbol_from_rete_loc(), symbol_union::id, IDENTIFIER_SYMBOL_TYPE, instantiate_rhs_value(), identifier_struct::level, make_new_identifier(), variable_struct::name, NIL, identifier_struct::promotion_level, cons_struct::rest, rhs_value_is_reteloc(), rhs_value_is_symbol(), rhs_value_is_unboundvar(), rhs_value_to_funcall_list(), rhs_value_to_reteloc_field_num(), rhs_value_to_reteloc_levels_up(), rhs_value_to_symbol(), rhs_value_to_unboundvar(), agent_struct::rhs_variable_bindings, identifier_struct::smem_lti, SMEM_LTI_UNKNOWN_LEVEL, symbol_add_ref(), symbol_remove_ref(), symbol_common_data_struct::symbol_type, agent_struct::timers_cpu, agent_struct::timers_kernel, agent_struct::timers_total_cpu_time, agent_struct::timers_total_kernel_time, TRUE, rhs_function_struct::user_data, symbol_union::var, and VARIABLE_SYMBOL_TYPE.
Referenced by execute_action(), instantiate_rhs_value(), and rl_build_template_instantiation().
void retract_instantiation | ( | agent * | thisAgent, |
instantiation * | inst | ||
) |
Definition at line 1043 of file recmem.cpp.
References rl_param_container::apoptosis, rl_param_container::apoptosis_chunks, rl_param_container::apoptosis_none, CHUNK_PRODUCTION_TYPE, excise_production(), FALSE, get_printer_output_column(), soar_module::constant_param< T >::get_value(), instantiation_struct::in_ms, preference_struct::in_tm, preference_struct::inst_next, production_struct::instantiations, JUSTIFICATION_PRODUCTION_TYPE, multi_attributes_struct::next, NIL, preference_struct::o_supported, possibly_deallocate_instantiation(), instantiation_struct::preferences_generated, print(), print_instantiation_with_wmes(), print_preference(), instantiation_struct::prod, production_struct::reference_count, soar_module::object_memory< T, N >::reference_object(), remove_from_dll, remove_preference_from_tm(), RETRACTION_CALLBACK, agent_struct::rl_params, agent_struct::rl_prods, production_struct::rl_ref_count, production_struct::rl_rule, production_struct::rl_update_count, soar_invoke_callbacks(), agent_struct::sysparams, trace_firings_of_inst(), TRACE_FIRINGS_PREFERENCES_SYSPARAM, TRACE_FIRINGS_WME_TRACE_TYPE_SYSPARAM, TRUE, production_struct::type, and xml_object().
Referenced by do_preference_phase().
Bool shouldCreateInstantiation | ( | agent * | thisAgent, |
production * | prod, | ||
struct token_struct * | tok, | ||
wme * | w | ||
) |
New waterfall model: Returns true if the function create_instantiation should run for this production. Used to delay firing of matches in the inner preference loop.
Definition at line 789 of file recmem.cpp.
References production_struct::action_list, agent_struct::active_level, agent_struct::change_level, FALSE, FUNCALL_ACTION, get_symbol_from_rete_loc(), agent_struct::highest_active_level, action_struct::id, symbol_union::id, identifier_struct::level, action_struct::next, NIL, print(), print_with_symbols(), rhs_value_is_reteloc(), rhs_value_is_symbol(), rhs_value_is_unboundvar(), rhs_value_to_reteloc_field_num(), rhs_value_to_reteloc_levels_up(), rhs_value_to_symbol(), agent_struct::sysparams, TEMPLATE_PRODUCTION_TYPE, TRACE_WATERFALL_SYSPARAM, TRUE, production_struct::type, and action_struct::type.
Referenced by do_preference_phase().
|
inline |
Definition at line 565 of file recmem.cpp.
References agent_struct::sysparams, and TRACE_FIRINGS_OF_USER_PRODS_SYSPARAM.
Referenced by create_instantiation(), and retract_instantiation().
wme* glbDeepCopyWMEs = NULL |
Definition at line 76 of file recmem.cpp.
Referenced by create_instantiation(), and recursive_wme_copy().