Soar Kernel
9.3.2 08-06-12
|
#include <portability.h>
#include <stdlib.h>
#include "chunk.h"
#include "symtab.h"
#include "wmem.h"
#include "gdatastructs.h"
#include "kernel.h"
#include "agent.h"
#include "instantiations.h"
#include "production.h"
#include "rhsfun.h"
#include "print.h"
#include "init_soar.h"
#include "prefmem.h"
#include "decide.h"
#include "explain.h"
#include "backtrace.h"
#include "recmem.h"
#include "rete.h"
#include "xml.h"
#include "soar_TraceNames.h"
#include "wma.h"
#include <ctype.h>
Go to the source code of this file.
Macros | |
#define | BUFFER_GEN_CHUNK_NAME_SIZE 512 |
#define | BUFFER_IMPASS_NAME_SIZE 32 |
#define BUFFER_GEN_CHUNK_NAME_SIZE 512 |
Referenced by generate_chunk_name_sym_constant().
#define BUFFER_IMPASS_NAME_SIZE 32 |
Referenced by generate_chunk_name_sym_constant().
void add_goal_or_impasse_tests | ( | agent * | thisAgent, |
chunk_cond * | all_ccs | ||
) |
Definition at line 640 of file chunk.cpp.
References add_new_test_to_test(), agent_struct::complex_test_pool, condition_struct::data, get_new_tc_number(), GOAL_ID_TEST, symbol_union::id, three_field_tests_struct::id_test, IMPASSE_ID_TEST, chunk_cond_struct::instantiated_cond, identifier_struct::isa_goal, identifier_struct::isa_impasse, make_test_from_complex_test(), chunk_cond_struct::next, NIL, POSITIVE_CONDITION, referent_of_equality_test(), identifier_struct::tc_num, condition_struct::condition_main_data_union::tests, complex_test_struct::type, condition_struct::type, and chunk_cond_struct::variablized_cond.
Referenced by chunk_instantiation().
void add_pref_to_results | ( | agent * | thisAgent, |
preference * | pref | ||
) |
Definition at line 88 of file chunk.cpp.
References add_results_if_needed(), preference_struct::attr, preference_struct::id, preference_struct::inst, instantiation_struct::match_goal_level, preference_struct::next_clone, preference_struct::next_result, NIL, preference_is_binary(), preference_is_unary(), preference_struct::prev_clone, preference_struct::referent, agent_struct::results, agent_struct::results_match_goal_level, preference_struct::type, and preference_struct::value.
Referenced by add_results_for_id(), and get_results_for_instantiation().
Definition at line 123 of file chunk.cpp.
References add_pref_to_results(), add_results_if_needed(), preference_struct::all_of_slot_next, slot_struct::all_preferences, agent_struct::extra_result_prefs_from_instantiation, wme_struct::id, preference_struct::id, symbol_union::id, identifier_struct::input_wmes, preference_struct::inst_next, wme_struct::next, slot_struct::next, NIL, agent_struct::results_tc_number, identifier_struct::slots, wme_struct::value, and slot_struct::wmes.
Referenced by add_results_if_needed().
Definition at line 79 of file chunk.cpp.
References add_results_for_id(), common, IDENTIFIER_SYMBOL_TYPE, agent_struct::results_match_goal_level, and agent_struct::results_tc_number.
Referenced by add_pref_to_results(), and add_results_for_id().
Bool add_to_chunk_cond_set | ( | agent * | thisAgent, |
chunk_cond_set * | set, | ||
chunk_cond * | new_cc | ||
) |
Definition at line 364 of file chunk.cpp.
References agent_struct::chunk_cond_pool, chunk_cond_struct::compressed_hash_value, chunk_cond_struct::cond, conditions_are_equal(), FALSE, chunk_cond_struct::hash_value, insert_at_head_of_dll, chunk_cond_struct::next_in_bucket, NIL, and TRUE.
Referenced by backtrace_through_instantiation().
void build_chunk_conds_for_grounds_and_add_negateds | ( | agent * | thisAgent, |
chunk_cond ** | dest_top, | ||
chunk_cond ** | dest_bottom, | ||
tc_number | tc_to_use, | ||
bool * | reliable | ||
) |
Definition at line 417 of file chunk.cpp.
References add_cond_to_tc(), chunk_cond_set_struct::all, agent_struct::chunk_cond_pool, CHUNK_THROUGH_LOCAL_NEGATIONS_SYSPARAM, chunk_cond_struct::cond, cond_is_in_tc(), copy_condition(), FALSE, cons_struct::first, free_cons(), agent_struct::grounds, chunk_cond_struct::instantiated_cond, agent_struct::negated_set, chunk_cond_struct::next, condition_struct::next, NIL, chunk_cond_struct::prev, condition_struct::prev, print_condition(), print_string(), remove_from_chunk_cond_set(), report_local_negation(), cons_struct::rest, agent_struct::sysparams, TRACE_BACKTRACING_SYSPARAM, and chunk_cond_struct::variablized_cond.
Referenced by chunk_instantiation().
void chunk_instantiation | ( | agent * | thisAgent, |
instantiation * | inst, | ||
bool | dont_variablize, | ||
instantiation ** | custom_inst_list | ||
) |
Definition at line 973 of file chunk.cpp.
References explain_chunk_struct::actions, add_goal_or_impasse_tests(), add_production_to_rete(), explain_chunk_struct::all_grounds, identifier_struct::allow_bottom_up_chunks, explain_chunk_struct::backtrace, agent_struct::backtrace_number, backtrace_through_instantiation(), instantiation_struct::bottom_of_instantiated_conditions, build_chunk_conds_for_grounds_and_add_negateds(), agent_struct::chunk_cond_pool, chunk_instantiation(), CHUNK_PRODUCTION_TYPE, agent_struct::chunks_this_d_cycle, explain_chunk_struct::conds, copy_and_variablize_result_list(), copy_condition_list(), agent_struct::current_phase, deallocate_action_list(), deallocate_condition_list(), DUPLICATE_PRODUCTION, excise_production(), explain_add_temp_to_chunk_list(), EXPLAIN_CHUNK_STRUCT_NAME_BUFFER_SIZE, EXPLAIN_SYSPARAM, FALSE, fill_in_new_instantiation_stuff(), free_list(), instantiation_struct::GDS_evaluated_already, generate_chunk_name_sym_constant(), generate_new_sym_constant(), get_new_tc_number(), get_nots_for_instantiated_conditions(), get_printer_output_column(), get_results_for_instantiation(), agent_struct::grounds, agent_struct::grounds_tc, identifier_struct::higher_goal, preference_struct::id, symbol_union::id, instantiation_struct::in_ms, preference_struct::inst, preference_struct::inst_next, chunk_cond_struct::instantiated_cond, agent_struct::instantiation_pool, agent_struct::instantiations_with_nots, agent_struct::justification_count, JUSTIFICATION_PRODUCTION_TYPE, identifier_struct::level, agent_struct::locals, agent_struct::locals_tc, make_clones_of_results(), make_production(), instantiation_struct::match_goal, instantiation_struct::match_goal_level, agent_struct::max_chunks_reached, MAX_CHUNKS_SYSPARAM, explain_chunk_struct::name, sym_constant_struct::name, chunk_cond_struct::next, instantiation_struct::next, explain_chunk_struct::next_chunk, preference_struct::next_result, NIL, instantiation_struct::nots, agent_struct::positive_potentials, agent_struct::potentials_tc, instantiation_struct::preferences_generated, print(), print_action_list(), print_condition_list(), print_preference(), print_production(), print_string(), PRINT_WARNINGS_SYSPARAM, print_with_symbols(), instantiation_struct::prod, REFRACTED_INST_DID_NOT_MATCH, REFRACTED_INST_MATCHED, instantiation_struct::reliable, reorder_instantiated_conditions(), reset_backtrace_list(), reset_variable_generator(), symbol_union::sc, should_variablize(), smem_valid_production(), agent_struct::stop_soar, symbol_remove_ref(), agent_struct::sysparams, agent_struct::system_halted, TIMERS_ENABLED, instantiation_struct::top_of_instantiated_conditions, TRACE_BACKTRACING_SYSPARAM, TRACE_CHUNK_NAMES_SYSPARAM, TRACE_CHUNKS_SYSPARAM, trace_grounded_potentials(), TRACE_JUSTIFICATION_NAMES_SYSPARAM, TRACE_JUSTIFICATIONS_SYSPARAM, trace_locals(), trace_ungrounded_potentials(), TRUE, agent_struct::variablization_tc, variablize_condition_list(), variablize_nots_and_insert_into_conditions(), chunk_cond_struct::variablized_cond, xml_att_val(), xml_begin_tag(), xml_end_tag(), and xml_generate_warning().
Referenced by _epmem_process_buffered_wme_list(), _smem_process_buffered_wme_list(), chunk_instantiation(), and create_instantiation().
action* copy_and_variablize_result_list | ( | agent * | thisAgent, |
preference * | pref, | ||
bool | variablize | ||
) |
Definition at line 254 of file chunk.cpp.
References agent_struct::action_pool, preference_struct::attr, action_struct::attr, preference_struct::id, action_struct::id, MAKE_ACTION, action_struct::next, preference_struct::next_result, NIL, preference_is_binary(), action_struct::preference_type, preference_struct::referent, action_struct::referent, symbol_add_ref(), symbol_to_rhs_value(), preference_struct::type, action_struct::type, preference_struct::value, action_struct::value, and variablize_symbol().
Referenced by chunk_instantiation().
Symbol* find_goal_at_goal_stack_level | ( | agent * | thisAgent, |
goal_stack_level | level | ||
) |
Definition at line 765 of file chunk.cpp.
References symbol_union::id, identifier_struct::level, identifier_struct::lower_goal, NIL, and agent_struct::top_goal.
Referenced by generate_chunk_name_sym_constant().
Definition at line 774 of file chunk.cpp.
References wme_struct::attr, symbol_union::id, identifier_struct::impasse_wmes, wme_struct::next, NIL, and wme_struct::value.
Referenced by generate_chunk_name_sym_constant().
Symbol* generate_chunk_name_sym_constant | ( | agent * | thisAgent, |
instantiation * | inst | ||
) |
Definition at line 782 of file chunk.cpp.
References agent_struct::attribute_symbol, BUFFER_GEN_CHUNK_NAME_SIZE, BUFFER_IMPASS_NAME_SIZE, agent_struct::chunk_count, agent_struct::chunk_name_prefix, agent_struct::chunks_this_d_cycle, CONFLICT_IMPASSE_TYPE, CONSTRAINT_FAILURE_IMPASSE_TYPE, agent_struct::d_cycle_count, find_goal_at_goal_stack_level(), find_impasse_wme_value(), find_sym_constant(), generate_new_sym_constant(), preference_struct::id, symbol_union::id, preference_struct::inst_next, identifier_struct::level, identifier_struct::lower_goal, make_sym_constant(), NIL, NO_CHANGE_IMPASSE_TYPE, NONE_IMPASSE_TYPE, agent_struct::operator_symbol, instantiation_struct::preferences_generated, print(), agent_struct::state_symbol, agent_struct::sysparams, TIE_IMPASSE_TYPE, agent_struct::top_goal, type_of_existing_impasse(), USE_LONG_CHUNK_NAMES, and xml_generate_warning().
Referenced by chunk_instantiation().
not_struct* get_nots_for_instantiated_conditions | ( | agent * | thisAgent, |
list * | instantiations_with_nots, | ||
tc_number | tc_of_grounds | ||
) |
Definition at line 527 of file chunk.cpp.
References cons_struct::first, free_cons(), symbol_union::id, not_struct::next, NIL, agent_struct::not_pool, instantiation_struct::nots, cons_struct::rest, not_struct::s1, not_struct::s2, symbol_add_ref(), and identifier_struct::tc_num.
Referenced by chunk_instantiation().
preference* get_results_for_instantiation | ( | agent * | thisAgent, |
instantiation * | inst | ||
) |
Definition at line 146 of file chunk.cpp.
References add_pref_to_results(), agent_struct::extra_result_prefs_from_instantiation, get_new_tc_number(), preference_struct::id, symbol_union::id, preference_struct::inst_next, identifier_struct::level, instantiation_struct::match_goal_level, NIL, instantiation_struct::preferences_generated, agent_struct::results, agent_struct::results_match_goal_level, agent_struct::results_tc_number, and identifier_struct::tc_num.
Referenced by chunk_instantiation().
void init_chunk_cond_set | ( | chunk_cond_set * | set | ) |
Definition at line 339 of file chunk.cpp.
References CHUNK_COND_HASH_TABLE_SIZE, and NIL.
Referenced by init_chunker().
void init_chunker | ( | agent * | thisAgent | ) |
Definition at line 1371 of file chunk.cpp.
References agent_struct::chunk_cond_pool, init_chunk_cond_set(), init_memory_pool(), and agent_struct::negated_set.
Referenced by init_soar_agent().
chunk_cond* make_chunk_cond_for_condition | ( | agent * | thisAgent, |
condition * | cond | ||
) |
Definition at line 346 of file chunk.cpp.
References agent_struct::chunk_cond_pool, chunk_cond_struct::compressed_hash_value, chunk_cond_struct::cond, hash_condition(), chunk_cond_struct::hash_value, LOG_2_CHUNK_COND_HASH_TABLE_SIZE, masks_for_n_low_order_bits, and uint32_t().
Referenced by backtrace_through_instantiation().
void make_clones_of_results | ( | agent * | thisAgent, |
preference * | results, | ||
instantiation * | chunk_inst | ||
) |
Definition at line 738 of file chunk.cpp.
References preference_struct::attr, preference_struct::id, insert_at_head_of_dll, preference_struct::inst, make_preference(), preference_struct::next_clone, preference_struct::next_result, NIL, preference_is_binary(), instantiation_struct::preferences_generated, preference_struct::prev_clone, preference_struct::referent, symbol_add_ref(), preference_struct::type, and preference_struct::value.
Referenced by chunk_instantiation().
void remove_from_chunk_cond_set | ( | chunk_cond_set * | set, |
chunk_cond * | cc | ||
) |
Definition at line 384 of file chunk.cpp.
References chunk_cond_struct::compressed_hash_value, and remove_from_dll.
Referenced by build_chunk_conds_for_grounds_and_add_negateds().
void reorder_instantiated_conditions | ( | chunk_cond * | top_cc, |
condition ** | dest_inst_top, | ||
condition ** | dest_inst_bottom | ||
) |
Definition at line 692 of file chunk.cpp.
References chunk_cond_struct::instantiated_cond, chunk_cond_struct::next, condition_struct::next, NIL, condition_struct::prev, chunk_cond_struct::saved_prev_pointer_of_variablized_cond, and chunk_cond_struct::variablized_cond.
Referenced by chunk_instantiation().
bool should_variablize | ( | agent * | thisAgent, |
instantiation * | inst | ||
) |
Definition at line 903 of file chunk.cpp.
References identifier_struct::allow_bottom_up_chunks, agent_struct::chunk_free_problem_spaces, agent_struct::chunky_problem_spaces, preference_struct::id, symbol_union::id, preference_struct::inst_next, LEARNING_ALL_GOALS_SYSPARAM, LEARNING_EXCEPT_SYSPARAM, LEARNING_ON_SYSPARAM, LEARNING_ONLY_SYSPARAM, identifier_struct::level, instantiation_struct::match_goal, instantiation_struct::match_goal_level, member_of_list(), instantiation_struct::preferences_generated, print(), agent_struct::soar_verbose_flag, symbol_to_string(), agent_struct::sysparams, TRACE_CHUNKS_SYSPARAM, and xml_generate_verbose().
Referenced by chunk_instantiation().
Definition at line 238 of file chunk.cpp.
References three_field_tests_struct::attr_test, CONJUNCTIVE_NEGATION_CONDITION, condition_struct::data, three_field_tests_struct::id_test, condition_struct::condition_main_data_union::ncc, NEGATIVE_CONDITION, condition_struct::next, NIL, POSITIVE_CONDITION, condition_struct::condition_main_data_union::tests, ncc_info_struct::top, condition_struct::type, three_field_tests_struct::value_test, variablize_condition_list(), and variablize_test().
Referenced by chunk_instantiation(), rl_build_template_instantiation(), and variablize_condition_list().
void variablize_nots_and_insert_into_conditions | ( | agent * | thisAgent, |
not_struct * | nots, | ||
condition * | conds | ||
) |
Definition at line 576 of file chunk.cpp.
References abort_with_fatal_error(), add_new_test_to_test(), three_field_tests_struct::attr_test, BUFFER_MSG_SIZE, agent_struct::complex_test_pool, complex_test_struct::data, condition_struct::data, FALSE, symbol_union::id, three_field_tests_struct::id_test, make_test_from_complex_test(), not_struct::next, condition_struct::next, NIL, NOT_EQUAL_TEST, POSITIVE_CONDITION, complex_test_struct::test_info_union::referent, not_struct::s1, not_struct::s2, symbol_add_ref(), test_includes_equality_test_for_symbol(), condition_struct::condition_main_data_union::tests, TRUE, complex_test_struct::type, condition_struct::type, three_field_tests_struct::value_test, and identifier_struct::variablization.
Referenced by chunk_instantiation(), and rl_build_template_instantiation().
Definition at line 179 of file chunk.cpp.
References generate_new_variable(), symbol_union::id, IDENTIFIER_SYMBOL_TYPE, NIL, symbol_add_ref(), symbol_remove_ref(), identifier_struct::tc_num, identifier_struct::variablization, and agent_struct::variablization_tc.
Referenced by copy_and_variablize_result_list(), rl_make_simple_action(), and variablize_test().
Definition at line 210 of file chunk.cpp.
References complex_test_from_test(), complex_test_struct::test_info_union::conjunct_list, CONJUNCTIVE_TEST, complex_test_struct::data, DISJUNCTION_TEST, cons_struct::first, GOAL_ID_TEST, IMPASSE_ID_TEST, NIL, complex_test_struct::test_info_union::referent, cons_struct::rest, test_is_blank_or_equality_test(), test_is_blank_test(), complex_test_struct::type, and variablize_symbol().
Referenced by variablize_condition_list().