Soar Kernel
9.3.2 08-06-12
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
src
instantiations.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
/* instantiations.h */
7
8
#ifndef INSTANTIATIONS_H
9
#define INSTANTIATIONS_H
10
11
#ifdef __cplusplus
12
//extern "C"
13
//{
14
#endif
15
16
/* -------------------------------------------------------------------
17
Instantiations and Nots
18
19
Instantiations record three main things:
20
(1) the instantiated LHS of the production,
21
(2) any "<>" tests that are between identifiers and that occur in
22
top-level positive conditions on the LHS, and
23
(3) the still-existing preferences that were generated by the RHS.
24
25
Fields in an instantiation:
26
27
prod: points to the production. (Note: this can also be NIL, for
28
fake instantiations used for goal ^item augmentations. See decide.c.)
29
30
next, prev: used for a doubly-linked list of instantiations of this
31
production that are still in the match set.
32
33
rete_token, rete_wme: these fields are reserved for use by the Rete.
34
(The Rete needs them to find the proper instantiation to retract
35
when a token is delted from a p_node.)
36
37
top_of_instantiated_conditions, bottom_of_instantiated_conditions:
38
point to the top and bottom of the instantiated LHS conditions.
39
40
nots: header of a singly-linked list of Nots from the LHS.
41
42
preferences_generated: header for a doubly-linked list of existing
43
preferences that were created by this instantiation.
44
45
match_goal: points to the match goal of the instantiation, or NIL
46
if there is none.
47
48
match_goal_level: goal stack level of the match goal, or
49
ATTRIBUTE_IMPASSE_LEVEL if there is no match goal.
50
51
reliable: false iff instantiation is a justification whose
52
backtrace either:
53
54
- tests ^quiescence t, or
55
- contains a local negated condition and learn -N is set, or
56
- goes through an unreliable justification
57
58
Intuitively, a justification is unreliable if its creation is
59
not guaranteed by the state of production and working memory
60
61
in_ms: TRUE iff this instantiation is still in the match set (i.e.,
62
Rete-supported).
63
backtrace_number: used by the chunker to avoid backtracing through
64
the same instantiation twice during the building of the same chunk.
65
66
GDS_evaluated_already: Most productions produce several actions.
67
When we compute the goal-dependency-set (gds) gds for one wme of an
68
instantiation, there's no point in redoing the work for a second wme
69
from the same instantiation since the gds will be the same. By
70
testing this flag, we avoid duplicating this work. The value is set
71
to FALSE whenever an instantiation is created.
72
73
Reference counts on instantiations:
74
+1 if it's in the match set
75
+1 for each preference it created that's still around
76
The reference count is kept implicitly using the preferences_generated
77
and in_ms fields. We deallocate an instantiation if its reference count
78
goes to 0.
79
------------------------------------------------------------------- */
80
81
typedef
char
Bool
;
82
83
struct
not_struct
{
84
struct
not_struct
*
next
;
/* next Not in the singly-linked list */
85
Symbol
*
s1
;
/* the two identifiers constrained to be "<>" */
86
Symbol
*
s2
;
87
};
88
89
typedef
struct
instantiation_struct
{
90
struct
production_struct
*
prod
;
/* used full name of struct because
91
a forward declaration is needed -ajc (5/1/02) */
92
struct
instantiation_struct
*
next
, *
prev
;
/* dll of inst's from same prod */
93
struct
token_struct
*
rete_token
;
/* used by Rete for retractions */
94
wme
*
rete_wme
;
/* ditto */
95
condition
*
top_of_instantiated_conditions
;
96
condition
*
bottom_of_instantiated_conditions
;
97
not_struct
*
nots
;
98
preference
*
preferences_generated
;
/* header for dll of prefs */
99
Symbol
*
match_goal
;
/* symbol, or NIL if none */
100
goal_stack_level
match_goal_level
;
/* level, or ATTRIBUTE_IMPASSE_LEVEL */
101
bool
reliable
;
102
Bool
in_ms
;
/* TRUE iff this inst. is still in the match set */
103
tc_number
backtrace_number
;
104
Bool
GDS_evaluated_already
;
105
}
instantiation
;
106
107
/* REW: begin 09.15.96 */
108
/* A dll of instantiations that will be used to determine the gds through
109
a backtracing-style procedure, evaluate_gds in decide.cpp */
110
111
typedef
struct
pi_struct
{
112
struct
pi_struct
*
next
, *
prev
;
113
instantiation
*
inst
;
114
}
parent_inst
;
115
/* REW: end 09.15.96 */
116
117
#ifdef __cplusplus
118
//}
119
#endif
120
121
#endif
Generated on Mon Aug 6 2012 17:21:02 for Soar Kernel by
1.8.1.2