1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
-- Programmed by Jedidiah Barber
-- Licensed under the Sunset License v1.0
-- See license.txt for further details
private with
Ada.Containers.Hashed_Maps,
Ada.Containers.Vectors,
Ada.Finalization;
generic
Relation : in Goal;
Within : in State;
package Kompsos.Collector is
State_Not_Found_Error : exception;
function Has_Next
return Boolean;
function Next
return State;
function Next
(Default : in State)
return State;
private
-- Interleaved Graph Inversion --
package Positive_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Positive);
subtype Disjuncts_Chosen is Positive_Vectors.Vector;
function "<"
(Left, Right : in Disjuncts_Chosen)
return Boolean;
type Parent_Arrow is record
Node : Graph_Component_Access;
Order : Disjuncts_Chosen;
end record;
function "<"
(Left, Right : in Parent_Arrow)
return Boolean;
package Parent_Arrow_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Parent_Arrow);
subtype Disjuncts_Passed is Natural;
type Node_Upwards is record
Depth : Disjuncts_Passed;
Parents : Parent_Arrow_Vectors.Vector;
end record;
package Upwards_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Node_Upwards);
package Upwards_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => Graph_Component_Access,
Element_Type => Positive,
Hash => Graph_Component_Access_Hash,
Equivalent_Keys => "=");
-- Conjunct Expansion --
type Goal_Access is access all Goal;
package Goal_Access_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Goal_Access);
-- Upwards Depth First Search --
type Breadcrumb is record
Choice_Node : Graph_Component_Access;
Option : Positive;
State_Size : Long_Natural;
end record;
package Breadcrumb_Vectors is new Ada.Containers.Vectors
(Index_Type => Positive,
Element_Type => Breadcrumb);
-- Cleanup --
type Collector_Final_Controller is new Ada.Finalization.Limited_Controlled with null record;
overriding procedure Finalize
(This : in out Collector_Final_Controller);
Cleanup : Collector_Final_Controller;
end Kompsos.Collector;
|