| 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 REASONER_H |
| 21 | #define REASONER_Hcxx . . $ `Kernel/Reasoner.h:21:9`! |
| 22 | |
| 23 | #include "globaldef.h"cxx . . $ `<file>/Kernel/globaldef.h`/ |
| 24 | #include "tBranchingContext.h"cxx . . $ `<file>/Kernel/tBranchingContext.h`/ |
| 25 | #include "dlCompletionGraph.h"cxx . . $ `<file>/Kernel/dlCompletionGraph.h`/ |
| 26 | #include "dlTBox.h"cxx . . $ `<file>/Kernel/dlTBox.h`/ |
| 27 | #include "dlDag.h"cxx . . $ `<file>/Kernel/dlDag.h`/ |
| 28 | #include "modelCacheIan.h"cxx . . $ `<file>/Kernel/modelCacheIan.h`/ |
| 29 | #include "tSaveStack.h"cxx . . $ `<file>/Kernel/tSaveStack.h`/ |
| 30 | #include "procTimer.h"cxx . . $ `<file>/Kernel/procTimer.h`/ |
| 31 | #include "DataReasoning.h"cxx . . $ `<file>/Kernel/DataReasoning.h`/ |
| 32 | #include "ToDoList.h"cxx . . $ `<file>/Kernel/ToDoList.h`/ |
| 33 | #include "tFastSet.h"cxx . . $ `<file>/Kernel/tFastSet.h`/ |
| 34 | |
| 35 | #if USE_LOGGINGcxx . . $ `Kernel/globaldef.h:45:10`! // don't gather statistics w/o logging |
| 36 | # define USE_REASONING_STATISTICS |
| 37 | #endif |
| 38 | |
| 39 | #ifdef USE_REASONING_STATISTICS |
| 40 | /// class for gathering statistic both for session and totally |
| 41 | class AccumulatedStatistic |
| 42 | { |
| 43 | protected: // static members |
| 44 | /// all members are linked together |
| 45 | static AccumulatedStatistic* root; |
| 46 | |
| 47 | public: // static methods |
| 48 | /// accumulate all registered statistic elements |
| 49 | static void accumulateAll ( void ) |
| 50 | { |
| 51 | for ( AccumulatedStatistic* cur = root; cur; cur = cur->next ) |
| 52 | cur->accumulate(); |
| 53 | } |
| 54 | |
| 55 | protected: // members |
| 56 | /// accumulated statistic |
| 57 | unsigned int total = 0; |
| 58 | /// current session statistic |
| 59 | unsigned int local = 0; |
| 60 | /// link to the next element |
| 61 | AccumulatedStatistic* next; |
| 62 | |
| 63 | public: // interface |
| 64 | /// c'tor: link itself to the list |
| 65 | AccumulatedStatistic ( void ) : next(root) { root = this; } |
| 66 | /// no copy c'tor |
| 67 | AccumulatedStatistic ( const AccumulatedStatistic& ) = delete; |
| 68 | /// no assignment |
| 69 | AccumulatedStatistic& operator = ( const AccumulatedStatistic& ) = delete; |
| 70 | /// d'tor: remove link from the list |
| 71 | ~AccumulatedStatistic() |
| 72 | { |
| 73 | // all statistic elements are deleted in the inverted creation order |
| 74 | if ( root == this ) |
| 75 | { |
| 76 | root = next; |
| 77 | return; |
| 78 | } |
| 79 | // we are here if it's multi-environment and arbitrary deletion order was chosen |
| 80 | AccumulatedStatistic *prev = root, *cur = root->next; |
| 81 | // find a pointer to current node |
| 82 | while ( cur && cur != this ) |
| 83 | prev = cur, cur = cur->next; |
| 84 | if ( cur == this ) |
| 85 | prev->next = next; |
| 86 | } |
| 87 | |
| 88 | // access to the elements |
| 89 | |
| 90 | /// get (RO) value of the element |
| 91 | unsigned int get ( bool needLocal ) const { return needLocal ? local : total; } |
| 92 | |
| 93 | // general statistic operators |
| 94 | |
| 95 | /// increment local value |
| 96 | void inc ( void ) |
| 97 | { |
| 98 | ++local; |
| 99 | } |
| 100 | /// set local value to particular N |
| 101 | void set ( unsigned int n ) |
| 102 | { |
| 103 | local = n; |
| 104 | } |
| 105 | /// add local value to a global one |
| 106 | void accumulate ( void ) { total += local; local = 0; } |
| 107 | |
| 108 | // output |
| 109 | |
| 110 | void Print ( std::ostream& o, bool needLocal, const char* prefix, const char* suffix ) const |
| 111 | { |
| 112 | if ( get(needLocal) > 0 ) |
| 113 | o << prefix << get(needLocal) << suffix; |
| 114 | } |
| 115 | }; // AccumulatedStatistic |
| 116 | #endif |
| 117 | |
| 118 | class DlSatTestercxx . . $ DlSatTester# |
| 119 | { |
| 120 | protected: // type definition |
| 121 | /// TODO table type |
| 122 | typedef ToDoListcxx . . $ ToDoList# ToDoTableTypecxx . . $ DlSatTester#ToDoTableType#; |
| 123 | /// vector of edges |
| 124 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<DlCompletionTreeArccxx . . $ DlCompletionTreeArc#*> EdgeVectorcxx . . $ DlSatTester#EdgeVector#; |
| 125 | /// vector of nodes |
| 126 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<DlCompletionTreecxx . . $ DlCompletionTree#*> NodeVectorcxx . . $ DlSatTester#NodeVector#; |
| 127 | /// RO label iterator |
| 128 | typedef DlCompletionTreecxx . . $ DlCompletionTree#::const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator# const_label_iteratorcxx . . $ DlSatTester#const_label_iterator#; |
| 129 | /// set to keep BPs (during cascaded cache creation) |
| 130 | typedef stdcxx . . $ std/::setcxx . . $ std/set#<BipolarPointercxx . . $ BipolarPointer#> BPSetcxx . . $ DlSatTester#BPSet#; |
| 131 | |
| 132 | protected: // constants |
| 133 | /// possible flags of re-checking ALL-like expressions in new nodes |
| 134 | const unsigned int redoForallcxx . . $ DlSatTester#redoForall. = 1; |
| 135 | const unsigned int redoFunccxx . . $ DlSatTester#redoFunc. = 2; |
| 136 | const unsigned int redoAtMostcxx . . $ DlSatTester#redoAtMost. = 4; |
| 137 | const unsigned int redoIrrcxx . . $ DlSatTester#redoIrr. = 8; |
| 138 | // Do NOT forget to update when new constant is added |
| 139 | const unsigned int redoEverythingcxx . . $ DlSatTester#redoEverything. = redoForallcxx . . $ DlSatTester#redoForall. | redoFunccxx . . $ DlSatTester#redoFunc. | redoAtMostcxx . . $ DlSatTester#redoAtMost. | redoIrrcxx . . $ DlSatTester#redoIrr.; |
| 140 | |
| 141 | protected: // classes |
| 142 | /// stack to keep BContext |
| 143 | class BCStackcxx . . $ DlSatTester#BCStack#: public TSaveStackcxx . . $ TSaveStack#<BranchingContextcxx . . $ BranchingContext#> |
| 144 | { |
| 145 | protected: // members |
| 146 | /// pool for OR contexts |
| 147 | DeletelessAllocatorcxx . . $ DeletelessAllocator#<BCOrcxx . . $ BCOr#> PoolOrcxx . . $ DlSatTester#BCStack#PoolOr.; |
| 148 | /// pool for NN contexts |
| 149 | DeletelessAllocatorcxx . . $ DeletelessAllocator#<BCNNcxx . . $ BCNN#> PoolNNcxx . . $ DlSatTester#BCStack#PoolNN.; |
| 150 | /// pool for LE contexts |
| 151 | DeletelessAllocatorcxx . . $ DeletelessAllocator#<BCLEcxx . . $ BCLE#<DlCompletionTreeArccxx . . $ DlCompletionTreeArc#> > PoolLEcxx . . $ DlSatTester#BCStack#PoolLE.; |
| 152 | /// pool for Top-LE contexts |
| 153 | DeletelessAllocatorcxx . . $ DeletelessAllocator#<BCLEcxx . . $ BCLE#<DlCompletionTreecxx . . $ DlCompletionTree#> > PoolTopLEcxx . . $ DlSatTester#BCStack#PoolTopLE.; |
| 154 | /// pool for Choose contexts |
| 155 | DeletelessAllocatorcxx . . $ DeletelessAllocator#<BCChoosecxx . . $ BCChoose#> PoolChcxx . . $ DlSatTester#BCStack#PoolCh.; |
| 156 | /// single entry for the barrier (good for nominal reasoner) |
| 157 | BCBarriercxx . . $ BCBarrier#* bcBarriercxx . . $ DlSatTester#BCStack#bcBarrier.; |
| 158 | |
| 159 | protected: // methods |
| 160 | /// specialise new method as the one doing nothing |
| 161 | BranchingContextcxx . . $ BranchingContext#* createNewcxx . . $ DlSatTester#BCStack#createNew(2f2c093764250d56). ( void ) override { return nullptr; } |
| 162 | /// push method to use |
| 163 | BranchingContextcxx . . $ BranchingContext#* pushcxx . . $ DlSatTester#BCStack#push(ce2f044344076b67). ( BranchingContextcxx . . $ BranchingContext#* p ) |
| 164 | { |
| 165 | p->initcxx . . $ BranchingContext#init(49f6e7a06ebc5aa8).(); |
| 166 | TSaveStackcxx . . $ TSaveStack#<BranchingContext>::pushcxx . . $ TSaveStack#push(155dc7f103cdb9db).(); |
| 167 | this->Basecxx . . $ growingArrayP#Base.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).this->lastcxx . . $ growingArrayP#last.-1] = p; |
| 168 | return p; |
| 169 | } |
| 170 | |
| 171 | public: // interface |
| 172 | /// empty c'tor |
| 173 | BCStackcxx . . $ DlSatTester#BCStack#BCStack(49f6e7a06ebc5aa8). ( void ) : bcBarriercxx . . $ DlSatTester#BCStack#bcBarrier.(new BCBarriercxx . . $ BCBarrier#) {} |
| 174 | /// empty d'tor |
| 175 | ~cxx . . $ DlSatTester#BCStack#`~BCStack`(49f6e7a06ebc5aa8).BCStackcxx . . $ DlSatTester#BCStack#() override |
| 176 | { |
| 177 | // all the members will be deleted in the resp. pools |
| 178 | for ( iteratorcxx . . $ growingArrayP#iterator# p = this->Basecxx . . $ growingArrayP#Base..begincxx . . $ std/vector#begin(33b10a496a38335b).(), p_end = this->Basecxx . . $ growingArrayP#Base..endcxx . . $ std/vector#end(33b10a496a38335b).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 179 | *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p = nullptr; |
| 180 | delete bcBarriercxx . . $ DlSatTester#BCStack#bcBarrier.; |
| 181 | } |
| 182 | |
| 183 | // push methods |
| 184 | |
| 185 | /// get BC for Or-rule |
| 186 | BranchingContextcxx . . $ BranchingContext#* pushOrcxx . . $ DlSatTester#BCStack#pushOr(2f2c093764250d56). ( void ) { return pushcxx . . $ DlSatTester#BCStack#push(ce2f044344076b67).(PoolOrcxx . . $ DlSatTester#BCStack#PoolOr..getcxx . . $ DeletelessAllocator#get(155dc7f103cdb9db).()); } |
| 187 | /// get BC for NN-rule |
| 188 | BranchingContextcxx . . $ BranchingContext#* pushNNcxx . . $ DlSatTester#BCStack#pushNN(2f2c093764250d56). ( void ) { return pushcxx . . $ DlSatTester#BCStack#push(ce2f044344076b67).(PoolNNcxx . . $ DlSatTester#BCStack#PoolNN..getcxx . . $ DeletelessAllocator#get(155dc7f103cdb9db).()); } |
| 189 | /// get BC for LE-rule |
| 190 | BranchingContextcxx . . $ BranchingContext#* pushLEcxx . . $ DlSatTester#BCStack#pushLE(2f2c093764250d56). ( void ) { return pushcxx . . $ DlSatTester#BCStack#push(ce2f044344076b67).(PoolLEcxx . . $ DlSatTester#BCStack#PoolLE..getcxx . . $ DeletelessAllocator#get(155dc7f103cdb9db).()); } |
| 191 | /// get BC for TopLE-rule |
| 192 | BranchingContextcxx . . $ BranchingContext#* pushTopLEcxx . . $ DlSatTester#BCStack#pushTopLE(2f2c093764250d56). ( void ) { return pushcxx . . $ DlSatTester#BCStack#push(ce2f044344076b67).(PoolTopLEcxx . . $ DlSatTester#BCStack#PoolTopLE..getcxx . . $ DeletelessAllocator#get(155dc7f103cdb9db).()); } |
| 193 | /// get BC for Choose-rule |
| 194 | BranchingContextcxx . . $ BranchingContext#* pushChcxx . . $ DlSatTester#BCStack#pushCh(2f2c093764250d56). ( void ) { return pushcxx . . $ DlSatTester#BCStack#push(ce2f044344076b67).(PoolChcxx . . $ DlSatTester#BCStack#PoolCh..getcxx . . $ DeletelessAllocator#get(155dc7f103cdb9db).()); } |
| 195 | /// get BC for the barrier |
| 196 | BranchingContextcxx . . $ BranchingContext#* pushBarriercxx . . $ DlSatTester#BCStack#pushBarrier(2f2c093764250d56). ( void ) { return pushcxx . . $ DlSatTester#BCStack#push(ce2f044344076b67).(bcBarriercxx . . $ DlSatTester#BCStack#bcBarrier.); } |
| 197 | |
| 198 | /// clear all the pools |
| 199 | void clearPoolscxx . . $ DlSatTester#BCStack#clearPools(49f6e7a06ebc5aa8). ( void ) |
| 200 | { |
| 201 | PoolOrcxx . . $ DlSatTester#BCStack#PoolOr..clearcxx . . $ growingArrayP#clear(49f6e7a06ebc5aa8).(); |
| 202 | PoolNNcxx . . $ DlSatTester#BCStack#PoolNN..clearcxx . . $ growingArrayP#clear(49f6e7a06ebc5aa8).(); |
| 203 | PoolLEcxx . . $ DlSatTester#BCStack#PoolLE..clearcxx . . $ growingArrayP#clear(49f6e7a06ebc5aa8).(); |
| 204 | PoolTopLEcxx . . $ DlSatTester#BCStack#PoolTopLE..clearcxx . . $ growingArrayP#clear(49f6e7a06ebc5aa8).(); |
| 205 | PoolChcxx . . $ DlSatTester#BCStack#PoolCh..clearcxx . . $ growingArrayP#clear(49f6e7a06ebc5aa8).(); |
| 206 | } |
| 207 | /// clear the stack and pools |
| 208 | void clearcxx . . $ DlSatTester#BCStack#clear(49f6e7a06ebc5aa8). ( void ) override |
| 209 | { |
| 210 | clearPoolscxx . . $ DlSatTester#BCStack#clearPools(49f6e7a06ebc5aa8).(); |
| 211 | TSaveStackcxx . . $ TSaveStack#<BranchingContext>::clearcxx . . $ growingArrayP#clear(49f6e7a06ebc5aa8).(); |
| 212 | } |
| 213 | }; // BCStack |
| 214 | |
| 215 | protected: // members |
| 216 | /// host TBox |
| 217 | TBoxcxx . . $ TBox#& tBoxcxx . . $ DlSatTester#tBox.; |
| 218 | /// link to dag from TBox |
| 219 | DLDagcxx . . $ DLDag#& DLHeapcxx . . $ DlSatTester#DLHeap.; |
| 220 | /// all the reflexive roles |
| 221 | RoleMastercxx . . $ RoleMaster#::TRoleVeccxx . . $ RoleMaster#TRoleVec# ReflexiveRolescxx . . $ DlSatTester#ReflexiveRoles.; |
| 222 | |
| 223 | /// manager for all the dep-sets corresponding to a graph here |
| 224 | TDepSetManagercxx . . $ TDepSetManager# Managercxx . . $ DlSatTester#Manager.; |
| 225 | /// Completion Graph of tested concept(s) |
| 226 | DlCompletionGraphcxx . . $ DlCompletionGraph# CGraphcxx . . $ DlSatTester#CGraph.; |
| 227 | /// TODO list |
| 228 | ToDoTableTypecxx . . $ DlSatTester#ToDoTableType# TODOcxx . . $ DlSatTester#TODO.; |
| 229 | /// reasoning subsystem for the datatypes |
| 230 | DataTypeReasonercxx . . $ DataTypeReasoner# DTReasonercxx . . $ DlSatTester#DTReasoner.; |
| 231 | /// Used sets for pos- and neg- entries |
| 232 | TFastSetcxx . . $ TFastSet#<unsigned int> pUsedcxx . . $ DlSatTester#pUsed., nUsedcxx . . $ DlSatTester#nUsed.; |
| 233 | /// cache for testing whether it's possible to non-expand newly created node |
| 234 | modelCacheIancxx . . $ modelCacheIan# newNodeCachecxx . . $ DlSatTester#newNodeCache.; |
| 235 | /// auxiliary cache that is built from the edges of newly created node |
| 236 | modelCacheIancxx . . $ modelCacheIan# newNodeEdgescxx . . $ DlSatTester#newNodeEdges.; |
| 237 | |
| 238 | /// GCI-related KB flags |
| 239 | const TKBFlagscxx . . $ TKBFlags#& GCIscxx . . $ DlSatTester#GCIs.; |
| 240 | |
| 241 | /// record nodes that were processed during Cascaded Cache construction |
| 242 | stdcxx . . $ std/::setcxx . . $ std/set#<BipolarPointercxx . . $ BipolarPointer#> inProcesscxx . . $ DlSatTester#inProcess.; |
| 243 | |
| 244 | /// timer for the SAT tests (ie, cache creation) |
| 245 | TsProcTimercxx . . $ TsProcTimer# satTimercxx . . $ DlSatTester#satTimer.; |
| 246 | /// timer for the SUB tests (ie, general subsumption) |
| 247 | TsProcTimercxx . . $ TsProcTimer# subTimercxx . . $ DlSatTester#subTimer.; |
| 248 | /// timer for a single test; use it as a timeout checker |
| 249 | TsProcTimercxx . . $ TsProcTimer# testTimercxx . . $ DlSatTester#testTimer.; |
| 250 | |
| 251 | // save/restore option |
| 252 | |
| 253 | /// stack for the local reasoner's state |
| 254 | BCStackcxx . . $ DlSatTester#BCStack# Stackcxx . . $ DlSatTester#Stack.; |
| 255 | /// context from the restored branching rule |
| 256 | BranchingContextcxx . . $ BranchingContext#* bContextcxx . . $ DlSatTester#bContext. = nullptr; |
| 257 | /// index of last non-det situation |
| 258 | unsigned int tryLevelcxx . . $ DlSatTester#tryLevel. = InitBranchingLevelValuecxx . . $ InitBranchingLevelValue.; |
| 259 | /// shift in order to determine the 1st non-det application |
| 260 | unsigned int nonDetShiftcxx . . $ DlSatTester#nonDetShift. = 0; |
| 261 | |
| 262 | // statistic elements |
| 263 | |
| 264 | #ifdef USE_REASONING_STATISTICS |
| 265 | AccumulatedStatistic |
| 266 | nTacticCalls, |
| 267 | nUseless, |
| 268 | |
| 269 | nIdCalls, |
| 270 | nSingletonCalls, |
| 271 | nOrCalls, |
| 272 | nOrBrCalls, |
| 273 | nAndCalls, |
| 274 | nSomeCalls, |
| 275 | nAllCalls, |
| 276 | nFuncCalls, |
| 277 | nLeCalls, |
| 278 | nGeCalls, |
| 279 | |
| 280 | nNNCalls, |
| 281 | nMergeCalls, |
| 282 | |
| 283 | nAutoEmptyLookups, |
| 284 | nAutoTransLookups, |
| 285 | |
| 286 | nSRuleAdd, |
| 287 | nSRuleFire, |
| 288 | |
| 289 | nStateSaves, |
| 290 | nStateRestores, |
| 291 | nNodeSaves, |
| 292 | nNodeRestores, |
| 293 | |
| 294 | nLookups, |
| 295 | |
| 296 | nFairnessViolations, |
| 297 | |
| 298 | // reasoning cache |
| 299 | nCacheTry, |
| 300 | nCacheFailedNoCache, |
| 301 | nCacheFailedShallow, |
| 302 | nCacheFailed, |
| 303 | nCachedSat, |
| 304 | nCachedUnsat; |
| 305 | #endif |
| 306 | |
| 307 | // current values |
| 308 | |
| 309 | /// currently processed CTree node |
| 310 | DlCompletionTreecxx . . $ DlCompletionTree#* curNodecxx . . $ DlSatTester#curNode. = nullptr; |
| 311 | /// currently processed Concept |
| 312 | ConceptWDepcxx . . $ ConceptWDep# curConceptcxx . . $ DlSatTester#curConcept.; |
| 313 | /// GCIs local to session |
| 314 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<BipolarPointercxx . . $ BipolarPointer#> SessionGCIscxx . . $ DlSatTester#SessionGCIs.; |
| 315 | |
| 316 | /// size of the DAG with some extra space |
| 317 | size_tcxx . . $ size_t# dagSizecxx . . $ DlSatTester#dagSize. = 0; |
| 318 | |
| 319 | /// temporary array used in OR operation |
| 320 | BCOrcxx . . $ BCOr#::OrIndexcxx . . $ BCOr#OrIndex# OrConceptsToTestcxx . . $ DlSatTester#OrConceptsToTest.; |
| 321 | /// temporary array used in <= operations |
| 322 | EdgeVectorcxx . . $ DlSatTester#EdgeVector# EdgesToMergecxx . . $ DlSatTester#EdgesToMerge.; |
| 323 | /// nodes to merge in the TopRole-LE rules |
| 324 | NodeVectorcxx . . $ DlSatTester#NodeVector# NodesToMergecxx . . $ DlSatTester#NodesToMerge.; |
| 325 | /// contains clash set if clash is encountered in a node label |
| 326 | DepSetcxx . . $ DepSet# clashSetcxx . . $ DlSatTester#clashSet.; |
| 327 | |
| 328 | // session status flags: |
| 329 | |
| 330 | /// true if nominal-related expansion rule was fired during reasoning |
| 331 | bool encounterNominalcxx . . $ DlSatTester#encounterNominal. = false; |
| 332 | /// flag to show if it is necessary to produce DT reasoning immediately |
| 333 | bool checkDataNodecxx . . $ DlSatTester#checkDataNode. = true; |
| 334 | |
| 335 | protected: // methods |
| 336 | |
| 337 | /// increment statistic counter |
| 338 | #ifdef USE_REASONING_STATISTICS |
| 339 | # define incStat(stat) stat.inc() |
| 340 | #else |
| 341 | # define incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(stat) |
| 342 | #endif |
| 343 | |
| 344 | //----------------------------------------------------------------------------- |
| 345 | // flags section |
| 346 | //----------------------------------------------------------------------------- |
| 347 | |
| 348 | /// @return timeout value for a single SAT/Sub test in milliseconds; 0 means no timeout |
| 349 | unsigned long getSatTimeoutcxx . . $ DlSatTester#getSatTimeout(fe4d2d262d4164a8). ( void ) const { return tBoxcxx . . $ DlSatTester#tBox..testTimeoutcxx . . $ TBox#testTimeout.; } |
| 350 | /// @return true iff semantic branching is used |
| 351 | bool useSemanticBranchingcxx . . $ DlSatTester#useSemanticBranching(50ce9a9e25b4a850). ( void ) const { return tBoxcxx . . $ DlSatTester#tBox..useSemanticBranchingcxx . . $ TBox#useSemanticBranching.; } |
| 352 | /// @return true iff lazy blocking is used |
| 353 | bool useLazyBlockingcxx . . $ DlSatTester#useLazyBlocking(50ce9a9e25b4a850). ( void ) const { return tBoxcxx . . $ DlSatTester#tBox..useLazyBlockingcxx . . $ TBox#useLazyBlocking.; } |
| 354 | |
| 355 | /// reset all session flags |
| 356 | void resetSessionFlagscxx . . $ DlSatTester#resetSessionFlags(49f6e7a06ebc5aa8). ( void ); |
| 357 | |
| 358 | /// adds C to the labels of NODE; @return true iff clash occurs |
| 359 | bool addToDoEntrycxx . . $ DlSatTester#addToDoEntry(14ef716f111d87ae). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, const ConceptWDepcxx . . $ ConceptWDep#& C, const char* reason = nullptr ); |
| 360 | /// synonym to the above |
| 361 | bool addToDoEntrycxx . . $ DlSatTester#addToDoEntry(50176c0f88cf3d4f). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, BipolarPointercxx . . $ BipolarPointer# c, const DepSetcxx . . $ DepSet#& dep, const char* reason = nullptr ) |
| 362 | { return addToDoEntrycxx . . $ DlSatTester#addToDoEntry(14ef716f111d87ae). ( node, ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(12a183a495b39f91).(c,dep), reason ); } |
| 363 | /// insert C to the label of NODE; do necessary updates; may return Clash in case of data entry C |
| 364 | bool insertToDoEntrycxx . . $ DlSatTester#insertToDoEntry(47bd769b3ba2342c). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, const ConceptWDepcxx . . $ ConceptWDep#& C, DagTagcxx . . $ DagTag# tag, const char* reason ); |
| 365 | /// if something was added to cached node N, un- or re-cache it; @return result of re-cache |
| 366 | bool correctCachedEntrycxx . . $ DlSatTester#correctCachedEntry(4899fbe844c80f28). ( DlCompletionTreecxx . . $ DlCompletionTree#* n ); |
| 367 | |
| 368 | // CGraph-wide rules support |
| 369 | |
| 370 | /// @return true if node is valid for the reasoning |
| 371 | bool isNodeGloballyUsedcxx . . $ DlSatTester#isNodeGloballyUsed(e2c3b6f64f9879b7). ( const DlCompletionTreecxx . . $ DlCompletionTree#* node ) const |
| 372 | { return ! ( node->isDataNodecxx . . $ DlCompletionTree#isDataNode(50ce9a9e25b4a850).() || node->isIBlockedcxx . . $ DlCompletionTree#isIBlocked(50ce9a9e25b4a850).() || node->isPBlockedcxx . . $ DlCompletionTree#isPBlocked(50ce9a9e25b4a850).() ); } |
| 373 | /// @return true if node is valid for the reasoning |
| 374 | bool isObjectNodeUnblockedcxx . . $ DlSatTester#isObjectNodeUnblocked(e2c3b6f64f9879b7). ( const DlCompletionTreecxx . . $ DlCompletionTree#* node ) const |
| 375 | { return isNodeGloballyUsedcxx . . $ DlSatTester#isNodeGloballyUsed(e2c3b6f64f9879b7).(node) && !node->isDBlockedcxx . . $ DlCompletionTree#isDBlocked(50ce9a9e25b4a850).(); } |
| 376 | /// add C to a set of session GCIs; init all nodes with (C,dep) |
| 377 | bool addSessionGCIcxx . . $ DlSatTester#addSessionGCI(cbd92d0fb85c8e0). ( BipolarPointercxx . . $ BipolarPointer# C, const DepSetcxx . . $ DepSet#& dep ); |
| 378 | |
| 379 | |
| 380 | /// put TODO entry for either BP or inverse(BP) in NODE's label |
| 381 | void updateNamecxx . . $ DlSatTester#updateName(8eafcbdc06e60ab5). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, BipolarPointercxx . . $ BipolarPointer# bp ) |
| 382 | { |
| 383 | const CGLabelcxx . . $ CGLabel#& lab = node->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).(); |
| 384 | CGLabelcxx . . $ CGLabel#::const_iteratorcxx . . $ CGLabel#const_iterator# pcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(49f6e7a06ebc5aa8).; |
| 385 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). lab.begin_sccxx . . $ CGLabel#begin_sc(e55d760a93e9f197).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). lab.end_sccxx . . $ CGLabel#end_sc(e55d760a93e9f197).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 386 | if ( unlikelycxx . . $ ConceptWDep#bp(455f465bc33b4cdf). ( p->bp() == bp || p->bp() == inverse(bp) ) ) |
| 387 | { |
| 388 | addExistingToDoEntrycxx . . $ DlSatTester#addExistingToDoEntry(9ebb2e7de5f347be). ( node, lab.getSCOffsetcxx . . $ CGLabel#getSCOffset(f30316450779e1c3).(p), "sp" ); |
| 389 | break; |
| 390 | } |
| 391 | } |
| 392 | /// re-do every BP or inverse(BP) in labels of CGraph |
| 393 | void updateNamecxx . . $ DlSatTester#updateName(d4f767463ce0a6b3). ( BipolarPointercxx . . $ BipolarPointer# bp ) |
| 394 | { |
| 395 | for ( DlCompletionTreecxx . . $ DlCompletionTree#* node : CGraphcxx . . $ DlSatTester#CGraph. ) |
| 396 | if ( isNodeGloballyUsedcxx . . $ DlSatTester#isNodeGloballyUsed(e2c3b6f64f9879b7).(node) ) |
| 397 | updateNamecxx . . $ DlSatTester#updateName(8eafcbdc06e60ab5). ( node, bp ); |
| 398 | } |
| 399 | |
| 400 | // label access interface |
| 401 | |
| 402 | /// try to add a concept to a label given by TAG; ~C can't appear in the label |
| 403 | bool findConceptcxx . . $ DlSatTester#findConcept(887bff1c1e5f863e). ( const CWDArraycxx . . $ CWDArray#& lab, BipolarPointercxx . . $ BipolarPointer# bp ); |
| 404 | /// try to add a concept to a label given by TAG; ~C can't appear in the label |
| 405 | bool findConceptcxx . . $ DlSatTester#findConcept(baf284e062705c9d). ( const CWDArraycxx . . $ CWDArray#& lab, const ConceptWDepcxx . . $ ConceptWDep#& C ) { return findConceptcxx . . $ DlSatTester#findConcept(887bff1c1e5f863e). ( lab, C.bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).() ); } |
| 406 | /// try to add a concept to a label given by TAG; ~C can't appear in the label; setup clash-set if found |
| 407 | bool findConceptClashcxx . . $ DlSatTester#findConceptClash(770c5e45e3d3d307). ( const CWDArraycxx . . $ CWDArray#& lab, BipolarPointercxx . . $ BipolarPointer# bp, const DepSetcxx . . $ DepSet#& dep ); |
| 408 | /// try to add a concept to a label given by TAG; ~C can't appear in the label; setup clash-set if found |
| 409 | bool findConceptClashcxx . . $ DlSatTester#findConceptClash(baf284e062705c9d). ( const CWDArraycxx . . $ CWDArray#& lab, const ConceptWDepcxx . . $ ConceptWDep#& C ) { return findConceptClashcxx . . $ DlSatTester#findConceptClash(770c5e45e3d3d307). ( lab, C.bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).(), C.getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() ); } |
| 410 | /// check if it is possible to add a concept to a label given by TAG |
| 411 | addConceptResultcxx . . $ addConceptResult# checkAddedConceptcxx . . $ DlSatTester#checkAddedConcept(64ab7a30545240e0). ( const CWDArraycxx . . $ CWDArray#& lab, BipolarPointercxx . . $ BipolarPointer# bp, const DepSetcxx . . $ DepSet#& dep ); |
| 412 | /// check if C or ~C is already in LAB |
| 413 | addConceptResultcxx . . $ addConceptResult# tryAddConceptcxx . . $ DlSatTester#tryAddConcept(64ab7a30545240e0). ( const CWDArraycxx . . $ CWDArray#& lab, BipolarPointercxx . . $ BipolarPointer# bp, const DepSetcxx . . $ DepSet#& dep ); |
| 414 | |
| 415 | /** Adds ToDo entry which already exists in label of NODE. There is no need |
| 416 | to add entry to label, but it is necessary to provide offset of existing concept. |
| 417 | This is done by providing OFFSET of the concept in NODE's label |
| 418 | */ |
| 419 | void addExistingToDoEntrycxx . . $ DlSatTester#addExistingToDoEntry(9ebb2e7de5f347be). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, int offset, const char* reason = nullptr ) |
| 420 | { |
| 421 | const ConceptWDepcxx . . $ ConceptWDep#& C = node->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).().getConceptcxx . . $ CGLabel#getConcept(ea7a63ba58262a62).(offset); |
| 422 | auto bp = C.bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).(); |
| 423 | TODOcxx . . $ DlSatTester#TODO..addEntrycxx . . $ ToDoList#addEntry(6f2cfd92839f4348). ( node, DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).bp].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).(), bp, offset ); |
| 424 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 425 | logEntrycxx . . $ DlSatTester#logEntry(d13ce3616f4e8cf5). ( node, C, reason ); |
| 426 | } |
| 427 | /// add all elements from NODE label into TODO list |
| 428 | void redoNodeLabelcxx . . $ DlSatTester#redoNodeLabel(d88b49f725c82ece). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, const char* reason ) |
| 429 | { |
| 430 | const CGLabelcxx . . $ CGLabel#& lab = node->labelcxx . . $ DlCompletionTree#label(d7a009c437cd4657).(); |
| 431 | CGLabelcxx . . $ CGLabel#::const_iteratorcxx . . $ CGLabel#const_iterator# pcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(49f6e7a06ebc5aa8). { }; |
| 432 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). lab.begin_sccxx . . $ CGLabel#begin_sc(e55d760a93e9f197).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). lab.end_sccxx . . $ CGLabel#end_sc(e55d760a93e9f197).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 433 | addExistingToDoEntrycxx . . $ DlSatTester#addExistingToDoEntry(9ebb2e7de5f347be). ( node, lab.getSCOffsetcxx . . $ CGLabel#getSCOffset(f30316450779e1c3).(p), reason ); |
| 434 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(8a166801ba8fe87b). lab.begin_cccxx . . $ CGLabel#begin_cc(e55d760a93e9f197).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). lab.end_cccxx . . $ CGLabel#end_cc(e55d760a93e9f197).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 435 | addExistingToDoEntrycxx . . $ DlSatTester#addExistingToDoEntry(9ebb2e7de5f347be). ( node, lab.getCCOffsetcxx . . $ CGLabel#getCCOffset(f30316450779e1c3).(p), reason ); |
| 436 | } |
| 437 | |
| 438 | /// main reasoning function |
| 439 | bool checkSatisfiabilitycxx . . $ DlSatTester#checkSatisfiability(c9857a73d68e59ba). ( void ); |
| 440 | /// perform all the actions that should be done once, after all normal rules are not applicable. @return true if the concept is unsat |
| 441 | bool performAfterReasoningcxx . . $ DlSatTester#performAfterReasoning(c9857a73d68e59ba). ( void ); |
| 442 | /// make sure that the DAG does not grow larger than that was recorded |
| 443 | void ensureDAGSizecxx . . $ DlSatTester#ensureDAGSize(49f6e7a06ebc5aa8). ( void ) |
| 444 | { |
| 445 | if ( unlikelycxx . . $ DlSatTester#dagSize. ( dagSize < DLHeap.size() ) ) |
| 446 | { |
| 447 | dagSizecxx . . $ DlSatTester#dagSize. = DLHeapcxx . . $ DlSatTester#DLHeap..maxSizecxx . . $ DLDag#maxSize(fe4d2d262d4164a8).(); |
| 448 | pUsedcxx . . $ DlSatTester#pUsed..ensureMaxSetSizecxx . . $ TFastSet#ensureMaxSetSize(2c44cd906ae4e829).(dagSizecxx . . $ DlSatTester#dagSize.); |
| 449 | nUsedcxx . . $ DlSatTester#nUsed..ensureMaxSetSizecxx . . $ TFastSet#ensureMaxSetSize(2c44cd906ae4e829).(dagSizecxx . . $ DlSatTester#dagSize.); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | //----------------------------------------------------------------------------- |
| 454 | //-- internal cache support |
| 455 | //----------------------------------------------------------------------------- |
| 456 | |
| 457 | /// build cache suitable for classification |
| 458 | void prepareCascadedCachecxx . . $ DlSatTester#prepareCascadedCache(d4f767463ce0a6b3). ( BipolarPointercxx . . $ BipolarPointer# p ); |
| 459 | /// create cache for given DAG node bu building model; @return cache |
| 460 | modelCacheInterfacecxx . . $ modelCacheInterface#* buildCachecxx . . $ DlSatTester#buildCache(f17fff7e095f06bd). ( BipolarPointercxx . . $ BipolarPointer# p ); |
| 461 | /// return cache of given completion tree (implementation) |
| 462 | modelCacheInterfacecxx . . $ modelCacheInterface#* createModelCachecxx . . $ DlSatTester#createModelCache(3b43971eaa030b12). ( const DlCompletionTreecxx . . $ DlCompletionTree#* p ) const |
| 463 | { return new modelCacheIancxx . . $ modelCacheIan# ( DLHeapcxx . . $ DlSatTester#DLHeap., p, encounterNominalcxx . . $ DlSatTester#encounterNominal., tBoxcxx . . $ DlSatTester#tBox..nCcxx . . $ TBox#nC., tBoxcxx . . $ DlSatTester#tBox..nRcxx . . $ TBox#nR. ); } |
| 464 | |
| 465 | /// check whether given NODE can be cached |
| 466 | bool canBeCachedcxx . . $ DlSatTester#canBeCached(4899fbe844c80f28). ( DlCompletionTreecxx . . $ DlCompletionTree#* node ); |
| 467 | /// build cache of the node (it is known that caching is possible) in newNodeCache |
| 468 | void doCacheNodecxx . . $ DlSatTester#doCacheNode(3bf754c9a531d7e6). ( DlCompletionTreecxx . . $ DlCompletionTree#* node ); |
| 469 | /// mark NODE (un)cached depending on the joint cache STATUS; @return resulting status |
| 470 | modelCacheStatecxx . . $ modelCacheState# reportNodeCachedcxx . . $ DlSatTester#reportNodeCached(f00754d885c410ab). ( DlCompletionTreecxx . . $ DlCompletionTree#* node ); |
| 471 | /// check whether node may be (un)cached; save node if something is changed |
| 472 | modelCacheStatecxx . . $ modelCacheState# tryCacheNodecxx . . $ DlSatTester#tryCacheNode(f00754d885c410ab). ( DlCompletionTreecxx . . $ DlCompletionTree#* node ) |
| 473 | { |
| 474 | modelCacheStatecxx . . $ modelCacheState# ret = canBeCachedcxx . . $ DlSatTester#canBeCached(4899fbe844c80f28).(node) ? reportNodeCachedcxx . . $ DlSatTester#reportNodeCached(f00754d885c410ab).(node) : csFailedcxx . . $ csFailed.; |
| 475 | // node is cached if RET is csValid |
| 476 | CGraphcxx . . $ DlSatTester#CGraph..saveRareCondcxx . . $ DlCompletionGraph#saveRareCond(1cbbef85a2ba1293).(node->setCachedcxx . . $ DlCompletionTree#setCached(174567ded8c58c70).(ret == csValidcxx . . $ csValid.)); |
| 477 | return ret; |
| 478 | } |
| 479 | /// @return true iff cache status is invalid |
| 480 | static bool usageByStatecxx . . $ DlSatTester#usageByState(fcb1385b525cf1b). ( modelCacheStatecxx . . $ modelCacheState# status ) |
| 481 | { |
| 482 | return status == csInvalidcxx . . $ csInvalid.; |
| 483 | } |
| 484 | |
| 485 | //----------------------------------------------------------------------------- |
| 486 | //-- internal nominal reasoning interface |
| 487 | //----------------------------------------------------------------------------- |
| 488 | |
| 489 | /// check whether reasoning with nominals is performed |
| 490 | virtual bool hasNominalscxx . . $ DlSatTester#hasNominals(50ce9a9e25b4a850). ( void ) const { return false; } |
| 491 | |
| 492 | /// check satisfiability of task which is set-up |
| 493 | bool runSatcxx . . $ DlSatTester#runSat(c9857a73d68e59ba). ( void ); |
| 494 | |
| 495 | /* |
| 496 | * Tactics description; |
| 497 | * |
| 498 | * Each tactic represents (possibly combined) expansion rule for |
| 499 | * certain type of concept expression (parameter CUR). |
| 500 | * |
| 501 | * Each tactic returns: |
| 502 | * - true - if expansion of CUR lead to clash |
| 503 | * - false - otherwise |
| 504 | */ |
| 505 | |
| 506 | /// main calling method; wrapper for Body |
| 507 | bool commonTacticcxx . . $ DlSatTester#commonTactic(c9857a73d68e59ba). ( void ); |
| 508 | /// choose proper tactic based on type of a concept constructor |
| 509 | bool commonTacticBodycxx . . $ DlSatTester#commonTacticBody(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 510 | /// expansion rule for (non)primitive concept |
| 511 | bool commonTacticBodyIdcxx . . $ DlSatTester#commonTacticBodyId(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 512 | /// expansion rule for (non)primitive singleton concept |
| 513 | bool commonTacticBodySingletoncxx . . $ DlSatTester#commonTacticBodySingleton(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 514 | /// expansion rule for conjunction |
| 515 | bool commonTacticBodyAndcxx . . $ DlSatTester#commonTacticBodyAnd(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 516 | /// expansion rule for disjunction |
| 517 | bool commonTacticBodyOrcxx . . $ DlSatTester#commonTacticBodyOr(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 518 | /// expansion rule for general existential quantifier |
| 519 | bool commonTacticBodySomecxx . . $ DlSatTester#commonTacticBodySome(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 520 | /// expansion rule for existential quantifier in the form \ER{nom} |
| 521 | bool commonTacticBodyValuecxx . . $ DlSatTester#commonTacticBodyValue(4b2f14765f8633dd). ( const TRolecxx . . $ TRole#* R, const TIndividualcxx . . $ TIndividual#* nom ); |
| 522 | /// expansion rule for the existential quantifier with universal role |
| 523 | bool commonTacticBodySomeUnivcxx . . $ DlSatTester#commonTacticBodySomeUniv(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 524 | /// expansion rule for universal restriction |
| 525 | bool commonTacticBodyAllcxx . . $ DlSatTester#commonTacticBodyAll(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 526 | /// expansion rule for universal restriction with simple role using RA |
| 527 | bool commonTacticBodyAllSimplecxx . . $ DlSatTester#commonTacticBodyAllSimple(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 528 | /// expansion rule for universal restriction with non-simple role using RA |
| 529 | bool commonTacticBodyAllComplexcxx . . $ DlSatTester#commonTacticBodyAllComplex(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 530 | /// expansion rule for \E R{Self} |
| 531 | bool commonTacticBodySomeSelfcxx . . $ DlSatTester#commonTacticBodySomeSelf(f4c3e7633be50e77). ( const TRolecxx . . $ TRole#* R ); |
| 532 | /// expansion rule for \neg\E R{Self} |
| 533 | bool commonTacticBodyIrreflcxx . . $ DlSatTester#commonTacticBodyIrrefl(f4c3e7633be50e77). ( const TRolecxx . . $ TRole#* R ); |
| 534 | /// expansion rule for at-least number restriction |
| 535 | bool commonTacticBodyGEcxx . . $ DlSatTester#commonTacticBodyGE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 536 | /// expansion rule for at-most number restriction |
| 537 | bool commonTacticBodyLEcxx . . $ DlSatTester#commonTacticBodyLE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 538 | /// expansion rule for choose-rule |
| 539 | bool commonTacticBodyChoosecxx . . $ DlSatTester#commonTacticBodyChoose(dc9af82091734e92). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ); |
| 540 | /// expansion rule for functional restriction |
| 541 | bool commonTacticBodyFunccxx . . $ DlSatTester#commonTacticBodyFunc(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 542 | /// expansion rule for at-most restriction in nominal node (NN-rule) |
| 543 | bool commonTacticBodyNNcxx . . $ DlSatTester#commonTacticBodyNN(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 544 | /// expansion rule for auxiliary projection-construction |
| 545 | bool commonTacticBodyProjcxx . . $ DlSatTester#commonTacticBodyProj(61818a0a3dc494fb). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C, const TRolecxx . . $ TRole#* ProjR ); |
| 546 | |
| 547 | /// expansion rule for the functional restriction with top role |
| 548 | bool processTopRoleFunccxx . . $ DlSatTester#processTopRoleFunc(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 549 | /// expansion rule for the at-most restriction with top role |
| 550 | bool processTopRoleLEcxx . . $ DlSatTester#processTopRoleLE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 551 | /// expansion rule for the at-least restriction with top role |
| 552 | bool processTopRoleGEcxx . . $ DlSatTester#processTopRoleGE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 553 | |
| 554 | // support for inapplicable tactics |
| 555 | |
| 556 | /// @return true iff current node is i-blocked (ie, no expansion necessary) |
| 557 | bool isIBlockedcxx . . $ DlSatTester#isIBlocked(50ce9a9e25b4a850). ( void ) const { return curNodecxx . . $ DlSatTester#curNode.->isIBlockedcxx . . $ DlCompletionTree#isIBlocked(50ce9a9e25b4a850).(); } |
| 558 | /// @return true iff NN-rule wrt (<= R.C) is applicable to the curNode |
| 559 | bool isNNApplicablecxx . . $ DlSatTester#isNNApplicable(95e2d485c042ad5a). ( const TRolecxx . . $ TRole#* r, BipolarPointercxx . . $ BipolarPointer# C, BipolarPointercxx . . $ BipolarPointer# stopper ) const; |
| 560 | /// apply rule-like actions for the concept P |
| 561 | bool applyExtraRulescxx . . $ DlSatTester#applyExtraRules(15d44b555a30180e). ( const TConceptcxx . . $ TConcept#* p ); |
| 562 | /// apply rule-like actions for the concept P if necessary |
| 563 | inline |
| 564 | bool applyExtraRulesIfcxx . . $ DlSatTester#applyExtraRulesIf(15d44b555a30180e). ( const TConceptcxx . . $ TConcept#* p ) |
| 565 | { |
| 566 | if ( !p->hasExtraRulescxx . . $ TConcept#hasExtraRules(50ce9a9e25b4a850).() ) |
| 567 | return false; |
| 568 | fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`! ( p->isPrimitive() ); |
| 569 | return applyExtraRulescxx . . $ DlSatTester#applyExtraRules(15d44b555a30180e).(p); |
| 570 | } |
| 571 | |
| 572 | // support for choose-rule |
| 573 | |
| 574 | /// apply choose-rule for given range of edges |
| 575 | bool applyChooseRulecxx . . $ DlSatTester#applyChooseRule(313c71cfc95746d6). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, BipolarPointercxx . . $ BipolarPointer# C ); |
| 576 | |
| 577 | // support for creating/updating edge methods |
| 578 | |
| 579 | /// check whether current node is blocked |
| 580 | bool isCurNodeBlockedcxx . . $ DlSatTester#isCurNodeBlocked(c9857a73d68e59ba). ( void ); |
| 581 | /// apply all the generating rules for the (unblocked) current node |
| 582 | void applyAllGeneratingRulescxx . . $ DlSatTester#applyAllGeneratingRules(3bf754c9a531d7e6). ( DlCompletionTreecxx . . $ DlCompletionTree#* node ); |
| 583 | /// add C and T_G with given DEP-set to a NODE; @return DONE/CLASH |
| 584 | bool initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, const DepSetcxx . . $ DepSet#& dep, BipolarPointercxx . . $ BipolarPointer# C ); |
| 585 | /// apply reflexive roles to the (newly created) NODE with appropriate DEP; @return true for clash |
| 586 | bool applyReflexiveRolescxx . . $ DlSatTester#applyReflexiveRoles(9c3f4bbfaa7a98e6). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, const DepSetcxx . . $ DepSet#& dep ); |
| 587 | /// add necessary concepts to the NODE of the new edge, labelled with R |
| 588 | bool initHeadOfNewEdgecxx . . $ DlSatTester#initHeadOfNewEdge(d1200003e7ec4530). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, const TRolecxx . . $ TRole#* R, const DepSetcxx . . $ DepSet#& dep, const char* reason ); |
| 589 | |
| 590 | // support for existential-like rules |
| 591 | |
| 592 | /// @return true iff there is R-neighbour labelled with C |
| 593 | bool isSomeExistscxx . . $ DlSatTester#isSomeExists(e3f7d912c5a8ce7d). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ) const |
| 594 | { |
| 595 | if ( !isUsedcxx . . $ DlSatTester#isUsed(4a668f6de69bf818).(C) ) |
| 596 | return false; |
| 597 | const DlCompletionTreecxx . . $ DlCompletionTree#* where = curNodecxx . . $ DlSatTester#curNode.->isSomeApplicablecxx . . $ DlCompletionTree#isSomeApplicable(36354e590de20f49). ( R, C ); |
| 598 | if ( where != nullptr ) |
| 599 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llGTAcxx . . $ llGTA.) ) |
| 600 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " E(" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). R->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). where->getIdcxx . . $ DlCompletionTree#getId(ddd8539a2fcdd4ce).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). C <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 601 | return where != nullptr; |
| 602 | } |
| 603 | /// aux method for setting up new edge PA |
| 604 | bool setupEdgecxx . . $ DlSatTester#setupEdge(4031d85ce7510aa7). ( DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* pA, const DepSetcxx . . $ DepSet#& curDep, unsigned int redoFlags = 0 ); |
| 605 | /// aux method for creating new edge from curNode with given ROLE edge label and CONCEPT at the final label |
| 606 | bool createNewEdgecxx . . $ DlSatTester#createNewEdge(bffb270855f01a8f). ( const TRolecxx . . $ TRole#* Role, BipolarPointercxx . . $ BipolarPointer# Concept, unsigned int redoFlags ); |
| 607 | /// create new ROLE-neighbour with LEVEL to curNode; return edge to it |
| 608 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* createOneNeighbourcxx . . $ DlSatTester#createOneNeighbour(38b471ae92c362df). ( const TRolecxx . . $ TRole#* Role, const DepSetcxx . . $ DepSet#& dep, |
| 609 | CTNominalLevelcxx . . $ CTNominalLevel# level = BlockableLevelcxx . . $ BlockableLevel. ); |
| 610 | |
| 611 | // support for re-applying expansion rules for FORALL-like concepts in node label |
| 612 | |
| 613 | /** |
| 614 | apply AR.C in and <= nR (if needed) in NODE's label where R is label of arcSample. |
| 615 | Set of applicable concepts is defined by redoFlags value. |
| 616 | */ |
| 617 | bool applyUniversalNRcxx . . $ DlSatTester#applyUniversalNR(c075c0126f93693d). ( DlCompletionTreecxx . . $ DlCompletionTree#* Node, const DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* arcSample, |
| 618 | const DepSetcxx . . $ DepSet#& dep, unsigned int redoFlags ); |
| 619 | |
| 620 | // support for branching rules |
| 621 | |
| 622 | /// check if branching rule was called for the 1st time |
| 623 | bool isFirstBranchCallcxx . . $ DlSatTester#isFirstBranchCall(50ce9a9e25b4a850). ( void ) const { return bContextcxx . . $ DlSatTester#bContext. == nullptr; } |
| 624 | /// init branching context with given rule type |
| 625 | void initBCcxx . . $ DlSatTester#initBC(49f6e7a06ebc5aa8). ( void ) |
| 626 | { |
| 627 | // save reasoning context |
| 628 | bContextcxx . . $ DlSatTester#bContext.->curNodecxx . . $ BranchingContext#curNode. = curNodecxx . . $ DlSatTester#curNode.; |
| 629 | bContextcxx . . $ DlSatTester#bContext.->curConceptcxx . . $ BranchingContext#curConcept. =cxx . . $ ConceptWDep#`operator=`(53d048f7c804eb56). curConceptcxx . . $ DlSatTester#curConcept.; |
| 630 | bContextcxx . . $ DlSatTester#bContext.->branchDepcxx . . $ BranchingContext#branchDep. =cxx . . $ TDepSet#`operator=`(6a948e2ed08fa462). curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).(); |
| 631 | bContextcxx . . $ DlSatTester#bContext.->pUsedIndexcxx . . $ BranchingContext#pUsedIndex. = pUsedcxx . . $ DlSatTester#pUsed..sizecxx . . $ TFastSet#size(fe4d2d262d4164a8).(); |
| 632 | bContextcxx . . $ DlSatTester#bContext.->nUsedIndexcxx . . $ BranchingContext#nUsedIndex. = nUsedcxx . . $ DlSatTester#nUsed..sizecxx . . $ TFastSet#size(fe4d2d262d4164a8).(); |
| 633 | bContextcxx . . $ DlSatTester#bContext.->SGsizecxx . . $ BranchingContext#SGsize. = SessionGCIscxx . . $ DlSatTester#SessionGCIs..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).(); |
| 634 | } |
| 635 | /// clear branching context |
| 636 | void clearBCcxx . . $ DlSatTester#clearBC(49f6e7a06ebc5aa8). ( void ) { bContextcxx . . $ DlSatTester#bContext. = nullptr; } |
| 637 | |
| 638 | /// create BC for Or rule |
| 639 | void createBCOrcxx . . $ DlSatTester#createBCOr(49f6e7a06ebc5aa8). ( void ) { bContextcxx . . $ DlSatTester#bContext. = Stackcxx . . $ DlSatTester#Stack..pushOrcxx . . $ DlSatTester#BCStack#pushOr(2f2c093764250d56).(); initBCcxx . . $ DlSatTester#initBC(49f6e7a06ebc5aa8).(); } |
| 640 | /// create BC for NN-rule |
| 641 | void createBCNNcxx . . $ DlSatTester#createBCNN(49f6e7a06ebc5aa8). ( void ) { bContextcxx . . $ DlSatTester#bContext. = Stackcxx . . $ DlSatTester#Stack..pushNNcxx . . $ DlSatTester#BCStack#pushNN(2f2c093764250d56).(); initBCcxx . . $ DlSatTester#initBC(49f6e7a06ebc5aa8).(); } |
| 642 | /// create BC for LE-rule |
| 643 | void createBCLEcxx . . $ DlSatTester#createBCLE(49f6e7a06ebc5aa8). ( void ) { bContextcxx . . $ DlSatTester#bContext. = Stackcxx . . $ DlSatTester#Stack..pushLEcxx . . $ DlSatTester#BCStack#pushLE(2f2c093764250d56).(); initBCcxx . . $ DlSatTester#initBC(49f6e7a06ebc5aa8).(); } |
| 644 | /// create BC for LE-rule |
| 645 | void createBCTopLEcxx . . $ DlSatTester#createBCTopLE(49f6e7a06ebc5aa8). ( void ) { bContextcxx . . $ DlSatTester#bContext. = Stackcxx . . $ DlSatTester#Stack..pushTopLEcxx . . $ DlSatTester#BCStack#pushTopLE(2f2c093764250d56).(); initBCcxx . . $ DlSatTester#initBC(49f6e7a06ebc5aa8).(); } |
| 646 | /// create BC for Choose-rule |
| 647 | void createBCChcxx . . $ DlSatTester#createBCCh(49f6e7a06ebc5aa8). ( void ) { bContextcxx . . $ DlSatTester#bContext. = Stackcxx . . $ DlSatTester#Stack..pushChcxx . . $ DlSatTester#BCStack#pushCh(2f2c093764250d56).(); initBCcxx . . $ DlSatTester#initBC(49f6e7a06ebc5aa8).(); } |
| 648 | /// create BC for the barrier |
| 649 | void createBCBarriercxx . . $ DlSatTester#createBCBarrier(49f6e7a06ebc5aa8). ( void ) { bContextcxx . . $ DlSatTester#bContext. = Stackcxx . . $ DlSatTester#Stack..pushBarriercxx . . $ DlSatTester#BCStack#pushBarrier(2f2c093764250d56).(); initBCcxx . . $ DlSatTester#initBC(49f6e7a06ebc5aa8).(); } |
| 650 | |
| 651 | // support for disjunction |
| 652 | |
| 653 | /// Aux method for locating OR node characteristics; @return true if node is labelled by one of DJs |
| 654 | bool planOrProcessingcxx . . $ DlSatTester#planOrProcessing(161d161df85261e4). ( const DLVertexcxx . . $ DLVertex#& cur, DepSetcxx . . $ DepSet#& dep ); |
| 655 | /// aux method for disjunction processing |
| 656 | bool processOrEntrycxx . . $ DlSatTester#processOrEntry(c9857a73d68e59ba). ( void ); |
| 657 | |
| 658 | // support for (qualified) number restrictions |
| 659 | |
| 660 | /// create N R-neighbours of curNode with given Nominal LEVEL labelled with C |
| 661 | bool createDifferentNeighbourscxx . . $ DlSatTester#createDifferentNeighbours(57e1dd464b08be9). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C, const DepSetcxx . . $ DepSet#& dep, |
| 662 | unsigned int n, CTNominalLevelcxx . . $ CTNominalLevel# level ); |
| 663 | |
| 664 | /// check whether a node represents a functional one |
| 665 | static bool isFunctionalVertexcxx . . $ DlSatTester#isFunctionalVertex(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& v ) { return ( v.Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).() == dtLEcxx . . $ dtLE. && v.getNumberLEcxx . . $ DLVertex#getNumberLE(ddd8539a2fcdd4ce).() == 1 && v.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).() == bpTOPcxx . . $ bpTOP. ); } |
| 666 | /// check if ATLEAST and ATMOST entries are in clash. Both vertex MUST have dtLE type. |
| 667 | bool checkNRclashcxx . . $ DlSatTester#checkNRclash(17a20583008e8ff). ( const DLVertexcxx . . $ DLVertex#& atleast, const DLVertexcxx . . $ DLVertex#& atmost ) const |
| 668 | { // >= n R.C clash with <= m S.D iff... |
| 669 | return (atmost.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).() == bpTOPcxx . . $ bpTOP. || atleast.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).() == atmost.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).()) && // either D is TOP or C == D... |
| 670 | atleast.getNumberGEcxx . . $ DLVertex#getNumberGE(ddd8539a2fcdd4ce).() > atmost.getNumberLEcxx . . $ DLVertex#getNumberLE(ddd8539a2fcdd4ce).() && // and n is greater than m... |
| 671 | *atleast.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).() <=cxx . . $ TRole#`operator<=`(f855a32f4b5dce26). *atmost.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).(); // and R [= S |
| 672 | } |
| 673 | /// check if ATLEAST and ATMOST restrictions are in clash; setup depset from CUR |
| 674 | bool isNRClashcxx . . $ DlSatTester#isNRClash(8d4f16609c5957f). ( const DLVertexcxx . . $ DLVertex#& atleast, const DLVertexcxx . . $ DLVertex#& atmost, const ConceptWDepcxx . . $ ConceptWDep#& reason ); |
| 675 | /// quick check whether CURNODE has a clash with a given ATMOST restriction |
| 676 | bool isQuickClashLEcxx . . $ DlSatTester#isQuickClashLE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& atmost ) |
| 677 | { |
| 678 | for ( DlCompletionTreecxx . . $ DlCompletionTree#::const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator# q = curNodecxx . . $ DlSatTester#curNode.->beginl_cccxx . . $ DlCompletionTree#beginl_cc(e55d760a93e9f197).(), q_end = curNodecxx . . $ DlSatTester#curNode.->endl_cccxx . . $ DlCompletionTree#endl_cc(e55d760a93e9f197).(); q <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). q_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q ) |
| 679 | if ( isNegativecxx . . $ isNegative(83c267b20bac841a).(q->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) // need at-least restriction |
| 680 | && isNRClashcxx . . $ DlSatTester#isNRClash(8d4f16609c5957f). ( DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(b4043884e5934906).*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q], atmost, *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q ) ) |
| 681 | return true; |
| 682 | return false; |
| 683 | } |
| 684 | /// quick check whether CURNODE has a clash with a given ATLEAST restriction |
| 685 | bool isQuickClashGEcxx . . $ DlSatTester#isQuickClashGE(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& atleast ) |
| 686 | { |
| 687 | for ( DlCompletionTreecxx . . $ DlCompletionTree#::const_label_iteratorcxx . . $ DlCompletionTree#const_label_iterator# q = curNodecxx . . $ DlSatTester#curNode.->beginl_cccxx . . $ DlCompletionTree#beginl_cc(e55d760a93e9f197).(), q_end = curNodecxx . . $ DlSatTester#curNode.->endl_cccxx . . $ DlCompletionTree#endl_cc(e55d760a93e9f197).(); q <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). q_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q ) |
| 688 | if ( isPositivecxx . . $ isPositive(83c267b20bac841a).(q->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).()) // need at-most restriction |
| 689 | && isNRClashcxx . . $ DlSatTester#isNRClash(8d4f16609c5957f). ( atleast, DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(b4043884e5934906).*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q], *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q ) ) |
| 690 | return true; |
| 691 | return false; |
| 692 | } |
| 693 | /// init the LE processing (fill in the EdgesToMerge); @return true if the CR is satisfied |
| 694 | bool initLEProcessingcxx . . $ DlSatTester#initLEProcessing(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 695 | /// init the LE processing for the TopRole (fill in the NodesToMerge); @return true if the CR is satisfied |
| 696 | bool initTopLEProcessingcxx . . $ DlSatTester#initTopLEProcessing(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ); |
| 697 | |
| 698 | /// aux method that fills the dep-set for either C or ~C found in the label; @return whether C was found |
| 699 | bool findChooseRuleConceptcxx . . $ DlSatTester#findChooseRuleConcept(1f424839d3fe8655). ( const CWDArraycxx . . $ CWDArray#& label, BipolarPointercxx . . $ BipolarPointer# C, DepSetcxx . . $ DepSet#& Dep ) |
| 700 | { |
| 701 | if ( C == bpTOPcxx . . $ bpTOP. ) |
| 702 | return true; |
| 703 | if ( findConceptClashcxx . . $ DlSatTester#findConceptClash(770c5e45e3d3d307). ( label, C, Dep ) ) |
| 704 | { |
| 705 | Dep.addcxx . . $ TDepSet#add(d0e32107376501c0).(getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).()); |
| 706 | return true; |
| 707 | } |
| 708 | else if ( findConceptClashcxx . . $ DlSatTester#findConceptClash(770c5e45e3d3d307). ( label, inversecxx . . $ inverse(7864480464b09eea).(C), Dep ) ) |
| 709 | { |
| 710 | Dep.addcxx . . $ TDepSet#add(d0e32107376501c0).(getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).()); |
| 711 | return false; |
| 712 | } |
| 713 | else |
| 714 | fpp_unreachablecxx . . $ EFPPAssertion#(); |
| 715 | } |
| 716 | /// apply choose-rule for all vertices (necessary for Top role in QCR) |
| 717 | bool applyChooseRuleGloballycxx . . $ DlSatTester#applyChooseRuleGlobally(83c267b20bac841a). ( BipolarPointercxx . . $ BipolarPointer# C ); |
| 718 | /// aux method which fills EdgesToMerge with *different* ROLE-neighbours of curNode |
| 719 | void findNeighbourscxx . . $ DlSatTester#findNeighbours(64c329be3c32769c). ( const TRolecxx . . $ TRole#* Role, BipolarPointercxx . . $ BipolarPointer# C, DepSetcxx . . $ DepSet#& Dep ); |
| 720 | /// the same but for universal role |
| 721 | void findCLabelledNodescxx . . $ DlSatTester#findCLabelledNodes(cfc3f78a9b546f1d). ( BipolarPointercxx . . $ BipolarPointer# C, DepSetcxx . . $ DepSet#& Dep ); |
| 722 | /// aux method that checks whether clash occurs during the merge of labels |
| 723 | bool checkMergeClashcxx . . $ DlSatTester#checkMergeClash(8f3204f21abf4ab4). ( const CGLabelcxx . . $ CGLabel#& from, const CGLabelcxx . . $ CGLabel#& to, const DepSetcxx . . $ DepSet#& dep, unsigned int nodeId ); |
| 724 | /// aux method that merge FROM label to the TO node with an appropriate dep-set |
| 725 | bool mergeLabelscxx . . $ DlSatTester#mergeLabels(eda12b98be57c15d). ( const CGLabelcxx . . $ CGLabel#& from, DlCompletionTreecxx . . $ DlCompletionTree#* to, const DepSetcxx . . $ DepSet#& dep ); |
| 726 | /// merge FROM node into TO node with additional dep-set DEPF |
| 727 | bool Mergecxx . . $ DlSatTester#Merge(9805cd4076885613). ( DlCompletionTreecxx . . $ DlCompletionTree#* from, DlCompletionTreecxx . . $ DlCompletionTree#* to, const DepSetcxx . . $ DepSet#& depF ); |
| 728 | /// check whether clash occurs due to new edge from FROM to TO labelled with R |
| 729 | bool checkDisjointRoleClashcxx . . $ DlSatTester#checkDisjointRoleClash(e9490775c569687e). ( const DlCompletionTreecxx . . $ DlCompletionTree#* from, const DlCompletionTreecxx . . $ DlCompletionTree#* to, |
| 730 | const TRolecxx . . $ TRole#* R, const DepSetcxx . . $ DepSet#& dep ); |
| 731 | /// check whether clash occurs EDGE to TO labelled with S disjoint with R |
| 732 | bool checkDisjointRoleClashcxx . . $ DlSatTester#checkDisjointRoleClash(22c7de14146f1c24). ( const DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* edge, const DlCompletionTreecxx . . $ DlCompletionTree#* to, |
| 733 | const TRolecxx . . $ TRole#* R, const DepSetcxx . . $ DepSet#& dep ) |
| 734 | { // clash found |
| 735 | if ( edge->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).() == to && edge->getRolecxx . . $ DlCompletionTreeArc#getRole(69f26110a94b259f).()->isDisjointcxx . . $ TRole#isDisjoint(81d69a9c8508a392).(R) ) |
| 736 | { |
| 737 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(dep); |
| 738 | updateClashSetcxx . . $ DlSatTester#updateClashSet(d0e32107376501c0).(edge->getDepcxx . . $ DlCompletionTreeArc#getDep(bce6462a16d96b29).()); |
| 739 | return true; |
| 740 | } |
| 741 | return false; |
| 742 | } |
| 743 | |
| 744 | // support for FORALL expansion |
| 745 | |
| 746 | /** Perform expansion of (\neg \ER.Self).DEP to an EDGE */ |
| 747 | bool checkIrreflexivitycxx . . $ DlSatTester#checkIrreflexivity(cfccf941f2df725f). ( const DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* edge, |
| 748 | const TRolecxx . . $ TRole#* R, const DepSetcxx . . $ DepSet#& dep ) |
| 749 | { |
| 750 | // only loops counts here... |
| 751 | if ( edge->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).() != edge->getReversecxx . . $ DlCompletionTreeArc#getReverse(96bc8dcf80af44db).()->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).() ) |
| 752 | return false; |
| 753 | // which are labelled either with R or with R- |
| 754 | if ( !edge->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392).(R) && !edge->isNeighbourcxx . . $ DlCompletionTreeArc#isNeighbour(81d69a9c8508a392).(R->inversecxx . . $ TRole#inverse(69f26110a94b259f).()) ) |
| 755 | return false; |
| 756 | |
| 757 | // set up clash |
| 758 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(dep); |
| 759 | updateClashSetcxx . . $ DlSatTester#updateClashSet(d0e32107376501c0).(edge->getDepcxx . . $ DlCompletionTreeArc#getDep(bce6462a16d96b29).()); |
| 760 | return true; |
| 761 | } |
| 762 | |
| 763 | /** Perform expansion of (C=\AR{0}.X).DEP wrt RST to an EDGE with a given reason */ |
| 764 | bool applyTransitionscxx . . $ DlSatTester#applyTransitions(f4a06eb45cd3fe17). ( const DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* edge, const RAStateTransitionscxx . . $ RAStateTransitions#& RST, |
| 765 | BipolarPointercxx . . $ BipolarPointer# C, const DepSetcxx . . $ DepSet#& dep, const char* reason = nullptr ); |
| 766 | |
| 767 | // support for the projection |
| 768 | |
| 769 | /// apply projection to given edge if necessary |
| 770 | bool checkProjectioncxx . . $ DlSatTester#checkProjection(9b792ef1469f2519). ( DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* pA, BipolarPointercxx . . $ BipolarPointer# C, const TRolecxx . . $ TRole#* ProjR ); |
| 771 | |
| 772 | // datatype staff |
| 773 | |
| 774 | /// @return true iff given data node contains inconsistent data constraints |
| 775 | bool hasDataClashcxx . . $ DlSatTester#hasDataClash(6c1e73ffdfd78b24). ( const DlCompletionTreecxx . . $ DlCompletionTree#* node ); |
| 776 | /// @return true iff given data node contains inconsistent data constraints |
| 777 | bool checkDataClashcxx . . $ DlSatTester#checkDataClash(6c1e73ffdfd78b24). ( const DlCompletionTreecxx . . $ DlCompletionTree#* node ) |
| 778 | { |
| 779 | if ( hasDataClashcxx . . $ DlSatTester#hasDataClash(6c1e73ffdfd78b24).(node) ) |
| 780 | { |
| 781 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(DTReasonercxx . . $ DlSatTester#DTReasoner..getClashSetcxx . . $ DataTypeReasoner#getClashSet(bce6462a16d96b29).()); |
| 782 | return true; |
| 783 | } |
| 784 | else |
| 785 | return false; |
| 786 | } |
| 787 | |
| 788 | // logging actions |
| 789 | |
| 790 | /// log indentation |
| 791 | void logIndentationcxx . . $ DlSatTester#logIndentation(83f5f38750778ac8). ( void ) const; |
| 792 | /// log start of processing of a ToDo entry |
| 793 | void logStartEntrycxx . . $ DlSatTester#logStartEntry(83f5f38750778ac8). ( void ) const; |
| 794 | /// log finish of processing of a ToDo entry |
| 795 | void logFinishEntrycxx . . $ DlSatTester#logFinishEntry(a85845bc2b7828e2). ( bool res ) const; |
| 796 | /// log the result of processing ACTION with entry (N,C{DEP})/REASON |
| 797 | void logNCEntrycxx . . $ DlSatTester#logNCEntry(211754774cf273d0). ( const DlCompletionTreecxx . . $ DlCompletionTree#* n, const ConceptWDepcxx . . $ ConceptWDep#& C, |
| 798 | const char* action, const char* reason ) const |
| 799 | { |
| 800 | CHECK_LL_RETURNcxx . . $ llGTA.(llGTA); // useless, but safe |
| 801 | |
| 802 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). action <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "("; |
| 803 | n->logNodecxx . . $ DlCompletionTree#logNode(83f5f38750778ac8).(); |
| 804 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). C.bpcxx . . $ ConceptWDep#bp(455f465bc33b4cdf).() <<cxx . . $ `operator<<`(8df530197ee94a2e). C.getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 805 | if ( reason ) |
| 806 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). reason; |
| 807 | } |
| 808 | /// log addition of the entry to ToDo list |
| 809 | void logEntrycxx . . $ DlSatTester#logEntry(d13ce3616f4e8cf5). ( const DlCompletionTreecxx . . $ DlCompletionTree#* n, const ConceptWDepcxx . . $ ConceptWDep#& C, const char* reason ) const |
| 810 | { logNCEntrycxx . . $ DlSatTester#logNCEntry(211754774cf273d0). ( n, C, "+", reason ); } |
| 811 | /// log clash happened during node processing |
| 812 | void logClashcxx . . $ DlSatTester#logClash(a520327312b37f83). ( const DlCompletionTreecxx . . $ DlCompletionTree#* n, const ConceptWDepcxx . . $ ConceptWDep#& C ) const |
| 813 | { logNCEntrycxx . . $ DlSatTester#logNCEntry(211754774cf273d0). ( n, C, "x", DLHeapcxx . . $ DlSatTester#DLHeap.[cxx . . $ DLDag#`operator[]`(b4043884e5934906).C].getTagNamecxx . . $ DLVertex#getTagName(a9f41ea0e82d88cf).() ); } |
| 814 | /// write root subtree of CG with given LEVEL |
| 815 | void writeRootcxx . . $ DlSatTester#writeRoot(cb2f890c2fdad230). ( unsigned int level ) |
| 816 | { |
| 817 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(level) ) |
| 818 | CGraphcxx . . $ DlSatTester#CGraph..Printcxx . . $ DlCompletionGraph#Print(f7f45734e6842120).(LLcxx . . $ LL.); |
| 819 | } |
| 820 | |
| 821 | /// merge session statistics to the global one |
| 822 | void finaliseStatisticcxx . . $ DlSatTester#finaliseStatistic(49f6e7a06ebc5aa8). ( void ); |
| 823 | /// write down statistics wrt LOCAL flag |
| 824 | void logStatisticDatacxx . . $ DlSatTester#logStatisticData(25a4e5f405a65361). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o, bool needLocal ) const; |
| 825 | |
| 826 | // save/restore methods |
| 827 | |
| 828 | /// restore local state from current branching context |
| 829 | void restoreBCcxx . . $ DlSatTester#restoreBC(49f6e7a06ebc5aa8). ( void ); |
| 830 | /// use this method in ALL dependency stuff (never use tryLevel directly) |
| 831 | unsigned int getCurLevelcxx . . $ DlSatTester#getCurLevel(ddd8539a2fcdd4ce). ( void ) const { return tryLevelcxx . . $ DlSatTester#tryLevel.; } |
| 832 | /// set new branching level (never use tryLevel directly) |
| 833 | void setCurLevelcxx . . $ DlSatTester#setCurLevel(cb2f890c2fdad230). ( unsigned int level ) { tryLevelcxx . . $ DlSatTester#tryLevel. = level; } |
| 834 | /// @return true if no branching ops were applied during reasoners; FIXME!! doesn't work properly with a nominal cloud |
| 835 | bool noBranchingOpscxx . . $ DlSatTester#noBranchingOps(50ce9a9e25b4a850). ( void ) const { return tryLevelcxx . . $ DlSatTester#tryLevel. == InitBranchingLevelValuecxx . . $ InitBranchingLevelValue. + nonDetShiftcxx . . $ DlSatTester#nonDetShift.; } |
| 836 | /// Get save/restore level based on either current- or DS level |
| 837 | unsigned int getSaveRestoreLevelcxx . . $ DlSatTester#getSaveRestoreLevel(7fd325710fe62907). ( const DepSetcxx . . $ DepSet#& ds ) const |
| 838 | { |
| 839 | // FIXME!!! see more precise it later |
| 840 | if ( RKG_USE_DYNAMIC_BACKJUMPINGcxx . . $ `Kernel/globaldef.h:52:10`! ) |
| 841 | return ds.levelcxx . . $ TDepSet#level(ddd8539a2fcdd4ce).()+1; |
| 842 | else |
| 843 | return getCurLevelcxx . . $ DlSatTester#getCurLevel(ddd8539a2fcdd4ce).(); |
| 844 | } |
| 845 | /// save current reasoning state |
| 846 | void savecxx . . $ DlSatTester#save(49f6e7a06ebc5aa8). ( void ); |
| 847 | /// restore reasoning state to the latest saved position |
| 848 | void restorecxx . . $ DlSatTester#restore(49f6e7a06ebc5aa8). ( void ) { return restorecxx . . $ DlSatTester#restore(cb2f890c2fdad230).(getCurLevelcxx . . $ DlSatTester#getCurLevel(ddd8539a2fcdd4ce).()-1); } |
| 849 | /// restore reasoning state to the NEWTRYLEVEL position |
| 850 | void restorecxx . . $ DlSatTester#restore(cb2f890c2fdad230). ( unsigned int newTryLevel ); |
| 851 | /// update level in N node and save it's state (if necessary) |
| 852 | void updateLevelcxx . . $ DlSatTester#updateLevel(745f507b4f58d579). ( DlCompletionTreecxx . . $ DlCompletionTree#* n, const DepSetcxx . . $ DepSet#& ds ) { CGraphcxx . . $ DlSatTester#CGraph..saveNodecxx . . $ DlCompletionGraph#saveNode(aa3cbc006cb08887). ( n, getSaveRestoreLevelcxx . . $ DlSatTester#getSaveRestoreLevel(7fd325710fe62907).(ds) ); } |
| 853 | /// finalize branching OP processing making deterministic op |
| 854 | void determiniseBranchingOpcxx . . $ DlSatTester#determiniseBranchingOp(49f6e7a06ebc5aa8). ( void ) |
| 855 | { |
| 856 | clearBCcxx . . $ DlSatTester#clearBC(49f6e7a06ebc5aa8).(); // clear context for the next branching op |
| 857 | Stackcxx . . $ DlSatTester#Stack..popcxx . . $ TSaveStack#pop(155dc7f103cdb9db).(); // remove unnecessary context from the stack |
| 858 | } |
| 859 | |
| 860 | // access to global clashset, which contains result of clash during label addition |
| 861 | |
| 862 | /// get value of global dep-set |
| 863 | const DepSetcxx . . $ DepSet#& getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29). ( void ) const { return clashSetcxx . . $ DlSatTester#clashSet.; } |
| 864 | /// set value of global dep-set to D |
| 865 | void setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0). ( const DepSetcxx . . $ DepSet#& d ) { clashSetcxx . . $ DlSatTester#clashSet. =cxx . . $ TDepSet#`operator=`(6a948e2ed08fa462). d; } |
| 866 | /// add D to global dep-set |
| 867 | void updateClashSetcxx . . $ DlSatTester#updateClashSet(d0e32107376501c0). ( const DepSetcxx . . $ DepSet#& d ) { clashSetcxx . . $ DlSatTester#clashSet..addcxx . . $ TDepSet#add(d0e32107376501c0).(d); } |
| 868 | /// get dep-set wrt current level |
| 869 | DepSetcxx . . $ DepSet# getCurDepSetcxx . . $ DlSatTester#getCurDepSet(6e9566718b894103). ( void ) const { return DepSetcxx . . $ DepSet#(Managercxx . . $ DlSatTester#Manager..getcxx . . $ TDepSetManager#get(2aaa63506cec10d9).(getCurLevelcxx . . $ DlSatTester#getCurLevel(ddd8539a2fcdd4ce).()-1)); } |
| 870 | |
| 871 | /// get RW access to current branching dep-set |
| 872 | DepSetcxx . . $ DepSet#& getBranchDepcxx . . $ DlSatTester#getBranchDep(595707e528a7237f). ( void ) { return bContextcxx . . $ DlSatTester#bContext.->branchDepcxx . . $ BranchingContext#branchDep.; } |
| 873 | /// get RO access to current branching dep-set |
| 874 | const DepSetcxx . . $ DepSet#& getBranchDepcxx . . $ DlSatTester#getBranchDep(bce6462a16d96b29). ( void ) const { return bContextcxx . . $ DlSatTester#bContext.->branchDepcxx . . $ BranchingContext#branchDep.; } |
| 875 | /// prepare cumulative dep-set to usage |
| 876 | void prepareBranchDepcxx . . $ DlSatTester#prepareBranchDep(49f6e7a06ebc5aa8). ( void ) { getBranchDepcxx . . $ DlSatTester#getBranchDep(595707e528a7237f).().restrictcxx . . $ TDepSet#restrict(cb2f890c2fdad230).(getCurLevelcxx . . $ DlSatTester#getCurLevel(ddd8539a2fcdd4ce).()); } |
| 877 | /// prepare cumulative dep-set and copy it to the general clash-set |
| 878 | void useBranchDepcxx . . $ DlSatTester#useBranchDep(49f6e7a06ebc5aa8). ( void ) |
| 879 | { |
| 880 | prepareBranchDepcxx . . $ DlSatTester#prepareBranchDep(49f6e7a06ebc5aa8).(); |
| 881 | setClashSetcxx . . $ DlSatTester#setClashSet(d0e32107376501c0).(getBranchDepcxx . . $ DlSatTester#getBranchDep(595707e528a7237f).()); |
| 882 | } |
| 883 | /// update cumulative branch-dep with current clash-set and move options forward |
| 884 | void nextBranchingOptioncxx . . $ DlSatTester#nextBranchingOption(49f6e7a06ebc5aa8). ( void ) |
| 885 | { |
| 886 | getBranchDepcxx . . $ DlSatTester#getBranchDep(595707e528a7237f).().addcxx . . $ TDepSet#add(d0e32107376501c0).(getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).()); |
| 887 | bContextcxx . . $ DlSatTester#bContext.->nextOptioncxx . . $ BranchingContext#nextOption(49f6e7a06ebc5aa8).(); |
| 888 | } |
| 889 | |
| 890 | /// restore one level (no backjumping) |
| 891 | bool straightforwardRestorecxx . . $ DlSatTester#straightforwardRestore(c9857a73d68e59ba). ( void ); |
| 892 | /// restore if backjumping is used |
| 893 | bool backJumpedRestorecxx . . $ DlSatTester#backJumpedRestore(c9857a73d68e59ba). ( void ); |
| 894 | /// restore state based on usedBackjumping flag |
| 895 | bool tunedRestorecxx . . $ DlSatTester#tunedRestore(c9857a73d68e59ba). ( void ); |
| 896 | |
| 897 | /// check if P was used during current reasoning session |
| 898 | bool isUsedcxx . . $ DlSatTester#isUsed(4a668f6de69bf818). ( BipolarPointercxx . . $ BipolarPointer# p ) const { return ( isPositivecxx . . $ isPositive(83c267b20bac841a).(p) ? pUsedcxx . . $ DlSatTester#pUsed. : nUsedcxx . . $ DlSatTester#nUsed. ).incxx . . $ TFastSet#in(8877ebe272b9620d).(getValuecxx . . $ getValue(46cc46841198e427).(p)); } |
| 899 | /// set P as a used during current reasoning |
| 900 | void setUsedcxx . . $ DlSatTester#setUsed(d4f767463ce0a6b3). ( BipolarPointercxx . . $ BipolarPointer# p ) { ( isPositivecxx . . $ isPositive(83c267b20bac841a).(p) ? pUsedcxx . . $ DlSatTester#pUsed. : nUsedcxx . . $ DlSatTester#nUsed. ).addcxx . . $ TFastSet#add(77d9f17553126ecb).(getValuecxx . . $ getValue(46cc46841198e427).(p)); } |
| 901 | |
| 902 | public: // rule's support |
| 903 | /// @return true if the rule is applicable; set the dep-set accordingly |
| 904 | bool applicablecxx . . $ DlSatTester#applicable(960c6c35cf19a11a). ( const TBoxcxx . . $ TBox#::TSimpleRulecxx . . $ TBox#TSimpleRule#& rule ); |
| 905 | |
| 906 | public: // blocking support |
| 907 | /// re-apply all the relevant expansion rules to a given unblocked NODE |
| 908 | void repeatUnblockedNodecxx . . $ DlSatTester#repeatUnblockedNode(b0d9ee120534554a). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, bool direct ) |
| 909 | { |
| 910 | if ( direct ) // not blocked -- clear blocked cache |
| 911 | applyAllGeneratingRulescxx . . $ DlSatTester#applyAllGeneratingRules(3bf754c9a531d7e6).(node); // re-apply all the generating rules |
| 912 | else |
| 913 | redoNodeLabelcxx . . $ DlSatTester#redoNodeLabel(d88b49f725c82ece). ( node, "ubi" ); |
| 914 | } |
| 915 | |
| 916 | /// get access to the DAG associated with it (necessary for the blocking support) |
| 917 | const DLDagcxx . . $ DLDag#& getDAGcxx . . $ DlSatTester#getDAG(9e19445b34a9809a). ( void ) const { return tBoxcxx . . $ DlSatTester#tBox..DLHeapcxx . . $ TBox#DLHeap.; } |
| 918 | |
| 919 | public: |
| 920 | /// c'tor |
| 921 | explicit DlSatTestercxx . . $ DlSatTester#DlSatTester(8683a8a7d2fb73f). ( TBoxcxx . . $ TBox#& tbox ); |
| 922 | /// no copy c'tor |
| 923 | DlSatTestercxx . . $ DlSatTester#DlSatTester(c03bdb203e91a11f). ( const DlSatTestercxx . . $ DlSatTester#& ) = delete; |
| 924 | /// no assignment |
| 925 | DlSatTestercxx . . $ DlSatTester#& operatorcxx . . $ DlSatTester#`operator=`(f99575d6748b1e4c). = ( const DlSatTestercxx . . $ DlSatTester#& ) = delete; |
| 926 | /// d'tor |
| 927 | virtual ~cxx . . $ DlSatTester#`~DlSatTester`(49f6e7a06ebc5aa8).DlSatTestercxx . . $ DlSatTester#() = default; |
| 928 | |
| 929 | /// prepare reasoner to a new run |
| 930 | virtual void prepareReasonercxx . . $ DlSatTester#prepareReasoner(49f6e7a06ebc5aa8). ( void ); |
| 931 | /// set-up satisfiability task for given pointers and run runSat on it |
| 932 | bool runSatcxx . . $ DlSatTester#runSat(cf9ef193275fa6d8). ( BipolarPointercxx . . $ BipolarPointer# p, BipolarPointercxx . . $ BipolarPointer# q = bpTOPcxx . . $ bpTOP. ); |
| 933 | /// set-up role disjointness task for given roles and run SAT test |
| 934 | bool checkDisjointRolescxx . . $ DlSatTester#checkDisjointRoles(ee962dbb2fa027b9). ( const TRolecxx . . $ TRole#* R, const TRolecxx . . $ TRole#* S ); |
| 935 | /// set-up role irreflexivity task for R and run SAT test |
| 936 | bool checkIrreflexivitycxx . . $ DlSatTester#checkIrreflexivity(f4c3e7633be50e77). ( const TRolecxx . . $ TRole#* R ); |
| 937 | |
| 938 | /// get the ROOT node of the completion graph |
| 939 | const DlCompletionTreecxx . . $ DlCompletionTree#* getRootNodecxx . . $ DlSatTester#getRootNode(19e040716207bced). ( void ) const { return CGraphcxx . . $ DlSatTester#CGraph..getRootcxx . . $ DlCompletionGraph#getRoot(19e040716207bced).(); } |
| 940 | |
| 941 | /// set blocking method for a session |
| 942 | void setBlockingMethodcxx . . $ DlSatTester#setBlockingMethod(b0b38cda41d4ede4). ( bool hasInverse, bool hasQCR ) { CGraphcxx . . $ DlSatTester#CGraph..setBlockingMethodcxx . . $ DlCompletionGraph#setBlockingMethod(b0b38cda41d4ede4). ( hasInverse, hasQCR ); } |
| 943 | |
| 944 | /// build cache entry for given DAG node, using cascaded schema; @return cache |
| 945 | const modelCacheInterfacecxx . . $ modelCacheInterface#* createCachecxx . . $ DlSatTester#createCache(b3d3cd5834c92364). ( BipolarPointercxx . . $ BipolarPointer# p ); |
| 946 | /// create model cache for the just-classified entry |
| 947 | modelCacheInterfacecxx . . $ modelCacheInterface#* buildCacheByCGraphcxx . . $ DlSatTester#buildCacheByCGraph(b0360ae62ba10694). ( bool sat ) const |
| 948 | { |
| 949 | if ( sat ) // here we need actual (not a p-blocked) root of the tree |
| 950 | return createModelCachecxx . . $ DlSatTester#createModelCache(3b43971eaa030b12).(getRootNodecxx . . $ DlSatTester#getRootNode(19e040716207bced).()); |
| 951 | else // unsat => cache is just bottom |
| 952 | return createConstCachecxx . . $ createConstCache(b04ec3060c58d05c).(bpBOTTOMcxx . . $ bpBOTTOM.); |
| 953 | } |
| 954 | |
| 955 | void writeTotalStatisticcxx . . $ DlSatTester#writeTotalStatistic(f7f45734e6842120). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) |
| 956 | { |
| 957 | # ifdef USE_REASONING_STATISTICS |
| 958 | AccumulatedStatistic::accumulateAll(); // ensure that the last reasoning results are in |
| 959 | logStatisticData ( o, /*needLocal=*/false ); |
| 960 | # endif |
| 961 | printBlockingStatcxx . . $ `Kernel/dlCompletionTree.h:48:10`! (o); |
| 962 | clearBlockingStatcxx . . $ `Kernel/dlCompletionTree.h:49:10`!(); |
| 963 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 964 | } |
| 965 | |
| 966 | /// print SAT/SUB timings to O; @return total time spend during reasoning |
| 967 | float printReasoningTimecxx . . $ DlSatTester#printReasoningTime(aa6fa99658f404e2). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const; |
| 968 | }; // DlSatTester |
| 969 | |
| 970 | // implementation |
| 971 | |
| 972 | inline void DlSatTestercxx . . $ DlSatTester# :: resetSessionFlagscxx . . $ DlSatTester#resetSessionFlags(49f6e7a06ebc5aa8). ( void ) |
| 973 | { |
| 974 | // reflect possible change of DAG size |
| 975 | ensureDAGSizecxx . . $ DlSatTester#ensureDAGSize(49f6e7a06ebc5aa8).(); |
| 976 | |
| 977 | setUsedcxx . . $ DlSatTester#setUsed(d4f767463ce0a6b3).(bpTOPcxx . . $ bpTOP.); |
| 978 | setUsedcxx . . $ DlSatTester#setUsed(d4f767463ce0a6b3).(bpBOTTOMcxx . . $ bpBOTTOM.); |
| 979 | |
| 980 | encounterNominalcxx . . $ DlSatTester#encounterNominal. = false; |
| 981 | checkDataNodecxx . . $ DlSatTester#checkDataNode. = true; |
| 982 | } |
| 983 | |
| 984 | inline bool |
| 985 | DlSatTestercxx . . $ DlSatTester# :: initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( DlCompletionTreecxx . . $ DlCompletionTree#* node, const DepSetcxx . . $ DepSet#& dep, BipolarPointercxx . . $ BipolarPointer# C ) |
| 986 | { |
| 987 | if ( node->isDataNodecxx . . $ DlCompletionTree#isDataNode(50ce9a9e25b4a850).() ) // creating new data node -- do data check once in the end |
| 988 | checkDataNodecxx . . $ DlSatTester#checkDataNode. = false; |
| 989 | node->setInitcxx . . $ DlCompletionTree#setInit(d4f767463ce0a6b3).(C); |
| 990 | if ( unlikelycxx . . $ DlSatTester#addToDoEntry(50176c0f88cf3d4f). ( addToDoEntry ( node, C, dep ) ) ) |
| 991 | return true; |
| 992 | if ( node->isDataNodecxx . . $ DlCompletionTree#isDataNode(50ce9a9e25b4a850).() ) |
| 993 | return false; |
| 994 | if ( unlikelycxx . . $ TBox#getTG(455f465bc33b4cdf). ( addToDoEntry ( node, tBox.getTG(), dep ) ) ) |
| 995 | return true; |
| 996 | if ( unlikelycxx . . $ DlSatTester#GCIs. ( GCIs.isReflexive() && applyReflexiveRoles ( node, dep ) ) ) |
| 997 | return true; |
| 998 | if ( unlikelycxx . . $ DlSatTester#SessionGCIs. ( !SessionGCIs.empty() ) ) |
| 999 | for ( stdcxx . . $ std/::vectorcxx . . $ std/vector#<BipolarPointer>::iteratorcxx . . $ std/vector#iterator# p = SessionGCIscxx . . $ DlSatTester#SessionGCIs..begincxx . . $ std/vector#begin(33b10a496a38335b).(), p_end = SessionGCIscxx . . $ DlSatTester#SessionGCIs..endcxx . . $ std/vector#end(33b10a496a38335b).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 1000 | if ( unlikelycxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e). ( addToDoEntry ( node, *p, dep, "sg" ) ) ) |
| 1001 | return true; |
| 1002 | |
| 1003 | return false; |
| 1004 | } |
| 1005 | |
| 1006 | inline bool |
| 1007 | DlSatTestercxx . . $ DlSatTester# :: runSatcxx . . $ DlSatTester#runSat(cf9ef193275fa6d8). ( BipolarPointercxx . . $ BipolarPointer# p, BipolarPointercxx . . $ BipolarPointer# q ) |
| 1008 | { |
| 1009 | prepareReasonercxx . . $ DlSatTester#prepareReasoner(49f6e7a06ebc5aa8).(); |
| 1010 | |
| 1011 | // use general method to init node with P and add Q then |
| 1012 | if ( initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( CGraphcxx . . $ DlSatTester#CGraph..getRootcxx . . $ DlCompletionGraph#getRoot(8f504d760f19febe).(), DepSetcxx . . $ DepSet#(), p ) || |
| 1013 | addToDoEntrycxx . . $ DlSatTester#addToDoEntry(14ef716f111d87ae). ( CGraphcxx . . $ DlSatTester#CGraph..getRootcxx . . $ DlCompletionGraph#getRoot(8f504d760f19febe).(), ConceptWDepcxx . . $ ConceptWDep#ConceptWDep(d4f767463ce0a6b3).(q) ) ) |
| 1014 | return false; // concept[s] unsatisfiable |
| 1015 | |
| 1016 | // check satisfiability explicitly |
| 1017 | TsProcTimercxx . . $ TsProcTimer#& timer = q == bpTOPcxx . . $ bpTOP. ? satTimercxx . . $ DlSatTester#satTimer. : subTimercxx . . $ DlSatTester#subTimer.; |
| 1018 | timer.Startcxx . . $ TsProcTimer#Start(49f6e7a06ebc5aa8).(); |
| 1019 | bool result = runSatcxx . . $ DlSatTester#runSat(c9857a73d68e59ba).(); |
| 1020 | timer.Stopcxx . . $ TsProcTimer#Stop(49f6e7a06ebc5aa8).(); |
| 1021 | return result; |
| 1022 | } |
| 1023 | |
| 1024 | inline bool |
| 1025 | DlSatTestercxx . . $ DlSatTester# :: checkDisjointRolescxx . . $ DlSatTester#checkDisjointRoles(ee962dbb2fa027b9). ( const TRolecxx . . $ TRole#* R, const TRolecxx . . $ TRole#* S ) |
| 1026 | { |
| 1027 | prepareReasonercxx . . $ DlSatTester#prepareReasoner(49f6e7a06ebc5aa8).(); |
| 1028 | |
| 1029 | // use general method to init node... |
| 1030 | DepSetcxx . . $ DepSet# dummycxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; |
| 1031 | if ( initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( CGraphcxx . . $ DlSatTester#CGraph..getRootcxx . . $ DlCompletionGraph#getRoot(8f504d760f19febe).(), dummy, bpTOPcxx . . $ bpTOP. ) ) |
| 1032 | return true; |
| 1033 | // ... add edges with R and S... |
| 1034 | curNodecxx . . $ DlSatTester#curNode. = CGraphcxx . . $ DlSatTester#CGraph..getRootcxx . . $ DlCompletionGraph#getRoot(8f504d760f19febe).(); |
| 1035 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* edgeR = createOneNeighbourcxx . . $ DlSatTester#createOneNeighbour(38b471ae92c362df). ( R, dummy ); |
| 1036 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* edgeS = createOneNeighbourcxx . . $ DlSatTester#createOneNeighbour(38b471ae92c362df). ( S, dummy ); |
| 1037 | // init new nodes/edges. No need to apply restrictions, as no reasoning have been done yet. |
| 1038 | if ( initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( edgeR->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), dummy, bpTOPcxx . . $ bpTOP. ) |
| 1039 | || initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( edgeS->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), dummy, bpTOPcxx . . $ bpTOP. ) |
| 1040 | || setupEdgecxx . . $ DlSatTester#setupEdge(4031d85ce7510aa7). ( edgeR, dummy ) |
| 1041 | || setupEdgecxx . . $ DlSatTester#setupEdge(4031d85ce7510aa7). ( edgeS, dummy ) |
| 1042 | || Mergecxx . . $ DlSatTester#Merge(9805cd4076885613). ( edgeS->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), edgeR->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), dummy ) ) |
| 1043 | return true; |
| 1044 | |
| 1045 | // 2 roles are disjoint if current setting is unsatisfiable |
| 1046 | curNodecxx . . $ DlSatTester#curNode. = nullptr; |
| 1047 | return !runSatcxx . . $ DlSatTester#runSat(c9857a73d68e59ba).(); |
| 1048 | } |
| 1049 | |
| 1050 | inline bool |
| 1051 | DlSatTestercxx . . $ DlSatTester# :: checkIrreflexivitycxx . . $ DlSatTester#checkIrreflexivity(f4c3e7633be50e77). ( const TRolecxx . . $ TRole#* R ) |
| 1052 | { |
| 1053 | prepareReasonercxx . . $ DlSatTester#prepareReasoner(49f6e7a06ebc5aa8).(); |
| 1054 | |
| 1055 | // use general method to init node... |
| 1056 | DepSetcxx . . $ DepSet# dummycxx . . $ TDepSet#TDepSet(49f6e7a06ebc5aa8).; |
| 1057 | if ( initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( CGraphcxx . . $ DlSatTester#CGraph..getRootcxx . . $ DlCompletionGraph#getRoot(8f504d760f19febe).(), dummy, bpTOPcxx . . $ bpTOP. ) ) |
| 1058 | return true; |
| 1059 | // ... add an R-loop |
| 1060 | curNodecxx . . $ DlSatTester#curNode. = CGraphcxx . . $ DlSatTester#CGraph..getRootcxx . . $ DlCompletionGraph#getRoot(8f504d760f19febe).(); |
| 1061 | DlCompletionTreeArccxx . . $ DlCompletionTreeArc#* edgeR = createOneNeighbourcxx . . $ DlSatTester#createOneNeighbour(38b471ae92c362df). ( R, dummy ); |
| 1062 | // init new nodes/edges. No need to apply restrictions, as no reasoning have been done yet. |
| 1063 | if ( initNewNodecxx . . $ DlSatTester#initNewNode(96e59f80c609b310). ( edgeR->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), dummy, bpTOPcxx . . $ bpTOP. ) |
| 1064 | || setupEdgecxx . . $ DlSatTester#setupEdge(4031d85ce7510aa7). ( edgeR, dummy ) |
| 1065 | || Mergecxx . . $ DlSatTester#Merge(9805cd4076885613). ( edgeR->getArcEndcxx . . $ DlCompletionTreeArc#getArcEnd(1b0634bb62d2788b).(), CGraphcxx . . $ DlSatTester#CGraph..getRootcxx . . $ DlCompletionGraph#getRoot(8f504d760f19febe).(), dummy ) ) |
| 1066 | return true; |
| 1067 | |
| 1068 | // R is irreflexive if current setting is unsatisfiable |
| 1069 | curNodecxx . . $ DlSatTester#curNode. = nullptr; |
| 1070 | return !runSatcxx . . $ DlSatTester#runSat(c9857a73d68e59ba).(); |
| 1071 | } |
| 1072 | |
| 1073 | // restore implementation |
| 1074 | inline bool DlSatTestercxx . . $ DlSatTester# :: backJumpedRestorecxx . . $ DlSatTester#backJumpedRestore(c9857a73d68e59ba). ( void ) |
| 1075 | { |
| 1076 | // if empty clash dep-set -- concept is unsatisfiable |
| 1077 | if ( getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).().emptycxx . . $ TDepSet#empty(50ce9a9e25b4a850). () ) |
| 1078 | return true; |
| 1079 | |
| 1080 | // some non-deterministic choices were done |
| 1081 | restorecxx . . $ DlSatTester#restore(cb2f890c2fdad230). ( getClashSetcxx . . $ DlSatTester#getClashSet(bce6462a16d96b29).().levelcxx . . $ TDepSet#level(ddd8539a2fcdd4ce).() ); |
| 1082 | return false; |
| 1083 | } |
| 1084 | |
| 1085 | inline bool DlSatTestercxx . . $ DlSatTester# :: straightforwardRestorecxx . . $ DlSatTester#straightforwardRestore(c9857a73d68e59ba). ( void ) |
| 1086 | { |
| 1087 | if ( noBranchingOpscxx . . $ DlSatTester#noBranchingOps(50ce9a9e25b4a850).() ) // no non-deterministic choices was made |
| 1088 | return true; // ... the concept is unsatisfiable |
| 1089 | else |
| 1090 | { // restoring the state |
| 1091 | restorecxx . . $ DlSatTester#restore(49f6e7a06ebc5aa8). (); |
| 1092 | return false; |
| 1093 | } |
| 1094 | } |
| 1095 | |
| 1096 | inline bool DlSatTestercxx . . $ DlSatTester# :: tunedRestorecxx . . $ DlSatTester#tunedRestore(c9857a73d68e59ba). ( void ) |
| 1097 | { |
| 1098 | if ( tBoxcxx . . $ DlSatTester#tBox..useBackjumpingcxx . . $ TBox#useBackjumping. ) |
| 1099 | return backJumpedRestorecxx . . $ DlSatTester#backJumpedRestore(c9857a73d68e59ba). (); |
| 1100 | else |
| 1101 | return straightforwardRestorecxx . . $ DlSatTester#straightforwardRestore(c9857a73d68e59ba). (); |
| 1102 | } |
| 1103 | |
| 1104 | inline bool DlSatTestercxx . . $ DlSatTester# :: commonTacticBodyAllcxx . . $ DlSatTester#commonTacticBodyAll(eb1459783ad55ca9). ( const DLVertexcxx . . $ DLVertex#& cur ) |
| 1105 | { |
| 1106 | #ifdef ENABLE_CHECKING |
| 1107 | fpp_assert ( isPositive(curConcept.bp()) && cur.Type() == dtForall ); |
| 1108 | #endif |
| 1109 | |
| 1110 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(cur.getRole()->isTop()) ) |
| 1111 | { |
| 1112 | incStatcxx . . $ `Kernel/Reasoner.h:341:10`!(nAllCalls); |
| 1113 | return addSessionGCIcxx . . $ DlSatTester#addSessionGCI(cbd92d0fb85c8e0). ( cur.getCcxx . . $ DLVertex#getC(455f465bc33b4cdf).(), curConceptcxx . . $ DlSatTester#curConcept..getDepcxx . . $ ConceptWDep#getDep(bce6462a16d96b29).() ); |
| 1114 | } |
| 1115 | // can't skip singleton models for complex roles due to empty transitions |
| 1116 | if ( cur.getRolecxx . . $ DLVertex#getRole(69f26110a94b259f).()->isSimplecxx . . $ TRole#isSimple(50ce9a9e25b4a850).() ) |
| 1117 | return commonTacticBodyAllSimplecxx . . $ DlSatTester#commonTacticBodyAllSimple(eb1459783ad55ca9).(cur); |
| 1118 | else |
| 1119 | return commonTacticBodyAllComplexcxx . . $ DlSatTester#commonTacticBodyAllComplex(eb1459783ad55ca9).(cur); |
| 1120 | } |
| 1121 | |
| 1122 | //----------------------------------------------------------------------------- |
| 1123 | //-- implementation of reasoner-related parts of TBox |
| 1124 | //----------------------------------------------------------------------------- |
| 1125 | |
| 1126 | inline const modelCacheInterfacecxx . . $ modelCacheInterface#* |
| 1127 | TBoxcxx . . $ TBox# :: initCachecxx . . $ TBox#initCache(6e2e6147ec169214). ( const TConceptcxx . . $ TConcept#* pConcept, bool sub ) |
| 1128 | { |
| 1129 | BipolarPointercxx . . $ BipolarPointer# bp = sub ? inversecxx . . $ inverse(7864480464b09eea).(pConcept->pNamecxx . . $ TConcept#pName.) : pConcept->pNamecxx . . $ TConcept#pName.; |
| 1130 | const modelCacheInterfacecxx . . $ modelCacheInterface#* cache = DLHeapcxx . . $ TBox#DLHeap..getCachecxx . . $ DLDag#getCache(a400da756ae1652b).(bp); |
| 1131 | |
| 1132 | if ( cache == nullptr ) |
| 1133 | { |
| 1134 | if ( sub ) |
| 1135 | prepareFeaturescxx . . $ TBox#prepareFeatures(774c8a5cd0d40bb6). ( nullptr, pConcept ); |
| 1136 | else |
| 1137 | prepareFeaturescxx . . $ TBox#prepareFeatures(774c8a5cd0d40bb6). ( pConcept, nullptr ); |
| 1138 | cache = getReasonercxx . . $ TBox#getReasoner(975d19aa5547cabb).()->createCachecxx . . $ DlSatTester#createCache(b3d3cd5834c92364).(bp); |
| 1139 | clearFeaturescxx . . $ TBox#clearFeatures(49f6e7a06ebc5aa8).(); |
| 1140 | } |
| 1141 | |
| 1142 | return cache; |
| 1143 | } |
| 1144 | |
| 1145 | /// test if 2 concept non-subsumption can be determined by cache merging |
| 1146 | inline enum modelCacheStatecxx . . $ modelCacheState# |
| 1147 | TBoxcxx . . $ TBox# :: testCachedNonSubsumptioncxx . . $ TBox#testCachedNonSubsumption(88faddbc21e41e4b). ( const TConceptcxx . . $ TConcept#* p, const TConceptcxx . . $ TConcept#* q ) |
| 1148 | { |
| 1149 | const modelCacheInterfacecxx . . $ modelCacheInterface#* pCache = initCachecxx . . $ TBox#initCache(6e2e6147ec169214). ( p, /*sub=*/false ); |
| 1150 | const modelCacheInterfacecxx . . $ modelCacheInterface#* nCache = initCachecxx . . $ TBox#initCache(6e2e6147ec169214). ( q, /*sub=*/true ); |
| 1151 | return pCache->canMergecxx . . $ modelCacheInterface#canMerge(be618e219bff59e1).(nCache); |
| 1152 | } |
| 1153 | |
| 1154 | #endif |