Soar Kernel  9.3.2 08-06-12
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
decide.h
Go to the documentation of this file.
1 /*************************************************************************
2  * PLEASE SEE THE FILE "license.txt" (INCLUDED WITH THIS SOFTWARE PACKAGE)
3  * FOR LICENSE AND COPYRIGHT INFORMATION.
4  *************************************************************************/
5 
6 /* =======================================================================
7  decide.h
8 
9  Decide.cpp contains the decider as well as routine for managing working
10  memory, preference memory, slots, and the garbage collection of
11  disconnected WMEs.
12 
13  Whenever a link is added from one identifier to another (i.e.,
14  (I37 ^x R26)), we call post_link_addition(). This records the link
15  addition and buffers it for later processing. Similarly, whenever a
16  link is removed, we call post_link_removal(), which buffers the
17  removal for later processing. At the end of the phase, we call
18  do_buffered_link_changes() to update the goal stack level of all
19  identifiers, and garbage collect anything that's now disconnected.
20 
21  Whenever some acceptable or require preference for a context slot
22  changes, we call mark_context_slot_as_acceptable_preference_changed().
23 
24  see decide.cpp for more information in the comments.
25 ======================================================================= */
26 
27 #ifndef DECIDE_H
28 #define DECIDE_H
29 
30 #ifdef __cplusplus
31 //extern "C"
32 //{
33 #endif
34 
35 typedef char Bool;
36 typedef unsigned char byte;
37 typedef union symbol_union Symbol;
38 typedef struct wme_struct wme;
39 typedef struct slot_struct slot;
42 typedef struct agent_struct agent;
43 
44 extern void post_link_addition (agent* thisAgent, Symbol *from, Symbol *to);
45 extern void post_link_removal (agent* thisAgent, Symbol *from, Symbol *to);
46 
48 
50 void post_link_addition (agent* thisAgent, Symbol *from, Symbol *to);
51 void post_link_removal (agent* thisAgent, Symbol *from, Symbol *to);
52 
53 /* REW: begin 09.15.96 additions for Soar8 architecture */
54 void elaborate_gds (agent* thisAgent);
55 void gds_invalid_so_remove_goal (agent* thisAgent, wme *w);
56 void free_parent_list(agent* thisAgent);
57 void uniquely_add_to_head_of_dll(agent* thisAgent, instantiation *inst);
58 void create_gds_for_goal( agent* thisAgent, Symbol *goal );
59 extern void remove_operator_if_necessary(agent* thisAgent, slot *s, wme *w);
60 
61 extern int GDS_PrintCmd (/****ClientData****/ int clientData,
62  /****Tcl_Interp****/ void * interp,
63  int argc, char *argv[]);
64 /* REW: end 09.15.96 */
65 
66 
67 /* ---------------------------------------------------------------------
68  Top-Level Decider Routines
69 
70  Init_decider() should be called at startup time to initialize this
71  module.
72 
73  Do_buffered_wm_and_ownership_changes() does the end-of-phase processing
74  of WM changes, ownership calculations, garbage collection, etc.
75 
76  Do_working_memory_phase() and do_decision_phase() are called from
77  the top level to run those phases.
78 
79  Create_top_goal() creates the top goal in the goal stack.
80  Clear_goal_stack() wipes out the whole goal stack--this is called
81  during an init-soar.
82 
83  Print_lowest_slot_in_context_stack() is used for the watch 0 trace
84  to print the context slot that was just decided.
85 --------------------------------------------------------------------- */
86 
87 extern void remove_wmes_for_context_slot (agent* thisAgent, slot *s); /* added this prototype -ajc (5/1/02) */
88 extern void init_decider (agent* thisAgent);
89 extern void do_buffered_wm_and_ownership_changes (agent* thisAgent);
90 extern void do_working_memory_phase (agent* thisAgent);
91 extern void do_decision_phase (agent* thisAgent,bool predict = false);
92 extern void create_top_goal (agent* thisAgent);
93 extern void clear_goal_stack (agent* thisAgent);
94 extern void print_lowest_slot_in_context_stack (agent* thisAgent);
95 
96 /* These prototypes moved here from consistency.cpp -ajc (5/3/02) */
97 extern void remove_existing_context_and_descendents (agent* thisAgent, Symbol *goal);
98 extern byte type_of_existing_impasse (agent* thisAgent, Symbol *goal);
99 extern Symbol *attribute_of_existing_impasse (agent* thisAgent, Symbol *goal);
101  slot *s, preference **result_candidates);
102 
103 /* These prototypes moved here from chunk.cpp -ajc (5/3/02) */
104 extern byte type_of_existing_impasse (agent* thisAgent, Symbol *goal);
105 
106 // SBW 5/07 added prototype
107 unsigned int count_candidates(preference * candidates);
108 
109 #ifdef __cplusplus
110 //}
111 #endif
112 
113 #endif