Soar Kernel
9.3.2 08-06-12
|
#include <portability.h>
#include "soar_rand.h"
#include "init_soar.h"
#include "agent.h"
#include "consistency.h"
#include "callback.h"
#include "print.h"
#include "production.h"
#include "decide.h"
#include "recmem.h"
#include "explain.h"
#include "symtab.h"
#include "wmem.h"
#include "io_soar.h"
#include "rete.h"
#include "gdatastructs.h"
#include "xml.h"
#include "utilities.h"
#include <assert.h>
#include <time.h>
#include "reinforcement_learning.h"
#include "wma.h"
#include "episodic_memory.h"
#include "semantic_memory.h"
Go to the source code of this file.
void abort_with_fatal_error | ( | agent * | thisAgent, |
const char * | msg | ||
) |
Definition at line 89 of file init_soar.cpp.
References print(), and xml_generate_error().
Referenced by add_rete_test_list_to_tests(), add_rete_tests_for_test(), allocate_memory(), attribute_of_existing_impasse(), copy_of_equality_test_found_in_test(), deallocate_preference(), deallocate_production(), deallocate_rete_node(), deallocate_symbol(), decide_context_slot(), decide_non_context_slot(), error_rete_test_routine(), find_goal_for_match_set_change_assertion(), get_next_char(), hash_condition(), hash_test(), highest_active_goal_apply(), highest_active_goal_propose(), init_memory_pool(), make_fake_preference_for_goal_item(), make_symbol_for_current_lexeme(), merge_into_mp_node(), p_node_left_removal(), parse_rhs_action(), preference_type_indicator(), print_trace_format_list(), promote_id_and_tc(), remove_output_link_tc_info(), remove_token_and_subtree(), rete_error_left(), rete_error_right(), reteload_am_from_index(), reteload_node_and_children(), reteload_rhs_value(), reteload_symbol_from_index(), retesave_rete_node_and_children(), reverse_direction_of_relational_test(), rhs_value_to_string(), single_rete_tests_are_identical(), symbol_to_string(), trace_format_list_to_string(), type_of_existing_impasse(), update_node_with_matches_from_above(), var_bound_in_reconstructed_conds(), and variablize_nots_and_insert_into_conditions().
void add_pwatch | ( | agent * | thisAgent, |
production * | prod | ||
) |
Definition at line 247 of file init_soar.cpp.
References agent_struct::productions_being_traced, push(), production_struct::trace_firings, and TRUE.
Definition at line 1381 of file init_soar.cpp.
References agent_struct::bottom_goal, symbol_union::id, identifier_struct::operator_slot, agent_struct::operator_symbol, agent_struct::state_symbol, and slot_struct::wmes.
Referenced by run_for_n_selections_of_slot(), and run_for_n_selections_of_slot_at_level().
void determine_highest_active_production_level_in_stack_apply | ( | agent * | thisAgent | ) |
Definition at line 611 of file consistency.cpp.
References agent_struct::active_goal, agent_struct::active_level, active_production_type_at_goal(), any_assertions_or_retractions_ready(), agent_struct::bottom_goal, agent_struct::current_phase, determine_highest_active_production_level_in_stack_apply(), agent_struct::e_cycles_this_d_cycle, FALSE, agent_struct::FIRING_TYPE, goal_stack_consistent_through_goal(), HIGHER_LEVEL, highest_active_goal_apply(), symbol_union::id, IE_PRODS, identifier_struct::level, LOWER_LEVEL, MAX_ELABORATIONS_SYSPARAM, minor_quiescence_at_goal(), NEW_DECISION, NIL_GOAL_RETRACTIONS, NO_SAVED_PRODS, OUTPUT_PHASE, PE_PRODS, agent_struct::previous_active_goal, agent_struct::previous_active_level, print(), PRINT_WARNINGS_SYSPARAM, SAME_LEVEL, identifier_struct::saved_firing_type, agent_struct::sysparams, agent_struct::top_goal, and xml_generate_warning().
Referenced by determine_highest_active_production_level_in_stack_apply(), and do_one_top_level_phase().
void determine_highest_active_production_level_in_stack_propose | ( | agent * | thisAgent | ) |
Definition at line 842 of file consistency.cpp.
References agent_struct::active_goal, agent_struct::active_level, agent_struct::bottom_goal, agent_struct::current_phase, DECISION_PHASE, agent_struct::e_cycles_this_d_cycle, FALSE, agent_struct::FIRING_TYPE, goal_stack_consistent_through_goal(), HIGHER_LEVEL, highest_active_goal_propose(), symbol_union::id, IE_PRODS, identifier_struct::level, LOWER_LEVEL, MAX_ELABORATIONS_SYSPARAM, minor_quiescence_at_goal(), agent_struct::ms_i_assertions, agent_struct::ms_retractions, NEW_DECISION, NIL_GOAL_RETRACTIONS, NO_SAVED_PRODS, PE_PRODS, agent_struct::previous_active_goal, agent_struct::previous_active_level, print(), PRINT_WARNINGS_SYSPARAM, SAME_LEVEL, identifier_struct::saved_firing_type, agent_struct::sysparams, agent_struct::top_goal, and xml_generate_warning().
Referenced by do_one_top_level_phase().
void do_one_top_level_phase | ( | agent * | thisAgent | ) |
KJC June 05: moved output function timers into do_output_cycle
Definition at line 527 of file init_soar.cpp.
References AFTER_APPLY_PHASE_CALLBACK, AFTER_DECISION_CYCLE_CALLBACK, AFTER_DECISION_PHASE_CALLBACK, AFTER_ELABORATION_CALLBACK, AFTER_HALT_SOAR_CALLBACK, AFTER_INPUT_PHASE_CALLBACK, AFTER_OUTPUT_PHASE_CALLBACK, AFTER_PREFERENCE_PHASE_CALLBACK, AFTER_PROPOSE_PHASE_CALLBACK, AFTER_WM_PHASE_CALLBACK, rl_param_container::apoptosis, rl_param_container::apoptosis_none, APPLY_PHASE, agent_struct::applyPhase, BEFORE_APPLY_PHASE_CALLBACK, BEFORE_DECISION_CYCLE_CALLBACK, BEFORE_DECISION_PHASE_CALLBACK, BEFORE_ELABORATION_CALLBACK, BEFORE_INPUT_PHASE_CALLBACK, BEFORE_OUTPUT_PHASE_CALLBACK, BEFORE_PREFERENCE_PHASE_CALLBACK, BEFORE_PROPOSE_PHASE_CALLBACK, BEFORE_WM_PHASE_CALLBACK, agent_struct::bottom_goal, agent_struct::chunks_this_d_cycle, agent_struct::cumulative_wm_size, agent_struct::current_phase, agent_struct::d_cycle_count, agent_struct::dc_stat_tracking, DECISION_CYCLE_MAX_USEC_INTERRUPT, DECISION_PHASE, agent_struct::decision_phases_count, determine_highest_active_production_level_in_stack_apply(), determine_highest_active_production_level_in_stack_propose(), do_decision_phase(), do_input_cycle(), do_output_cycle(), do_preference_phase(), do_working_memory_phase(), agent_struct::e_cycle_count, agent_struct::e_cycles_this_d_cycle, epmem_enabled(), epmem_go(), agent_struct::epmem_params, agent_struct::epmem_timers, excise_production(), FALSE, agent_struct::FIRING_TYPE, soar_module::object_memory< T, N >::forget(), soar_module::object_memory< T, N >::forgotten_begin(), soar_module::object_memory< T, N >::forgotten_end(), get_derived_kernel_time_usec(), soar_module::constant_param< T >::get_value(), GO_ELABORATION, agent_struct::go_type, identifier_struct::higher_goal, symbol_union::id, IE_PRODS, initialize_consistency_calculations_for_new_decision(), agent_struct::input_cycle_flag, agent_struct::input_period, INPUT_PHASE, agent_struct::last_derived_kernel_time_usec, agent_struct::max_dc_epmem_time_cycle, agent_struct::max_dc_epmem_time_sec, agent_struct::max_dc_production_firing_count_cycle, agent_struct::max_dc_production_firing_count_value, agent_struct::max_dc_smem_time_cycle, agent_struct::max_dc_smem_time_sec, agent_struct::max_dc_time_cycle, agent_struct::max_dc_time_usec, agent_struct::max_dc_wm_changes_cycle, agent_struct::max_dc_wm_changes_value, MAX_NIL_OUTPUT_CYCLES_SYSPARAM, agent_struct::max_wm_size, agent_struct::ms_o_assertions, NIL, agent_struct::num_wm_sizes_accumulated, agent_struct::num_wmes_in_rete, identifier_struct::operator_slot, agent_struct::output_link_changed, OUTPUT_PHASE, agent_struct::pe_cycle_count, agent_struct::pe_cycles_this_d_cycle, PE_PRODS, epmem_param_container::phase, epmem_param_container::phase_output, epmem_param_container::phase_selection, PREFERENCE_PHASE, print(), print_lowest_slot_in_context_stack(), print_phase(), print_string(), soar_module::object_memory< T, N >::process_buffered_references(), agent_struct::production_firing_count, PROPOSE_PHASE, agent_struct::reason_for_stopping, rl_enabled(), agent_struct::rl_params, rl_perform_update(), agent_struct::rl_prods, rl_tabulate_reward_value_for_goal(), agent_struct::run_elaboration_count, agent_struct::run_generated_output_count, agent_struct::run_last_output_count, agent_struct::run_phase_count, smem_attach(), smem_enabled(), smem_go(), agent_struct::smem_timers, soar_invoke_callbacks(), agent_struct::start_dc_production_firing_count, agent_struct::start_dc_wme_addition_count, agent_struct::start_dc_wme_removal_count, stats_db_store(), agent_struct::stop_soar, agent_struct::sysparams, agent_struct::system_halted, soar_module::object_memory< T, N >::time_forward(), agent_struct::timers_decision_cycle_phase, agent_struct::timers_phase, smem_timer_container::total, epmem_timer_container::total, agent_struct::total_dc_epmem_time_sec, agent_struct::total_dc_smem_time_sec, TRACE_CONTEXT_DECISIONS_SYSPARAM, TRACE_PHASES_SYSPARAM, TRUE, soar_module::timer::value(), WM_PHASE, agent_struct::wma_d_cycle_count, wma_enabled(), wma_forgetting, wma_go(), wma_histories, agent_struct::wme_addition_count, agent_struct::wme_removal_count, slot_struct::wmes, xml_generate_error(), and xml_invoke_callback().
Referenced by run_for_n_decision_cycles(), run_for_n_elaboration_cycles(), run_for_n_modifications_of_output(), run_for_n_phases(), run_for_n_selections_of_slot(), run_for_n_selections_of_slot_at_level(), and run_forever().
char* getenv | ( | ) |
void init_agent_memory | ( | agent * | thisAgent | ) |
Definition at line 1481 of file init_soar.cpp.
References add_input_wme(), create_top_goal(), agent_struct::current_phase, agent_struct::d_cycle_count, do_input_cycle(), do_output_cycle(), agent_struct::epmem_timers, get_new_io_identifier(), agent_struct::input_link_symbol, INPUT_PHASE, agent_struct::io_header, agent_struct::io_header_input, agent_struct::io_header_link, agent_struct::io_header_output, agent_struct::io_symbol, agent_struct::output_link_symbol, agent_struct::prev_top_state, print_lowest_slot_in_context_stack(), print_string(), soar_module::timer_container::reset(), reset_max_stats(), reset_timers(), agent_struct::smem_timers, agent_struct::sysparams, agent_struct::top_goal, agent_struct::top_state, TRACE_CONTEXT_DECISIONS_SYSPARAM, agent_struct::wma_d_cycle_count, and agent_struct::wma_timers.
Referenced by init_soar_agent(), and load_rete_net().
void init_sysparams | ( | agent * | thisAgent | ) |
Definition at line 186 of file init_soar.cpp.
References ATTENTION_LAPSE_ON_SYSPARAM, CHUNK_THROUGH_LOCAL_NEGATIONS_SYSPARAM, DECISION_CYCLE_MAX_USEC_INTERRUPT, EXPLAIN_SYSPARAM, FALSE, HIGHEST_SYSPARAM_NUMBER, LEARNING_ALL_GOALS_SYSPARAM, LEARNING_EXCEPT_SYSPARAM, LEARNING_ON_SYSPARAM, LEARNING_ONLY_SYSPARAM, MAX_CHUNKS_SYSPARAM, MAX_ELABORATIONS_SYSPARAM, MAX_GOAL_DEPTH, MAX_MEMORY_USAGE_SYSPARAM, MAX_NIL_OUTPUT_CYCLES_SYSPARAM, NONE_WME_TRACE, PRINT_ALIAS_SYSPARAM, PRINT_WARNINGS_SYSPARAM, RESPOND_TO_LOAD_ERRORS_SYSPARAM, agent_struct::sysparams, TIMERS_ENABLED, TRACE_CHUNK_NAMES_SYSPARAM, TRACE_CONTEXT_DECISIONS_SYSPARAM, TRACE_FIRINGS_OF_CHUNKS_SYSPARAM, TRACE_FIRINGS_WME_TRACE_TYPE_SYSPARAM, TRACE_JUSTIFICATION_NAMES_SYSPARAM, TRACE_LOADING_SYSPARAM, TRACE_OPERAND2_REMOVALS_SYSPARAM, TRUE, USE_LONG_CHUNK_NAMES, USER_SELECT_MODE_SYSPARAM, USER_SELECT_REDUCE_SYSPARAM, and USER_SELECT_SOFTMAX.
Referenced by create_soar_agent().
void load_file | ( | agent * | thisAgent, |
char * | file_name, | ||
FILE * | already_open_file | ||
) |
Definition at line 1461 of file init_soar.cpp.
References FALSE, agent_struct::print_prompt_flag, start_lex_from_file(), and stop_lex_from_file().
bool reinitialize_soar | ( | agent * | thisAgent | ) |
Definition at line 382 of file init_soar.cpp.
References wma_param_container::activation, agent_struct::active_level, AFTER_INIT_SOAR_CALLBACK, rl_param_container::apoptosis, rl_param_container::apoptosis_none, BEFORE_INIT_SOAR_CALLBACK, clear_goal_stack(), agent_struct::current_phase, agent_struct::did_PE, do_preference_phase(), agent_struct::dyn_counters, agent_struct::epmem_stats, FALSE, agent_struct::FIRING_TYPE, soar_module::constant_param< T >::get_value(), GO_DECISION, agent_struct::go_number, agent_struct::go_type, IE_PRODS, agent_struct::input_cycle_flag, INPUT_PHASE, NONE_WME_TRACE, soar_module::off, soar_module::ok, soar_module::on, agent_struct::reason_for_stopping, soar_module::stat_container::reset(), reset_explain(), reset_id_counters(), reset_statistics(), reset_wme_timetags(), agent_struct::rl_params, agent_struct::rl_stats, set_sysparam(), wma_activation_param::set_value(), rl_apoptosis_param::set_value(), agent_struct::smem_stats, soar_invoke_callbacks(), stats_close(), agent_struct::stats_db, agent_struct::stop_soar, agent_struct::substate_break_level, agent_struct::sysparams, agent_struct::system_halted, TRACE_CONTEXT_DECISIONS_SYSPARAM, TRACE_FIRINGS_OF_DEFAULT_PRODS_SYSPARAM, TRACE_FIRINGS_OF_USER_PRODS_SYSPARAM, TRACE_FIRINGS_PREFERENCES_SYSPARAM, TRACE_FIRINGS_WME_TRACE_TYPE_SYSPARAM, TRACE_GDS_SYSPARAM, TRACE_PHASES_SYSPARAM, TRACE_WM_CHANGES_SYSPARAM, TRUE, wma_enabled(), agent_struct::wma_params, agent_struct::wma_stats, and xml_reset().
Referenced by load_rete_net().
void remove_pwatch | ( | agent * | thisAgent, |
production * | prod | ||
) |
Definition at line 260 of file init_soar.cpp.
References extract_list_elements(), FALSE, free_list(), agent_struct::productions_being_traced, remove_pwatch_test_fn(), and production_struct::trace_firings.
Referenced by excise_production().
Definition at line 254 of file init_soar.cpp.
References cons_struct::first.
Referenced by remove_pwatch().
void reset_max_stats | ( | agent * | thisAgent | ) |
Definition at line 363 of file init_soar.cpp.
References agent_struct::max_dc_epmem_time_cycle, agent_struct::max_dc_epmem_time_sec, agent_struct::max_dc_production_firing_count_cycle, agent_struct::max_dc_production_firing_count_value, agent_struct::max_dc_smem_time_cycle, agent_struct::max_dc_smem_time_sec, agent_struct::max_dc_time_cycle, agent_struct::max_dc_time_usec, agent_struct::max_dc_wm_changes_cycle, agent_struct::max_dc_wm_changes_value, agent_struct::total_dc_epmem_time_sec, and agent_struct::total_dc_smem_time_sec.
Referenced by create_soar_agent(), init_agent_memory(), and reset_statistics().
void reset_production_firing_counts | ( | agent * | thisAgent | ) |
Definition at line 278 of file init_soar.cpp.
References agent_struct::all_productions_of_type, production_struct::firing_count, production_struct::next, NIL, and NUM_PRODUCTION_TYPES.
Referenced by reset_statistics().
void reset_statistics | ( | agent * | thisAgent | ) |
Definition at line 290 of file init_soar.cpp.
References agent_struct::chunks_this_d_cycle, agent_struct::cumulative_wm_size, agent_struct::d_cycle_count, agent_struct::d_cycle_last_output, agent_struct::decision_phases_count, agent_struct::e_cycle_count, agent_struct::e_cycles_this_d_cycle, agent_struct::epmem_timers, agent_struct::inner_e_cycle_count, agent_struct::max_wm_size, agent_struct::num_wm_sizes_accumulated, agent_struct::pe_cycle_count, agent_struct::pe_cycles_this_d_cycle, agent_struct::production_firing_count, soar_module::timer_container::reset(), reset_max_stats(), reset_production_firing_counts(), reset_timers(), agent_struct::run_elaboration_count, agent_struct::run_generated_output_count, agent_struct::run_last_output_count, agent_struct::run_phase_count, agent_struct::smem_timers, agent_struct::start_dc_production_firing_count, agent_struct::start_dc_wme_addition_count, agent_struct::start_dc_wme_removal_count, agent_struct::wma_d_cycle_count, agent_struct::wma_timers, agent_struct::wme_addition_count, and agent_struct::wme_removal_count.
Referenced by init_soar_agent(), and reinitialize_soar().
void reset_timers | ( | agent * | thisAgent | ) |
Definition at line 333 of file init_soar.cpp.
References agent_struct::last_derived_kernel_time_usec, NUM_PHASE_TYPES, agent_struct::sysparams, agent_struct::timers_cpu, agent_struct::timers_decision_cycle_phase, TIMERS_ENABLED, agent_struct::timers_input_function_cpu_time, agent_struct::timers_kernel, agent_struct::timers_monitors_cpu_time, agent_struct::timers_output_function_cpu_time, agent_struct::timers_phase, agent_struct::timers_total_cpu_time, and agent_struct::timers_total_kernel_time.
Referenced by create_soar_agent(), init_agent_memory(), and reset_statistics().
void run_for_n_decision_cycles | ( | agent * | thisAgent, |
int64_t | n | ||
) |
Definition at line 1354 of file init_soar.cpp.
References agent_struct::d_cycle_count, do_one_top_level_phase(), FALSE, agent_struct::reason_for_stopping, run_forever(), agent_struct::stop_soar, agent_struct::timers_cpu, agent_struct::timers_kernel, agent_struct::timers_total_cpu_time, and agent_struct::timers_total_kernel_time.
void run_for_n_elaboration_cycles | ( | agent * | thisAgent, |
int64_t | n | ||
) |
Definition at line 1285 of file init_soar.cpp.
References agent_struct::d_cycle_count, do_one_top_level_phase(), agent_struct::e_cycle_count, FALSE, GO_ELABORATION, GO_PHASE, agent_struct::go_type, agent_struct::reason_for_stopping, run_forever(), agent_struct::stop_soar, agent_struct::timers_cpu, agent_struct::timers_kernel, agent_struct::timers_total_cpu_time, and agent_struct::timers_total_kernel_time.
void run_for_n_modifications_of_output | ( | agent * | thisAgent, |
int64_t | n | ||
) |
Definition at line 1319 of file init_soar.cpp.
References agent_struct::current_phase, do_one_top_level_phase(), FALSE, MAX_NIL_OUTPUT_CYCLES_SYSPARAM, agent_struct::output_link_changed, OUTPUT_PHASE, agent_struct::reason_for_stopping, run_forever(), agent_struct::stop_soar, agent_struct::sysparams, agent_struct::timers_cpu, agent_struct::timers_kernel, agent_struct::timers_total_cpu_time, and agent_struct::timers_total_kernel_time.
void run_for_n_phases | ( | agent * | thisAgent, |
int64_t | n | ||
) |
Definition at line 1264 of file init_soar.cpp.
References do_one_top_level_phase(), FALSE, agent_struct::reason_for_stopping, run_forever(), agent_struct::stop_soar, agent_struct::timers_cpu, agent_struct::timers_kernel, agent_struct::timers_total_cpu_time, and agent_struct::timers_total_kernel_time.
Definition at line 1387 of file init_soar.cpp.
References attr_of_slot_just_decided(), agent_struct::current_phase, DECISION_PHASE, do_one_top_level_phase(), FALSE, agent_struct::reason_for_stopping, run_forever(), agent_struct::stop_soar, agent_struct::timers_cpu, agent_struct::timers_kernel, agent_struct::timers_total_cpu_time, and agent_struct::timers_total_kernel_time.
void run_for_n_selections_of_slot_at_level | ( | agent * | thisAgent, |
int64_t | n, | ||
Symbol * | attr_of_slot, | ||
goal_stack_level | level | ||
) |
Definition at line 1414 of file init_soar.cpp.
References attr_of_slot_just_decided(), agent_struct::bottom_goal, agent_struct::current_phase, DECISION_PHASE, do_one_top_level_phase(), FALSE, symbol_union::id, identifier_struct::level, agent_struct::reason_for_stopping, run_forever(), agent_struct::stop_soar, agent_struct::timers_cpu, agent_struct::timers_kernel, agent_struct::timers_total_cpu_time, and agent_struct::timers_total_kernel_time.
void run_forever | ( | agent * | thisAgent | ) |
Definition at line 1244 of file init_soar.cpp.
References do_one_top_level_phase(), FALSE, agent_struct::reason_for_stopping, agent_struct::stop_soar, agent_struct::timers_cpu, agent_struct::timers_kernel, agent_struct::timers_total_cpu_time, and agent_struct::timers_total_kernel_time.
Referenced by run_for_n_decision_cycles(), run_for_n_elaboration_cycles(), run_for_n_modifications_of_output(), run_for_n_phases(), run_for_n_selections_of_slot(), and run_for_n_selections_of_slot_at_level().
Definition at line 174 of file init_soar.cpp.
References HIGHEST_SYSPARAM_NUMBER, print(), soar_invoke_callbacks(), agent_struct::sysparams, and SYSTEM_PARAMETER_CHANGED_CALLBACK.
Referenced by exploration_set_policy(), init_explain(), and reinitialize_soar().