Soar Kernel
9.3.2 08-06-12
|
#include <portability.h>
#include <stdlib.h>
#include "reorder.h"
#include "kernel.h"
#include "rhsfun.h"
#include "gdatastructs.h"
#include "production.h"
#include "mem.h"
#include "symtab.h"
#include "print.h"
#include "agent.h"
#include "init_soar.h"
#include "xml.h"
#include "soar_TraceNames.h"
Go to the source code of this file.
Data Structures | |
struct | saved_test_struct |
Macros | |
#define | BF_FOR_ACCEPTABLE_PREFS 8 /* cost of (. ^. <var> +) */ |
#define | BF_FOR_ATTRIBUTES 8 /* cost of (. ^<var> .) */ |
#define | BF_FOR_VALUES 8 /* cost of (. ^. <var>) */ |
#define | MAX_COST 10000005 /* cost of a disconnected condition */ |
Typedefs | |
typedef struct saved_test_struct | saved_test |
#define BF_FOR_ACCEPTABLE_PREFS 8 /* cost of (. ^. <var> +) */ |
Definition at line 668 of file reorder.cpp.
Referenced by cost_of_adding_condition().
#define BF_FOR_ATTRIBUTES 8 /* cost of (. ^<var> .) */ |
Definition at line 670 of file reorder.cpp.
Referenced by cost_of_adding_condition().
#define BF_FOR_VALUES 8 /* cost of (. ^. <var>) */ |
Definition at line 669 of file reorder.cpp.
Referenced by cost_of_adding_condition().
#define MAX_COST 10000005 /* cost of a disconnected condition */ |
Definition at line 667 of file reorder.cpp.
Referenced by cost_of_adding_condition(), find_lowest_cost_lookahead(), and reorder_simplified_conditions().
typedef struct saved_test_struct saved_test |
Definition at line 143 of file reorder.cpp.
References FALSE, cons_struct::first, NIL, cons_struct::rest, rhs_value_is_funcall(), rhs_value_to_funcall_list(), rhs_value_to_symbol(), variable_struct::tc_num, TRUE, symbol_union::var, and VARIABLE_SYMBOL_TYPE.
Referenced by legal_to_execute_action().
bool check_negative_relational_test_bindings | ( | agent * | thisAgent, |
condition * | cond_list, | ||
tc_number | tc | ||
) |
Definition at line 1121 of file reorder.cpp.
References add_bound_variables_in_condition(), three_field_tests_struct::attr_test, check_unbound_negative_relational_test_referents(), 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, unmark_variables_and_free_list(), and three_field_tests_struct::value_test.
Referenced by reorder_lhs().
Definition at line 1080 of file reorder.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, agent_struct::name_of_production_being_reordered, NIL, print(), complex_test_struct::test_info_union::referent, cons_struct::rest, variable_struct::tc_num, test_is_blank_or_equality_test(), test_is_blank_test(), test_to_string(), complex_test_struct::type, symbol_union::var, and VARIABLE_SYMBOL_TYPE.
Referenced by check_negative_relational_test_bindings().
list* collect_root_variables | ( | agent * | thisAgent, |
condition * | cond_list, | ||
tc_number | tc, | ||
Bool | allow_printing_warnings | ||
) |
Definition at line 590 of file reorder.cpp.
References add_bound_variables_in_test(), add_to_growable_string(), condition_struct::data, FALSE, cons_struct::first, free_growable_string(), three_field_tests_struct::id_test, make_blank_growable_string(), agent_struct::name_of_production_being_reordered, condition_struct::next, NIL, POSITIVE_CONDITION, print(), PRINT_WARNINGS_SYSPARAM, print_with_symbols(), cons_struct::rest, symbol_to_string(), agent_struct::sysparams, test_includes_equality_test_for_symbol(), test_includes_goal_or_impasse_id_test(), condition_struct::condition_main_data_union::tests, text_of_growable_string(), TRUE, condition_struct::type, unmark_variables_and_free_list(), three_field_tests_struct::value_test, and xml_generate_warning().
Referenced by find_compile_time_match_goal(), reorder_lhs(), and reorder_simplified_conditions().
list* collect_vars_tested_by_cond_that_are_bound | ( | agent * | thisAgent, |
condition * | cond, | ||
tc_number | tc, | ||
list * | starting_list | ||
) |
Definition at line 519 of file reorder.cpp.
References three_field_tests_struct::attr_test, collect_vars_tested_by_test_that_are_bound(), CONJUNCTIVE_NEGATION_CONDITION, condition_struct::data, three_field_tests_struct::id_test, condition_struct::condition_main_data_union::ncc, condition_struct::next, NIL, condition_struct::condition_main_data_union::tests, ncc_info_struct::top, condition_struct::type, and three_field_tests_struct::value_test.
Referenced by fill_in_vars_requiring_bindings().
list* collect_vars_tested_by_test_that_are_bound | ( | agent * | thisAgent, |
test | t, | ||
tc_number | tc, | ||
list * | starting_list | ||
) |
Definition at line 478 of file reorder.cpp.
References add_if_not_member(), 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, referent_of_equality_test(), cons_struct::rest, variable_struct::tc_num, test_is_blank_or_equality_test(), test_is_blank_test(), complex_test_struct::type, symbol_union::var, and VARIABLE_SYMBOL_TYPE.
Referenced by collect_vars_tested_by_cond_that_are_bound().
int64_t cost_of_adding_condition | ( | agent * | thisAgent, |
condition * | cond, | ||
tc_number | tc, | ||
list * | root_vars_not_bound_yet | ||
) |
Definition at line 726 of file reorder.cpp.
References three_field_tests_struct::attr_test, BF_FOR_ACCEPTABLE_PREFS, BF_FOR_ATTRIBUTES, BF_FOR_VALUES, condition_struct::data, cons_struct::first, get_cost_of_possible_multi_attribute(), three_field_tests_struct::id_test, MAX_COST, NIL, POSITIVE_CONDITION, referent_of_equality_test(), condition_struct::reorder, cons_struct::rest, symbol_is_constant_or_marked_variable(), test_covered_by_bound_vars(), condition_struct::test_for_acceptable_preference, test_is_blank_or_equality_test(), test_is_blank_test(), condition_struct::condition_main_data_union::tests, condition_struct::type, three_field_tests_struct::value_test, and reorder_info_struct::vars_requiring_bindings.
Referenced by find_lowest_cost_lookahead(), and reorder_simplified_conditions().
Definition at line 542 of file reorder.cpp.
References add_bound_variables_in_condition(), collect_vars_tested_by_cond_that_are_bound(), CONJUNCTIVE_NEGATION_CONDITION, condition_struct::data, condition_struct::condition_main_data_union::ncc, condition_struct::next, NIL, POSITIVE_CONDITION, condition_struct::reorder, ncc_info_struct::top, condition_struct::type, unmark_variables_and_free_list(), and reorder_info_struct::vars_requiring_bindings.
Referenced by reorder_lhs().
int64_t find_lowest_cost_lookahead | ( | agent * | thisAgent, |
condition * | candidates, | ||
condition * | chosen, | ||
tc_number | tc, | ||
list * | root_vars_not_bound_yet | ||
) |
Definition at line 797 of file reorder.cpp.
References add_bound_variables_in_condition(), cost_of_adding_condition(), MAX_COST, condition_struct::next, NIL, and unmark_variables_and_free_list().
Referenced by reorder_simplified_conditions().
Definition at line 709 of file reorder.cpp.
References agent_struct::multi_attributes, multi_attributes_struct::next, multi_attributes_struct::symbol, and multi_attributes_struct::value.
Referenced by cost_of_adding_condition().
void init_reorderer | ( | agent * | thisAgent | ) |
Definition at line 1218 of file reorder.cpp.
References init_memory_pool(), and agent_struct::saved_test_pool.
Referenced by init_production_utilities().
Definition at line 164 of file reorder.cpp.
References all_variables_in_rhs_value_bound(), action_struct::attr, FALSE, action_struct::id, MAKE_ACTION, preference_is_binary(), action_struct::preference_type, action_struct::referent, rhs_value_is_funcall(), TRUE, action_struct::type, and action_struct::value.
Referenced by reorder_action_list().
void print_saved_test | ( | agent * | thisAgent, |
saved_test * | st | ||
) |
Definition at line 210 of file reorder.cpp.
References print_string(), print_with_symbols(), test_to_string(), saved_test_struct::the_test, and saved_test_struct::var.
Referenced by print_saved_test_list().
void print_saved_test_list | ( | agent * | thisAgent, |
saved_test * | st | ||
) |
Definition at line 215 of file reorder.cpp.
References saved_test_struct::next, print(), and print_saved_test().
Referenced by restore_and_deallocate_saved_tests().
void remove_isa_state_tests_for_non_roots | ( | agent * | thisAgent, |
condition ** | lhs_top, | ||
condition ** | , | ||
list * | roots | ||
) |
Definition at line 1151 of file reorder.cpp.
References copy_test_removing_goal_impasse_tests(), condition_struct::data, deallocate_test(), FALSE, three_field_tests_struct::id_test, condition_struct::next, NIL, POSITIVE_CONDITION, test_includes_goal_or_impasse_id_test(), test_is_complex_test(), test_tests_for_root(), condition_struct::condition_main_data_union::tests, TRUE, and condition_struct::type.
Referenced by reorder_lhs().
Definition at line 564 of file reorder.cpp.
References CONJUNCTIVE_NEGATION_CONDITION, condition_struct::data, free_list(), condition_struct::condition_main_data_union::ncc, condition_struct::next, NIL, POSITIVE_CONDITION, condition_struct::reorder, ncc_info_struct::top, condition_struct::type, and reorder_info_struct::vars_requiring_bindings.
Referenced by reorder_lhs().
Definition at line 85 of file reorder.cpp.
References add_all_variables_in_action(), FALSE, legal_to_execute_action(), agent_struct::name_of_production_being_reordered, action_struct::next, NIL, print(), TRUE, and unmark_variables_and_free_list().
Referenced by make_production().
void reorder_condition_list | ( | agent * | thisAgent, |
condition ** | top_of_conds, | ||
condition ** | bottom_of_conds, | ||
list * | roots, | ||
tc_number | tc, | ||
Bool | reorder_nccs | ||
) |
Definition at line 990 of file reorder.cpp.
References reorder_simplified_conditions(), restore_and_deallocate_saved_tests(), and simplify_condition_list().
Referenced by reorder_lhs(), and reorder_simplified_conditions().
Bool reorder_lhs | ( | agent * | thisAgent, |
condition ** | lhs_top, | ||
condition ** | lhs_bottom, | ||
Bool | reorder_nccs | ||
) |
Definition at line 1175 of file reorder.cpp.
References add_bound_variables_in_test(), check_negative_relational_test_bindings(), collect_root_variables(), condition_struct::data, FALSE, fill_in_vars_requiring_bindings(), free_list(), get_new_tc_number(), three_field_tests_struct::id_test, agent_struct::name_of_production_being_reordered, condition_struct::next, NIL, POSITIVE_CONDITION, print(), remove_isa_state_tests_for_non_roots(), remove_vars_requiring_bindings(), reorder_condition_list(), test_includes_goal_or_impasse_id_test(), condition_struct::condition_main_data_union::tests, TRUE, and condition_struct::type.
Referenced by make_production().
void reorder_simplified_conditions | ( | agent * | thisAgent, |
condition ** | top_of_conds, | ||
condition ** | bottom_of_conds, | ||
list * | roots, | ||
tc_number | bound_vars_tc_number, | ||
Bool | reorder_nccs | ||
) |
Definition at line 838 of file reorder.cpp.
References add_bound_variables_in_condition(), add_to_growable_string(), ncc_info_struct::bottom, canonical_cond_greater(), collect_root_variables(), CONJUNCTIVE_NEGATION_CONDITION, cost_of_adding_condition(), condition_struct::data, find_lowest_cost_lookahead(), cons_struct::first, free_growable_string(), free_list(), insert_at_head_of_dll, make_blank_growable_string(), MAX_COST, agent_struct::name_of_production_being_reordered, condition_struct::condition_main_data_union::ncc, saved_test_struct::next, condition_struct::next, reorder_info_struct::next_min_cost, NIL, POSITIVE_CONDITION, print(), PRINT_WARNINGS_SYSPARAM, remove_from_dll, condition_struct::reorder, reorder_condition_list(), cons_struct::rest, agent_struct::sysparams, text_of_growable_string(), ncc_info_struct::top, TRUE, condition_struct::type, unmark_variables_and_free_list(), and xml_generate_warning().
Referenced by reorder_condition_list().
void restore_and_deallocate_saved_tests | ( | agent * | thisAgent, |
condition * | conds_list, | ||
tc_number | tc, | ||
saved_test * | tests_to_restore | ||
) |
Definition at line 403 of file reorder.cpp.
References add_bound_variables_in_test(), add_to_growable_string(), three_field_tests_struct::attr_test, CONJUNCTIVE_NEGATION_CONDITION, condition_struct::data, FALSE, free_growable_string(), three_field_tests_struct::id_test, make_blank_growable_string(), agent_struct::name_of_production_being_reordered, NEGATIVE_CONDITION, condition_struct::next, NIL, POSITIVE_CONDITION, print(), print_saved_test_list(), PRINT_WARNINGS_SYSPARAM, restore_saved_tests_to_test(), agent_struct::sysparams, condition_struct::condition_main_data_union::tests, text_of_growable_string(), TRUE, condition_struct::type, unmark_variables_and_free_list(), three_field_tests_struct::value_test, and xml_generate_warning().
Referenced by reorder_condition_list().
saved_test* restore_saved_tests_to_test | ( | agent * | thisAgent, |
test * | t, | ||
Bool | is_id_field, | ||
tc_number | bound_vars_tc_number, | ||
saved_test * | tests_to_restore, | ||
bool | neg | ||
) |
Definition at line 342 of file reorder.cpp.
References add_new_test_to_test_if_not_already_there(), complex_test_from_test(), complex_test_struct::data, DISJUNCTION_TEST, FALSE, GOAL_ID_TEST, IMPASSE_ID_TEST, saved_test_struct::next, NIL, complex_test_struct::test_info_union::referent, reverse_direction_of_relational_test(), agent_struct::saved_test_pool, symbol_is_constant_or_marked_variable(), symbol_remove_ref(), test_includes_equality_test_for_symbol(), saved_test_struct::the_test, TRUE, complex_test_struct::type, and saved_test_struct::var.
Referenced by restore_and_deallocate_saved_tests().
Definition at line 323 of file reorder.cpp.
References abort_with_fatal_error(), BUFFER_MSG_SIZE, GREATER_OR_EQUAL_TEST, GREATER_TEST, LESS_OR_EQUAL_TEST, LESS_TEST, NOT_EQUAL_TEST, and SAME_TYPE_TEST.
Referenced by restore_saved_tests_to_test().
saved_test* simplify_condition_list | ( | agent * | thisAgent, |
condition * | conds_list | ||
) |
Definition at line 303 of file reorder.cpp.
References three_field_tests_struct::attr_test, CONJUNCTIVE_NEGATION_CONDITION, condition_struct::data, three_field_tests_struct::id_test, condition_struct::next, NIL, POSITIVE_CONDITION, simplify_test(), condition_struct::condition_main_data_union::tests, condition_struct::type, and three_field_tests_struct::value_test.
Referenced by reorder_condition_list().
saved_test* simplify_test | ( | agent * | thisAgent, |
test * | t, | ||
saved_test * | old_sts | ||
) |
Definition at line 223 of file reorder.cpp.
References allocate_cons(), complex_test_from_test(), complex_test_struct::test_info_union::conjunct_list, CONJUNCTIVE_TEST, complex_test_struct::data, cons_struct::first, free_cons(), generate_new_variable(), make_equality_test_without_adding_reference(), saved_test_struct::next, NIL, referent_of_equality_test(), cons_struct::rest, agent_struct::saved_test_pool, symbol_add_ref(), test_is_blank_or_equality_test(), test_is_blank_test(), saved_test_struct::the_test, complex_test_struct::type, and saved_test_struct::var.
Referenced by simplify_condition_list().
Definition at line 53 of file reorder.cpp.
References common, and VARIABLE_SYMBOL_TYPE.
Referenced by cost_of_adding_condition(), restore_saved_tests_to_test(), and test_covered_by_bound_vars().
Definition at line 679 of file reorder.cpp.
References complex_test_from_test(), complex_test_struct::test_info_union::conjunct_list, CONJUNCTIVE_TEST, complex_test_struct::data, FALSE, cons_struct::first, member_of_list(), NIL, referent_of_equality_test(), cons_struct::rest, symbol_is_constant_or_marked_variable(), test_is_blank_or_equality_test(), test_is_blank_test(), TRUE, and complex_test_struct::type.
Referenced by cost_of_adding_condition().
Definition at line 1010 of file reorder.cpp.
References complex_test_from_test(), complex_test_struct::test_info_union::conjunct_list, CONJUNCTIVE_TEST, complex_test_struct::data, DISJUNCTION_TEST, FALSE, cons_struct::first, GOAL_ID_TEST, IMPASSE_ID_TEST, member_of_list(), NIL, complex_test_struct::test_info_union::referent, referent_of_equality_test(), cons_struct::rest, test_is_blank_or_equality_test(), test_is_blank_test(), TRUE, complex_test_struct::type, and VARIABLE_SYMBOL_TYPE.
Referenced by remove_isa_state_tests_for_non_roots().