Debian Codegraph @

Kernel/dlCompletionTree.h

raw symbols SCIP
1 /* This file is part of the FaCT++ DL reasoner
2 Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester
3 Copyright (C) 2015-2017 Dmitry Tsarkov
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef DLCOMPLETIONTREE_H
21 #define DLCOMPLETIONTREE_Hcxx . . $ `Kernel/dlCompletionTree.h:21:9`!
22
23 #include <vector>
24
25 #include "globaldef.h"cxx . . $ `<file>/Kernel/globaldef.h`/
26 #include "dlCompletionTreeArc.h"cxx . . $ `<file>/Kernel/dlCompletionTreeArc.h`/
27 #include "tSaveList.h"cxx . . $ `<file>/Kernel/tSaveList.h`/
28 #include "tRestorer.h"cxx . . $ `<file>/Kernel/tRestorer.h`/
29 #include "CGLabel.h"cxx . . $ `<file>/Kernel/CGLabel.h`/
30 #include "logging.h"cxx . . $ `<file>/Kernel/logging.h`/
31
32 class DLDagcxx . . $ DLDag#;
33 class DlCompletionGraphcxx . . $ DlCompletionGraph#;
34
35 // use the following to control logging information about saving/restoring nodes
36 #define RKG_CHECK_BACKJUMPINGcxx . . $ `Kernel/dlCompletionTree.h:36:9`!
37
38 #if USE_LOGGINGcxx . . $ `Kernel/globaldef.h:45:10`! // don't gather statistics w/o logging
39 # define USE_BLOCKING_STATISTICS
40 #endif
41
42 #ifdef USE_BLOCKING_STATISTICS
43 extern void printBlockingStat1 ( std::ostream& o );
44 extern void clearBlockingStat1 ( void );
45 # define printBlockingStat(O) printBlockingStat1(O)
46 # define clearBlockingStat() clearBlockingStat1()
47 #else
48 # define printBlockingStatcxx . . $ `Kernel/dlCompletionTree.h:48:10`!(O) (void)NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!
49 # define clearBlockingStatcxx . . $ `Kernel/dlCompletionTree.h:49:10`!() (void)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!
50 #endif
51
52 /// level of CTree's nominal node
53 typedef unsigned short CTNominalLevelcxx . . $ CTNominalLevel#;
54 /// default level for the Blockable node
55 const CTNominalLevelcxx . . $ CTNominalLevel# BlockableLevelcxx . . $ BlockableLevel. = static_cast<CTNominalLevelcxx . . $ CTNominalLevel#>(-1);
56
57 class DlCompletionTreecxx . . $ DlCompletionTree#
58 {
59 friend class DlCompletionGraphcxx . . $ DlCompletionGraph#;
60
61 protected: // internal classes
62 /// class for saving Completion Tree nodes state
63 class SaveStatecxx . . $ DlCompletionTree#SaveState#
64 {
65 public: // members
66 /// saving status of the label
67 CGLabelcxx . . $ CGLabel#::SaveStatecxx . . $ CGLabel#SaveState# labcxx . . $ DlCompletionTree#SaveState#lab.;
68 /// curLevel of the Node structure
69 unsigned int curLevelcxx . . $ DlCompletionTree#SaveState#curLevel. = 0;
70 /// amount of neighbours
71 size_tcxx . . $ std/size_t# nNeighbourscxx . . $ DlCompletionTree#SaveState#nNeighbours. = 0;
72
73 public: // interface
74 /// get level of a saved node
75 unsigned int levelcxx . . $ DlCompletionTree#SaveState#level(ddd8539a2fcdd4ce). ( void ) const { return curLevelcxx . . $ DlCompletionTree#SaveState#curLevel.; }
76 }; // SaveState
77
78 /// restore blocked node
79 class UnBlockcxx . . $ DlCompletionTree#UnBlock#: public TRestorercxx . . $ TRestorer#
80 {
81 protected:
82 DlCompletionTreecxx . . $ DlCompletionTree#* pcxx . . $ DlCompletionTree#UnBlock#p.;
83 const DlCompletionTreecxx . . $ DlCompletionTree#* Blockercxx . . $ DlCompletionTree#UnBlock#Blocker.;
84 DepSetcxx . . $ DepSet# depcxx . . $ DlCompletionTree#UnBlock#dep.;
85 bool pBlockedcxx . . $ DlCompletionTree#UnBlock#pBlocked., dBlockedcxx . . $ DlCompletionTree#UnBlock#dBlocked.;
86 public:
87 explicit UnBlockcxx . . $ DlCompletionTree#UnBlock#UnBlock(3bf754c9a531d7e6). ( DlCompletionTreecxx . . $ DlCompletionTree#* q ) : pcxx . . $ DlCompletionTree#UnBlock#p.(q), Blockercxx . . $ DlCompletionTree#UnBlock#Blocker.(q->Blockercxx . . $ DlCompletionTree#Blocker.), depcxx . . $ DlCompletionTree#UnBlock#dep.(q->pDepcxx . . $ DlCompletionTree#pDep.), pBlockedcxx . . $ DlCompletionTree#UnBlock#pBlocked.(q->pBlockedcxx . . $ DlCompletionTree#pBlocked.), dBlockedcxx . . $ DlCompletionTree#UnBlock#dBlocked.(q->dBlockedcxx . . $ DlCompletionTree#dBlocked.) {}
88 void restorecxx . . $ DlCompletionTree#UnBlock#restore(49f6e7a06ebc5aa8). ( void ) override { pcxx . . $ DlCompletionTree#UnBlock#p.->Blockercxx . . $ DlCompletionTree#Blocker. = Blockercxx . . $ DlCompletionTree#UnBlock#Blocker.; pcxx . . $ DlCompletionTree#UnBlock#p.->pDepcxx . . $ DlCompletionTree#pDep. =cxx . . $ TDepSet#`operator=`(6a948e2ed08fa462). depcxx . . $ DlCompletionTree#UnBlock#dep.; pcxx . . $ DlCompletionTree#UnBlock#p.->pBlockedcxx . . $ DlCompletionTree#pBlocked. = pBlockedcxx . . $ DlCompletionTree#UnBlock#pBlocked.; pcxx . . $ DlCompletionTree#UnBlock#p.->dBlockedcxx . . $ DlCompletionTree#dBlocked. = dBlockedcxx . . $ DlCompletionTree#UnBlock#dBlocked.; }
89 }; // UnBlock
90
91 /// restore (un)cached node
92 class CacheRestorercxx . . $ DlCompletionTree#CacheRestorer#: public TRestorercxx . . $ TRestorer#
93 {
94 protected:
95 DlCompletionTreecxx . . $ DlCompletionTree#* pcxx . . $ DlCompletionTree#CacheRestorer#p.;
96 bool cachedcxx . . $ DlCompletionTree#CacheRestorer#cached.;
97 public:
98 explicit CacheRestorercxx . . $ DlCompletionTree#CacheRestorer#CacheRestorer(3bf754c9a531d7e6). ( DlCompletionTreecxx . . $ DlCompletionTree#* q ) : pcxx . . $ DlCompletionTree#CacheRestorer#p.(q), cachedcxx . . $ DlCompletionTree#CacheRestorer#cached.(q->cachedcxx . . $ DlCompletionTree#cached.) {}
99 void restorecxx . . $ DlCompletionTree#CacheRestorer#restore(49f6e7a06ebc5aa8). ( void ) override { pcxx . . $ DlCompletionTree#CacheRestorer#p.->cachedcxx . . $ DlCompletionTree#cached. = cachedcxx . . $ DlCompletionTree#CacheRestorer#cached.; }
100 }; // CacheRestorer
101
102 #ifdef RKG_IR_IN_NODE_LABELcxx . . $ `Kernel/globaldef.h:69:9`!
103 /// restore node after IR set change
104 class IRRestorercxx . . $ DlCompletionTree#IRRestorer#: public TRestorercxx . . $ TRestorer#
105 {
106 protected:
107 DlCompletionTreecxx . . $ DlCompletionTree#* pcxx . . $ DlCompletionTree#IRRestorer#p.;
108 size_tcxx . . $ std/size_t# ncxx . . $ DlCompletionTree#IRRestorer#n.;
109 public:
110 explicit IRRestorercxx . . $ DlCompletionTree#IRRestorer#IRRestorer(3bf754c9a531d7e6). ( DlCompletionTreecxx . . $ DlCompletionTree#* q ) : pcxx . . $ DlCompletionTree#IRRestorer#p.(q), ncxx . . $ DlCompletionTree#IRRestorer#n.(q->IRcxx . . $ DlCompletionTree#IR..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).()) {}
111 void restorecxx . . $ DlCompletionTree#IRRestorer#restore(49f6e7a06ebc5aa8). ( void ) override { pcxx . . $ DlCompletionTree#IRRestorer#p.->IRcxx . . $ DlCompletionTree#IR..resizecxx . . $ std/vector#resize(2c44cd906ae4e829).(ncxx . . $ DlCompletionTree#IRRestorer#n.); }
112 }; // IRRestorer
113 #endif
114
115 public: // type interface
116 /// type for set of arcs
117 typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<DlCompletionTreeArccxx . . $ DlCompletionTreeArc#*> ArcCollectioncxx . . $ DlCompletionTree#ArcCollection#;
118
119 /// iterator on edges
120 typedef ArcCollectioncxx . . $ DlCompletionTree#ArcCollection#::iteratorcxx . . $ std/vector#iterator# edge_iteratorcxx . . $ DlCompletionTree#edge_iterator#;
121 /// const iterator on edges
122 typedef ArcCollectioncxx . . $ DlCompletionTree#ArcCollection#::const_iteratorcxx . . $ std/vector#const_iterator# const_edge_iteratorcxx . . $ DlCompletionTree#const_edge_iterator#;
123
124 /// RO iterator on label
125 typedef CGLabelcxx . . $ CGLabel#::const_iteratorcxx . . $ CGLabel#const_iterator# const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator#;
126
127 #ifdef RKG_IR_IN_NODE_LABELcxx . . $ `Kernel/globaldef.h:69:9`!
128 /// type for inequality relation information
129 typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<ConceptWDepcxx . . $ ConceptWDep#> IRInfocxx . . $ DlCompletionTree#IRInfo#;
130 #endif
131
132 protected: // members
133 /// label of a node
134 CGLabelcxx . . $ CGLabel# Labelcxx . . $ DlCompletionTree#Label.;
135 #ifdef RKG_IR_IN_NODE_LABELcxx . . $ `Kernel/globaldef.h:69:9`!
136 /// inequality relation information respecting current node
137 IRInfocxx . . $ DlCompletionTree#IRInfo# IRcxx . . $ DlCompletionTree#IR.;
138 #endif
139 /// Neighbours information
140 ArcCollectioncxx . . $ DlCompletionTree#ArcCollection# Neighbourcxx . . $ DlCompletionTree#Neighbour.;
141 /// pointer to last saved node
142 TSaveListcxx . . $ TSaveList#<SaveStatecxx . . $ DlCompletionTree#SaveState#> savescxx . . $ DlCompletionTree#saves.;
143 /// ID of node (used in print)
144 unsigned int idcxx . . $ DlCompletionTree#id. = 0;
145 /// concept that init the newly created node
146 BipolarPointercxx . . $ BipolarPointer# Initcxx . . $ DlCompletionTree#Init. = bpINVALIDcxx . . $ bpINVALID.;
147
148 /// blocker of a node
149 const DlCompletionTreecxx . . $ DlCompletionTree#* Blockercxx . . $ DlCompletionTree#Blocker. = nullptr;
150 /// dep-set for Purge op
151 DepSetcxx . . $ DepSet# pDepcxx . . $ DlCompletionTree#pDep.;
152
153 // save state information
154 unsigned int curLevelcxx . . $ DlCompletionTree#curLevel. = 0; // current level
155 /// level of a nominal node; 0 means blockable one
156 CTNominalLevelcxx . . $ CTNominalLevel# nominalLevelcxx . . $ DlCompletionTree#nominalLevel.;
157
158 /// is given node a data node
159 bool flagDataNodecxx . . $ DlCompletionTree#flagDataNode. : 1;
160 /// flag if node is Cached
161 bool cachedcxx . . $ DlCompletionTree#cached. : 1;
162 /// flag whether node is permanently/temporarily blocked
163 bool pBlockedcxx . . $ DlCompletionTree#pBlocked. : 1;
164 /// flag whether node is directly/indirectly blocked
165 bool dBlockedcxx . . $ DlCompletionTree#dBlocked. : 1;
166 /** Whether node is affected by change of some potential blocker.
167 This flag may be viewed as a cache for a 'blocked' status
168 */
169 bool affectedcxx . . $ DlCompletionTree#affected. : 1;
170
171 protected: // methods
172
173 //----------------------------------------------
174 // blocking support methods
175 //----------------------------------------------
176
177 // sub-methods for optimal blocking
178
179 /// check B1 and B2 from optimal blocking for given blocker candidate
180 bool isCommonlyBlockedBycxx . . $ DlCompletionTree#isCommonlyBlockedBy(f6b0d2269aa74b81). ( const DLDagcxx . . $ DLDag#& dag, const DlCompletionTreecxx . . $ DlCompletionTree#* p ) const;
181 /// check B3 and B4 from optimal blocking for given blocker candidate
182 bool isABlockedBycxx . . $ DlCompletionTree#isABlockedBy(f6b0d2269aa74b81). ( const DLDagcxx . . $ DLDag#& dag, const DlCompletionTreecxx . . $ DlCompletionTree#* p ) const;
183 /// check B5 and B6 from optimal blocking for given blocker candidate
184 bool isCBlockedBycxx . . $ DlCompletionTree#isCBlockedBy(f6b0d2269aa74b81). ( const DLDagcxx . . $ DLDag#& dag, const DlCompletionTreecxx . . $ DlCompletionTree#* p ) const;
185
186 // checking the blocking conditions for optimized blocking
187
188 /// check if B1 holds for a given vertex (p is a candidate for blocker)
189 bool B1cxx . . $ DlCompletionTree#B1(e2c3b6f64f9879b7). ( const DlCompletionTreecxx . . $ DlCompletionTree#* p ) const;
190 /// check if B2 holds for (AS C) with transitions RST from A[0] using a simple automaton A for S
191 bool B2Simplecxx . . $ DlCompletionTree#B2Simple(f5432516a9e7ed0a). ( const RAStateTransitionscxx . . $ RAStateTransitions#& RST, BipolarPointercxx . . $ BipolarPointer# C ) const;
192 /// check if B2 holds for C=(AS{n} X) with transitions RST from A[n] using a complex automaton A for S
193 bool B2Complexcxx . . $ DlCompletionTree#B2Complex(f5432516a9e7ed0a). ( const RAStateTransitionscxx . . $ RAStateTransitions#& RST, BipolarPointercxx . . $ BipolarPointer# C ) const;
194 /// check if B2 holds for given DL vertex with C=V
195 bool B2cxx . . $ DlCompletionTree#B2(7b1f20b7aec1dd78). ( const DLVertexcxx . . $ DLVertex#& v, BipolarPointercxx . . $ BipolarPointer# C ) const
196 {
197 # ifdef ENABLE_CHECKING
198 fpp_assert ( hasParent() ); // safety
199 # endif
200 const RAStateTransitionscxx . . $ RAStateTransitions#& RST = v.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).()->getAutomatoncxx . . $ TRole#getAutomaton(63b0d77ccf579a4).()[cxx . . $ RoleAutomaton#`operator[]`(49d1c2a99a57610b).v.getStatecxx . . $ DLVertex#getState(ddd8539a2fcdd4ce).()];
201 if ( v.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).()->isSimplecxx . . $ TRole#isSimple(50ce9a9e25b4a850).() )
202 return B2Simplecxx . . $ DlCompletionTree#B2Simple(f5432516a9e7ed0a). ( RST, v.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).() );
203 else
204 {
205 if ( RST.emptycxx . . $ RAStateTransitions#empty(50ce9a9e25b4a850).() ) // no possible applications
206 return true;
207 // pointer to current forall
208 BipolarPointercxx . . $ BipolarPointer# bp = C - (BipolarPointercxx . . $ BipolarPointer#)v.getStatecxx . . $ DLVertex#getState(ddd8539a2fcdd4ce).();
209 if ( RST.isSingletoncxx . . $ RAStateTransitions#isSingleton(50ce9a9e25b4a850).() )
210 return B2Simplecxx . . $ DlCompletionTree#B2Simple(f5432516a9e7ed0a). ( RST, bp + (BipolarPointercxx . . $ BipolarPointer#)RST.getTransitionEndcxx . . $ RAStateTransitions#getTransitionEnd(ddd8539a2fcdd4ce).() );
211 return B2Complexcxx . . $ DlCompletionTree#B2Complex(f5432516a9e7ed0a). ( RST, bp );
212 }
213 }
214 /// check if B3 holds for (<= n S.C)\in w' (p is a candidate for blocker)
215 bool B3cxx . . $ DlCompletionTree#B3(443f159c0c2bf13b). ( const DlCompletionTreecxx . . $ DlCompletionTree#* p, unsigned int n, const TRolecxx . . $ TRole#* S, BipolarPointercxx . . $ BipolarPointer# C ) const;
216 /// check if B4 holds for (>= m T.E)\in w' (p is a candidate for blocker)
217 bool B4cxx . . $ DlCompletionTree#B4(443f159c0c2bf13b). ( const DlCompletionTreecxx . . $ DlCompletionTree#* p, unsigned int m, const TRolecxx . . $ TRole#* T, BipolarPointercxx . . $ BipolarPointer# E ) const;
218 /// check if B5 holds for (<= n T.E)\in w'
219 bool B5cxx . . $ DlCompletionTree#B5(e3f7d912c5a8ce7d). ( const TRolecxx . . $ TRole#* T, BipolarPointercxx . . $ BipolarPointer# E ) const;
220 /// check if B6 holds for (>= m U.F)\in v
221 bool B6cxx . . $ DlCompletionTree#B6(e3f7d912c5a8ce7d). ( const TRolecxx . . $ TRole#* U, BipolarPointercxx . . $ BipolarPointer# F ) const;
222
223 //----------------------------------------------
224 // re-building blocking hierarchy
225 //----------------------------------------------
226
227 /// check whether a node can block another one with init concept C
228 bool canBlockInitcxx . . $ DlCompletionTree#canBlockInit(4a668f6de69bf818). ( BipolarPointercxx . . $ BipolarPointer# C ) const { return C == bpTOPcxx . . $ bpTOP. || labelcxx . . $ DlCompletionTree#label(fdeef9563491d77a).().containscxx . . $ CGLabel#contains(4a668f6de69bf818).(C); }
229 /// check if all parent arcs are blocked
230 bool isParentArcIBlockedcxx . . $ DlCompletionTree#isParentArcIBlocked(50ce9a9e25b4a850). ( void ) const
231 {
232 for ( const DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* edge : *this )
233 if ( edge->isPredEdgecxx . . $ DlCompletionTreeArc#isPredEdge(50ce9a9e25b4a850).() && !edge->isIBlockedcxx . . $ DlCompletionTreeArc#isIBlocked(50ce9a9e25b4a850).() )
234 return false;
235 return true;
236 }
237
238 //----------------------------------------------
239 // Transitive SOME support interface
240 //----------------------------------------------
241
242 /// check if SOME rule is applicable for transitive R
243 const DlCompletionTreecxx . . $ DlCompletionTree#* isTSomeApplicablecxx . . $ DlCompletionTree#isTSomeApplicable(36354e590de20f49). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ) const;
244 /// check if SOME rule is applicable for non-transitive R
245 const DlCompletionTreecxx . . $ DlCompletionTree#* isNSomeApplicablecxx . . $ DlCompletionTree#isNSomeApplicable(36354e590de20f49). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ) const;
246 /// check if transitive R-successor labelled with C
247 const DlCompletionTreecxx . . $ DlCompletionTree#* isTSuccLabelledcxx . . $ DlCompletionTree#isTSuccLabelled(36354e590de20f49). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ) const;
248 /// check if transitive R-predecessor labelled with C; skip FROM node
249 const DlCompletionTreecxx . . $ DlCompletionTree#* isTPredLabelledcxx . . $ DlCompletionTree#isTPredLabelled(f31e00b7016a43da). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C, const DlCompletionTreecxx . . $ DlCompletionTree#* from ) const;
250
251 //----------------------------------------------
252 // inequality relation methods
253 //----------------------------------------------
254
255 /// check if the current node is in IR wrt C; if so, write the clash-set to DEP
256 bool inIRwithCcxx . . $ DlCompletionTree#inIRwithC(cacefedd615bba0c). ( const ConceptWDepcxx . . $ ConceptWDep#& C, DepSetcxx . . $ DepSet#& dep ) const;
257
258 //----------------------------------------------
259 // saving/restoring
260 //----------------------------------------------
261
262 /// get current save-level
263 unsigned int getCurLevelcxx . . $ DlCompletionTree#getCurLevel(ddd8539a2fcdd4ce). ( void ) const { return curLevelcxx . . $ DlCompletionTree#curLevel.; }
264 /// save current state to given SS
265 void savecxx . . $ DlCompletionTree#save(9a922c1c7ac46c1a). ( SaveStatecxx . . $ DlCompletionTree#SaveState#* nss ) const;
266 /// restore state from given SS; delete SS after
267 void restorecxx . . $ DlCompletionTree#restore(4fcc177ae5126665). ( SaveStatecxx . . $ DlCompletionTree#SaveState#* nss );
268
269 //----------------------------------------------
270 // logging/output
271 //----------------------------------------------
272
273 /// log saving/restoring node
274 void logSRNodecxx . . $ DlCompletionTree#logSRNode(acfedb98bf840c77). ( const char* action ATTR_UNUSEDcxx . . $ `Kernel/globaldef.h:27:10`! ) const
275 {
276 # if defined(RKG_CHECK_BACKJUMPINGcxx . . $ `Kernel/dlCompletionTree.h:36:9`!)
277 if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llSRInfocxx . . $ llSRInfo.) )
278 LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). action <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "(" <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). idcxx . . $ DlCompletionTree#id. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[" <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). Neighbourcxx . . $ DlCompletionTree#Neighbour..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]," <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). getCurLevelcxx . . $ DlCompletionTree#getCurLevel(ddd8539a2fcdd4ce).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")";
279 # undef RKG_CHECK_BACKJUMPINGcxx . . $ `Kernel/dlCompletionTree.h:36:9`! // it is the only user
280 # endif
281 }
282 /// get letter corresponding to the blocking mode
283 const char* getBlockingStatusNamecxx . . $ DlCompletionTree#getBlockingStatusName(a9f41ea0e82d88cf). ( void ) const { return isPBlockedcxx . . $ DlCompletionTree#isPBlocked(50ce9a9e25b4a850).() ? "p" : isDBlockedcxx . . $ DlCompletionTree#isDBlocked(50ce9a9e25b4a850).() ? "d" : isIBlockedcxx . . $ DlCompletionTree#isIBlocked(50ce9a9e25b4a850).() ? "i" : "u"; }
284 /// log node status (d-,i-,p-blocked or cached
285 void logNodeBStatuscxx . . $ DlCompletionTree#logNodeBStatus(490063bd7e6d8d5d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const
286 {
287 // blocking status information
288 if ( Blockercxx . . $ DlCompletionTree#Blocker. )
289 o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). getBlockingStatusNamecxx . . $ DlCompletionTree#getBlockingStatusName(a9f41ea0e82d88cf).() <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). Blockercxx . . $ DlCompletionTree#Blocker.->getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).();
290 if ( isCachedcxx . . $ DlCompletionTree#isCached(50ce9a9e25b4a850).() )
291 o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "c";
292 }
293 /// log if node became p-blocked
294 void logNodeBlockedcxx . . $ DlCompletionTree#logNodeBlocked(83f5f38750778ac8). ( void ) const
295 {
296 if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) )
297 {
298 LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). getBlockingStatusNamecxx . . $ DlCompletionTree#getBlockingStatusName(a9f41ea0e82d88cf).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "b(" <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). idcxx . . $ DlCompletionTree#id.;
299 if ( Blockercxx . . $ DlCompletionTree#Blocker. )
300 LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). Blockercxx . . $ DlCompletionTree#Blocker.->idcxx . . $ DlCompletionTree#id.;
301 LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")";
302 }
303 }
304
305 public: // methods
306 /// init newly created node with starting LEVEL
307 void initcxx . . $ DlCompletionTree#init(cb2f890c2fdad230). ( unsigned int level );
308 /// c'tor: create an empty node
309 explicit DlCompletionTreecxx . . $ DlCompletionTree#DlCompletionTree(cb2f890c2fdad230). ( unsigned int newId ) : idcxx . . $ DlCompletionTree#id.(newId) {}
310 /// no copy c'tor
311 DlCompletionTreecxx . . $ DlCompletionTree#DlCompletionTree(da55984cfb6eaacc). ( const DlCompletionTreecxx . . $ DlCompletionTree#& ) = delete;
312 /// no assignment
313 DlCompletionTreecxx . . $ DlCompletionTree#& operatorcxx . . $ DlCompletionTree#`operator=`(7df90ee59f153ff2). = ( const DlCompletionTreecxx . . $ DlCompletionTree#& ) = delete;
314 /// d'tor: delete node
315 ~cxx . . $ DlCompletionTree#`~DlCompletionTree`(49f6e7a06ebc5aa8).DlCompletionTreecxx . . $ DlCompletionTree#() { savescxx . . $ DlCompletionTree#saves..clearcxx . . $ TSaveList#clear(49f6e7a06ebc5aa8).(); }
316
317 /// add given arc P as a neighbour
318 void addNeighbourcxx . . $ DlCompletionTree#addNeighbour(7cce2cce5bd28a53). ( DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* p ) { Neighbourcxx . . $ DlCompletionTree#Neighbour..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(p); }
319
320 /// get Node's id
321 unsigned int getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce). ( void ) const { return idcxx . . $ DlCompletionTree#id.; }
322 /// check if the node is cached (IE need not to be expanded)
323 bool isCachedcxx . . $ DlCompletionTree#isCached(50ce9a9e25b4a850). ( void ) const { return cachedcxx . . $ DlCompletionTree#cached.; }
324 /// set cached status of given node
325 TRestorercxx . . $ TRestorer#* setCachedcxx . . $ DlCompletionTree#setCached(174567ded8c58c70). ( bool val )
326 {
327 if ( cachedcxx . . $ DlCompletionTree#cached. == val )
328 return nullptr;
329 TRestorercxx . . $ TRestorer#* ret = new CacheRestorercxx . . $ DlCompletionTree#CacheRestorer#CacheRestorer(3bf754c9a531d7e6).(this);
330 cachedcxx . . $ DlCompletionTree#cached. = val;
331 return ret;
332 }
333
334 // data node methods
335
336 bool isDataNodecxx . . $ DlCompletionTree#isDataNode(50ce9a9e25b4a850). ( void ) const { return flagDataNodecxx . . $ DlCompletionTree#flagDataNode.; }
337 void setDataNodecxx . . $ DlCompletionTree#setDataNode(49f6e7a06ebc5aa8). ( void ) { flagDataNodecxx . . $ DlCompletionTree#flagDataNode. = true; }
338
339 // nominal node methods
340
341 bool isBlockableNodecxx . . $ DlCompletionTree#isBlockableNode(50ce9a9e25b4a850). ( void ) const { return nominalLevelcxx . . $ DlCompletionTree#nominalLevel. == BlockableLevelcxx . . $ BlockableLevel.; }
342 bool isNominalNodecxx . . $ DlCompletionTree#isNominalNode(50ce9a9e25b4a850). ( void ) const { return nominalLevelcxx . . $ DlCompletionTree#nominalLevel. != BlockableLevelcxx . . $ BlockableLevel.; }
343 bool isNominalNodecxx . . $ DlCompletionTree#isNominalNode(897f8267d825a106). ( CTNominalLevelcxx . . $ CTNominalLevel# level ) const { return nominalLevelcxx . . $ DlCompletionTree#nominalLevel. == level; }
344 void setNominalLevelcxx . . $ DlCompletionTree#setNominalLevel(49f6e7a06ebc5aa8). ( void ) { nominalLevelcxx . . $ DlCompletionTree#nominalLevel. = 0; }
345 void setNominalLevelcxx . . $ DlCompletionTree#setNominalLevel(ed53e3bbd3fa2f69). ( CTNominalLevelcxx . . $ CTNominalLevel# newLevel ) { nominalLevelcxx . . $ DlCompletionTree#nominalLevel. = newLevel; }
346 CTNominalLevelcxx . . $ CTNominalLevel# getNominalLevelcxx . . $ DlCompletionTree#getNominalLevel(72085aa11f4b6e09). ( void ) const { return nominalLevelcxx . . $ DlCompletionTree#nominalLevel.; }
347
348 /// compare 2 CT nodes wrt their nominal level/status
349 bool operatorcxx . . $ DlCompletionTree#`operator<`(306fae7647cf32c9). < ( const DlCompletionTreecxx . . $ DlCompletionTree#& node ) const
350 {
351 return ( getNominalLevelcxx . . $ DlCompletionTree#getNominalLevel(72085aa11f4b6e09).() < node.getNominalLevelcxx . . $ DlCompletionTree#getNominalLevel(72085aa11f4b6e09).() ) ||
352 ( ( getNominalLevelcxx . . $ DlCompletionTree#getNominalLevel(72085aa11f4b6e09).() == node.getNominalLevelcxx . . $ DlCompletionTree#getNominalLevel(72085aa11f4b6e09).() ) &&
353 ( getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).() < node.getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).() ) );
354 }
355
356 /// adds concept P to a label, defined by TAG; update blocked status if necessary
357 void addConceptcxx . . $ DlCompletionTree#addConcept(65b796d27884e484). ( const ConceptWDepcxx . . $ ConceptWDep#& p, bool isComplex ) { Labelcxx . . $ DlCompletionTree#Label..getLabelcxx . . $ CGLabel#getLabel(ad96fabd6ffb3e80).(isComplex).addcxx . . $ CWDArray#add(ae2a9648ed5e6860).(p); }
358 /// set the Init concept
359 void setInitcxx . . $ DlCompletionTree#setInit(d4f767463ce0a6b3). ( BipolarPointercxx . . $ BipolarPointer# p ) { Initcxx . . $ DlCompletionTree#Init. = p; }
360 BipolarPointercxx . . $ BipolarPointer# getInitcxx . . $ DlCompletionTree#getInit(b126dc7c1de90089).() { return Initcxx . . $ DlCompletionTree#Init.; }
361
362 //----------------------------------------------
363 // children/parent access interface
364 //----------------------------------------------
365
366 // neighbour iterators
367 const_edge_iteratorcxx . . $ DlCompletionTree#const_edge_iterator# begincxx . . $ DlCompletionTree#begin(d3473f034184ffc9). ( void ) const { return Neighbourcxx . . $ DlCompletionTree#Neighbour..begincxx . . $ std/vector#begin(359ca5030082c9f).(); }
368 const_edge_iteratorcxx . . $ DlCompletionTree#const_edge_iterator# endcxx . . $ DlCompletionTree#end(d3473f034184ffc9). ( void ) const { return Neighbourcxx . . $ DlCompletionTree#Neighbour..endcxx . . $ std/vector#end(359ca5030082c9f).(); }
369 edge_iteratorcxx . . $ DlCompletionTree#edge_iterator# begincxx . . $ DlCompletionTree#begin(de7d1c517ae77062). ( void ) { return Neighbourcxx . . $ DlCompletionTree#Neighbour..begincxx . . $ std/vector#begin(33b10a496a38335b).(); }
370 edge_iteratorcxx . . $ DlCompletionTree#edge_iterator# endcxx . . $ DlCompletionTree#end(de7d1c517ae77062). ( void ) { return Neighbourcxx . . $ DlCompletionTree#Neighbour..endcxx . . $ std/vector#end(33b10a496a38335b).(); }
371
372 /// return true if node is a non-root; works for reflexive roles
373 bool hasParentcxx . . $ DlCompletionTree#hasParent(50ce9a9e25b4a850). ( void ) const
374 {
375 if ( Neighbourcxx . . $ DlCompletionTree#Neighbour..emptycxx . . $ std/vector#empty(50ce9a9e25b4a850).() )
376 return false;
377 return (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).begincxx . . $ DlCompletionTree#begin(d3473f034184ffc9).())->isPredEdgecxx . . $ DlCompletionTreeArc#isPredEdge(50ce9a9e25b4a850).();
378 }
379
380 //----------------------------------------------
381 // Transitive SOME support interface
382 //----------------------------------------------
383
384 /// check if SOME rule is applicable; includes transitive SOME support
385 const DlCompletionTreecxx . . $ DlCompletionTree#* isSomeApplicablecxx . . $ DlCompletionTree#isSomeApplicable(36354e590de20f49). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ) const
386 { return R->isTransitivecxx . . $ TRole#isTransitive(50ce9a9e25b4a850).() ? isTSomeApplicablecxx . . $ DlCompletionTree#isTSomeApplicable(36354e590de20f49).(R,C) : isNSomeApplicablecxx . . $ DlCompletionTree#isNSomeApplicable(36354e590de20f49).(R,C); }
387
388 //----------------------------------------------
389 // Label access interface
390 //----------------------------------------------
391
392 /// RO access to a label
393 const CGLabelcxx . . $ CGLabel#& labelcxx . . $ DlCompletionTree#label(fdeef9563491d77a). ( void ) const { return Labelcxx . . $ DlCompletionTree#Label.; }
394 /// RW access to a label
395 CGLabelcxx . . $ CGLabel#& labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657). ( void ) { return Labelcxx . . $ DlCompletionTree#Label.; }
396
397 // label iterators
398
399 /// begin() iterator for a label with simple concepts
400 const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator# beginl_sccxx . . $ DlCompletionTree#beginl_sc(e55d760a93e9f197). ( void ) const { return Labelcxx . . $ DlCompletionTree#Label..begin_sccxx . . $ CGLabel#begin_sc(e55d760a93e9f197).(); }
401 /// end() iterator for a label with simple concepts
402 const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator# endl_sccxx . . $ DlCompletionTree#endl_sc(e55d760a93e9f197). ( void ) const { return Labelcxx . . $ DlCompletionTree#Label..end_sccxx . . $ CGLabel#end_sc(e55d760a93e9f197).(); }
403 /// begin() iterator for a label with complex concepts
404 const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator# beginl_cccxx . . $ DlCompletionTree#beginl_cc(e55d760a93e9f197). ( void ) const { return Labelcxx . . $ DlCompletionTree#Label..begin_cccxx . . $ CGLabel#begin_cc(e55d760a93e9f197).(); }
405 /// end() iterator for a label with complex concepts
406 const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator# endl_cccxx . . $ DlCompletionTree#endl_cc(e55d760a93e9f197). ( void ) const { return Labelcxx . . $ DlCompletionTree#Label..end_cccxx . . $ CGLabel#end_cc(e55d760a93e9f197).(); }
407
408 /// check whether node's label contains P
409 bool isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818). ( BipolarPointercxx . . $ BipolarPointer# p ) const { return Labelcxx . . $ DlCompletionTree#Label..containscxx . . $ CGLabel#contains(4a668f6de69bf818).(p); }
410
411 //----------------------------------------------
412 // blocking interface
413 //----------------------------------------------
414
415 // Blocked-By methods for different logics
416
417 /// check blocking condition for SH logic
418 bool isBlockedBy_SHcxx . . $ DlCompletionTree#isBlockedBy_SH(e2c3b6f64f9879b7). ( const DlCompletionTreecxx . . $ DlCompletionTree#* p ) const { return B1cxx . . $ DlCompletionTree#B1(e2c3b6f64f9879b7).(p); }
419 /// check blocking condition for SHI logic
420 bool isBlockedBy_SHIcxx . . $ DlCompletionTree#isBlockedBy_SHI(f6b0d2269aa74b81). ( const DLDagcxx . . $ DLDag#& dag, const DlCompletionTreecxx . . $ DlCompletionTree#* p ) const { return isCommonlyBlockedBycxx . . $ DlCompletionTree#isCommonlyBlockedBy(f6b0d2269aa74b81). ( dag, p ); }
421 /// check blocking condition for SHIQ logic using optimised blocking
422 bool isBlockedBy_SHIQcxx . . $ DlCompletionTree#isBlockedBy_SHIQ(f6b0d2269aa74b81). ( const DLDagcxx . . $ DLDag#& dag, const DlCompletionTreecxx . . $ DlCompletionTree#* p ) const
423 { return isCommonlyBlockedBycxx . . $ DlCompletionTree#isCommonlyBlockedBy(f6b0d2269aa74b81). ( dag, p ) && ( isCBlockedBycxx . . $ DlCompletionTree#isCBlockedBy(f6b0d2269aa74b81). ( dag, p ) || isABlockedBycxx . . $ DlCompletionTree#isABlockedBy(f6b0d2269aa74b81). ( dag, p ) ); }
424
425 // WARNING!! works only for blockable nodes
426 // every non-root node will have first upcoming edge pointed to a parent
427
428 /// return RO pointer to the parent node; WARNING: correct only for nodes with hasParent()==TRUE
429 const DlCompletionTreecxx . . $ DlCompletionTree#* getParentNodecxx . . $ DlCompletionTree#getParentNode(19e040716207bced). ( void ) const { return (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).begincxx . . $ DlCompletionTree#begin(d3473f034184ffc9).())->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); }
430 /// return RW pointer to the parent node; WARNING: correct only for nodes with hasParent()==TRUE
431 DlCompletionTreecxx . . $ DlCompletionTree#* getParentNodecxx . . $ DlCompletionTree#getParentNode(8f504d760f19febe). ( void ) { return (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).begincxx . . $ DlCompletionTree#begin(de7d1c517ae77062).())->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(); }
432
433 //----------------------------------------------
434 // managing AFFECTED flag
435 //----------------------------------------------
436
437 /// check whether node is affected by blocking-related changes
438 bool isAffectedcxx . . $ DlCompletionTree#isAffected(50ce9a9e25b4a850). ( void ) const { return affectedcxx . . $ DlCompletionTree#affected.; }
439 /// set node (and all subnodes) affected
440 void setAffectedcxx . . $ DlCompletionTree#setAffected(49f6e7a06ebc5aa8). ( void )
441 {
442 // don't mark already affected, nominal or p-blocked nodes
443 if ( isAffectedcxx . . $ DlCompletionTree#isAffected(50ce9a9e25b4a850).() || isNominalNodecxx . . $ DlCompletionTree#isNominalNode(50ce9a9e25b4a850).() || isPBlockedcxx . . $ DlCompletionTree#isPBlocked(50ce9a9e25b4a850).() )
444 return;
445 affectedcxx . . $ DlCompletionTree#affected. = true;
446 for ( const_edge_iteratorcxx . . $ DlCompletionTree#const_edge_iterator# q = begincxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).(), q_end = endcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).(); q <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). q_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q )
447 if ( (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q)->isSuccEdgecxx . . $ DlCompletionTreeArc#isSuccEdge(50ce9a9e25b4a850).() )
448 (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q)->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).()->setAffectedcxx . . $ DlCompletionTree#setAffected(49f6e7a06ebc5aa8).();
449 }
450 /// clear affected flag
451 void clearAffectedcxx . . $ DlCompletionTree#clearAffected(49f6e7a06ebc5aa8). ( void ) { affectedcxx . . $ DlCompletionTree#affected. = false; }
452
453 // just returns calculated values
454
455 /// check if node is directly blocked
456 bool isDBlockedcxx . . $ DlCompletionTree#isDBlocked(50ce9a9e25b4a850). ( void ) const { return Blockercxx . . $ DlCompletionTree#Blocker. != nullptr && !pBlockedcxx . . $ DlCompletionTree#pBlocked. && dBlockedcxx . . $ DlCompletionTree#dBlocked.; }
457 /// check if node is indirectly blocked
458 bool isIBlockedcxx . . $ DlCompletionTree#isIBlocked(50ce9a9e25b4a850). ( void ) const { return Blockercxx . . $ DlCompletionTree#Blocker. != nullptr && !pBlockedcxx . . $ DlCompletionTree#pBlocked. && !dBlockedcxx . . $ DlCompletionTree#dBlocked.; }
459 /// check if node is purged (and so indirectly blocked)
460 bool isPBlockedcxx . . $ DlCompletionTree#isPBlocked(50ce9a9e25b4a850). ( void ) const { return Blockercxx . . $ DlCompletionTree#Blocker. != nullptr && pBlockedcxx . . $ DlCompletionTree#pBlocked. && !dBlockedcxx . . $ DlCompletionTree#dBlocked.; }
461 /// check if node is blocked (d/i)
462 bool isBlockedcxx . . $ DlCompletionTree#isBlocked(50ce9a9e25b4a850). ( void ) const { return Blockercxx . . $ DlCompletionTree#Blocker. != nullptr && !pBlockedcxx . . $ DlCompletionTree#pBlocked.; }
463 /// check the legality of the direct block
464 bool isIllegallyDBlockedcxx . . $ DlCompletionTree#isIllegallyDBlocked(50ce9a9e25b4a850). ( void ) const { return isDBlockedcxx . . $ DlCompletionTree#isDBlocked(50ce9a9e25b4a850).() && Blockercxx . . $ DlCompletionTree#Blocker.->isBlockedcxx . . $ DlCompletionTree#isBlocked(50ce9a9e25b4a850).(); }
465
466 /// get access to the blocker
467 const DlCompletionTreecxx . . $ DlCompletionTree#* getBlockercxx . . $ DlCompletionTree#getBlocker(19e040716207bced). ( void ) const { return Blockercxx . . $ DlCompletionTree#Blocker.; }
468 /// get RW node to which current one was merged
469 DlCompletionTreecxx . . $ DlCompletionTree#* resolvePBlockercxx . . $ DlCompletionTree#resolvePBlocker(8f504d760f19febe). ( void )
470 {
471 if ( unlikelycxx . . $ DlCompletionTree#isPBlocked(50ce9a9e25b4a850).(isPBlocked()) )
472 return const_cast<DlCompletionTreecxx . . $ DlCompletionTree#*>(Blockercxx . . $ DlCompletionTree#Blocker.)->resolvePBlockercxx . . $ DlCompletionTree#resolvePBlocker(8f504d760f19febe).();
473 else
474 return this;
475 }
476 /// get RO node to which current one was merged
477 const DlCompletionTreecxx . . $ DlCompletionTree#* resolvePBlockercxx . . $ DlCompletionTree#resolvePBlocker(19e040716207bced). ( void ) const
478 {
479 if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(isPBlocked()) )
480 return Blockercxx . . $ DlCompletionTree#Blocker.->resolvePBlockercxx . . $ DlCompletionTree#resolvePBlocker(19e040716207bced).();
481 else
482 return this;
483 }
484 /// get node to which current one was merged; fills DEP from pDep's
485 DlCompletionTreecxx . . $ DlCompletionTree#* resolvePBlockercxx . . $ DlCompletionTree#resolvePBlocker(9c33c38202537177). ( DepSetcxx . . $ DepSet#& dep )
486 {
487 if ( likelycxx . . $ `Kernel/globaldef.h:28:10`!(!isPBlocked()) )
488 return this;
489 dep +=cxx . . $ TDepSet#`operator+=`(6a948e2ed08fa462). pDepcxx . . $ DlCompletionTree#pDep.;
490 return const_cast<DlCompletionTreecxx . . $ DlCompletionTree#*>(Blockercxx . . $ DlCompletionTree#Blocker.)->resolvePBlockercxx . . $ DlCompletionTree#resolvePBlocker(9c33c38202537177).(dep);
491 }
492 /// get purge dep-set of a given node
493 const DepSetcxx . . $ DepSet#& getPurgeDepcxx . . $ DlCompletionTree#getPurgeDep(bce6462a16d96b29). ( void ) const { return pDepcxx . . $ DlCompletionTree#pDep.; }
494 /// check whether a node can block node P according to it's Init value
495 bool canBlockInitcxx . . $ DlCompletionTree#canBlockInit(e2c3b6f64f9879b7). ( const DlCompletionTreecxx . . $ DlCompletionTree#* p ) const { return canBlockInitcxx . . $ DlCompletionTree#canBlockInit(4a668f6de69bf818).(p->Initcxx . . $ DlCompletionTree#Init.); }
496
497 /// check whether the loop between a DBlocked NODE and it's parent blocked contains C
498 bool isLoopLabelledcxx . . $ DlCompletionTree#isLoopLabelled(83c267b20bac841a). ( BipolarPointercxx . . $ BipolarPointer# c )
499 {
500 fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( isDBlocked() );
501 if ( Blockercxx . . $ DlCompletionTree#Blocker.->isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818).(c) )
502 return true;
503 int n = 1; // Blocker is the 1st node in the loop
504 for ( DlCompletionTreecxx . . $ DlCompletionTree#* p = getParentNodecxx . . $ DlCompletionTree#getParentNode(8f504d760f19febe).(); p->hasParentcxx . . $ DlCompletionTree#hasParent(50ce9a9e25b4a850).() && p != Blockercxx . . $ DlCompletionTree#Blocker.; p = p->getParentNodecxx . . $ DlCompletionTree#getParentNode(8f504d760f19febe).() )
505 if ( p->isLabelledBycxx . . $ DlCompletionTree#isLabelledBy(4a668f6de69bf818).(c) )
506 return true;
507 else
508 ++n;
509 if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) )
510 LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " loop(" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). n <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")";
511 return false;
512 }
513
514 //----------------------------------------------
515 // re-building blocking hierarchy
516 //----------------------------------------------
517
518 /// set node blocked
519 TRestorercxx . . $ TRestorer#* setBlockedcxx . . $ DlCompletionTree#setBlocked(a6926329574e4c8a). ( const DlCompletionTreecxx . . $ DlCompletionTree#* blocker, bool permanently, bool directly )
520 {
521 TRestorercxx . . $ TRestorer#* ret = new UnBlockcxx . . $ DlCompletionTree#UnBlock#UnBlock(3bf754c9a531d7e6).(this);
522 Blockercxx . . $ DlCompletionTree#Blocker. = blocker;
523 pBlockedcxx . . $ DlCompletionTree#pBlocked. = permanently;
524 dBlockedcxx . . $ DlCompletionTree#dBlocked. = directly;
525 logNodeBlockedcxx . . $ DlCompletionTree#logNodeBlocked(83f5f38750778ac8).();
526 return ret;
527 }
528 /// mark node d-blocked
529 TRestorercxx . . $ TRestorer#* setDBlockedcxx . . $ DlCompletionTree#setDBlocked(5b1a0959643dd9be). ( const DlCompletionTreecxx . . $ DlCompletionTree#* blocker ) { return setBlockedcxx . . $ DlCompletionTree#setBlocked(a6926329574e4c8a). ( blocker, false, true ); }
530 /// mark node i-blocked
531 TRestorercxx . . $ TRestorer#* setIBlockedcxx . . $ DlCompletionTree#setIBlocked(5b1a0959643dd9be). ( const DlCompletionTreecxx . . $ DlCompletionTree#* blocker ) { return setBlockedcxx . . $ DlCompletionTree#setBlocked(a6926329574e4c8a). ( blocker, false, false ); }
532 /// mark node unblocked
533 TRestorercxx . . $ TRestorer#* setUBlockedcxx . . $ DlCompletionTree#setUBlocked(85c56efe7ce37b0e). ( void ) { return setBlockedcxx . . $ DlCompletionTree#setBlocked(a6926329574e4c8a). ( nullptr, true, true ); }
534 /// mark node purged
535 TRestorercxx . . $ TRestorer#* setPBlockedcxx . . $ DlCompletionTree#setPBlocked(7616d0d20370b11b). ( const DlCompletionTreecxx . . $ DlCompletionTree#* blocker, const DepSetcxx . . $ DepSet#& dep )
536 {
537 TRestorercxx . . $ TRestorer#* ret = new UnBlockcxx . . $ DlCompletionTree#UnBlock#(this);
538 Blockercxx . . $ DlCompletionTree#Blocker. = blocker;
539 if ( isNominalNodecxx . . $ DlCompletionTree#isNominalNode(50ce9a9e25b4a850).() )
540 pDepcxx . . $ DlCompletionTree#pDep. =cxx . . $ TDepSet#`operator=`(6a948e2ed08fa462). dep;
541 pBlockedcxx . . $ DlCompletionTree#pBlocked. = true;
542 dBlockedcxx . . $ DlCompletionTree#dBlocked. = false;
543 logNodeBlockedcxx . . $ DlCompletionTree#logNodeBlocked(83f5f38750778ac8).();
544 return ret;
545 }
546
547 //----------------------------------------------
548 // checking edge labeling
549 //----------------------------------------------
550
551 /// check if edge to NODE is labeled by R; return NULL if does not
552 DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* getEdgeLabelledcxx . . $ DlCompletionTree#getEdgeLabelled(9eec51ce6dfc960e). ( const TRolecxx . . $ TRole#* R, const DlCompletionTreecxx . . $ DlCompletionTree#* node ) const
553 {
554 for ( const_edge_iteratorcxx . . $ DlCompletionTree#const_edge_iterator# p = begincxx . . $ DlCompletionTree#begin(d3473f034184ffc9).(), p_end = endcxx . . $ DlCompletionTree#end(d3473f034184ffc9).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p )
555 if ( (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p)->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).() == node && (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p)->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392).(R) )
556 return *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p;
557 return nullptr;
558 }
559 /// check if parent arc is labeled by R; works only for blockable nodes
560 bool isParentArcLabelledcxx . . $ DlCompletionTree#isParentArcLabelled(81d69a9c8508a392). ( const TRolecxx . . $ TRole#* R ) const { return getEdgeLabelledcxx . . $ DlCompletionTree#getEdgeLabelled(9eec51ce6dfc960e). ( R, getParentNodecxx . . $ DlCompletionTree#getParentNode(19e040716207bced).() ) != nullptr; }
561
562 //----------------------------------------------
563 // inequality relation interface
564 //----------------------------------------------
565
566 #ifdef RKG_IR_IN_NODE_LABELcxx . . $ `Kernel/globaldef.h:69:9`!
567 /// init IR with given entry and dep-set; @return true if IR already has this label
568 bool initIRcxx . . $ DlCompletionTree#initIR(cbd92d0fb85c8e0). ( BipolarPointercxx . . $ BipolarPointer# level, const DepSetcxx . . $ DepSet#& ds )
569 {
570 ConceptWDepcxx . . $ ConceptWDep# Ccxx . . $ ConceptWDep#ConceptWDep(12a183a495b39f91).(level,ds);
571 DepSetcxx . . $ DepSet# dummycxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; // we don't need a clash-set here
572 if ( inIRwithCcxx . . $ DlCompletionTree#inIRwithC(cacefedd615bba0c). ( C, dummy ) )
573 return true;
574 IRcxx . . $ DlCompletionTree#IR..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(C));
575 return false;
576 }
577 /// check if the current node is in IR with NODE; if so, write the clash-set to DEP
578 bool nonMergeablecxx . . $ DlCompletionTree#nonMergeable(1fdb8df2fde94811). ( const DlCompletionTreecxx . . $ DlCompletionTree#* node, DepSetcxx . . $ DepSet#& dep ) const;
579 /// update IR of the current node with IR from NODE and additional dep-set; @return restorer
580 TRestorercxx . . $ TRestorer#* updateIRcxx . . $ DlCompletionTree#updateIR(7616d0d20370b11b). ( const DlCompletionTreecxx . . $ DlCompletionTree#* node, const DepSetcxx . . $ DepSet#& toAdd );
581 #endif
582
583 //----------------------------------------------
584 // saving/restoring
585 //----------------------------------------------
586
587 /// check if node needs to be saved
588 bool needSavecxx . . $ DlCompletionTree#needSave(8de63fdb265b07c1). ( unsigned int newLevel ) const { return getCurLevelcxx . . $ DlCompletionTree#getCurLevel(ddd8539a2fcdd4ce).() < newLevel; }
589 /// save node using internal stack
590 void savecxx . . $ DlCompletionTree#save(cb2f890c2fdad230). ( unsigned int level )
591 {
592 savecxx . . $ DlCompletionTree#save(9a922c1c7ac46c1a).(savescxx . . $ DlCompletionTree#saves..pushcxx . . $ TSaveList#push(155dc7f103cdb9db).());
593 curLevelcxx . . $ DlCompletionTree#curLevel. = level;
594 }
595 /// restore node from the topmost entry
596 void restorecxx . . $ DlCompletionTree#restore(49f6e7a06ebc5aa8). ( void )
597 {
598 fpp_assertcxx . . $ DlCompletionTree#saves. ( !saves.empty() );
599 restorecxx . . $ DlCompletionTree#restore(4fcc177ae5126665). (savescxx . . $ DlCompletionTree#saves..popcxx . . $ TSaveList#pop(155dc7f103cdb9db).());
600 }
601 /// check if node needs to be restored
602 bool needRestorecxx . . $ DlCompletionTree#needRestore(8de63fdb265b07c1). ( unsigned int restLevel ) const { return getCurLevelcxx . . $ DlCompletionTree#getCurLevel(ddd8539a2fcdd4ce).() > restLevel; }
603 /// restore node to given level
604 void restorecxx . . $ DlCompletionTree#restore(cb2f890c2fdad230). ( unsigned int level ) { restorecxx . . $ DlCompletionTree#restore(4fcc177ae5126665).(savescxx . . $ DlCompletionTree#saves..popcxx . . $ TSaveList#pop(18e8862a30c27574).(level)); }
605
606 // output
607
608 /// log node information (number, i/d blockers, cached)
609 void logNodecxx . . $ DlCompletionTree#logNode(83f5f38750778ac8). ( void ) const { LLcxx . . $ LL. <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).(); logNodeBStatuscxx . . $ DlCompletionTree#logNodeBStatus(490063bd7e6d8d5d).(LLcxx . . $ LL.); }
610 /// print body of the node (without neighbours)
611 void PrintBodycxx . . $ DlCompletionTree#PrintBody(490063bd7e6d8d5d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const;
612 }; // DlCompletionTree
613
614 /*
615 * Implementation
616 */
617
618 inline void DlCompletionTreecxx . . $ DlCompletionTree# :: initcxx . . $ DlCompletionTree#init(cb2f890c2fdad230). ( unsigned int level )
619 {
620 flagDataNodecxx . . $ DlCompletionTree#flagDataNode. = false;
621 nominalLevelcxx . . $ DlCompletionTree#nominalLevel. = BlockableLevelcxx . . $ BlockableLevel.;
622 curLevelcxx . . $ DlCompletionTree#curLevel. = level;
623 cachedcxx . . $ DlCompletionTree#cached. = false;
624 affectedcxx . . $ DlCompletionTree#affected. = true; // every (newly created) node can be blocked
625 dBlockedcxx . . $ DlCompletionTree#dBlocked. = true;
626 pBlockedcxx . . $ DlCompletionTree#pBlocked. = true; // unused flag combination
627
628 Labelcxx . . $ DlCompletionTree#Label..initcxx . . $ CGLabel#init(49f6e7a06ebc5aa8).();
629 Initcxx . . $ DlCompletionTree#Init. = bpTOPcxx . . $ bpTOP.;
630
631 // node was used -- clear all previous content
632 savescxx . . $ DlCompletionTree#saves..clearcxx . . $ TSaveList#clear(49f6e7a06ebc5aa8).();
633 #ifdef RKG_IR_IN_NODE_LABELcxx . . $ `Kernel/globaldef.h:69:9`!
634 IRcxx . . $ DlCompletionTree#IR..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).();
635 #endif
636 Neighbourcxx . . $ DlCompletionTree#Neighbour..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).();
637 Blockercxx . . $ DlCompletionTree#Blocker. = nullptr;
638 pDepcxx . . $ DlCompletionTree#pDep..clearcxx . . $ TDepSet#clear(49f6e7a06ebc5aa8).();
639 }
640
641 #endif // DLCOMPLETIONTREE_H