-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPredicatesAndPropositions.cc
More file actions
180 lines (127 loc) · 3.91 KB
/
Copy pathPredicatesAndPropositions.cc
File metadata and controls
180 lines (127 loc) · 3.91 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// Copyright (c) 2008 National ICT Australia Limited (NICTA)
//
// Author: Charles Gretton (charles.gretton@nicta.com.au)
//
// Redistribution and use in source and binary forms, with or without
// modification and only for non-commercial research and educational
// purposes are permitted provided that the conditions in the
// accompanying file "licence.txt" are met.
#include "PredicatesAndPropositions.hh"
#include "PredicatesAndPropositions_templates.hh"
using namespace Planning;
ostream& operator<<(ostream& o, const SetOfConstants& soc)
{
for(SetOfConstants::const_iterator p = soc.begin()
; p != soc.end()
; p++){
o<<*p<<", ";
}
return o;
}
ostream& operator<<(ostream& o, const VariableToConstant& vtc)
{
for(VariableToConstant::const_iterator p = vtc.begin()
; p != vtc.end()
; p++){
o<<p->first<<" -> "<<p->second<<endl;
}
return o;
}
ostream& operator<<(ostream& o, const VariableToUnsignedInt& vtc)
{
for(VariableToUnsignedInt::const_iterator p = vtc.begin()
; p != vtc.end()
; p++){
o<<p->first<<" -> "<<p->second<<endl;
}
return o;
}
ostream& operator<<(ostream& o, const SetOfPredicateNames& setOfPredicateNames)
{
for(SetOfPredicateNames::const_iterator p = setOfPredicateNames.begin()
; p != setOfPredicateNames.end()
; p++){
o<<*p<<" {:} ";
}
return o;
}
uint Planning::getArity(const Arguments& arguments)
{
uint arity = 0;
for(Arguments::const_iterator argument = arguments.begin()
; argument != arguments.end()
; argument++ ){
const Variables& variables = argument->second;
arity += variables.size();
}
return arity;
}
namespace PREDICATESANDPROPOSITIONS_Nonsense
{
void foo()
{
PredicateName predicateName("some predicate name");
{
Constants constants;
Predicate<> prop(predicateName, constants);
Proposition<> pred(predicateName, constants);
SignedPredicate sProp(predicateName, constants);
SignedProposition sPred(predicateName, constants);
}
Parameters parameters;
parameters.push_back(new Constant("some constant"));
parameters.push_back(new Variable("some constant"));
Parameters constants;
constants.push_back(new Constant("some constant"));
{
Predicate<HasStringRepresentation> p1(predicateName, parameters);
}
{
Proposition<HasStringRepresentation> p1(predicateName, constants);
}
{
SignedPredicate p1(predicateName, parameters);
}
{
SignedProposition p1(predicateName, constants);
}
SignedProposition sProp(predicateName, constants);
SignedPredicate sPred(predicateName, parameters);
Predicate<Signed<HasStringRepresentation> > p(sProp);
p = SignedPredicate(sPred);
{
Predicate<> sProp(predicateName, constants);
Predicate<> _sProp;
_sProp = sProp;
}
{
SignedProposition sProp(predicateName, constants);
SignedPredicate sPred(predicateName, constants);
Predicate<> prop(predicateName, constants);
Proposition<> pred(predicateName, constants);
SignedProposition _sProp(sProp);
SignedPredicate _sPred(sProp);
Predicate<> _prop(sProp);
Proposition<> _pred(sProp);
SignedProposition __sProp(sPred);
SignedPredicate __sPred(sPred);
Predicate<> __prop(sPred);
Proposition<> __pred(sPred);
SignedProposition __sProp_(prop);
SignedPredicate __sPred_(prop);
Predicate<> __prop_(prop);
Proposition<> __pred_(prop);
SignedProposition __sProp__(pred);
SignedPredicate __sPred__(pred);
Predicate<> __prop__(pred);
Proposition<> __pred__(pred);
__pred__.hash_value();
__sProp.hash_value();
VariableToConstant variableToConstant;
sProp.ground_NoSign(variableToConstant);
sPred.ground_NoSign(variableToConstant);
prop.ground_NoSign(variableToConstant);
pred.ground_NoSign(variableToConstant);
}
}
}