| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "CCalculationTableauCompletionTaskHandleAlgorithm.h" |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
#ifdef KONCLUDE_FORCE_ALL_DEBUG_DEACTIVATED |
| 31 |
#define KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(a) |
| 32 |
#define KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION(a) |
| 33 |
|
| 34 |
#define KONCLUCE_TASK_ALGORITHM_TIME_MEASURE_INSTRUCTION(a) |
| 35 |
|
| 36 |
#define KONCLUCE_TASK_ALGORITHM_MERGING_DEBUGGING_INSTRUCTION(a) |
| 37 |
#define KONCLUCE_TASK_ALGORITHM_VARIABLE_PROPAGATION_BLOCKING_DEBUGGING_INSTRUCTION(a) |
| 38 |
|
| 39 |
#else |
| 40 |
|
| 41 |
//#define KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(a) a |
| 42 |
#define KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(a) |
| 43 |
|
| 44 |
//#define KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION(a) a |
| 45 |
#define KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION(a) |
| 46 |
|
| 47 |
#define KONCLUCE_TASK_ALGORITHM_TIME_MEASURE_INSTRUCTION(a) a |
| 48 |
//#define KONCLUCE_TASK_ALGORITHM_TIME_MEASURE_INSTRUCTION(a) |
| 49 |
|
| 50 |
|
| 51 |
#define KONCLUCE_TASK_ALGORITHM_MERGING_DEBUGGING_INSTRUCTION(a) |
| 52 |
#define KONCLUCE_TASK_ALGORITHM_VARIABLE_PROPAGATION_BLOCKING_DEBUGGING_INSTRUCTION(a) |
| 53 |
|
| 54 |
#endif |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
namespace Konclude { |
| 65 |
|
| 66 |
namespace Reasoner { |
| 67 |
|
| 68 |
namespace Kernel { |
| 69 |
|
| 70 |
namespace Algorithm { |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
CCalculationTableauCompletionTaskHandleAlgorithm::CCalculationTableauCompletionTaskHandleAlgorithm(CUnsatisfiableCacheHandler* unsatCacheHandler, CSatisfiableExpanderCacheHandler* satExpCacheHandler, CReuseCompletionGraphCacheHandler* reuseCompGraphCacheHandler, CSaturationNodeExpansionCacheHandler* satNodeExpCacheHandler, CComputedConsequencesCacheHandler* compConsCacheHandler, CIndividualNodeBackendCacheHandler* backendCacheHandler, COccurrenceStatisticsCacheHandler* occStatsCacheHandler) { |
| 75 |
mConceptPriorityStrategy = new CConcreteConceptProcessingOperatorPriorityStrategy(); |
| 76 |
mIndiAncDepthMasConProcPriStr = new CIndividualAncestorDepthMaximumConceptProcessingPriorityStrategy(); |
| 77 |
//mTaskProcessingStrategy = new CEqualDepthTaskProcessingPriorityStrategy(); |
| 78 |
mTaskProcessingStrategy = new CEqualDepthCacheOrientatedProcessingPriorityStrategy(); |
| 79 |
mUnsatCachRetStrategy = new CGenerativeNonDeterministicUnsatisfiableCacheRetrievalStrategy(); |
| 80 |
mGroundingHandler = new CConceptNominalSchemaGroundingHandler(); |
| 81 |
mDatatypeHandler = new CDatatypeIndividualProcessNodeHandler(); |
| 82 |
mIncExpHandler = new CIncrementalCompletionGraphCompatibleExpansionHandler(); |
| 83 |
mProcessingDataBox = nullptr; |
| 84 |
mCalcAlgContext = nullptr; |
| 85 |
|
| 86 |
mClashDesFactory = new CClashDescriptorFactory(); |
| 87 |
mIndiNodeManager = new CIndividualNodeManager(); |
| 88 |
mDependencyFactory = new CDependencyFactory(); |
| 89 |
mSatExpCacheHandler = satExpCacheHandler; |
| 90 |
mUnsatCacheHandler = unsatCacheHandler; |
| 91 |
mSatNodeExpCacheHandler = satNodeExpCacheHandler; |
| 92 |
mReuseCompGraphCacheHandler = reuseCompGraphCacheHandler; |
| 93 |
mCompConsCacheHandler = compConsCacheHandler; |
| 94 |
mBackendCacheHandler = backendCacheHandler; |
| 95 |
mOccStatsCacheHandler = occStatsCacheHandler; |
| 96 |
|
| 97 |
mCompGraphCacheHandler = new CCompletionGraphCacheHandler(mBackendCacheHandler); |
| 98 |
|
| 99 |
|
| 100 |
mIndividualPriorityStrategy = mIndiAncDepthMasConProcPriStr; |
| 101 |
|
| 102 |
mPosJumpFuncVec = &mPosTableauRuleJumpFuncVec[mRuleFuncCount/2]; |
| 103 |
mNegJumpFuncVec = &mNegTableauRuleJumpFuncVec[mRuleFuncCount/2]; |
| 104 |
|
| 105 |
for (cint64 i = 0; i < mRuleFuncCount; ++i) { |
| 106 |
mPosTableauRuleJumpFuncVec[i] = nullptr; |
| 107 |
mNegTableauRuleJumpFuncVec[i] = nullptr; |
| 108 |
} |
| 109 |
|
| 110 |
mConfSpecializedAutomateRules = true; |
| 111 |
mConfSubSetBlocking = false; |
| 112 |
mConfOptimizedSubSetBlocking = true; |
| 113 |
mConfEqualSetBlocking = false; |
| 114 |
mConfPairwiseEqualSetBlocking = false; |
| 115 |
mConfAncestorBlockingSearch = false; |
| 116 |
mConfAnywhereBlockingSearch = false; |
| 117 |
mConfAnywhereBlockingCandidateHashSearch = false; |
| 118 |
mConfAnywhereBlockingLinkedCandidateHashSearch = true; |
| 119 |
mConfSaveCoreBlockingConceptsCandidates = true; |
| 120 |
mConfSemanticBranching = false; |
| 121 |
mConfAtomicSemanticBranching = true; |
| 122 |
mConfBranchTriggering = true; |
| 123 |
mConfStrictIndiNodeProcessing = true; |
| 124 |
mConfIDIndiPriorization = true; |
| 125 |
mConfPropagateNodeProcessed = false; |
| 126 |
mConfDirectRulePreprocessing = true; |
| 127 |
mConfLazyNewNominalGeneration = true; |
| 128 |
mConfConsRestrictedNonStrictIndiNodeProcessing = true; |
| 129 |
mConfUniqueNameAssumption = false; |
| 130 |
|
| 131 |
mConfBuildDependencies = true; |
| 132 |
mConfDependencyBacktracking = true; |
| 133 |
mConfDependencyBackjumping = true; |
| 134 |
mConfBuildAllBranchingNodes = true; |
| 135 |
|
| 136 |
mConfWriteUnsatCaching = true; |
| 137 |
mConfTestedConceptWriteUnsatCaching = true; |
| 138 |
mConfTestOccurUnsatCached = true; |
| 139 |
mConfTestPrecheckUnsatCached = true; |
| 140 |
mConfMinimizeMerging = true; |
| 141 |
mConfUnsatCachingUseFullNodeDependency = false; |
| 142 |
mConfUnsatCachingUseNodeSignatureSet = false; |
| 143 |
|
| 144 |
mConfSatExpCacheRetrieval = true; |
| 145 |
mConfSatExpCacheConceptExpansion = true; |
| 146 |
mConfSatExpCacheSatisfiableBlocking = true; |
| 147 |
mConfSatExpCacheWriting = true; |
| 148 |
|
| 149 |
mConfSignatureSaving = false; |
| 150 |
mConfSignatureMirroringBlocking = false; |
| 151 |
|
| 152 |
mConfSatExpCachedDisjAbsorp = true; |
| 153 |
mConfSatExpCachedMergAbsorp = true; |
| 154 |
mConfSatExpCachedSuccAbsorp = true; |
| 155 |
|
| 156 |
mConfAnywhereBlockingSomeInitializationHashing = false; |
| 157 |
mConfAnywhereBlockingLazyExactHashing = true; |
| 158 |
|
| 159 |
mConfSkipANDConcepts = false; |
| 160 |
mConfPairwiseMerging = false; |
| 161 |
|
| 162 |
mConfDepthOrientatedProcessing = true; |
| 163 |
mConfLateBlockingResolving = true; |
| 164 |
mConfUnsatBranchSatisfiableCaching = true; |
| 165 |
mConfAtleastAtmostFastClashCheck = true; |
| 166 |
|
| 167 |
mOptSignatureMirroringBlockingForceSubset = false; |
| 168 |
mOptSignatureMirroringBlockingInBlocking = false; |
| 169 |
mConfIndividualReusingFromSignatureBlocking = false; |
| 170 |
|
| 171 |
mConfCompGraphReuseCacheRetrieval = false; |
| 172 |
mConfCompGraphDeterministicReuse = true; |
| 173 |
mConfCompGraphNonDeterministicReuse = true; |
| 174 |
|
| 175 |
mConfRepresentativePropagationRules = true; |
| 176 |
mMapComparisonDirectLookupFactor = 20; |
| 177 |
mConfCurrentIndividualQueuing = false; |
| 178 |
|
| 179 |
mConfGenerateQueries = false; |
| 180 |
mConfDebuggingWriteData = false; |
| 181 |
mConfDebuggingWriteDataComplationTasks = false; |
| 182 |
mConfDebuggingWriteDataOnlyOnSatisfiability = false; |
| 183 |
mConfDebuggingWriteDataForConsistencyTests = false; |
| 184 |
mConfDebuggingWriteDataForClassificationTests = false; |
| 185 |
mConfDebuggingWriteDataForAnsweringPropagationTests = false; |
| 186 |
mConfDebuggingWriteDataForIncrementalExpansionTests = false; |
| 187 |
mConfDebuggingWriteDataForRepCacheIndiComputationTests = false; |
| 188 |
mConfDebuggingWriteDataForAllTests = false; |
| 189 |
|
| 190 |
mConfExpandCreatedSuccessorsFromSaturation = true; |
| 191 |
// dependencies are not yet generated correctly for resolvings (must include resolved foralls as dependency in addition to the existential restriction) |
| 192 |
mConfSuccessorSaturationExpansionRestrictionsResolving = false; |
| 193 |
mConfCachingBlockingFromSaturation = true; |
| 194 |
|
| 195 |
mConfExactNominalDependencyTracking = true; |
| 196 |
mConfSaturationCachingWithNominals = true; |
| 197 |
mConfConceptUnsatisfiabilitySaturatedTesting = false; |
| 198 |
mConfSaturationConceptUnsatisfiabilitySaturatedCacheWriting = true; |
| 199 |
mConfSaturationSatisfiabilitiyExpansionCacheWriting = false; |
| 200 |
mConfSaturationCachingTestingDuringBlockingTests = true; |
| 201 |
mConfSaturationExpansionCacheReading = true; |
| 202 |
mConfSaturationIncompleteExpansionFromCache = false; |
| 203 |
|
| 204 |
mConfDatatypeReasoning = true; |
| 205 |
mConfCompletionGraphCaching = true; |
| 206 |
mConfDelayCompletionGraphCachingReactivation = false; |
| 207 |
mConfCollectCachingUpdatedBlockableIndiNodes = true; |
| 208 |
|
| 209 |
|
| 210 |
mConfAddCachedComputedConsequences = true; |
| 211 |
mConfCacheComputedConsequences = true; |
| 212 |
mConfIndividualsBackendCacheLoading = true; |
| 213 |
|
| 214 |
mConfMergeConstructedIndividualNode = false; |
| 215 |
mConfBranchingStatisticsAnalysing = true; |
| 216 |
mOptAnalogousPropagationPathBlocking = false; |
| 217 |
|
| 218 |
|
| 219 |
mConfPossibleInstanceIndividualsMerging = true; |
| 220 |
mConfAllowBackendNeighbourExpansionBlocking = true; |
| 221 |
mConfNewMergingsOnlyInferringExpansion = true; |
| 222 |
mConfAllowBackendSuccessorExpansionBlocking = true; |
| 223 |
|
| 224 |
|
| 225 |
mConfAnalogousPropagationPathBlockingWithAnsweringPropagationAdapters = true; |
| 226 |
|
| 227 |
mConfOccurrenceStatisticsCollecting = true; |
| 228 |
mOptCollectOccurrenceStatistics = false; |
| 229 |
|
| 230 |
mConfIgnoreBlockingCompletionGraphCachedNonBlockingNodes = true; |
| 231 |
|
| 232 |
mConfOnlyDeterministicRepresentativeBackendIndividualDataConsideration = true; |
| 233 |
|
| 234 |
mConfDelayedBackendInitializiation = true; |
| 235 |
|
| 236 |
mIndiAncDepthMasConProcPriStr->configureStrategy(mConfStrictIndiNodeProcessing,mConfIDIndiPriorization); |
| 237 |
|
| 238 |
mPosJumpFuncVec[CCTOP] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 239 |
mPosJumpFuncVec[CCBOTTOM] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBOTTOMRule; |
| 240 |
mPosJumpFuncVec[CCAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 241 |
mPosJumpFuncVec[CCAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 242 |
mPosJumpFuncVec[CCIMPLAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 243 |
mPosJumpFuncVec[CCBRANCHAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 244 |
if (mConfSpecializedAutomateRules) { |
| 245 |
mPosJumpFuncVec[CCAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyAutomatANDRule; |
| 246 |
mPosJumpFuncVec[CCIMPLAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyAutomatANDRule; |
| 247 |
mPosJumpFuncVec[CCBRANCHAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyAutomatANDRule; |
| 248 |
} |
| 249 |
|
| 250 |
mPosJumpFuncVec[CCDATATYPE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyDATATYPERule; |
| 251 |
mNegJumpFuncVec[CCDATATYPE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyDATATYPERule; |
| 252 |
mPosJumpFuncVec[CCDATALITERAL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyDATALITERALRule; |
| 253 |
mNegJumpFuncVec[CCDATALITERAL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyDATALITERALRule; |
| 254 |
mPosJumpFuncVec[CCDATARESTRICTION] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyDATARESTRICTIONRule; |
| 255 |
mNegJumpFuncVec[CCDATARESTRICTION] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyDATARESTRICTIONRule; |
| 256 |
|
| 257 |
mPosJumpFuncVec[CCSUB] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 258 |
mPosJumpFuncVec[CCEQ] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 259 |
mPosJumpFuncVec[CCOR] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyORRule; |
| 260 |
mPosJumpFuncVec[CCALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyALLRule; |
| 261 |
mPosJumpFuncVec[CCAQALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyALLRule; |
| 262 |
mPosJumpFuncVec[CCIMPLAQALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyALLRule; |
| 263 |
mPosJumpFuncVec[CCBRANCHAQALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyALLRule; |
| 264 |
mPosJumpFuncVec[CCSOME] = &CCalculationTableauCompletionTaskHandleAlgorithm::applySOMERule; |
| 265 |
mPosJumpFuncVec[CCAQSOME] = &CCalculationTableauCompletionTaskHandleAlgorithm::applySOMERule; |
| 266 |
mPosJumpFuncVec[CCAQCHOOCE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyAutomatChooseRule; |
| 267 |
mPosJumpFuncVec[CCNOT] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyNegANDRule; |
| 268 |
mPosJumpFuncVec[CCSELF] = &CCalculationTableauCompletionTaskHandleAlgorithm::applySELFRule; |
| 269 |
mPosJumpFuncVec[CCATLEAST] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyATLEASTRule; |
| 270 |
mPosJumpFuncVec[CCATMOST] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyATMOSTRule; |
| 271 |
mPosJumpFuncVec[CCNOMINAL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyNOMINALRule; |
| 272 |
mPosJumpFuncVec[CCVALUE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVALUERule; |
| 273 |
|
| 274 |
mPosJumpFuncVec[CCIMPL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyIMPLICATIONRule; |
| 275 |
mPosJumpFuncVec[CCIMPLTRIG] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 276 |
mPosJumpFuncVec[CCBRANCHTRIG] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 277 |
mPosJumpFuncVec[CCIMPLALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyALLRule; |
| 278 |
mPosJumpFuncVec[CCBRANCHALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyALLRule; |
| 279 |
|
| 280 |
mNegJumpFuncVec[CCAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyORRule; |
| 281 |
mNegJumpFuncVec[CCOR] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 282 |
mNegJumpFuncVec[CCEQ] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyORRule; |
| 283 |
mNegJumpFuncVec[CCALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applySOMERule; |
| 284 |
mNegJumpFuncVec[CCNOT] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyNegANDRule; |
| 285 |
mNegJumpFuncVec[CCSOME] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyALLRule; |
| 286 |
mNegJumpFuncVec[CCAQCHOOCE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyAutomatChooseRule; |
| 287 |
mNegJumpFuncVec[CCSELF] = &CCalculationTableauCompletionTaskHandleAlgorithm::applySELFRule; |
| 288 |
mNegJumpFuncVec[CCATMOST] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyATLEASTRule; |
| 289 |
mNegJumpFuncVec[CCATLEAST] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyATMOSTRule; |
| 290 |
mNegJumpFuncVec[CCNOMINAL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyNOMINALRule; |
| 291 |
mNegJumpFuncVec[CCVALUE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVALUERule; |
| 292 |
|
| 293 |
// back propagation (propagation of candidates) |
| 294 |
mPosJumpFuncVec[CCPBINDVARIABLE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDVARIABLERule; |
| 295 |
mPosJumpFuncVec[CCPBINDTRIG] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEANDRule; |
| 296 |
mPosJumpFuncVec[CCPBINDAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEANDRule; |
| 297 |
mPosJumpFuncVec[CCPBINDAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEANDRule; |
| 298 |
mPosJumpFuncVec[CCPBINDIMPL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEIMPLICATIONRule; |
| 299 |
mPosJumpFuncVec[CCPBINDALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEALLRule; |
| 300 |
mPosJumpFuncVec[CCPBINDAQALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEALLRule; |
| 301 |
mPosJumpFuncVec[CCPBINDCYCLE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATECYCLERule; |
| 302 |
mPosJumpFuncVec[CCPBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEGROUNDINGRule; |
| 303 |
mNegJumpFuncVec[CCPBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEGROUNDINGRule; |
| 304 |
|
| 305 |
// normal propagation |
| 306 |
mPosJumpFuncVec[CCVARBINDVARIABLE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDVARIABLERule; |
| 307 |
mPosJumpFuncVec[CCVARBINDTRIG] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARIABLEBINDINGANDRule; |
| 308 |
mPosJumpFuncVec[CCVARBINDAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARIABLEBINDINGANDRule; |
| 309 |
mPosJumpFuncVec[CCVARBINDAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARIABLEBINDINGANDRule; |
| 310 |
mPosJumpFuncVec[CCVARBINDIMPL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEIMPLICATIONRule; |
| 311 |
mPosJumpFuncVec[CCVARBINDALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEALLRule; |
| 312 |
mPosJumpFuncVec[CCVARBINDAQALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEALLRule; |
| 313 |
mPosJumpFuncVec[CCVARBINDJOIN] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEJOINRule; |
| 314 |
mPosJumpFuncVec[CCVARBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEGROUNDINGRule; |
| 315 |
mNegJumpFuncVec[CCVARBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEGROUNDINGRule; |
| 316 |
|
| 317 |
// representative propagation |
| 318 |
if (mConfRepresentativePropagationRules) { |
| 319 |
mPosJumpFuncVec[CCVARBINDVARIABLE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEBINDVARIABLERule; |
| 320 |
mPosJumpFuncVec[CCVARBINDTRIG] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEANDRule; |
| 321 |
mPosJumpFuncVec[CCVARBINDAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEANDRule; |
| 322 |
mPosJumpFuncVec[CCVARBINDAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEANDRule; |
| 323 |
mPosJumpFuncVec[CCVARBINDIMPL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEIMPLICATIONRule; |
| 324 |
mPosJumpFuncVec[CCVARBINDALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEALLRule; |
| 325 |
mPosJumpFuncVec[CCVARBINDAQALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEALLRule; |
| 326 |
mPosJumpFuncVec[CCVARBINDJOIN] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEJOINRule; |
| 327 |
mPosJumpFuncVec[CCVARBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEGROUNDINGRule; |
| 328 |
mNegJumpFuncVec[CCVARBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEGROUNDINGRule; |
| 329 |
} |
| 330 |
|
| 331 |
|
| 332 |
mPosJumpFuncVec[CCBACKACTIVTRIG] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEANDFLAGALLRule; |
| 333 |
mPosJumpFuncVec[CCVARPBACKTRIG] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEANDRule; |
| 334 |
mPosJumpFuncVec[CCVARPBACKALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEALLRule; |
| 335 |
mPosJumpFuncVec[CCVARPBACKAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEANDRule; |
| 336 |
mPosJumpFuncVec[CCVARPBACKAQALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEALLRule; |
| 337 |
mPosJumpFuncVec[CCBACKACTIVIMPL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEIMPLICATIONRule; |
| 338 |
|
| 339 |
mPosJumpFuncVec[CCNOMINALIMPLI] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyNOMINALIMPLICATIONRule; |
| 340 |
mPosJumpFuncVec[CCDATATYPEIMPLI] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyDATATYPEIMPLICATIONRule; |
| 341 |
mPosJumpFuncVec[CCDATALITERALIMPLI] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyDATALITERALIMPLICATIONRule; |
| 342 |
mPosJumpFuncVec[CCDATARESTRICTIONIMPLI] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyDATARESTRICTIONIMPLICATIONRule; |
| 343 |
|
| 344 |
mPosJumpFuncVec[CCVARBINDPREPARE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPREPARERule; |
| 345 |
mPosJumpFuncVec[CCVARBINDFINALZE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDFINALIZERule; |
| 346 |
|
| 347 |
mLastConfig = nullptr; |
| 348 |
|
| 349 |
mAppliedALLRuleCount = 0; |
| 350 |
mAppliedSOMERuleCount = 0; |
| 351 |
mAppliedANDRuleCount = 0; |
| 352 |
mAppliedORRuleCount = 0; |
| 353 |
mAppliedATLEASTRuleCount = 0; |
| 354 |
mAppliedATMOSTRuleCount = 0; |
| 355 |
mAppliedTOTALRuleCount = 0; |
| 356 |
|
| 357 |
mStatVarBindingCreatedCount = 0; |
| 358 |
mStatVarBindingGroundingCount = 0; |
| 359 |
mStatVarBindingImplicationCount = 0; |
| 360 |
mStatVarBindingJoinCombinesCount = 0; |
| 361 |
mStatVarBindingPropagateSuccCount = 0; |
| 362 |
mStatVarBindingPropagateSuccFreshCount = 0; |
| 363 |
mStatVarBindingPropagateSuccInitialCount = 0; |
| 364 |
mStatVarBindingPropagateCount = 0; |
| 365 |
mStatVarBindingPropagateFreshCount = 0; |
| 366 |
mStatVarBindingPropagateInitialCount = 0; |
| 367 |
|
| 368 |
|
| 369 |
mStatRepresentativeCreatedCount = 0; |
| 370 |
mStatRepresentativeGroundingCount = 0; |
| 371 |
mStatRepresentativeImplicationCount = 0; |
| 372 |
mStatRepresentativeJoinCombinesCount = 0; |
| 373 |
mStatRepresentativePropagateSuccCount = 0; |
| 374 |
mStatRepresentativePropagateCount = 0; |
| 375 |
mStatRepresentativePropagateNewRepresentativeCount = 0; |
| 376 |
mStatRepresentativePropagateReusedRepresentativeCount = 0; |
| 377 |
mStatRepresentativePropagateUseRepresentativeCount = 0; |
| 378 |
mStatRepresentativeJoinCount = 0; |
| 379 |
mStatRepresentativeJoinedCount = 0; |
| 380 |
mStatRepresentativeJoinQuickFailCount = 0; |
| 381 |
|
| 382 |
mStatBackPropActivationCount = 0; |
| 383 |
|
| 384 |
mCurrentRecProcDepth = 0; |
| 385 |
mCurrentRecProcDepthLimit = 300; |
| 386 |
|
| 387 |
mMaxBlockingCachingSavedCandidateCount = 50; |
| 388 |
|
| 389 |
mStatConDesInsertionCount = 0; |
| 390 |
mStatConDesContainedCount = 0; |
| 391 |
|
| 392 |
mStatPossibleInstanceMergingCount = 0; |
| 393 |
mStatPossibleInstanceMergingSearchIndiCount = 0; |
| 394 |
mStatPossibleInstanceMergingFoundIndiCount = 0; |
| 395 |
mStatPossibleInstanceMergingTryingCount = 0; |
| 396 |
|
| 397 |
mStatPossibleInstanceMergingSkipIndiCount = 0; |
| 398 |
mStatPossibleInstanceMergingNotMergeableCount = 0; |
| 399 |
mStatPossibleInstanceMergingMaybeMergeableCount = 0; |
| 400 |
mStatPossibleInstanceMergingSuccessSubmitCount = 0; |
| 401 |
mStatPossibleInstanceMergingTriviallySuccessCount = 0; |
| 402 |
|
| 403 |
mStatStoppedCount = 0; |
| 404 |
mStatSatisfiableCount = 0; |
| 405 |
mStatClashCount = 0; |
| 406 |
|
| 407 |
//bool debug = true; |
| 408 |
//if (debug) { |
| 409 |
// QStringList debugStringList; |
| 410 |
// QFile debugTestFile("debugStop.txt"); |
| 411 |
// if (debugTestFile.open(QIODevice::ReadOnly)) { |
| 412 |
// while (!debugTestFile.atEnd()) { |
| 413 |
// QByteArray lineArray(debugTestFile.readLine()); |
| 414 |
// debugStringList.append(QString(lineArray)); |
| 415 |
// } |
| 416 |
// } |
| 417 |
// foreach (const QString& debugTestString, debugStringList) { |
| 418 |
// QString testString(debugTestString); |
| 419 |
// testString = testString.remove("^"); |
| 420 |
// testString = testString.remove("0"); |
| 421 |
// testString = testString.remove("1"); |
| 422 |
// testString = testString.remove("2"); |
| 423 |
// testString = testString.remove("3"); |
| 424 |
// testString = testString.remove("4"); |
| 425 |
// testString = testString.remove("5"); |
| 426 |
// testString = testString.remove("6"); |
| 427 |
// testString = testString.remove("7"); |
| 428 |
// testString = testString.remove("8"); |
| 429 |
// testString = testString.remove("9"); |
| 430 |
// testString = testString.trimmed(); |
| 431 |
|
| 432 |
// mCriticalConceptSetStringSet.insert(testString); |
| 433 |
// } |
| 434 |
// mFoundCriticalConceptSet = false; |
| 435 |
//} |
| 436 |
//mCriticalConceptSetStringSet.insert("? := ? ( ALL http://www.owllink.org/testsuite/galen#hasState. ?~http://www.owllink.org/testsuite/galen#actuallyHollow) ^"); |
| 437 |
//mCriticalConceptSetStringSet.insert(" := (~http://www.owllink.org/testsuite/galen#Topology AND ? ( ALL http://www.owllink.org/testsuite/galen#hasState. ?~http://www.owllink.org/testsuite/galen#actuallyHollow) ) ^"); |
| 438 |
//mCriticalConceptSetStringSet.insert("? := ? ( ALL http://www.owllink.org/testsuite/galen#hasState. ?~http://www.owllink.org/testsuite/galen#trulyHollow) ^"); |
| 439 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#Feature ^"); |
| 440 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#StructuralFeature ^"); |
| 441 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#Morphology ^"); |
| 442 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#Appearance ^"); |
| 443 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#Topology ^"); |
| 444 |
//mCriticalConceptSetStringSet.insert(" := (~http://www.owllink.org/testsuite/galen#Topology AND ? ( ALL http://www.owllink.org/testsuite/galen#hasState. ?~http://www.owllink.org/testsuite/galen#trulyHollow) ) ^"); |
| 445 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#TopCategory ^"); |
| 446 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#DomainCategory ^"); |
| 447 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#ModifierConcept ^"); |
| 448 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#Aspect ^"); |
| 449 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#Status ^"); |
| 450 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#AbstractStatus ^"); |
| 451 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#CountabilityStatus ^"); |
| 452 |
|
| 453 |
//mCriticalConceptSetStringSet.insert("~http://www.owllink.org/testsuite/galen#StomachToDuodenum"); |
| 454 |
|
| 455 |
|
| 456 |
for (cint64 i = 0; i < mDebugTaskIDVectorSize; ++i) { |
| 457 |
mDebugTaskIDVector[i] = 0; |
| 458 |
} |
| 459 |
mBacktrackingStep = 0; |
| 460 |
|
| 461 |
mFoundCriticalConceptSet = false; |
| 462 |
mBacktrackDebug = true; |
| 463 |
|
| 464 |
mNominalMerged = false; |
| 465 |
mNominalMergedCount = 0; |
| 466 |
|
| 467 |
mOverJumpedNonDeterministicDecisionCount = 0; |
| 468 |
mRelevantNonDeterministicDecisionCount = 0; |
| 469 |
|
| 470 |
mConfVariableBindingSteeringBackendNeighbourExpansion = true; |
| 471 |
|
| 472 |
mConfLimitBackendNeighbourExpansion = false; |
| 473 |
mConfMaxBackendNeighbourTotalExpansionCount = 5000; |
| 474 |
mConfCriticalBackendNeighbourTotalExpansionCount = 4000; |
| 475 |
mConfMinBackendNeighbourDirectExpansionCount = 10; |
| 476 |
mConfAllProblematicBackendNeighbourDirectExpansion = true; |
| 477 |
mConfAtmostAllDirectBackendNeighbourExpansion = true; |
| 478 |
mConfBackendExpansionReuse = true; |
| 479 |
mConfQueuedBackendNeighbourExpansionIndisBatchSize = 5; |
| 480 |
mConfQueuedBackendNeighbourExpansionRolesBatchCount = 3; |
| 481 |
|
| 482 |
mOptLimitBackendNeighbourExpansion = false; |
| 483 |
mOptBackendExpansionReuse = false; |
| 484 |
mConfBackendExpansionLateDynamicReuseActivation = true; |
| 485 |
|
| 486 |
mConfBackendExpansionNeighbourIndividualCountReuseActivation = 1; |
| 487 |
mConfBackendExpansionSameIndividualCountReuseActivation = 1; |
| 488 |
} |
| 489 |
|
| 490 |
CCalculationTableauCompletionTaskHandleAlgorithm::~CCalculationTableauCompletionTaskHandleAlgorithm() { |
| 491 |
delete mConceptPriorityStrategy; |
| 492 |
} |
| 493 |
|
| 494 |
void CCalculationTableauCompletionTaskHandleAlgorithm::readCalculationConfig(CSatisfiableCalculationTask* satCalcTask) { |
| 495 |
CCalculationConfigurationExtension *config = satCalcTask->getCalculationConfiguration(); |
| 496 |
if (config != mLastConfig) { |
| 497 |
if (config) { |
| 498 |
mConfSpecializedAutomateRules = config->isSpecializedAutomateRuleActivated(); |
| 499 |
mConfSubSetBlocking = config->isSubSetBlockingActivated(); |
| 500 |
mConfOptimizedSubSetBlocking = config->isOptimizedBlockingActivated(); |
| 501 |
mConfEqualSetBlocking = config->isEqualSetBlockingActivated(); |
| 502 |
mConfPairwiseEqualSetBlocking = config->isPairwiseEqualSetBlockingActivated(); |
| 503 |
mConfAncestorBlockingSearch = config->isAncestorBlockingSearchActivated(); |
| 504 |
mConfAnywhereBlockingSearch = config->isAnywhereBlockingSearchActivated(); |
| 505 |
mConfAnywhereBlockingCandidateHashSearch = config->isAnywhereBlockingCandidateHashSearchActivated(); |
| 506 |
mConfSemanticBranching = config->isSemanticBranchingActivated(); |
| 507 |
mConfAtomicSemanticBranching = config->isAtomicSemanticBranchingActivated(); |
| 508 |
mConfBranchTriggering = config->isBranchTriggeringActivated(); |
| 509 |
mConfStrictIndiNodeProcessing = config->isStrictIndiNodeProcessingActivated(); |
| 510 |
mConfIDIndiPriorization = config->isIDIndiPriorizationActivated(); |
| 511 |
mConfPropagateNodeProcessed = config->isPropagateNodeProcessedActivated(); |
| 512 |
mConfDirectRulePreprocessing = config->isDirectRulePreprocessingActivated(); |
| 513 |
mConfLazyNewNominalGeneration = config->isLazyNewNominalCreationActivated(); |
| 514 |
mConfConsRestrictedNonStrictIndiNodeProcessing = config->isConsistenceRestrictedNonStictProcessingActivated(); |
| 515 |
mConfUniqueNameAssumption = config->isUniqueNameAssumptionActivated(); |
| 516 |
mConfDependencyBacktracking = config->isDependencyTrackingActivated(); |
| 517 |
mConfBuildDependencies = mConfDependencyBacktracking; |
| 518 |
mConfDependencyBackjumping = config->isBackjumpingActivated(); |
| 519 |
mConfWriteUnsatCaching = config->isSingleLevelUnsatisfiableCacheWritingActivated(); |
| 520 |
mConfTestedConceptWriteUnsatCaching = config->isTestedConceptUnsatisfiableCacheWritingActivated(); |
| 521 |
mConfTestOccurUnsatCached = config->isUnsatisfiableCacheRetrievalActivated(); |
| 522 |
mConfTestPrecheckUnsatCached = mConfTestOccurUnsatCached; |
| 523 |
mConfMinimizeMerging = config->isMinimizeMergingBranchesActivated(); |
| 524 |
mConfSatExpCacheRetrieval = config->isSatisfiableExpansionCacheRetrievalActivated(); |
| 525 |
mConfSatExpCacheConceptExpansion = config->isSatisfiableExpansionCacheConceptExpansionActivated(); |
| 526 |
mConfSatExpCacheSatisfiableBlocking = config->isSatisfiableExpansionCacheSatisfiableBlockingActivated(); |
| 527 |
mConfSatExpCacheWriting = config->isSatisfiableExpansionCacheWritingActivated(); |
| 528 |
mConfSignatureSaving = config->isSignatureSavingActivated(); |
| 529 |
mConfSignatureMirroringBlocking = config->isSignatureMirroringBlockingActivated(); |
| 530 |
mConfUnsatCachingUseFullNodeDependency = config->isUnsatisfiableCachingFullDependencyActivated(); |
| 531 |
mConfUnsatCachingUseNodeSignatureSet = config->isUnsatisfiableCachingFullSignatureActivated(); |
| 532 |
mConfPairwiseMerging = config->isPairwiseMergingActivated(); |
| 533 |
mConfCompGraphReuseCacheRetrieval = config->isCompletionGraphReuseCachingRetrievalActivated(); |
| 534 |
mConfCompGraphDeterministicReuse = config->isCompletionGraphDeterministicReuseActivated(); |
| 535 |
mConfCompGraphNonDeterministicReuse = config->isCompletionGraphNonDeterministicReuseActivated(); |
| 536 |
mConfAnywhereBlockingLinkedCandidateHashSearch = config->isAnywhereBlockingCoreConceptCandidateHashSearchActivated(); |
| 537 |
mConfRepresentativePropagationRules = config->isRepresentativePropagationActivated(); |
| 538 |
mConfDebuggingWriteData = config->isDebuggingWriteDataActivated(); |
| 539 |
mConfGenerateQueries = config->isGeneratingTestQueriesActivated(); |
| 540 |
|
| 541 |
mConfDebuggingWriteDataComplationTasks = config->isDebuggingWriteDataCompletionTasksActivated(); |
| 542 |
mConfDebuggingWriteDataOnlyOnSatisfiability = config->isDebuggingWriteDataCompletionTasksOnlyOnSatisfiabilityActivated(); |
| 543 |
mConfDebuggingWriteDataForConsistencyTests = config->isDebuggingWriteDataCompletionTasksForConsistencyTestsActivated(); |
| 544 |
mConfDebuggingWriteDataForClassificationTests = config->isDebuggingWriteDataCompletionTasksForClassificationTestsActivated(); |
| 545 |
mConfDebuggingWriteDataForAnsweringPropagationTests = config->isDebuggingWriteDataCompletionTasksForAnsweringPropagationTestsActivated(); |
| 546 |
mConfDebuggingWriteDataForIncrementalExpansionTests = config->isDebuggingWriteDataCompletionTasksForIncrementalExpansionTestsActivated(); |
| 547 |
mConfDebuggingWriteDataForRepCacheIndiComputationTests = config->isDebuggingWriteDataCompletionTasksForRepresentativeCacheRecomputationTestsActivated(); |
| 548 |
mConfDebuggingWriteDataForAllTests = config->isDebuggingWriteDataCompletionTasksForAllTestsActivated(); |
| 549 |
|
| 550 |
mConfExpandCreatedSuccessorsFromSaturation = config->isSuccessorConceptSaturationExpansionActivated(); |
| 551 |
mConfCachingBlockingFromSaturation = config->isSaturationCachingActivated(); |
| 552 |
mConfSaturationCachingWithNominals = config->isSaturationCachingWithNominalsByReactivationActivated(); |
| 553 |
mConfSaturationConceptUnsatisfiabilitySaturatedCacheWriting = config->isSaturationUnsatisfiabilityCacheWritingActivated(); |
| 554 |
mConfSaturationSatisfiabilitiyExpansionCacheWriting = config->isSaturationExpansionSatisfiabilityCacheWritingActivated(); |
| 555 |
mConfDatatypeReasoning = config->isDatatypeReasoningActivated(); |
| 556 |
|
| 557 |
mConfCompletionGraphCaching = config->isCompletionGraphCachingActivated(); |
| 558 |
mConfDelayCompletionGraphCachingReactivation = config->isDelayedCompletionGraphCachingReactivationActivated(); |
| 559 |
mConfIndividualsBackendCacheLoading = config->isIndividualsBackendCacheLoadingActivated(); |
| 560 |
mConfAddCachedComputedConsequences = config->isComputedTypesCachingActivated(); |
| 561 |
|
| 562 |
|
| 563 |
mConfMergeConstructedIndividualNode = config->isConstructionIndividualNodeMergingActivated(); |
| 564 |
mCurrentRecProcDepthLimit = config->getMaximumRecursiveProcessingConceptCount(); |
| 565 |
|
| 566 |
|
| 567 |
mConfNewMergingsOnlyInferringExpansion = config->isNewMergingsBackendOnlyInferringNeighbourExpansionActivated(); |
| 568 |
mConfAllowBackendNeighbourExpansionBlocking = config->isAllowBackendNeighbourExpansionBlockingActivated(); |
| 569 |
mConfAllowBackendSuccessorExpansionBlocking = config->isAllowBackendSuccessorExpansionBlockingActivated(); |
| 570 |
mConfOccurrenceStatisticsCollecting = config->isOccurrenceStatisticsCollectionActivated(); |
| 571 |
|
| 572 |
mConfIgnoreBlockingCompletionGraphCachedNonBlockingNodes = config->isBlockingTestsIgnoringCompletionGraphCachedNonBlockedNodesActivated(); |
| 573 |
|
| 574 |
|
| 575 |
mConfDefaultIndividualPrecomputationCount = config->getDefaultIndividualPrecomputationCount(); |
| 576 |
|
| 577 |
mConfLimitBackendNeighbourExpansion = config->isBackendCriticalNeighbourExpansionLimitationActivated(); |
| 578 |
mConfMaxBackendNeighbourTotalExpansionCount = config->getBackendCriticalNeighbourExpansionLimit(); |
| 579 |
mConfCriticalBackendNeighbourTotalExpansionCount = config->getBackendCriticalNeighbourExpansionPriorityReductionCount(); |
| 580 |
mConfMinBackendNeighbourDirectExpansionCount = config->getBackendCriticalNeighbourDirectExpansionLimit(); |
| 581 |
mConfBackendExpansionLimitReachedReuseActivation = config->isBackendExpansionLimitReachedReuseActivationActivated(); |
| 582 |
mConfQueuedBackendNeighbourExpansionIndisBatchSize = config->getBackendCriticalNeighbourExpansionIndividualsBatchSize(); |
| 583 |
mConfQueuedBackendNeighbourExpansionRolesBatchCount = config->getBackendCriticalNeighbourExpansionRolesBatchSize(); |
| 584 |
|
| 585 |
mConfDelayedBackendInitializiation = config->isBackendDelayedSameInitializationCopyingActivated(); |
| 586 |
|
| 587 |
mConfNeighbourLabelRepresentativeExpansionDelaying = config->isBackendCriticalNeighbourRepresentativeExpansionDelayingActivated(); |
| 588 |
mConfMinDirectNeighbourExpansionOverCriticalReductionSize = config->getBackendCriticalNeighbourDirectExpansionOverCriticalReductionSize(); |
| 589 |
|
| 590 |
mConfOnlyDeterministicRepresentativeBackendIndividualDataConsideration = config->isBackendOnlyDeterministicRepresentativeIndividualDataConsiderationActivated(); |
| 591 |
|
| 592 |
mConfBackendExpansionReuse = config->isBackendCriticalNeighbourExpansionReusingActivated(); |
| 593 |
mConfBackendExpansionLateDynamicReuseActivation = config->isBackendCriticalNeighbourExpansionLateDynamicReusingActivated(); |
| 594 |
|
| 595 |
|
| 596 |
mConfBackendExpansionNeighbourIndividualCountReuseActivation = config->getBackendExpansionReuseActivationNeighbourIndividualCount(); |
| 597 |
mConfBackendExpansionSameIndividualCountReuseActivation = config->getBackendExpansionReuseActivationSameIndividualCount(); |
| 598 |
|
| 599 |
|
| 600 |
mConfExpandDeterministicMergedHandledNeighbours = config->isBackendExpandDeterministicallyMergedHandledNeighboursActivated(); |
| 601 |
mConfCardinalityNeighbourExpansionRepresentativeCounting = config->isBackendCardinalityNeighbourExpansionRepresentativeCountingActivated(); |
| 602 |
|
| 603 |
|
| 604 |
} else { |
| 605 |
mConfCompletionGraphCaching = true; |
| 606 |
mConfDelayCompletionGraphCachingReactivation = false; |
| 607 |
mConfSpecializedAutomateRules = true; |
| 608 |
mConfSubSetBlocking = false; |
| 609 |
mConfOptimizedSubSetBlocking = true; |
| 610 |
mConfEqualSetBlocking = false; |
| 611 |
mConfPairwiseEqualSetBlocking = false; |
| 612 |
mConfAncestorBlockingSearch = false; |
| 613 |
mConfAnywhereBlockingSearch = false; |
| 614 |
mConfAnywhereBlockingCandidateHashSearch = false; |
| 615 |
mConfAnywhereBlockingLinkedCandidateHashSearch = true; |
| 616 |
mConfSemanticBranching = false; |
| 617 |
mConfAtomicSemanticBranching = true; |
| 618 |
mConfBranchTriggering = true; |
| 619 |
mConfStrictIndiNodeProcessing = true; |
| 620 |
mConfIDIndiPriorization = true; |
| 621 |
mConfPropagateNodeProcessed = false; |
| 622 |
mConfDirectRulePreprocessing = true; |
| 623 |
mConfLazyNewNominalGeneration = true; |
| 624 |
mConfConsRestrictedNonStrictIndiNodeProcessing = true; |
| 625 |
mConfUniqueNameAssumption = false; |
| 626 |
mConfBuildDependencies = true; |
| 627 |
mConfDependencyBacktracking = true; |
| 628 |
mConfDependencyBackjumping = true; |
| 629 |
mConfWriteUnsatCaching = true; |
| 630 |
mConfTestedConceptWriteUnsatCaching = true; |
| 631 |
mConfTestOccurUnsatCached = true; |
| 632 |
mConfTestPrecheckUnsatCached = true; |
| 633 |
mConfMinimizeMerging = true; |
| 634 |
mConfSatExpCacheRetrieval = true; |
| 635 |
mConfSatExpCacheConceptExpansion = true; |
| 636 |
mConfSatExpCacheSatisfiableBlocking = true; |
| 637 |
mConfSatExpCacheWriting = true; |
| 638 |
mConfSignatureSaving = false; |
| 639 |
mConfSignatureMirroringBlocking = false; |
| 640 |
mConfUnsatCachingUseFullNodeDependency = false; |
| 641 |
mConfUnsatCachingUseNodeSignatureSet = false; |
| 642 |
mConfCompGraphReuseCacheRetrieval = false; |
| 643 |
mConfCompGraphDeterministicReuse = true; |
| 644 |
mConfCompGraphNonDeterministicReuse = true; |
| 645 |
mConfRepresentativePropagationRules = true; |
| 646 |
mConfDebuggingWriteData = false; |
| 647 |
mConfGenerateQueries = false; |
| 648 |
mConfDebuggingWriteDataComplationTasks = false; |
| 649 |
mConfDebuggingWriteDataOnlyOnSatisfiability = false; |
| 650 |
mConfDebuggingWriteDataForConsistencyTests = false; |
| 651 |
mConfDebuggingWriteDataForClassificationTests = false; |
| 652 |
mConfDebuggingWriteDataForAnsweringPropagationTests = false; |
| 653 |
mConfDebuggingWriteDataForIncrementalExpansionTests = false; |
| 654 |
mConfDebuggingWriteDataForRepCacheIndiComputationTests = false; |
| 655 |
mConfDebuggingWriteDataForAllTests = false; |
| 656 |
mConfExpandCreatedSuccessorsFromSaturation = true; |
| 657 |
mConfCachingBlockingFromSaturation = true; |
| 658 |
mConfSaturationCachingWithNominals = true; |
| 659 |
mConfSaturationConceptUnsatisfiabilitySaturatedCacheWriting = true; |
| 660 |
mConfSaturationSatisfiabilitiyExpansionCacheWriting = false; |
| 661 |
mConfDatatypeReasoning = true; |
| 662 |
mConfIndividualsBackendCacheLoading = true; |
| 663 |
mConfAddCachedComputedConsequences = true; |
| 664 |
mConfMergeConstructedIndividualNode = false; |
| 665 |
mConfAllowBackendNeighbourExpansionBlocking = true; |
| 666 |
mConfNewMergingsOnlyInferringExpansion = true; |
| 667 |
mConfAllowBackendSuccessorExpansionBlocking = true; |
| 668 |
mCurrentRecProcDepthLimit = 300; |
| 669 |
mConfOccurrenceStatisticsCollecting = true; |
| 670 |
mConfIgnoreBlockingCompletionGraphCachedNonBlockingNodes = true; |
| 671 |
|
| 672 |
|
| 673 |
mConfLimitBackendNeighbourExpansion = false; |
| 674 |
mConfMaxBackendNeighbourTotalExpansionCount = 15000; |
| 675 |
mConfDefaultIndividualPrecomputationCount = 1500; |
| 676 |
mConfCriticalBackendNeighbourTotalExpansionCount = 12000; |
| 677 |
mConfMinBackendNeighbourDirectExpansionCount = 10; |
| 678 |
mConfAllProblematicBackendNeighbourDirectExpansion = true; |
| 679 |
mConfAtmostAllDirectBackendNeighbourExpansion = true; |
| 680 |
mConfBackendExpansionReuse = true; |
| 681 |
mConfBackendExpansionLimitReachedReuseActivation = true; |
| 682 |
mConfQueuedBackendNeighbourExpansionIndisBatchSize = 5; |
| 683 |
mConfQueuedBackendNeighbourExpansionRolesBatchCount = 3; |
| 684 |
mConfMinDirectNeighbourExpansionOverCriticalReductionSize = 100; |
| 685 |
|
| 686 |
mConfNeighbourLabelRepresentativeExpansionDelaying = true; |
| 687 |
mConfOnlyDeterministicRepresentativeBackendIndividualDataConsideration = true; |
| 688 |
|
| 689 |
mConfDelayedBackendInitializiation = true; |
| 690 |
|
| 691 |
mConfBackendExpansionNeighbourIndividualCountReuseActivation = 1; |
| 692 |
mConfBackendExpansionSameIndividualCountReuseActivation = 1; |
| 693 |
|
| 694 |
mConfExpandDeterministicMergedHandledNeighbours = true; |
| 695 |
mConfCardinalityNeighbourExpansionRepresentativeCounting = false; |
| 696 |
|
| 697 |
} |
| 698 |
mLastConfig = config; |
| 699 |
|
| 700 |
mConfCollectCachingUpdatedBlockableIndiNodes = mConfCompletionGraphCaching; |
| 701 |
|
| 702 |
mPosJumpFuncVec[CCAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule; |
| 703 |
if (mConfSpecializedAutomateRules) { |
| 704 |
mPosJumpFuncVec[CCAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyAutomatANDRule; |
| 705 |
} |
| 706 |
|
| 707 |
|
| 708 |
if (mConfRepresentativePropagationRules) { |
| 709 |
mPosJumpFuncVec[CCVARBINDVARIABLE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEBINDVARIABLERule; |
| 710 |
mPosJumpFuncVec[CCVARBINDTRIG] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEANDRule; |
| 711 |
mPosJumpFuncVec[CCVARBINDAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEANDRule; |
| 712 |
mPosJumpFuncVec[CCVARBINDAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEANDRule; |
| 713 |
mPosJumpFuncVec[CCVARBINDIMPL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEIMPLICATIONRule; |
| 714 |
mPosJumpFuncVec[CCVARBINDALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEALLRule; |
| 715 |
mPosJumpFuncVec[CCVARBINDAQALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEALLRule; |
| 716 |
mPosJumpFuncVec[CCVARBINDJOIN] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEJOINRule; |
| 717 |
mPosJumpFuncVec[CCVARBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEGROUNDINGRule; |
| 718 |
mNegJumpFuncVec[CCVARBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEGROUNDINGRule; |
| 719 |
} else { |
| 720 |
mPosJumpFuncVec[CCVARBINDVARIABLE] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDVARIABLERule; |
| 721 |
mPosJumpFuncVec[CCVARBINDTRIG] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARIABLEBINDINGANDRule; |
| 722 |
mPosJumpFuncVec[CCVARBINDAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARIABLEBINDINGANDRule; |
| 723 |
mPosJumpFuncVec[CCVARBINDAQAND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARIABLEBINDINGANDRule; |
| 724 |
mPosJumpFuncVec[CCVARBINDIMPL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEIMPLICATIONRule; |
| 725 |
mPosJumpFuncVec[CCVARBINDALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEALLRule; |
| 726 |
mPosJumpFuncVec[CCVARBINDAQALL] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEALLRule; |
| 727 |
mPosJumpFuncVec[CCVARBINDJOIN] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEJOINRule; |
| 728 |
mPosJumpFuncVec[CCVARBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEGROUNDINGRule; |
| 729 |
mNegJumpFuncVec[CCVARBINDGROUND] = &CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEGROUNDINGRule; |
| 730 |
} |
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
} |
| 735 |
|
| 736 |
|
| 737 |
mConceptPriorityStrategy->readCalculationConfig(satCalcTask); |
| 738 |
|
| 739 |
|
| 740 |
bool consPrepProcessing = satCalcTask->getConsistenceAdapter() != nullptr && satCalcTask->getTaskDepth() <= 0; |
| 741 |
mConfSaveCoreBlockingConceptsCandidates = mConfAnywhereBlockingLinkedCandidateHashSearch; |
| 742 |
|
| 743 |
|
| 744 |
mOptIncrementalExpansion = false; |
| 745 |
mOptIncrementalDeterministicExpansion = false; |
| 746 |
mOptIncrementalNondeterministicExpansion = false; |
| 747 |
mOptIncrementalCompatibleExpansion = false; |
| 748 |
mOptIncrementalCachingExpansion = false; |
| 749 |
if (satCalcTask->getSatisfiableTaskIncrementalConsistencyTestingAdapter()) { |
| 750 |
mOptIncrementalCompatibleExpansion = !satCalcTask->getProcessingDataBox()->isIncrementalExpansionCompatibleMerged(); |
| 751 |
mOptIncrementalCachingExpansion = !mOptIncrementalCompatibleExpansion; |
| 752 |
mOptIncrementalExpansion = true; |
| 753 |
if (satCalcTask->getTaskDepth() <= 0) { |
| 754 |
consPrepProcessing = true; |
| 755 |
mOptIncrementalDeterministicExpansion = true; |
| 756 |
} else { |
| 757 |
mOptIncrementalNondeterministicExpansion = true; |
| 758 |
} |
| 759 |
} |
| 760 |
|
| 761 |
if (mConfAnalogousPropagationPathBlockingWithAnsweringPropagationAdapters && satCalcTask->getSatisfiableAnswererBindingPropagationAdapter()) { |
| 762 |
mOptAnalogousPropagationPathBlocking = true; |
| 763 |
} else { |
| 764 |
mOptAnalogousPropagationPathBlocking = false; |
| 765 |
} |
| 766 |
|
| 767 |
mOptMergeConstructedIndividualNode = mConfMergeConstructedIndividualNode; |
| 768 |
|
| 769 |
|
| 770 |
mOptCollectOccurrenceStatistics = false; |
| 771 |
CSatisfiableTaskRepresentativeBackendUpdatingAdapter* repBackCacheUpAdapter = satCalcTask->getSatisfiableRepresentativeBackendCacheUpdatingAdapter(); |
| 772 |
if (mConfOccurrenceStatisticsCollecting && (satCalcTask->getConsistenceAdapter() || repBackCacheUpAdapter)) { |
| 773 |
mOptCollectOccurrenceStatistics = true; |
| 774 |
} |
| 775 |
if (satCalcTask->getConsistenceAdapter() || repBackCacheUpAdapter) { |
| 776 |
mOptMergeConstructedIndividualNode = true; |
| 777 |
} |
| 778 |
|
| 779 |
|
| 780 |
mOptDelayedBackendInitializiation = false; |
| 781 |
mOptDelayedBackendInitializiationWithRootLinkers = false; |
| 782 |
mOptLimitBackendNeighbourExpansion = false; |
| 783 |
mOptBackendExpansionReuse = satCalcTask->getProcessingDataBox()->isBackendIndividualLateReuseExpansionActivated(); |
| 784 |
mOptNeighbourLabelRepresentativeExpansionDelaying = false; |
| 785 |
|
| 786 |
if (repBackCacheUpAdapter) { |
| 787 |
double preCompIndiCountFactor = (double)(repBackCacheUpAdapter->getIndividualComputationCount() + repBackCacheUpAdapter->getAdditionalIndividualComputationSize()) / (double)mConfDefaultIndividualPrecomputationCount; |
| 788 |
|
| 789 |
mOptMinBackendNeighbourDirectExpansionCount = mConfMinBackendNeighbourDirectExpansionCount * preCompIndiCountFactor; |
| 790 |
mOptMaxBackendNeighbourTotalExpansionCount = mConfMaxBackendNeighbourTotalExpansionCount * preCompIndiCountFactor; |
| 791 |
mOptCriticalBackendNeighbourTotalExpansionCount = mConfCriticalBackendNeighbourTotalExpansionCount * preCompIndiCountFactor; |
| 792 |
mOptQueuedBackendNeighbourExpansionIndisBatchSize = mConfQueuedBackendNeighbourExpansionIndisBatchSize * preCompIndiCountFactor; |
| 793 |
mOptQueuedBackendNeighbourExpansionRolesBatchCount = mConfQueuedBackendNeighbourExpansionRolesBatchCount * preCompIndiCountFactor; |
| 794 |
mOptMinDirectNeighbourExpansionOverCriticalReductionSize = mConfMinDirectNeighbourExpansionOverCriticalReductionSize * preCompIndiCountFactor; |
| 795 |
|
| 796 |
if (mConfBackendExpansionLimitReachedReuseActivation && repBackCacheUpAdapter->hasExpansionLimitReached()) { |
| 797 |
mOptBackendExpansionReuse = true; |
| 798 |
} |
| 799 |
|
| 800 |
if (mConfDelayedBackendInitializiation) { |
| 801 |
mOptDelayedBackendInitializiation = true; |
| 802 |
} |
| 803 |
//mOptDelayedBackendInitializiationWithRootLinkers = true; |
| 804 |
|
| 805 |
if (mConfLimitBackendNeighbourExpansion) { |
| 806 |
mOptLimitBackendNeighbourExpansion = true; |
| 807 |
} |
| 808 |
if (mConfBackendExpansionReuse) { |
| 809 |
mOptBackendExpansionReuse = true; |
| 810 |
} |
| 811 |
} |
| 812 |
|
| 813 |
if (satCalcTask->getSatisfiablePossibleInstancesMergingAdapter() && mConfNeighbourLabelRepresentativeExpansionDelaying) { |
| 814 |
mOptNeighbourLabelRepresentativeExpansionDelaying = true; |
| 815 |
if (mConfLimitBackendNeighbourExpansion) { |
| 816 |
mOptLimitBackendNeighbourExpansion = true; |
| 817 |
|
| 818 |
mOptMinBackendNeighbourDirectExpansionCount = mConfMinBackendNeighbourDirectExpansionCount; |
| 819 |
mOptMaxBackendNeighbourTotalExpansionCount = -1; |
| 820 |
mOptCriticalBackendNeighbourTotalExpansionCount = mConfCriticalBackendNeighbourTotalExpansionCount; |
| 821 |
mOptQueuedBackendNeighbourExpansionIndisBatchSize = -1; |
| 822 |
mOptQueuedBackendNeighbourExpansionRolesBatchCount = -1; |
| 823 |
mOptMinDirectNeighbourExpansionOverCriticalReductionSize = mConfMinDirectNeighbourExpansionOverCriticalReductionSize; |
| 824 |
} |
| 825 |
} |
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
mOptConsistenceNodeMarking = consPrepProcessing && mConfConsRestrictedNonStrictIndiNodeProcessing; |
| 832 |
mOptDetExpPreporcessing = consPrepProcessing; |
| 833 |
|
| 834 |
//mOptProcessedNodePropagation = mConfPropagateNodeProcessed || !mConfStrictIndiNodeProcessing; |
| 835 |
//mOptProcessedConsNodePropagation = mConfConsRestrictedNonStrictIndiNodeProcessing; |
| 836 |
//mOptProcessingBlockingTests = !mConfStrictIndiNodeProcessing; |
| 837 |
//mOptConsNodeProcessingBlockingTests = mConfConsRestrictedNonStrictIndiNodeProcessing; |
| 838 |
|
| 839 |
//mOptNonStrictIndiNodeProcessing = !mConfStrictIndiNodeProcessing || consPrepProcessing && mConfConsRestrictedNonStrictIndiNodeProcessing; |
| 840 |
//mIndiAncDepthMasConProcPriStr->configureStrategy(!mOptNonStrictIndiNodeProcessing,mConfIDIndiPriorization); |
| 841 |
mOptNonStrictIndiNodeProcessing = true; |
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
} |
| 846 |
|
| 847 |
|
| 848 |
CCalculationAlgorithmContextBase* CCalculationTableauCompletionTaskHandleAlgorithm::createCalculationAlgorithmContext(CTaskProcessorContext *processorContext, CProcessContext* processContext, CSatisfiableCalculationTask* satCalcTask) { |
| 849 |
CCalculationAlgorithmContextBase* calcAlgContext = CObjectAllocator< CCalculationAlgorithmContextBase >::allocateAndConstruct(processContext->getUsedMemoryAllocationManager()); |
| 850 |
calcAlgContext->initTaskProcessContext(processContext,satCalcTask); |
| 851 |
calcAlgContext->initCalculationAlgorithmContext(processorContext,mConceptPriorityStrategy,mIndividualPriorityStrategy,mTaskProcessingStrategy,mUnsatCachRetStrategy, |
| 852 |
mIndiNodeManager,mClashDesFactory,mDependencyFactory,mUnsatCacheHandler,mSatExpCacheHandler,mSatNodeExpCacheHandler); |
| 853 |
return calcAlgContext; |
| 854 |
} |
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::handleTask(CTaskProcessorContext *processorContext, CTask* task) { |
| 859 |
|
| 860 |
//lastBranchingMergingProcRest = nullptr; |
| 861 |
|
| 862 |
CTaskHandleMemoryAllocationManager* processorMemoryManager = processorContext->getTaskHandleMemoryAllocationManager(); |
| 863 |
CTaskProcessorCommunicator* processorCommunicator = processorContext->getTaskProcessorCommunicator(); |
| 864 |
|
| 865 |
CTaskHandleMemoryAllocationManager* taskHandleMemMan = processorContext->getTaskHandleMemoryAllocationManager(); |
| 866 |
taskHandleMemMan->releaseAllMemory(); |
| 867 |
|
| 868 |
CSatisfiableCalculationTask* satCalcTask = dynamic_cast<CSatisfiableCalculationTask*>(task); |
| 869 |
if (satCalcTask) { |
| 870 |
|
| 871 |
if (!processorCommunicator->verifyContinueTaskProcessing(satCalcTask)) { |
| 872 |
if (!satCalcTask->getTaskStatus()->isProcessable()) { |
| 873 |
processorCommunicator->communicateTaskComplete(satCalcTask); |
| 874 |
return false; |
| 875 |
} else { |
| 876 |
// continue later |
| 877 |
return true; |
| 878 |
} |
| 879 |
} |
| 880 |
|
| 881 |
readCalculationConfig(satCalcTask); |
| 882 |
|
| 883 |
|
| 884 |
mLastUnsatCacheTestedIndiNode = nullptr; |
| 885 |
mLastAnalysingBranchNodeTree = nullptr; |
| 886 |
|
| 887 |
CProcessContext* processContext = satCalcTask->getProcessContext(processorContext); |
| 888 |
CCalculationAlgorithmContextBase* calcAlgContext = createCalculationAlgorithmContext(processorContext,processContext,satCalcTask); |
| 889 |
mCalcAlgContext = calcAlgContext; |
| 890 |
mProcessingDataBox = satCalcTask->getProcessingDataBox(); |
| 891 |
bool clashed = false; |
| 892 |
bool satisfiable = false; |
| 893 |
bool completed = false; |
| 894 |
bool paused = false; |
| 895 |
bool error = false; |
| 896 |
bool canceled = false; |
| 897 |
cint64 errorCode = 0; |
| 898 |
|
| 899 |
CProcessTagger* processTagger = calcAlgContext->getUsedProcessTagger(); |
| 900 |
|
| 901 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 902 |
|
| 903 |
CNodeSwitchHistory* nodeSwitchHistory = processingDataBox->getNodeSwitchHistory(true); |
| 904 |
|
| 905 |
mProcessingQueue = nullptr; |
| 906 |
mDepthFirstProcessingQueue = nullptr; |
| 907 |
mSigBlockRevSet = nullptr; |
| 908 |
mReusingReviewData = nullptr; |
| 909 |
mIndiImmediateProQueue = nullptr; |
| 910 |
mIndiDetExpProQueue = nullptr; |
| 911 |
mIndiDetDeptFirstExpProQueue = nullptr; |
| 912 |
mValueSpaceTriggeringProQueue = nullptr; |
| 913 |
mValueSpaceSatCheckingQueue = nullptr; |
| 914 |
mNominalProcessingQueue = nullptr; |
| 915 |
mDepthProcessingQueue = nullptr; |
| 916 |
mEarlyIndiReactProcessingQueue = nullptr; |
| 917 |
mLateIndiReactProcessingQueue = nullptr; |
| 918 |
mIndiBlockReactProQueue = nullptr; |
| 919 |
mIndiSigBlockUpdProQueue = nullptr; |
| 920 |
mDelayedNominalProcessingQueue = nullptr; |
| 921 |
mVarBindConBatchProcessingQueue = nullptr; |
| 922 |
mRoleAssertionProcessingQueue = nullptr; |
| 923 |
mIncrementalExpansionInitializingProcessingQueue = nullptr; |
| 924 |
mIncrementalExpansionProcessingQueue = nullptr; |
| 925 |
mIncrementalCompatibilityCheckingQueue = nullptr; |
| 926 |
mMinConceptProcessingPriorityLevel = 0; |
| 927 |
mIndiNodeConcludeUnsatCaching = false; |
| 928 |
|
| 929 |
mOccStatsCacheHandler->configureOntology(processingDataBox->getOntology()); |
| 930 |
|
| 931 |
//CSatisfiableTaskClassificationMessageAdapter* adapter = satCalcTask->getClassificationMessageAdapter(); |
| 932 |
//if (adapter) { |
| 933 |
// CConcept* concept = adapter->getTestingConcept(); |
| 934 |
// if (concept && adapter->hasExtractionFlags(CSatisfiableTaskClassificationMessageAdapter::EFEXTRACTSUBSUMERSROOTNODE)) { |
| 935 |
// QString className = CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 936 |
// if (className == "http://reference.data.gov.uk/def/intervals/CalendarYear") { |
| 937 |
// bool bug = true; |
| 938 |
// } |
| 939 |
// } |
| 940 |
//} |
| 941 |
CSatisfiableTaskRepresentativeBackendUpdatingAdapter* repCacheUpdAd = satCalcTask->getSatisfiableRepresentativeBackendCacheUpdatingAdapter(); |
| 942 |
|
| 943 |
try { |
| 944 |
mBackendCacheHandler->setWorkingOntology(satCalcTask->getProcessingDataBox()->getOntology()); |
| 945 |
|
| 946 |
|
| 947 |
if (repCacheUpdAd && !processingDataBox->hasBackendCacheUpdateIndividualsInitialized()) { |
| 948 |
QList<CIndividualReference>* indiComputationList = repCacheUpdAd->getIndividualComputationList(); |
| 949 |
CIndividualVector* baseIndiVec = processingDataBox->getIndividualVector(true); |
| 950 |
CIndividualUnsortedProcessingQueue* indiNodeQueue = processingDataBox->getIndividualImmediatelyProcessingQueue(true); |
| 951 |
CIndividualProcessNodeVector* indiNodeVec = processingDataBox->getIndividualProcessNodeVector(); |
| 952 |
CDependencyTrackPoint* independentBaseDepTrackPoint = processingDataBox->getBranchingTree(true)->getBaseDependencyNode(true)->getContinueDependencyTrackPoint(); |
| 953 |
for (QList<CIndividualReference>::const_iterator it = indiComputationList->constBegin(), itEnd = indiComputationList->constEnd(); it != itEnd; ++it) { |
| 954 |
CIndividualReference individualReference = (*it); |
| 955 |
CIndividual* individual = individualReference.getIndividual(); |
| 956 |
cint64 individualID = individualReference.getIndividualID(); |
| 957 |
|
| 958 |
|
| 959 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assData = mBackendCacheHandler->getIndividualAssociationData(individualID, calcAlgContext); |
| 960 |
if (assData->isIncompletelyMarked()) { |
| 961 |
CBackendIndividualRetrievalComputationUpdateCoordinationHashData* coordData = repCacheUpdAd->getIndividualComputationCoordinationHash()->value(individualID); |
| 962 |
if (!coordData || !coordData->isComputationIntegrated()) { |
| 963 |
|
| 964 |
cint64 individualNodeID = -individualID; |
| 965 |
|
| 966 |
// does not use delayed backend initialization |
| 967 |
//CIndividualProcessNode* localIndi = getLocalizedIndividual(-individualID, calcAlgContext); |
| 968 |
|
| 969 |
if (!individual) { |
| 970 |
individual = baseIndiVec->getData(individualID); |
| 971 |
} |
| 972 |
if (!individual) { |
| 973 |
individual = CObjectAllocator<CIndividual>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 974 |
individual->initIndividual(individualID); |
| 975 |
individual->setTemporaryIndividual(true); |
| 976 |
baseIndiVec->setLocalData(individualID, individual); |
| 977 |
} |
| 978 |
CIndividualProcessNode* localIndi = indiNodeVec->getLocalData(individualNodeID); |
| 979 |
if (!localIndi) { |
| 980 |
localIndi = CObjectParameterizingAllocator< CIndividualProcessNode, CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getProcessContext()); |
| 981 |
localIndi->initDependencyTracker(independentBaseDepTrackPoint); |
| 982 |
localIndi->setIndividualNodeID(individualNodeID); |
| 983 |
localIndi->setAssertionDataLinker(individual->getAssertionDataLinker()); |
| 984 |
localIndi->setAssertionConceptLinker(individual->getAssertionConceptLinker()); |
| 985 |
localIndi->setAssertionRoleLinker(individual->getAssertionRoleLinker()); |
| 986 |
localIndi->setReverseAssertionRoleLinker(individual->getReverseAssertionRoleLinker()); |
| 987 |
localIndi->setNominalIndividual(individual); |
| 988 |
localIndi->setIndividualType(CIndividualProcessNode::NOMINALINDIVIDUALTYPE); |
| 989 |
localIndi->setNominalIndividualTriplesAssertions(true); |
| 990 |
localIndi->setInitializingConceptLinker(nullptr); |
| 991 |
indiNodeVec->setLocalData(individualNodeID, localIndi); |
| 992 |
} |
| 993 |
|
| 994 |
indiNodeQueue->insertIndiviudalProcessNode(localIndi); |
| 995 |
|
| 996 |
if (processingDataBox->getConstructedIndividualNode() == nullptr) { |
| 997 |
processingDataBox->setConstructedIndividualNode(localIndi); |
| 998 |
} |
| 999 |
} |
| 1000 |
} |
| 1001 |
|
| 1002 |
} |
| 1003 |
processingDataBox->setBackendCacheUpdateIndividualsInitialized(true); |
| 1004 |
} |
| 1005 |
|
| 1006 |
|
| 1007 |
|
| 1008 |
if (processingDataBox->getBranchingInstruction()) { |
| 1009 |
CBranchingInstruction* branchingInstruction = processingDataBox->getBranchingInstruction(); |
| 1010 |
CBranchingInstruction::BRANCHINGINSTRUCTIONTYPE branchingInstructionType = branchingInstruction->getBranchingInstructionType(); |
| 1011 |
if (branchingInstructionType == CBranchingInstruction::BIADDINDIVIDUALCONCEPTSTYPE) { |
| 1012 |
CBranchingInstructionAddIndividualConcepts* addConceptBrIn = (CBranchingInstructionAddIndividualConcepts*)branchingInstruction; |
| 1013 |
|
| 1014 |
CIndividualProcessNode* newLocIndiNode = getLocalizedIndividual(addConceptBrIn->getAddingIndividualNode(),false,calcAlgContext); |
| 1015 |
CConceptProcessingQueue* newConProcQueue = newLocIndiNode->getConceptProcessingQueue(true); |
| 1016 |
CDependencyTrackPoint* newDependencyTrackPoint = addConceptBrIn->getAddingDependencyTrackPoint(); |
| 1017 |
|
| 1018 |
for (CSortedNegLinker<CConcept*>* addingConceptLinker = addConceptBrIn->getAddingConceptLinker(); addingConceptLinker; addingConceptLinker = addingConceptLinker->getNext()) { |
| 1019 |
addConceptToIndividual(addingConceptLinker->getData(),addingConceptLinker->isNegated(),newLocIndiNode,newDependencyTrackPoint,false,true,calcAlgContext); |
| 1020 |
} |
| 1021 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForBranchedDisjuncts(nullptr,newLocIndiNode,nullptr)) { |
| 1022 |
addIndividualNodeForCacheUnsatisfiableRetrieval(newLocIndiNode,calcAlgContext); |
| 1023 |
} |
| 1024 |
addIndividualToProcessingQueue(newLocIndiNode,calcAlgContext); |
| 1025 |
|
| 1026 |
} |
| 1027 |
processingDataBox->clearBranchingInstruction(); |
| 1028 |
} |
| 1029 |
|
| 1030 |
|
| 1031 |
if (satCalcTask->getSatisfiableTaskIncrementalConsistencyTestingAdapter()) { |
| 1032 |
if (!processingDataBox->isIncrementalExpansionInitialised()) { |
| 1033 |
mIncrementalCompatibilityCheckingQueue = processingDataBox->getIncrementalCompatibilityCheckingQueue(true); |
| 1034 |
CIndividualUnsortedProcessingQueue* indiNodeQueue = processingDataBox->getIndividualImmediatelyProcessingQueue(true); |
| 1035 |
for (CXLinker<CIndividualProcessNode*>* indiNodeLinkerIt = indiNodeQueue->getProcessIndividualNodeLinker(); indiNodeLinkerIt; indiNodeLinkerIt = indiNodeLinkerIt->getNext()) { |
| 1036 |
CIndividualProcessNode* indiNode = indiNodeLinkerIt->getData(); |
| 1037 |
CIndividualProcessNode* locIndiNode = getLocalizedIndividual(indiNode,true,calcAlgContext); |
| 1038 |
locIndiNode->getIncrementalExpansionData(true)->setDirectlyChanged(true); |
| 1039 |
locIndiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANDING | CIndividualProcessNode::PRFINCREMENTALEXPANSIONRETESTDUEDIRECTMODIFIED); |
| 1040 |
locIndiNode->setIncrementalExpansionID(calcAlgContext->getProcessingDataBox()->getIncrementalExpansionID()); |
| 1041 |
mIncrementalCompatibilityCheckingQueue->insertProcessIndiviudal(locIndiNode); |
| 1042 |
} |
| 1043 |
processingDataBox->setIncrementalExpansionInitialised(true); |
| 1044 |
} |
| 1045 |
} |
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
if (processingDataBox->isReapplicationLastConceptDesciptorOnLastIndividualNodeRequired()) { |
| 1050 |
CIndividualProcessNode* lastProcessingIndiNode = nullptr; |
| 1051 |
CConceptProcessDescriptor* lastProcessingConDes = nullptr; |
| 1052 |
if (processingDataBox->getLastProcessingIndividualNodeAndConceptDescriptor(lastProcessingIndiNode,lastProcessingConDes)) { |
| 1053 |
addCopiedConceptToProcessingQueue(lastProcessingConDes,lastProcessingIndiNode,calcAlgContext); |
| 1054 |
} |
| 1055 |
processingDataBox->setReapplicationLastConceptDesciptorOnLastIndividualNodeRequired(false); |
| 1056 |
} |
| 1057 |
|
| 1058 |
|
| 1059 |
if (mConfPossibleInstanceIndividualsMerging) { |
| 1060 |
|
| 1061 |
|
| 1062 |
CSatisfiableTaskRealizationPossibleInstancesMergingAdapter* possibleInstancesMergingAdapter = satCalcTask->getSatisfiablePossibleInstancesMergingAdapter(); |
| 1063 |
if (possibleInstancesMergingAdapter) { |
| 1064 |
|
| 1065 |
CPossibleInstancesIndividualsMergingLinker* indiTestingMergingLinker = possibleInstancesMergingAdapter->getIndividualTestingMergingLinker(); |
| 1066 |
if (indiTestingMergingLinker && indiTestingMergingLinker->isSatisfiableMerged()) { |
| 1067 |
canceled = true; |
| 1068 |
satisfiable = true; |
| 1069 |
} |
| 1070 |
} |
| 1071 |
} |
| 1072 |
|
| 1073 |
|
| 1074 |
CIndividualProcessNode* indiProcNode = nullptr; |
| 1075 |
if (!canceled) { |
| 1076 |
indiProcNode = takeNextProcessIndividual(calcAlgContext); |
| 1077 |
} |
| 1078 |
CConceptProcessDescriptor* conProcDes = nullptr; |
| 1079 |
|
| 1080 |
mCurrentRecProcDepth = 0; |
| 1081 |
mProcessRuleToTaskProcessingVerificationCount = 80; |
| 1082 |
mRemainProcessRuleToTaskProcessingVerification = mProcessRuleToTaskProcessingVerificationCount; |
| 1083 |
|
| 1084 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mBeginTaskDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 1085 |
|
| 1086 |
|
| 1087 |
|
| 1088 |
CIndividualProcessNode* lastIndiProcNode = nullptr; |
| 1089 |
STATINC(TASKPROCESSCHANGECOUNT,mCalcAlgContext); |
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
CSatisfiableTaskCancellationAdapter* cancellationAdapter = satCalcTask->getCancellationAdapter(); |
| 1094 |
if (cancellationAdapter && cancellationAdapter->canCancelTaskCalculation()) { |
| 1095 |
canceled = true; |
| 1096 |
throw CCalculationErrorProcessingException(CCalculationErrorProcessingException::ECCANCELED); |
| 1097 |
} |
| 1098 |
|
| 1099 |
|
| 1100 |
if (repCacheUpdAd && repCacheUpdAd->hasUnsatisfiableComputed()) { |
| 1101 |
canceled = true; |
| 1102 |
throw CCalculationErrorProcessingException(CCalculationErrorProcessingException::ECCANCELED); |
| 1103 |
} |
| 1104 |
|
| 1105 |
|
| 1106 |
CSatisfiableTaskRepresentativeBackendUpdatingAdapter* repBackCacheUpAdapter = satCalcTask->getSatisfiableRepresentativeBackendCacheUpdatingAdapter(); |
| 1107 |
if (repBackCacheUpAdapter) { |
| 1108 |
mBackendCacheHandler->checkRecomputationIdUsage(repBackCacheUpAdapter->getRepresentativeCacheRecomputationId()); |
| 1109 |
} |
| 1110 |
|
| 1111 |
|
| 1112 |
while (indiProcNode && !canceled) { |
| 1113 |
lastIndiProcNode = indiProcNode; |
| 1114 |
conProcDes = nullptr; |
| 1115 |
|
| 1116 |
|
| 1117 |
// TODO: signature cached, but empty processing queue |
| 1118 |
//CConceptProcessingQueue* prevConProcQueue = indiProcNode->getConceptProcessingQueue(false); |
| 1119 |
//if (!prevConProcQueue || !prevConProcQueue->isEmpty()) { |
| 1120 |
if (true) { |
| 1121 |
|
| 1122 |
|
| 1123 |
|
| 1124 |
//CSatisfiableTaskRepresentativeBackendUpdatingAdapter* repCacheUpdAd = satCalcTask->getSatisfiableRepresentativeBackendCacheUpdatingAdapter(); |
| 1125 |
//cint64 repCompId = -1; |
| 1126 |
//if (repCompId && repCacheUpdAd) { |
| 1127 |
// repCompId = repCacheUpdAd->getRepresentativeCacheRecomputationId(); |
| 1128 |
//} |
| 1129 |
//if (lastRecomputationTaskId != repCompId) { |
| 1130 |
// nextReportingExpansionCount = 1000; |
| 1131 |
// lastRecomputationTaskId = repCompId; |
| 1132 |
// lastTaskDepth = 100; |
| 1133 |
//} |
| 1134 |
|
| 1135 |
|
| 1136 |
//bool reporting = false; |
| 1137 |
//cint64 currentExpansionCount = mProcessingDataBox->getBackendCacheIntegratedIndividualNodeCount(); |
| 1138 |
//if (currentExpansionCount > nextReportingExpansionCount && repCacheUpdAd) { |
| 1139 |
// reporting = true; |
| 1140 |
// nextReportingExpansionCount += 1000; |
| 1141 |
//} |
| 1142 |
//if (satCalcTask->getTaskDepth() > lastTaskDepth) { |
| 1143 |
// lastTaskDepth += 100; |
| 1144 |
// bool debug = true; |
| 1145 |
// reporting = true; |
| 1146 |
//} |
| 1147 |
//if (reporting) { |
| 1148 |
// LOG(INFO, "::Konclude::Reasoner::Kernel::Algorithm::TableauCompletionAlgorihm", logTr("Expansion reached size %1 (%6 same) for recomputation task %2 with limit %3 (%4 critical) at task depth %5.").arg(currentExpansionCount).arg(repCompId).arg(mOptMaxBackendNeighbourTotalExpansionCount).arg(mOptCriticalBackendNeighbourTotalExpansionCount).arg(satCalcTask->getTaskDepth()).arg(mProcessingDataBox->getBackendCacheIntegratedSameIndividualNodeCount()), this); |
| 1149 |
//} |
| 1150 |
|
| 1151 |
|
| 1152 |
processTagger->incNodeSwitchTag(); |
| 1153 |
nodeSwitchHistory->addIndividualProcessNodeSwitch(indiProcNode,processTagger->getCurrentNodeSwitchTag()); |
| 1154 |
mCalcAlgContext->setMinModificationIndividual(indiProcNode); |
| 1155 |
STATINC(INDIVIDUALNODESWITCHCOUNT,mCalcAlgContext); |
| 1156 |
|
| 1157 |
//testCompletionGraphCachingAndBlocking(calcAlgContext); |
| 1158 |
|
| 1159 |
// initialize individual |
| 1160 |
if (individualNodeInitializing(indiProcNode, calcAlgContext)) { |
| 1161 |
|
| 1162 |
bool indiStartProcessingDebug = false; |
| 1163 |
if (indiStartProcessingDebug) { |
| 1164 |
mEndTaskDebugIndiModelString = writeGeneratedExtendedDebugIndiModelStringList(QString("./Debugging/CompletionTasks/indi-%1-start.txt").arg(indiProcNode->getIndividualNodeID()), calcAlgContext); |
| 1165 |
} |
| 1166 |
|
| 1167 |
|
| 1168 |
bool continueProcessingIndividual = continueIndividualProcessing(indiProcNode,calcAlgContext); |
| 1169 |
|
| 1170 |
while (continueProcessingIndividual && !canceled) { |
| 1171 |
CConceptProcessingQueue* conProcQueue = indiProcNode->getConceptProcessingQueue(true); |
| 1172 |
conProcDes = conProcQueue->takeNextConceptDescriptorProcess(); |
| 1173 |
|
| 1174 |
processingDataBox->setLastProcessingIndividualNodeAndConceptDescriptor(indiProcNode,conProcDes); |
| 1175 |
|
| 1176 |
// process concept |
| 1177 |
mCurrentRecProcDepth = 0; |
| 1178 |
++mAppliedTOTALRuleCount; |
| 1179 |
STATINC(RULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 1180 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mBeforeRuleTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 1181 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mBeforeRuleDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 1182 |
|
| 1183 |
|
| 1184 |
continueProcessingIndividual = tableauRuleProcessing(indiProcNode,conProcDes,mCalcAlgContext); |
| 1185 |
|
| 1186 |
|
| 1187 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mAfterRuleDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 1188 |
|
| 1189 |
if (continueProcessingIndividual) { |
| 1190 |
continueProcessingIndividual = continueIndividualProcessing(indiProcNode,calcAlgContext); |
| 1191 |
} else { |
| 1192 |
addConceptToProcessingQueue(conProcDes,conProcQueue,indiProcNode,calcAlgContext); |
| 1193 |
} |
| 1194 |
|
| 1195 |
|
| 1196 |
if (--mRemainProcessRuleToTaskProcessingVerification <= 0) { |
| 1197 |
mRemainProcessRuleToTaskProcessingVerification = mProcessRuleToTaskProcessingVerificationCount; |
| 1198 |
|
| 1199 |
if (cancellationAdapter && cancellationAdapter->canCancelTaskCalculation()) { |
| 1200 |
canceled = true; |
| 1201 |
throw CCalculationErrorProcessingException(CCalculationErrorProcessingException::ECCANCELED); |
| 1202 |
} |
| 1203 |
|
| 1204 |
if (repCacheUpdAd && repCacheUpdAd->hasUnsatisfiableComputed()) { |
| 1205 |
canceled = true; |
| 1206 |
throw CCalculationErrorProcessingException(CCalculationErrorProcessingException::ECCANCELED); |
| 1207 |
} |
| 1208 |
|
| 1209 |
if (!processorCommunicator->verifyContinueTaskProcessing(satCalcTask)) { |
| 1210 |
STATINC(TASKPROCESSPAUSECOUNT,mCalcAlgContext); |
| 1211 |
paused = true; |
| 1212 |
calcAlgContext->setCurrentIndividualNode(nullptr); |
| 1213 |
addIndividualToProcessingQueue(indiProcNode,calcAlgContext); |
| 1214 |
throw CCalculationStopProcessingException(false); |
| 1215 |
} |
| 1216 |
} |
| 1217 |
|
| 1218 |
|
| 1219 |
} |
| 1220 |
|
| 1221 |
individualNodeConclusion(indiProcNode,calcAlgContext); |
| 1222 |
|
| 1223 |
} |
| 1224 |
|
| 1225 |
if (mCalcAlgContext->isMinModificationUpdated()) { |
| 1226 |
// update history |
| 1227 |
nodeSwitchHistory->updateLastIndividualProcessNodeSwitch(mCalcAlgContext->getMinModificationAncestorDepth(),mCalcAlgContext->getMinModificationIndividualID()); |
| 1228 |
} |
| 1229 |
} |
| 1230 |
|
| 1231 |
indiProcNode = nullptr; |
| 1232 |
if (!canceled) { |
| 1233 |
indiProcNode = takeNextProcessIndividual(calcAlgContext); |
| 1234 |
} |
| 1235 |
|
| 1236 |
} |
| 1237 |
|
| 1238 |
|
| 1239 |
if (mOptIncrementalExpansion && !mProcessingDataBox->isIncrementalExpansionCachingMerged()) { |
| 1240 |
incrementalMergeWithPreviousNondeterministicCompletionGraph(calcAlgContext); |
| 1241 |
mProcessingDataBox->setIncrementalExpansionCachingMerged(true); |
| 1242 |
} |
| 1243 |
|
| 1244 |
|
| 1245 |
//if (task->getTaskDepth() < 100) { |
| 1246 |
|
| 1247 |
// CSatisfiableCalculationTask* tasks = createDependendBranchingTaskList(2,calcAlgContext); |
| 1248 |
|
| 1249 |
// processorCommunicator->communicateTaskCreation(tasks); |
| 1250 |
// //throw CCalculationStopProcessingException(true); |
| 1251 |
// completed = true; |
| 1252 |
//} else { |
| 1253 |
// //CClashedConceptDescriptor* clashDes = CObjectAllocator<CClashedConceptDescriptor>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1254 |
// //throw clashDes; |
| 1255 |
// clashed = true; |
| 1256 |
//} |
| 1257 |
|
| 1258 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mSatTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
|
| 1263 |
if (mConfPossibleInstanceIndividualsMerging && !canceled) { |
| 1264 |
|
| 1265 |
|
| 1266 |
|
| 1267 |
CSatisfiableTaskRealizationPossibleInstancesMergingAdapter* possibleInstancesMergingAdapter = satCalcTask->getSatisfiablePossibleInstancesMergingAdapter(); |
| 1268 |
if (possibleInstancesMergingAdapter) { |
| 1269 |
|
| 1270 |
|
| 1271 |
|
| 1272 |
bool printMergingTask = false; |
| 1273 |
if (printMergingTask) { |
| 1274 |
QString writingFolder = "./Debugging/CompletionTasks/"; |
| 1275 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 1276 |
QFile file(QString("%1%2-task.txt").arg(writingFolder, "possible-instance-individuals-merging")); |
| 1277 |
if (file.open(QIODevice::WriteOnly)) { |
| 1278 |
file.write(mEndTaskDebugIndiModelString.replace("<br>", "\r\n").toLocal8Bit()); |
| 1279 |
file.close(); |
| 1280 |
} |
| 1281 |
} |
| 1282 |
|
| 1283 |
|
| 1284 |
CPossibleInstancesIndividualsMergingData* possInstanceMergeingData = possibleInstancesMergingAdapter->getPossibleInstanceMergingData(); |
| 1285 |
if (possInstanceMergeingData) { |
| 1286 |
CPossibleInstancesIndividualsMergingLinker* lastMergedPossibleInstanceIndividualLinker = (CPossibleInstancesIndividualsMergingLinker*)processingDataBox->getLastMergedPossibleInstanceIndividualLinker(); |
| 1287 |
if (lastMergedPossibleInstanceIndividualLinker) { |
| 1288 |
if (!lastMergedPossibleInstanceIndividualLinker->isSatisfiableMerged()) { |
| 1289 |
++mStatPossibleInstanceMergingSuccessSubmitCount; |
| 1290 |
possInstanceMergeingData->incMergingSuccess(); |
| 1291 |
lastMergedPossibleInstanceIndividualLinker->setSatisfiableMerged(); |
| 1292 |
} |
| 1293 |
} |
| 1294 |
CXLinker<CPossibleInstancesIndividualsMergingLinker*>* currentMergedPossibleInstanceIndividualLinkersLinker = (CXLinker<CPossibleInstancesIndividualsMergingLinker*>*)processingDataBox->getCurrentMergedPossibleInstanceIndividualLinkersLinker(); |
| 1295 |
while (currentMergedPossibleInstanceIndividualLinkersLinker) { |
| 1296 |
CPossibleInstancesIndividualsMergingLinker* currentMergedPossibleInstanceIndividualLinker = currentMergedPossibleInstanceIndividualLinkersLinker->getData(); |
| 1297 |
if (!currentMergedPossibleInstanceIndividualLinker->isSatisfiableMerged()) { |
| 1298 |
++mStatPossibleInstanceMergingSuccessSubmitCount; |
| 1299 |
possInstanceMergeingData->incMergingSuccess(); |
| 1300 |
currentMergedPossibleInstanceIndividualLinker->setSatisfiableMerged(); |
| 1301 |
} |
| 1302 |
currentMergedPossibleInstanceIndividualLinkersLinker = (CXLinker<CPossibleInstancesIndividualsMergingLinker*>*)currentMergedPossibleInstanceIndividualLinkersLinker->getNext(); |
| 1303 |
} |
| 1304 |
|
| 1305 |
|
| 1306 |
cint64 testingIndiId = possibleInstancesMergingAdapter->getTestingIndividualReference().getIndividualID(); |
| 1307 |
|
| 1308 |
// try merging possible Instances |
| 1309 |
if (!processingDataBox->isPossibleInstanceIndividualMergingStopped()) { |
| 1310 |
CIndividualProcessNode* testingIndiNode = getCorrectedNominalIndividualNode(-testingIndiId, calcAlgContext); |
| 1311 |
tryPossibleInstanceMerging(testingIndiNode, possInstanceMergeingData, calcAlgContext); |
| 1312 |
} else { |
| 1313 |
possInstanceMergeingData->incMergingStreakFails(); |
| 1314 |
} |
| 1315 |
} |
| 1316 |
|
| 1317 |
} |
| 1318 |
} |
| 1319 |
|
| 1320 |
|
| 1321 |
satisfiable = true; |
| 1322 |
|
| 1323 |
|
| 1324 |
if (mConfGenerateQueries) { |
| 1325 |
CCompletionGraphRandomWalkQueryGenerator queryGen; |
| 1326 |
queryGen.generateQueries(calcAlgContext->getSatisfiableCalculationTask()); |
| 1327 |
} |
| 1328 |
|
| 1329 |
|
| 1330 |
|
| 1331 |
|
| 1332 |
//lastBranchingMergingProcRest = lastBranchingMergingProcRest; |
| 1333 |
//if (lastBranchingMergingProcRest) { |
| 1334 |
// lastBranchingMergingProcRest->printIndividualContainer(); |
| 1335 |
//} |
| 1336 |
|
| 1337 |
//analyzeCompletionGraphStatistics(calcAlgContext); |
| 1338 |
//writeCompletionGraphStatistics(calcAlgContext); |
| 1339 |
|
| 1340 |
//testCompletionGraphCachingAndBlocking(calcAlgContext); |
| 1341 |
|
| 1342 |
} catch (const CClashedConceptDescriptor*& clashConLinker) { |
| 1343 |
clashed = true; |
| 1344 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mClashedDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 1345 |
} catch (const CCalculationClashProcessingException& calcClashProcException) { |
| 1346 |
clashed = true; |
| 1347 |
CClashedDependencyDescriptor* clashConLinker = calcClashProcException.getClashedDependencyDescriptor(); |
| 1348 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mClashedDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 1349 |
|
| 1350 |
if (mConfDependencyBacktracking) { |
| 1351 |
clashedBacktracking(clashConLinker,calcAlgContext); |
| 1352 |
} |
| 1353 |
} catch (const CCalculationStopProcessingException& calcStopProcException) { |
| 1354 |
if (calcStopProcException.isTaskCompletedProcessed()) { |
| 1355 |
completed = true; |
| 1356 |
} |
| 1357 |
} catch (const CCalculationErrorProcessingException& calcErrorProcException) { |
| 1358 |
if (calcErrorProcException.hasError()) { |
| 1359 |
error = true; |
| 1360 |
errorCode = (cint64)calcErrorProcException.getErrorCode(); |
| 1361 |
if (errorCode != CCalculationErrorProcessingException::ECCANCELED) { |
| 1362 |
LOG(ERROR, "::Konclude::Reasoner::Kernel::Algorithm::TableauCompletionAlgorihm", logTr("Error occured, computation stopped."), this); |
| 1363 |
} |
| 1364 |
} |
| 1365 |
} catch (const CMemoryAllocationException& memAllocException) { |
| 1366 |
error = true; |
| 1367 |
errorCode = 2; |
| 1368 |
} catch (...) { |
| 1369 |
error = true; |
| 1370 |
errorCode = 3; |
| 1371 |
} |
| 1372 |
|
| 1373 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mEndTaskDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 1374 |
|
| 1375 |
if (!error && repCacheUpdAd && repCacheUpdAd->hasUnsatisfiableComputed()) { |
| 1376 |
error = true; |
| 1377 |
completed = false; |
| 1378 |
clashed = false; |
| 1379 |
} |
| 1380 |
|
| 1381 |
bool xDebug = false; |
| 1382 |
|
| 1383 |
//if (satCalcTask->getTaskDepth() % 500 == 0) { |
| 1384 |
// xDebug = true; |
| 1385 |
//} |
| 1386 |
|
| 1387 |
bool sDebug = false; |
| 1388 |
//if (satCalcTask->getClassificationMessageAdapter()) { |
| 1389 |
// CIndividualProcessNode* node = getUpToDateIndividual(calcAlgContext->getProcessingDataBox()->getConstructedIndividualNode(), calcAlgContext); |
| 1390 |
// CIndividualMergingHash* mergingHash = node->getIndividualMergingHash(false); |
| 1391 |
// if (mergingHash) { |
| 1392 |
// bool slected = true; |
| 1393 |
// for (CIndividualMergingHash::const_iterator it = mergingHash->constBegin(), itEnd = mergingHash->constEnd(); it != itEnd && slected; ++it) { |
| 1394 |
// cint64 mergedIndi = it.key(); |
| 1395 |
// CIndividualProcessNode* mergedNode = getUpToDateIndividual(-mergedIndi, calcAlgContext); |
| 1396 |
// if (mergedNode && mergedNode->getNominalIndividual()) { |
| 1397 |
// QString mergedIndiName = CIRIName::getRecentIRIName(mergedNode->getNominalIndividual()->getNameLinker()); |
| 1398 |
// if (mergedIndiName != "http://www.semanticweb.org/ontologies/2010/9/Ontology1288387737869.owl#Ind350399375764604218" && mergedIndiName != "http://www.semanticweb.org/ontologies/2010/9/Ontology1288387737869.owl#Ind968776124155655128" && mergedIndiName != "http://www.semanticweb.org/ontologies/2010/9/Ontology1288387737869.owl#Swede") { |
| 1399 |
// slected = false; |
| 1400 |
// } |
| 1401 |
// } |
| 1402 |
// } |
| 1403 |
// if (slected) { |
| 1404 |
// bool otherNodesMerged = false; |
| 1405 |
// for (cint64 i = 0; i < 130 && !otherNodesMerged; ++i) { |
| 1406 |
// CIndividualProcessNode* checkNode = getUpToDateIndividual(i, calcAlgContext); |
| 1407 |
// if (checkNode) { |
| 1408 |
// if (node->getIndividualNodeID() != i && checkNode->getMergedIntoIndividualNodeID() == node->getIndividualNodeID()) { |
| 1409 |
// otherNodesMerged = true; |
| 1410 |
// } |
| 1411 |
// } |
| 1412 |
// } |
| 1413 |
// if (!otherNodesMerged) { |
| 1414 |
// sDebug = true; |
| 1415 |
// } |
| 1416 |
// } |
| 1417 |
// } |
| 1418 |
//} |
| 1419 |
|
| 1420 |
|
| 1421 |
if (mDebug && sDebug || xDebug || mConfDebuggingWriteData && mConfDebuggingWriteDataComplationTasks) { |
| 1422 |
|
| 1423 |
CSatisfiableTaskClassificationMessageAdapter* classificationAdapter = satCalcTask->getClassificationMessageAdapter(); |
| 1424 |
CTaskPreyingAdapter* consistencyAdapter = satCalcTask->getConsistenceAdapter(); |
| 1425 |
|
| 1426 |
QString writingFolder = "./Debugging/CompletionTasks/"; |
| 1427 |
QString specializedWritingFileName; |
| 1428 |
|
| 1429 |
bool writeDebuggingData = xDebug || mDebug; |
| 1430 |
if (classificationAdapter && (mConfDebuggingWriteDataForClassificationTests || mConfDebuggingWriteDataForAllTests) && (!mConfDebuggingWriteDataOnlyOnSatisfiability || satisfiable)) { |
| 1431 |
writeDebuggingData = true; |
| 1432 |
|
| 1433 |
CConcept* concept = classificationAdapter->getTestingConcept(); |
| 1434 |
if (concept && classificationAdapter->hasExtractionFlags(CSatisfiableTaskClassificationMessageAdapter::EFEXTRACTSUBSUMERSROOTNODE)) { |
| 1435 |
QString className = CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 1436 |
if (className.contains("/")) { |
| 1437 |
className = className.mid(className.lastIndexOf("/") + 1); |
| 1438 |
} |
| 1439 |
specializedWritingFileName += QString("classification-class-name-%1-satisfiability-test").arg(className); |
| 1440 |
} |
| 1441 |
|
| 1442 |
} else if (satCalcTask->getSatisfiableTaskIncrementalConsistencyTestingAdapter() && (mConfDebuggingWriteDataForIncrementalExpansionTests || mConfDebuggingWriteDataForAllTests) && (!mConfDebuggingWriteDataOnlyOnSatisfiability || satisfiable)) { |
| 1443 |
writeDebuggingData = true; |
| 1444 |
specializedWritingFileName += QString("consistency-incremental-expansion-%1-test").arg(mProcessingDataBox->getIncrementalExpansionID()); |
| 1445 |
} else if (satCalcTask->getSatisfiableRepresentativeBackendCacheUpdatingAdapter() && (mConfDebuggingWriteDataForRepCacheIndiComputationTests || mConfDebuggingWriteDataForAllTests) && (!mConfDebuggingWriteDataOnlyOnSatisfiability || satisfiable)) { |
| 1446 |
writeDebuggingData = true; |
| 1447 |
CSatisfiableTaskRepresentativeBackendUpdatingAdapter* repCacheUpdAd = satCalcTask->getSatisfiableRepresentativeBackendCacheUpdatingAdapter(); |
| 1448 |
specializedWritingFileName += QString("representative-cache-individual-recomputation-%1-starting-individual-%2-test").arg(repCacheUpdAd->getRepresentativeCacheRecomputationId()).arg(repCacheUpdAd->getFirstIndividualRecomputationId()); |
| 1449 |
} else if (satCalcTask->getConsistenceAdapter() && (mConfDebuggingWriteDataForConsistencyTests || mConfDebuggingWriteDataForAllTests) && (!mConfDebuggingWriteDataOnlyOnSatisfiability || satisfiable)) { |
| 1450 |
writeDebuggingData = true; |
| 1451 |
specializedWritingFileName += "consistency-test"; |
| 1452 |
} else if (satCalcTask->getSatisfiableAnswererBindingPropagationAdapter() && (mConfDebuggingWriteDataForAnsweringPropagationTests || mConfDebuggingWriteDataForAllTests) && (!mConfDebuggingWriteDataOnlyOnSatisfiability || satisfiable)) { |
| 1453 |
writeDebuggingData = true; |
| 1454 |
specializedWritingFileName += "answering-propagation-test"; |
| 1455 |
} else if (mConfDebuggingWriteDataForAllTests && (!mConfDebuggingWriteDataOnlyOnSatisfiability || satisfiable)) { |
| 1456 |
writeDebuggingData = true; |
| 1457 |
}/* else if (satCalcTask->getSatisfiableAnswererMaterializationAdapter() && satisfiable) { |
| 1458 |
writeDebuggingData = true; |
| 1459 |
specializedWritingFileName += QString("query-materilization-test"); |
| 1460 |
} else if (satCalcTask->getSatisfiableAnswererInstancePropagationMessageAdapter()) { |
| 1461 |
writeDebuggingData = true; |
| 1462 |
specializedWritingFileName += QString("answering-instance-propagation-test"); |
| 1463 |
}*/ |
| 1464 |
|
| 1465 |
|
| 1466 |
if (writeDebuggingData) { |
| 1467 |
QString satStopString = QString("stopped"); |
| 1468 |
if (satisfiable) { |
| 1469 |
satStopString = QString("satisfied"); |
| 1470 |
} |
| 1471 |
if (clashed) { |
| 1472 |
satStopString = QString("clashed"); |
| 1473 |
} |
| 1474 |
|
| 1475 |
if (specializedWritingFileName.isEmpty()) { |
| 1476 |
specializedWritingFileName += "uncategorized-test"; |
| 1477 |
} |
| 1478 |
|
| 1479 |
QString fileName = QString("%1%2-task-%3-%4-%5.txt").arg(writingFolder, specializedWritingFileName, QString::number(satCalcTask->getTaskDepth()), QString::number(satCalcTask->getTaskID()), satStopString); |
| 1480 |
mEndTaskDebugIndiModelString = writeGeneratedExtendedDebugIndiModelStringList(fileName, calcAlgContext); |
| 1481 |
|
| 1482 |
} |
| 1483 |
|
| 1484 |
|
| 1485 |
|
| 1486 |
} |
| 1487 |
|
| 1488 |
|
| 1489 |
|
| 1490 |
|
| 1491 |
|
| 1492 |
|
| 1493 |
|
| 1494 |
|
| 1495 |
if (completed) { |
| 1496 |
++mStatStoppedCount; |
| 1497 |
} |
| 1498 |
CBooleanTaskResult* satResult = satCalcTask->getSatisfiableCalculationTaskResult(); |
| 1499 |
if (clashed) { |
| 1500 |
++mStatClashCount; |
| 1501 |
if (!satResult->hasResult()) { |
| 1502 |
satResult->installResult(false); |
| 1503 |
} |
| 1504 |
|
| 1505 |
//writeSatisfiableCachedIndividualNodesOfUnsatisfiableBranch(mCalcAlgContext); |
| 1506 |
|
| 1507 |
completed = true; |
| 1508 |
} |
| 1509 |
if (satisfiable) { |
| 1510 |
++mStatSatisfiableCount; |
| 1511 |
STATINC(ROOTTASKSATISFIABLECOUNT, calcAlgContext); |
| 1512 |
satResult->installResult(true); |
| 1513 |
|
| 1514 |
|
| 1515 |
|
| 1516 |
//CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHash* useBackendConceptSetLabelProcessingHash = calcAlgContext->getProcessingDataBox()->getBackendCacheConceptSetLabelProcessingHash(false); |
| 1517 |
//if (useBackendConceptSetLabelProcessingHash) { |
| 1518 |
// for (CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHash::iterator it = useBackendConceptSetLabelProcessingHash->begin(), itEnd = useBackendConceptSetLabelProcessingHash->end(); it != itEnd; ++it) { |
| 1519 |
// CIndividualRepresentativeBackendCacheConceptSetLabelProcessingData& data = it.value(); |
| 1520 |
// if (data.getOnlyConceptSetProcessedCount() <= 0) { |
| 1521 |
// CIndividualRepresentativeBackendCacheConceptSetLabelNodeQueuingLinker* queringNodeLinker = data.getQueuingNodeLinker(); |
| 1522 |
// while (queringNodeLinker) { |
| 1523 |
// CIndividualProcessNode* queuingIndiNode = queringNodeLinker->getIndividualProcessNode(); |
| 1524 |
// queuingIndiNode = getUpToDateIndividual(queuingIndiNode, calcAlgContext); |
| 1525 |
|
| 1526 |
// if (queuingIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENPROCESSINGDELAYING)) { |
| 1527 |
// bool bug = true; |
| 1528 |
// } |
| 1529 |
|
| 1530 |
// queringNodeLinker = queringNodeLinker->getNext(); |
| 1531 |
// } |
| 1532 |
// } |
| 1533 |
// } |
| 1534 |
//} |
| 1535 |
|
| 1536 |
|
| 1537 |
|
| 1538 |
|
| 1539 |
if (!canceled && (mSatTaskConsAnalyser.analyseSatisfiableTask(satCalcTask,mCalcAlgContext) || mSatTaskIncConsAnalyser.analyseSatisfiableTask(satCalcTask,mCalcAlgContext))) { |
| 1540 |
rebuildSignatureBlockingCandidateHash(mCalcAlgContext); |
| 1541 |
} |
| 1542 |
|
| 1543 |
if (!canceled && (satCalcTask->getSatisfiableRepresentativeBackendCacheUpdatingAdapter() || (satCalcTask->getConsistenceAdapter() && satCalcTask->getConsistenceAdapter()->getConsitenceObserver()))) { |
| 1544 |
|
| 1545 |
mBackendCacheHandler->tryAssociateNodesWithBackendCache(processingDataBox->getLastBackendCacheIntegratedIndividualNodeLinker(), satCalcTask->getSatisfiableRepresentativeBackendCacheUpdatingAdapter(), calcAlgContext); |
| 1546 |
|
| 1547 |
//CBackendNeighbourExpansionControllingData* expContData = calcAlgContext->getUsedProcessingDataBox()->getBackendNeighbourExpansionControllingData(false); |
| 1548 |
//if (expContData && expContData->getCutBackendNeighbourExpansionIndividualLinker()) { |
| 1549 |
// QSet<cint64> expandedIndiIdSet; |
| 1550 |
// CXLinker<CIndividualProcessNode*>* expandedIndiNodeLinker = calcAlgContext->getUsedProcessingDataBox()->getLastBackendCacheIntegratedIndividualNodeLinker(); |
| 1551 |
// for (CXLinker<CIndividualProcessNode*>* expandedIndiNodeLinkerIt = expandedIndiNodeLinker; expandedIndiNodeLinkerIt && expandedIndiNodeLinkerIt; expandedIndiNodeLinkerIt = expandedIndiNodeLinkerIt->getNext()) { |
| 1552 |
// cint64 indiId = expandedIndiNodeLinkerIt->getData()->getNominalIndividual()->getIndividualID(); |
| 1553 |
// expandedIndiIdSet.insert(indiId); |
| 1554 |
// } |
| 1555 |
|
| 1556 |
|
| 1557 |
// for (CXLinker<CIndividualProcessNode*>* propCutIndiLinkerIt = expContData->getCutBackendNeighbourExpansionIndividualLinker(); propCutIndiLinkerIt; propCutIndiLinkerIt = propCutIndiLinkerIt->getNext()) { |
| 1558 |
// CIndividualProcessNode* propCutIndiNode = propCutIndiLinkerIt->getData(); |
| 1559 |
|
| 1560 |
// CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* propCutIndiBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)propCutIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 1561 |
// CBackendRepresentativeMemoryCacheIndividualAssociationData* propCutIndiAssocData = propCutIndiBackendSyncData->getAssocitaionData(); |
| 1562 |
|
| 1563 |
// CBackendNeighbourExpansionQueue* remainNeighExpQueue = propCutIndiBackendSyncData->getBackendNeighbourExpansionQueue(false); |
| 1564 |
// if (remainNeighExpQueue) { |
| 1565 |
// remainNeighExpQueue->visitNeighbourExpansionQueueDataLinkers([&](CBackendNeighbourExpansionQueueDataLinker* expQueuedLinker)->bool { |
| 1566 |
// cint64 cursor = expQueuedLinker->getNeighbourVisitingCursor(); |
| 1567 |
// cint64 arrayIndex = expQueuedLinker->getNeighbourArrayId(); |
| 1568 |
// CConcept* concept = expQueuedLinker->getConcept(); |
| 1569 |
// bool conNegation = expQueuedLinker->getConceptNegation(); |
| 1570 |
|
| 1571 |
// CConcept* opConcept = nullptr; |
| 1572 |
// bool opConceptTestingNegation = false; |
| 1573 |
// if (concept) { |
| 1574 |
// opConcept = concept->getOperandList()->getData(); |
| 1575 |
// bool opConceptNegation = concept->getOperandList()->isNegated(); |
| 1576 |
// opConceptTestingNegation = opConceptNegation; |
| 1577 |
// if (conNegation && opConcept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCFS_SOME_TYPE)) { |
| 1578 |
// opConceptTestingNegation = !opConceptTestingNegation; |
| 1579 |
// } |
| 1580 |
// } |
| 1581 |
|
| 1582 |
// mBackendCacheHandler->visitNeighbourIndividualIdsForNeighbourArrayIdFromCursor(propCutIndiAssocData, arrayIndex, [&](cint64 neighbourIndividualId, CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel, bool nondeterministic, cint64 cursor)->bool { |
| 1583 |
|
| 1584 |
// bool affected = false; |
| 1585 |
// CBackendRepresentativeMemoryCacheIndividualAssociationData* neighIndiAssocData = mBackendCacheHandler->getIndividualAssociationData(neighbourIndividualId, calcAlgContext); |
| 1586 |
// if (!opConcept || !mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(neighIndiAssocData, neighIndiAssocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), opConcept, opConceptTestingNegation, true, calcAlgContext)) { |
| 1587 |
// affected = true; |
| 1588 |
// } |
| 1589 |
|
| 1590 |
// if (affected && !expandedIndiIdSet.contains(neighbourIndividualId)) { |
| 1591 |
// mPropCuttedIndiIds.insert(neighbourIndividualId); |
| 1592 |
// } |
| 1593 |
|
| 1594 |
// return true; |
| 1595 |
// }, false, cursor, calcAlgContext); |
| 1596 |
|
| 1597 |
// return true; |
| 1598 |
// }); |
| 1599 |
// } |
| 1600 |
|
| 1601 |
// } |
| 1602 |
//} |
| 1603 |
} |
| 1604 |
|
| 1605 |
//testProblematicConceptSet(mCalcAlgContext); |
| 1606 |
|
| 1607 |
//analyzeABoxCompressionPossibilities(calcAlgContext); |
| 1608 |
|
| 1609 |
|
| 1610 |
//analyzeBranchingMemoryWasting(calcAlgContext); |
| 1611 |
|
| 1612 |
if (!canceled) { |
| 1613 |
mClassMessAnalyser.readCalculationConfig(satCalcTask->getCalculationConfiguration()); |
| 1614 |
mClassMessAnalyser.analyseSatisfiableTask(satCalcTask, mCalcAlgContext); |
| 1615 |
|
| 1616 |
mSatTaskPropClassAnalyser.readCalculationConfig(satCalcTask->getCalculationConfiguration()); |
| 1617 |
mSatTaskPropClassAnalyser.analyseSatisfiableTask(satCalcTask, mCalcAlgContext); |
| 1618 |
|
| 1619 |
mMarkerPropRealMessAnalyser.readCalculationConfig(satCalcTask->getCalculationConfiguration()); |
| 1620 |
mMarkerPropRealMessAnalyser.analyseSatisfiableTask(satCalcTask, mCalcAlgContext); |
| 1621 |
|
| 1622 |
mPossAssCollAnalyser.readCalculationConfig(satCalcTask->getCalculationConfiguration()); |
| 1623 |
mPossAssCollAnalyser.analyseSatisfiableTask(satCalcTask, mCalcAlgContext); |
| 1624 |
|
| 1625 |
mSatTaskCompAnswerAnalyser.readCalculationConfig(satCalcTask->getCalculationConfiguration()); |
| 1626 |
mSatTaskCompAnswerAnalyser.analyseSatisfiableTask(satCalcTask, mCalcAlgContext); |
| 1627 |
|
| 1628 |
mSatTaskPropBindingAnswerAnalyser.readCalculationConfig(satCalcTask->getCalculationConfiguration()); |
| 1629 |
mSatTaskPropBindingAnswerAnalyser.analyseSatisfiableTask(satCalcTask, mCalcAlgContext); |
| 1630 |
|
| 1631 |
cacheSatisfiableIndividualNodes(mCalcAlgContext); |
| 1632 |
} |
| 1633 |
analyseBranchingStatistics(mCalcAlgContext); |
| 1634 |
|
| 1635 |
completed = true; |
| 1636 |
} |
| 1637 |
commitCacheMessages(calcAlgContext); |
| 1638 |
|
| 1639 |
if (error) { |
| 1640 |
if (satCalcTask->hasActiveReferencedTask()) { |
| 1641 |
satCalcTask->clearUninitializedReferenceTasks(); |
| 1642 |
} |
| 1643 |
satCalcTask->getTaskStatus()->setError(error,errorCode); |
| 1644 |
processorCommunicator->communicateTaskError(satCalcTask); |
| 1645 |
return false; |
| 1646 |
} |
| 1647 |
|
| 1648 |
if (completed) { |
| 1649 |
processorCommunicator->communicateTaskComplete(satCalcTask); |
| 1650 |
return false; |
| 1651 |
} |
| 1652 |
return true; |
| 1653 |
|
| 1654 |
} |
| 1655 |
|
| 1656 |
return false; |
| 1657 |
} |
| 1658 |
|
| 1659 |
|
| 1660 |
|
| 1661 |
|
| 1662 |
|
| 1663 |
|
| 1664 |
|
| 1665 |
|
| 1666 |
|
| 1667 |
|
| 1668 |
|
| 1669 |
|
| 1670 |
|
| 1671 |
|
| 1672 |
|
| 1673 |
|
| 1674 |
|
| 1675 |
|
| 1676 |
|
| 1677 |
|
| 1678 |
|
| 1679 |
|
| 1680 |
|
| 1681 |
|
| 1682 |
|
| 1683 |
|
| 1684 |
|
| 1685 |
|
| 1686 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::findNextPossibleInstanceMergingIndividual(CIndividualProcessNode* processIndi, CPossibleInstancesIndividualsMergingData* possInstanceMergingData, CCalculationAlgorithmContextBase* calcAlgContext, |
| 1687 |
CPROCESSHASH<CBackendRepresentativeMemoryLabelCacheItem*, bool>*& testConceptLabelSetHash, CIndividualProcessNode** foundMergingIndiNode, cint64* foundMergingIndiId, bool* ruleApplicationFreeMerging) { |
| 1688 |
|
| 1689 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 1690 |
if (possInstanceMergingData->areAllPossibleInstancesIndividualsNonMerging() || processingDataBox->getRemainingPossibleInstanceIndividualMergingLimit() == 0) { |
| 1691 |
return false; |
| 1692 |
} |
| 1693 |
|
| 1694 |
cint64 maxMergingAttemptCount = possInstanceMergingData->getMaxMergingAttemptCount(); |
| 1695 |
bool foundPossIndiMerging = false; |
| 1696 |
for (cint64 i = 0; i < maxMergingAttemptCount && !foundPossIndiMerging; ++i) { |
| 1697 |
foundPossIndiMerging = findNextPossibleInstanceMergingIndividual(processIndi, possInstanceMergingData, calcAlgContext, testConceptLabelSetHash, i, foundMergingIndiNode, foundMergingIndiId, ruleApplicationFreeMerging); |
| 1698 |
} |
| 1699 |
return foundPossIndiMerging; |
| 1700 |
} |
| 1701 |
|
| 1702 |
|
| 1703 |
|
| 1704 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::findNextPossibleInstanceMergingIndividual(CIndividualProcessNode* processIndi, CPossibleInstancesIndividualsMergingData* possInstanceMergingData, CCalculationAlgorithmContextBase* calcAlgContext, |
| 1705 |
CPROCESSHASH<CBackendRepresentativeMemoryLabelCacheItem*, bool>*& testConceptLabelSetHash, cint64 individualMaxMergingAttemptCount, CIndividualProcessNode** foundMergingIndiNode, cint64* foundMergingIndiId, bool* ruleApplicationFreeMerging) { |
| 1706 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 1707 |
|
| 1708 |
if (possInstanceMergingData->areAllPossibleInstancesIndividualsNonMerging() || processingDataBox->getRemainingPossibleInstanceIndividualMergingLimit() == 0) { |
| 1709 |
return false; |
| 1710 |
} |
| 1711 |
|
| 1712 |
if (processingDataBox->getRemainingPossibleInstanceIndividualMergingLimit() == -1) { |
| 1713 |
// TODO: set a limit |
| 1714 |
} else if (processingDataBox->getRemainingPossibleInstanceIndividualMergingLimit() > 0) { |
| 1715 |
processingDataBox->setRemainingPossibleInstanceIndividualMergingLimit(processingDataBox->getRemainingPossibleInstanceIndividualMergingLimit() - 1); |
| 1716 |
} |
| 1717 |
|
| 1718 |
CPossibleInstancesIndividualsMergingLinker* nextMergedPossibleInstanceIndividualLinker = nullptr; |
| 1719 |
CPossibleInstancesIndividualsMergingLinker* initialMergedPossibleInstanceIndividualLinker = (CPossibleInstancesIndividualsMergingLinker*)processingDataBox->getLastMergedPossibleInstanceIndividualLinker(); |
| 1720 |
CPossibleInstancesIndividualsMergingLinker* lastMergedPossibleInstanceIndividualLinker = initialMergedPossibleInstanceIndividualLinker; |
| 1721 |
CPossibleInstancesIndividualsMergingLinker* foundMergedPossibleInstanceIndividualLinker = nullptr; |
| 1722 |
|
| 1723 |
bool allPossibleInstancesIndividualsNonMerging = false; |
| 1724 |
|
| 1725 |
|
| 1726 |
if (lastMergedPossibleInstanceIndividualLinker) { |
| 1727 |
nextMergedPossibleInstanceIndividualLinker = lastMergedPossibleInstanceIndividualLinker->getNextPossibleInstancesIndividualsMergingLinker(); |
| 1728 |
} else { |
| 1729 |
nextMergedPossibleInstanceIndividualLinker = possInstanceMergingData->getPossibleInstancesIndividualsMergingLinker(); |
| 1730 |
allPossibleInstancesIndividualsNonMerging = true; |
| 1731 |
} |
| 1732 |
|
| 1733 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher conceptSetBackendLabelOnlyHasher; |
| 1734 |
bool conceptSetBackendLabelOnlyRelevant = false; |
| 1735 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)processIndi->getIndividualBackendCacheSynchronisationData(false); |
| 1736 |
if (backendSyncData && !backendSyncData->hasNonConceptSetBackendLabelRelatedProcessing()) { |
| 1737 |
conceptSetBackendLabelOnlyRelevant = true; |
| 1738 |
conceptSetBackendLabelOnlyHasher = getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(backendSyncData->getAssocitaionData(), calcAlgContext); |
| 1739 |
} |
| 1740 |
|
| 1741 |
|
| 1742 |
|
| 1743 |
|
| 1744 |
|
| 1745 |
bool foundPossibleInstanceMerging = false; |
| 1746 |
while (nextMergedPossibleInstanceIndividualLinker && (!foundPossibleInstanceMerging)) { |
| 1747 |
|
| 1748 |
// TODO: based on attempts do a more ore less sophisticated checking whether the individual could possibly be considered for merging |
| 1749 |
if (!nextMergedPossibleInstanceIndividualLinker->isSatisfiableMerged() && nextMergedPossibleInstanceIndividualLinker->getMergingAttemptCount() <= individualMaxMergingAttemptCount && !nextMergedPossibleInstanceIndividualLinker->isFullTestingScheduled()) { |
| 1750 |
allPossibleInstancesIndividualsNonMerging = false; |
| 1751 |
nextMergedPossibleInstanceIndividualLinker->incMergingAttempt(); |
| 1752 |
possInstanceMergingData->incMergingAttempt(); |
| 1753 |
|
| 1754 |
++mStatPossibleInstanceMergingSearchIndiCount; |
| 1755 |
|
| 1756 |
cint64 mergingIndiId = nextMergedPossibleInstanceIndividualLinker->getMergingIndividualId(); |
| 1757 |
|
| 1758 |
|
| 1759 |
|
| 1760 |
bool mergingTryable = false; |
| 1761 |
bool possiblyRequiresRuleApplication = true; |
| 1762 |
CIndividualProcessNode* mergingIndiNode = nullptr; |
| 1763 |
|
| 1764 |
if (isNominalIndividualNodeAvailable(-mergingIndiId, calcAlgContext)) { |
| 1765 |
|
| 1766 |
CIndividualProcessNode* mergingIndiNode = getCorrectedNominalIndividualNode(-mergingIndiId, calcAlgContext); |
| 1767 |
|
| 1768 |
possiblyRequiresRuleApplication = false; |
| 1769 |
if (isIndividualNodesMergeableWithoutNewRuleApplications(processIndi, mergingIndiNode, &possiblyRequiresRuleApplication, foundPossibleInstanceMerging, calcAlgContext)) { |
| 1770 |
mergingTryable = true; |
| 1771 |
} else { |
| 1772 |
mergingTryable = false; |
| 1773 |
} |
| 1774 |
|
| 1775 |
} else { |
| 1776 |
|
| 1777 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assData = mBackendCacheHandler->getIndividualAssociationData(mergingIndiId, calcAlgContext); |
| 1778 |
if (assData) { |
| 1779 |
if (conceptSetBackendLabelOnlyRelevant) { |
| 1780 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher hasher = getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(assData, calcAlgContext); |
| 1781 |
if (conceptSetBackendLabelOnlyHasher == hasher) { |
| 1782 |
mergingTryable = true; |
| 1783 |
possiblyRequiresRuleApplication = false; |
| 1784 |
} |
| 1785 |
} |
| 1786 |
|
| 1787 |
if (!mergingTryable) { |
| 1788 |
// test whether there are some obvious clashes between atomic concepts |
| 1789 |
CBackendRepresentativeMemoryLabelCacheItem* conceptSetLabelItem = assData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 1790 |
if (testConceptLabelSetHash && testConceptLabelSetHash->contains(conceptSetLabelItem)) { |
| 1791 |
mergingTryable = testConceptLabelSetHash->value(conceptSetLabelItem); |
| 1792 |
} else { |
| 1793 |
bool containsAtomicClash = false; |
| 1794 |
CReapplyConceptLabelSet* baseConceptSet = processIndi->getReapplyConceptLabelSet(false); |
| 1795 |
mBackendCacheHandler->visitConceptsOfAssociatedFullConceptSetLabel(assData, conceptSetLabelItem, [&](CConcept* concept, bool negation, bool deterministic)->bool { |
| 1796 |
if (baseConceptSet->containsConcept(concept, !negation)) { |
| 1797 |
containsAtomicClash = true; |
| 1798 |
return false; |
| 1799 |
} |
| 1800 |
return true; |
| 1801 |
}, true, false, calcAlgContext); |
| 1802 |
|
| 1803 |
|
| 1804 |
mergingTryable = !containsAtomicClash; |
| 1805 |
|
| 1806 |
if (!testConceptLabelSetHash) { |
| 1807 |
testConceptLabelSetHash = CObjectParameterizingAllocator< CPROCESSHASH<CBackendRepresentativeMemoryLabelCacheItem*, bool>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(), calcAlgContext->getUsedTaskProcessorContext()); |
| 1808 |
} |
| 1809 |
testConceptLabelSetHash->insert(conceptSetLabelItem, mergingTryable); |
| 1810 |
} |
| 1811 |
} |
| 1812 |
} |
| 1813 |
|
| 1814 |
} |
| 1815 |
|
| 1816 |
|
| 1817 |
|
| 1818 |
if (mergingTryable) { |
| 1819 |
if (!possiblyRequiresRuleApplication) { |
| 1820 |
|
| 1821 |
nextMergedPossibleInstanceIndividualLinker->incMergingAttempt(); |
| 1822 |
possInstanceMergingData->incMergingAttempt(); |
| 1823 |
++mStatPossibleInstanceMergingFoundIndiCount; |
| 1824 |
|
| 1825 |
if (!nextMergedPossibleInstanceIndividualLinker->isSatisfiableMerged()) { |
| 1826 |
++mStatPossibleInstanceMergingSuccessSubmitCount; |
| 1827 |
++mStatPossibleInstanceMergingTriviallySuccessCount; |
| 1828 |
possInstanceMergingData->incMergingSuccess(); |
| 1829 |
nextMergedPossibleInstanceIndividualLinker->setSatisfiableMerged(); |
| 1830 |
} |
| 1831 |
|
| 1832 |
} else { |
| 1833 |
|
| 1834 |
if (!foundPossibleInstanceMerging) { |
| 1835 |
++mStatPossibleInstanceMergingMaybeMergeableCount; |
| 1836 |
foundPossibleInstanceMerging = true; |
| 1837 |
|
| 1838 |
if (!mergingIndiNode) { |
| 1839 |
mergingIndiNode = getLocalizedForcedBackendInitializedNominalIndividualNode(mergingIndiId, calcAlgContext); |
| 1840 |
} |
| 1841 |
|
| 1842 |
if (foundMergingIndiNode) { |
| 1843 |
*foundMergingIndiNode = mergingIndiNode; |
| 1844 |
} |
| 1845 |
if (foundMergingIndiId) { |
| 1846 |
*foundMergingIndiId = mergingIndiId; |
| 1847 |
} |
| 1848 |
foundMergedPossibleInstanceIndividualLinker = nextMergedPossibleInstanceIndividualLinker; |
| 1849 |
} |
| 1850 |
} |
| 1851 |
|
| 1852 |
} else { |
| 1853 |
++mStatPossibleInstanceMergingNotMergeableCount; |
| 1854 |
} |
| 1855 |
|
| 1856 |
|
| 1857 |
} else { |
| 1858 |
++mStatPossibleInstanceMergingSkipIndiCount; |
| 1859 |
} |
| 1860 |
|
| 1861 |
|
| 1862 |
if (!foundMergedPossibleInstanceIndividualLinker) { |
| 1863 |
foundMergedPossibleInstanceIndividualLinker = nextMergedPossibleInstanceIndividualLinker; |
| 1864 |
} |
| 1865 |
lastMergedPossibleInstanceIndividualLinker = nextMergedPossibleInstanceIndividualLinker; |
| 1866 |
nextMergedPossibleInstanceIndividualLinker = nextMergedPossibleInstanceIndividualLinker->getNextPossibleInstancesIndividualsMergingLinker(); |
| 1867 |
} |
| 1868 |
|
| 1869 |
if (allPossibleInstancesIndividualsNonMerging) { |
| 1870 |
possInstanceMergingData->setAllPossibleInstancesIndividualsNonMerging(true); |
| 1871 |
} |
| 1872 |
|
| 1873 |
if (!foundMergedPossibleInstanceIndividualLinker) { |
| 1874 |
foundMergedPossibleInstanceIndividualLinker = lastMergedPossibleInstanceIndividualLinker; |
| 1875 |
} |
| 1876 |
processingDataBox->setLastMergedPossibleInstanceIndividualLinker(foundMergedPossibleInstanceIndividualLinker); |
| 1877 |
return foundPossibleInstanceMerging; |
| 1878 |
} |
| 1879 |
|
| 1880 |
|
| 1881 |
|
| 1882 |
|
| 1883 |
|
| 1884 |
|
| 1885 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::tryPossibleInstanceMerging(CIndividualProcessNode* processIndi, CPossibleInstancesIndividualsMergingData* possInstanceMergingData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1886 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 1887 |
if (possInstanceMergingData && mConfPossibleInstanceIndividualsMerging) { |
| 1888 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 1889 |
|
| 1890 |
++mStatPossibleInstanceMergingTryingCount; |
| 1891 |
CPROCESSHASH<CBackendRepresentativeMemoryLabelCacheItem*, bool>* testConceptLabelSetHash = nullptr; |
| 1892 |
|
| 1893 |
cint64 foundMergingIndiId = -1; |
| 1894 |
CIndividual* foundMergingIndi = nullptr; |
| 1895 |
CIndividualProcessNode* foundMergingIndiNode = nullptr; |
| 1896 |
bool ruleApplicationFreeMerging = false; |
| 1897 |
CDependencyTrackPoint* initContinueDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 1898 |
bool hasNextMergingIndi = findNextPossibleInstanceMergingIndividual(processIndi, possInstanceMergingData, calcAlgContext, testConceptLabelSetHash, &foundMergingIndiNode, &foundMergingIndiId, &ruleApplicationFreeMerging); |
| 1899 |
if (hasNextMergingIndi) { |
| 1900 |
++mStatPossibleInstanceMergingCount; |
| 1901 |
cint64 taskCreationCount = 2; |
| 1902 |
|
| 1903 |
CSatisfiableCalculationTask* newTaskList = createDependendBranchingTaskList(taskCreationCount, calcAlgContext); |
| 1904 |
|
| 1905 |
CSatisfiableCalculationTask* newTaskIt = newTaskList; |
| 1906 |
|
| 1907 |
|
| 1908 |
CMERGEPOSSIBLEINSTANCEINDIVIDUALDependencyNode* reuseDepNode = createMERGEPOSSIBLEINSTANCEINDIVIDUALDependencyNode(processIndi, initContinueDepTrackPoint, foundMergingIndiNode, calcAlgContext); |
| 1909 |
|
| 1910 |
|
| 1911 |
for (cint64 i = 0; i < taskCreationCount; ++i) { |
| 1912 |
|
| 1913 |
CSatisfiableCalculationTask* newSatCalcTask = newTaskIt; |
| 1914 |
|
| 1915 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 1916 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext, newProcessContext, newSatCalcTask); |
| 1917 |
CMemoryAllocationManager* newAllocMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 1918 |
|
| 1919 |
bool mergingAlternative = i == 0; |
| 1920 |
|
| 1921 |
if (mergingAlternative) { |
| 1922 |
|
| 1923 |
CDependencyTrackPoint* mergeNonDetDepTrackPoint = nullptr; |
| 1924 |
mergeNonDetDepTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseDepNode, false, newCalcAlgContext); |
| 1925 |
|
| 1926 |
|
| 1927 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 1928 |
newProcessingDataBox->initProcessingDataBox(processingDataBox); |
| 1929 |
newProcessingDataBox->setBackendCacheLoadedAssociationHash(processingDataBox->getBackendCacheLoadedAssociationHash(true)); |
| 1930 |
newProcessingDataBox->setPossibleInstanceIndividualMergedCount(processingDataBox->getPossibleInstanceIndividualMergedCount() + 1); |
| 1931 |
newProcessingDataBox->setPossibleInstanceIndividualCurrentMergingCount(1); |
| 1932 |
|
| 1933 |
|
| 1934 |
CProcessTagger* newProcessTagger = newCalcAlgContext->getUsedProcessTagger(); |
| 1935 |
// dirty trick, but probably works since for the other alternative there is no processing required, i.e., we can simply overwrite/modify the existing data |
| 1936 |
newProcessTagger->incBranchingTag(); |
| 1937 |
//newProcessTagger->incLocalizationTag(); |
| 1938 |
|
| 1939 |
|
| 1940 |
CIndividualProcessNode* newLocProcessIndiNode = getLocalizedIndividual(processIndi, false, newCalcAlgContext); |
| 1941 |
CIndividualProcessNode* newLocMergingIndiNode = getLocalizedIndividual(foundMergingIndiNode, false, newCalcAlgContext); |
| 1942 |
|
| 1943 |
|
| 1944 |
CIndividualProcessNode* locMergedIndiNode = getMergedIndividualNodes(newLocProcessIndiNode, newLocMergingIndiNode, mergeNonDetDepTrackPoint, newCalcAlgContext); |
| 1945 |
|
| 1946 |
|
| 1947 |
|
| 1948 |
if (possInstanceMergingData->getMergingStreakFailCount() <= 0) { |
| 1949 |
cint64 furtherMergeCount = processingDataBox->getPossibleInstanceIndividualMergingSize(); |
| 1950 |
if (furtherMergeCount > 1) { |
| 1951 |
// try to merge some additional individuals within the same task (to save some memory) |
| 1952 |
|
| 1953 |
CXLinker<CXLinker<cint64>*>* currentMergedPossibleInstanceIndividualLinkersLinker = CObjectAllocator< CXLinker<CXLinker<cint64>*> >::allocateAndConstruct(newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1954 |
currentMergedPossibleInstanceIndividualLinkersLinker->initLinker(processingDataBox->getLastMergedPossibleInstanceIndividualLinker()); |
| 1955 |
|
| 1956 |
|
| 1957 |
cint64 currentlyMerged = 1; |
| 1958 |
while (hasNextMergingIndi && currentlyMerged <= furtherMergeCount) { |
| 1959 |
foundMergingIndiId = -1; |
| 1960 |
foundMergingIndi = nullptr; |
| 1961 |
foundMergingIndiNode = nullptr; |
| 1962 |
ruleApplicationFreeMerging = false; |
| 1963 |
hasNextMergingIndi = findNextPossibleInstanceMergingIndividual(locMergedIndiNode, possInstanceMergingData, newCalcAlgContext, testConceptLabelSetHash, &foundMergingIndiNode, &foundMergingIndiId, &ruleApplicationFreeMerging); |
| 1964 |
if (hasNextMergingIndi) { |
| 1965 |
++mStatPossibleInstanceMergingCount; |
| 1966 |
++currentlyMerged; |
| 1967 |
newLocMergingIndiNode = getLocalizedIndividual(foundMergingIndiNode, false, newCalcAlgContext); |
| 1968 |
locMergedIndiNode = getMergedIndividualNodes(locMergedIndiNode, newLocMergingIndiNode, mergeNonDetDepTrackPoint, newCalcAlgContext); |
| 1969 |
|
| 1970 |
|
| 1971 |
CXLinker<CXLinker<cint64>*>* nextMergedPossibleInstanceIndividualLinkersLinker = CObjectAllocator< CXLinker<CXLinker<cint64>*> >::allocateAndConstruct(newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1972 |
nextMergedPossibleInstanceIndividualLinkersLinker->initLinker(newProcessingDataBox->getLastMergedPossibleInstanceIndividualLinker()); |
| 1973 |
|
| 1974 |
currentMergedPossibleInstanceIndividualLinkersLinker = nextMergedPossibleInstanceIndividualLinkersLinker->append(currentMergedPossibleInstanceIndividualLinkersLinker); |
| 1975 |
} |
| 1976 |
} |
| 1977 |
newProcessingDataBox->setPossibleInstanceIndividualCurrentMergingCount(currentlyMerged); |
| 1978 |
newProcessingDataBox->setPossibleInstanceIndividualMergedCount(processingDataBox->getPossibleInstanceIndividualMergedCount() + currentlyMerged); |
| 1979 |
newProcessingDataBox->setCurrentMergedPossibleInstanceIndividualLinkersLinker(currentMergedPossibleInstanceIndividualLinkersLinker); |
| 1980 |
|
| 1981 |
|
| 1982 |
} |
| 1983 |
if (furtherMergeCount < 10) { |
| 1984 |
furtherMergeCount *= 2; |
| 1985 |
} else { |
| 1986 |
furtherMergeCount *= 20; |
| 1987 |
} |
| 1988 |
newProcessingDataBox->setPossibleInstanceIndividualMergingSize(furtherMergeCount); |
| 1989 |
} |
| 1990 |
|
| 1991 |
|
| 1992 |
prepareBranchedTaskProcessing(locMergedIndiNode, newSatCalcTask, newCalcAlgContext); |
| 1993 |
|
| 1994 |
|
| 1995 |
} else { |
| 1996 |
|
| 1997 |
createNonDeterministicDependencyTrackPointBranch(reuseDepNode, false, newCalcAlgContext); |
| 1998 |
|
| 1999 |
// remove adapter such that no further merging tests are performed |
| 2000 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 2001 |
newProcessingDataBox->setPossibleInstanceIndividualMergingStopped(true); |
| 2002 |
newProcessingDataBox->setBackendCacheLoadedAssociationHash(processingDataBox->getBackendCacheLoadedAssociationHash(true)); |
| 2003 |
|
| 2004 |
CIndividualProcessNode* newLocIndiNode = getLocalizedIndividual(processIndi, false, newCalcAlgContext); |
| 2005 |
prepareBranchedTaskProcessing(newLocIndiNode, newSatCalcTask, newCalcAlgContext); |
| 2006 |
} |
| 2007 |
|
| 2008 |
// set new task priority |
| 2009 |
double newTaskPriority = calcAlgContext->getUsedTaskPriorityStrategy()->getPriorityForTaskReusing(newSatCalcTask, calcAlgContext->getUsedSatisfiableCalculationTask(), mergingAlternative); |
| 2010 |
newSatCalcTask->setTaskPriority(newTaskPriority); |
| 2011 |
|
| 2012 |
newTaskIt = (CSatisfiableCalculationTask*)newTaskIt->getNext(); |
| 2013 |
|
| 2014 |
} |
| 2015 |
|
| 2016 |
|
| 2017 |
processorContext->getTaskProcessorCommunicator()->communicateTaskCreation(newTaskList); |
| 2018 |
|
| 2019 |
throw CCalculationStopProcessingException(true); |
| 2020 |
} |
| 2021 |
} |
| 2022 |
return false; |
| 2023 |
} |
| 2024 |
|
| 2025 |
|
| 2026 |
|
| 2027 |
|
| 2028 |
|
| 2029 |
|
| 2030 |
|
| 2031 |
|
| 2032 |
|
| 2033 |
|
| 2034 |
|
| 2035 |
|
| 2036 |
|
| 2037 |
|
| 2038 |
|
| 2039 |
|
| 2040 |
|
| 2041 |
|
| 2042 |
|
| 2043 |
|
| 2044 |
|
| 2045 |
|
| 2046 |
|
| 2047 |
|
| 2048 |
|
| 2049 |
|
| 2050 |
|
| 2051 |
|
| 2052 |
|
| 2053 |
|
| 2054 |
|
| 2055 |
|
| 2056 |
|
| 2057 |
|
| 2058 |
|
| 2059 |
|
| 2060 |
|
| 2061 |
|
| 2062 |
|
| 2063 |
|
| 2064 |
|
| 2065 |
|
| 2066 |
|
| 2067 |
|
| 2068 |
|
| 2069 |
|
| 2070 |
|
| 2071 |
|
| 2072 |
|
| 2073 |
|
| 2074 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::continueIndividualProcessing(CIndividualProcessNode*& indiProcNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2075 |
|
| 2076 |
bool purgedIndiBlocked = indiProcNode->hasIndirectBlockedProcessingRestrictionFlags() || indiProcNode->hasPurgedBlockedProcessingRestrictionFlags(); |
| 2077 |
if (purgedIndiBlocked) { |
| 2078 |
return false; |
| 2079 |
} |
| 2080 |
|
| 2081 |
CConceptProcessingQueue* conProQue = indiProcNode->getConceptProcessingQueue(false); |
| 2082 |
|
| 2083 |
if (conProQue && !conProQue->isEmpty()) { |
| 2084 |
CConceptProcessPriority conProPri; |
| 2085 |
if (conProQue->getNextConceptProcessPriority(&conProPri)) { |
| 2086 |
double priority = conProPri.getPriority(); |
| 2087 |
if (priority < mMinConceptProcessingPriorityLevel) { |
| 2088 |
return false; |
| 2089 |
} |
| 2090 |
} |
| 2091 |
return true; |
| 2092 |
} |
| 2093 |
return false; |
| 2094 |
} |
| 2095 |
|
| 2096 |
|
| 2097 |
|
| 2098 |
|
| 2099 |
|
| 2100 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::installSaturationCachingReactivation(CIndividualProcessNode* indiProcNode, CSaturationNodeAssociatedDependentNominalSet* nominalSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2101 |
if (nominalSet) { |
| 2102 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 2103 |
for (CSaturationNodeAssociatedDependentNominalSet::const_iterator it = nominalSet->constBegin(), itEnd = nominalSet->constEnd(); it != itEnd; ++it) { |
| 2104 |
cint64 nominalID(*it); |
| 2105 |
CIndividualProcessNode* nominalNode = getUpToDateIndividual(-nominalID,calcAlgContext); |
| 2106 |
nominalNode->setCachingLossNodeReactivationInstalled(true); |
| 2107 |
CIndividualProcessNode* locNominalNode = getLocalizedIndividual(nominalNode,true,calcAlgContext); |
| 2108 |
CNominalCachingLossReactivationData* locNominalReactivationData = locNominalNode->getNominalCachingLossReactivationData(true); |
| 2109 |
bool nominalBasedCachingPossible = true; |
| 2110 |
if (nominalNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALID | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || |
| 2111 |
!nominalNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED) && !nominalNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED)) { |
| 2112 |
nominalBasedCachingPossible = false; |
| 2113 |
} |
| 2114 |
if (locNominalReactivationData->hasReactivated()) { |
| 2115 |
nominalBasedCachingPossible = false; |
| 2116 |
} |
| 2117 |
if (!nominalBasedCachingPossible) { |
| 2118 |
CIndividualUnsortedProcessingQueue* reactivationQueue = processingDataBox->getNominalCachingLossReactivationProcessingQueue(true); |
| 2119 |
reactivationQueue->insertIndiviudalProcessNode(indiProcNode); |
| 2120 |
} else { |
| 2121 |
locNominalReactivationData->addReactivationIndividualNode(indiProcNode); |
| 2122 |
} |
| 2123 |
} |
| 2124 |
} |
| 2125 |
return true; |
| 2126 |
} |
| 2127 |
|
| 2128 |
|
| 2129 |
|
| 2130 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::tryInstallSaturationCachingReactivation(CIndividualProcessNode* indiProcNode, CSuccessorConnectedNominalSet* nominalSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2131 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 2132 |
for (CSuccessorConnectedNominalSet::const_iterator it = nominalSet->constBegin(), itEnd = nominalSet->constEnd(); it != itEnd; ++it) { |
| 2133 |
cint64 nominalID(*it); |
| 2134 |
CIndividualProcessNode* nominalNode = getUpToDateIndividual(-nominalID,calcAlgContext); |
| 2135 |
if (nominalNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALID | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || |
| 2136 |
!nominalNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED) && !nominalNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED)) { |
| 2137 |
return false; |
| 2138 |
} |
| 2139 |
nominalNode->setCachingLossNodeReactivationInstalled(true); |
| 2140 |
CNominalCachingLossReactivationData* nominalReactivationData = nominalNode->getNominalCachingLossReactivationData(false); |
| 2141 |
if (nominalReactivationData && nominalReactivationData->hasReactivated()) { |
| 2142 |
return false; |
| 2143 |
} |
| 2144 |
CIndividualProcessNode* locNominalNode = getLocalizedIndividual(nominalNode,true,calcAlgContext); |
| 2145 |
CNominalCachingLossReactivationData* locNominalReactivationData = locNominalNode->getNominalCachingLossReactivationData(true); |
| 2146 |
locNominalReactivationData->addReactivationIndividualNode(indiProcNode); |
| 2147 |
} |
| 2148 |
return true; |
| 2149 |
} |
| 2150 |
|
| 2151 |
|
| 2152 |
|
| 2153 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::checkIndividualNodesReactivationDueToNominalCachingLoss(CIndividualProcessNode* nominalProcNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2154 |
if (nominalProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALID | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || |
| 2155 |
!nominalProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED) && !nominalProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED)) { |
| 2156 |
return reactivateIndividualNodesDueToNominalCachingLoss(nominalProcNode,calcAlgContext); |
| 2157 |
} |
| 2158 |
return false; |
| 2159 |
} |
| 2160 |
|
| 2161 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::reactivateIndividualNodesDueToNominalCachingLoss(CIndividualProcessNode* nominalProcNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2162 |
bool nodesReactivated = false; |
| 2163 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 2164 |
CNominalCachingLossReactivationData* nominalReactivationData = nominalProcNode->getNominalCachingLossReactivationData(false); |
| 2165 |
CIndividualUnsortedProcessingQueue* reactivationQueue = nullptr; |
| 2166 |
if (nominalReactivationData) { |
| 2167 |
if (!nominalReactivationData->hasReactivated()) { |
| 2168 |
nominalReactivationData = nominalProcNode->getNominalCachingLossReactivationData(true); |
| 2169 |
nominalReactivationData->setReactivated(true); |
| 2170 |
for (CXLinker<CIndividualProcessNode*>* reactivationLinkerIt = nominalReactivationData->takeReactivationIndividualNodeLinker(); reactivationLinkerIt; reactivationLinkerIt = reactivationLinkerIt->getNext()) { |
| 2171 |
CIndividualProcessNode* reactivationIndiNode = reactivationLinkerIt->getData(); |
| 2172 |
if (!reactivationQueue) { |
| 2173 |
reactivationQueue = processingDataBox->getNominalCachingLossReactivationProcessingQueue(true); |
| 2174 |
} |
| 2175 |
reactivationQueue->insertIndiviudalProcessNode(reactivationIndiNode); |
| 2176 |
nodesReactivated = true; |
| 2177 |
} |
| 2178 |
} |
| 2179 |
} |
| 2180 |
return nodesReactivated; |
| 2181 |
} |
| 2182 |
|
| 2183 |
|
| 2184 |
|
| 2185 |
bool individualIDGreaterThan(CXLinker<CIndividualProcessNode*>*& s1, CXLinker<CIndividualProcessNode*>*& s2) { |
| 2186 |
return s1->getData()->getIndividualNodeID() > s2->getData()->getIndividualNodeID(); |
| 2187 |
} |
| 2188 |
|
| 2189 |
|
| 2190 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::takeNextProcessIndividual(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2191 |
CIndividualProcessNode* indiProcNode = nullptr; |
| 2192 |
mIndiNodeConcludeUnsatCaching = false; |
| 2193 |
mIndiNodeFromQueueType = INQT_NONE; |
| 2194 |
|
| 2195 |
if (!indiProcNode) { |
| 2196 |
mMinConceptProcessingPriorityLevel = mImmediatelyProcessPriority; |
| 2197 |
if (mProcessingDataBox->hasCacheTestingIndividualNodes()) { |
| 2198 |
indiProcNode = mProcessingDataBox->takeNextCacheTestingIndividualNode(); |
| 2199 |
mIndiNodeConcludeUnsatCaching = true; |
| 2200 |
mIndiNodeFromQueueType = INQT_CACHETEST; |
| 2201 |
} |
| 2202 |
} |
| 2203 |
if (!indiProcNode) { |
| 2204 |
mIndiImmediateProQueue = mProcessingDataBox->getIndividualImmediatelyProcessingQueue(false); |
| 2205 |
if (mIndiImmediateProQueue && !mIndiImmediateProQueue->isEmpty()) { |
| 2206 |
mIndiImmediateProQueue = mProcessingDataBox->getIndividualImmediatelyProcessingQueue(true); |
| 2207 |
indiProcNode = mIndiImmediateProQueue->takeNextProcessIndividualNode(); |
| 2208 |
mIndiNodeFromQueueType = INQT_IMMEDIATE; |
| 2209 |
} |
| 2210 |
} |
| 2211 |
if (!indiProcNode) { |
| 2212 |
CIndividualDelayedBackendInitializationProcessingQueue* delayedBackendInitProcQueue = mProcessingDataBox->getDelayedBackendConceptSetLabelProcessingInitializationQueue(false); |
| 2213 |
while (delayedBackendInitProcQueue && !delayedBackendInitProcQueue->isEmpty() && !indiProcNode) { |
| 2214 |
delayedBackendInitProcQueue = mProcessingDataBox->getDelayedBackendConceptSetLabelProcessingInitializationQueue(true); |
| 2215 |
indiProcNode = delayedBackendInitProcQueue->takeNextProcessIndividualNode(); |
| 2216 |
|
| 2217 |
indiProcNode = getUpToDateIndividual(indiProcNode, calcAlgContext); |
| 2218 |
|
| 2219 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiProcNode->getIndividualBackendCacheSynchronisationData(false); |
| 2220 |
if (backendSyncData && !backendSyncData->isBackendConceptSetInitialized()) { |
| 2221 |
mIndiNodeFromQueueType = INQT_DELAYEDBACKENDINIT; |
| 2222 |
} else { |
| 2223 |
indiProcNode = nullptr; |
| 2224 |
} |
| 2225 |
} |
| 2226 |
} |
| 2227 |
if (!indiProcNode) { |
| 2228 |
mRoleAssertionProcessingQueue = mProcessingDataBox->getRoleAssertionExpansionProcessingQueue(false); |
| 2229 |
if (mRoleAssertionProcessingQueue && !mRoleAssertionProcessingQueue->isEmpty()) { |
| 2230 |
mRoleAssertionProcessingQueue = mProcessingDataBox->getRoleAssertionExpansionProcessingQueue(true); |
| 2231 |
indiProcNode = mRoleAssertionProcessingQueue->takeNextProcessIndividualNode(); |
| 2232 |
mIndiNodeFromQueueType = INQT_ROLEASS; |
| 2233 |
} |
| 2234 |
} |
| 2235 |
if (!indiProcNode) { |
| 2236 |
mMinConceptProcessingPriorityLevel = mDeterministicProcessPriority; |
| 2237 |
mIndiDetExpProQueue = mProcessingDataBox->getIndividualDepthDeterministicExpansionPreprocessingQueue(false); |
| 2238 |
if (mIndiDetExpProQueue && !mIndiDetExpProQueue->isEmpty()) { |
| 2239 |
mIndiDetExpProQueue = mProcessingDataBox->getIndividualDepthDeterministicExpansionPreprocessingQueue(true); |
| 2240 |
indiProcNode = mIndiDetExpProQueue->takeNextProcessIndividual(); |
| 2241 |
mIndiNodeFromQueueType = INQT_DETEXP; |
| 2242 |
} |
| 2243 |
} |
| 2244 |
if (!indiProcNode) { |
| 2245 |
mIndiDetDeptFirstExpProQueue = mProcessingDataBox->getIndividualDepthFirstDeterministicExpansionProcessingQueue(false); |
| 2246 |
if (mIndiDetDeptFirstExpProQueue && !mIndiDetDeptFirstExpProQueue->isEmpty()) { |
| 2247 |
mIndiDetDeptFirstExpProQueue = mProcessingDataBox->getIndividualDepthFirstDeterministicExpansionProcessingQueue(true); |
| 2248 |
indiProcNode = mIndiDetDeptFirstExpProQueue->takeNextProcessIndividualNode(); |
| 2249 |
mIndiNodeFromQueueType = INQT_DEPTHFIRST; |
| 2250 |
} |
| 2251 |
} |
| 2252 |
|
| 2253 |
|
| 2254 |
|
| 2255 |
|
| 2256 |
|
| 2257 |
if (!indiProcNode) { |
| 2258 |
mValueSpaceSatCheckingQueue = mProcessingDataBox->getDistinctValueSpaceSatisfiabilityCheckingQueue(false); |
| 2259 |
if (mValueSpaceSatCheckingQueue && !mValueSpaceSatCheckingQueue->isEmpty()) { |
| 2260 |
mValueSpaceSatCheckingQueue = mProcessingDataBox->getDistinctValueSpaceSatisfiabilityCheckingQueue(true); |
| 2261 |
indiProcNode = mValueSpaceSatCheckingQueue->takeNextProcessIndividual(); |
| 2262 |
mIndiNodeFromQueueType = INQT_VSTSATTESTING; |
| 2263 |
if (indiProcNode) { |
| 2264 |
indiProcNode = getLocalizedIndividual(indiProcNode,true,calcAlgContext); |
| 2265 |
} |
| 2266 |
} |
| 2267 |
} |
| 2268 |
if (!indiProcNode) { |
| 2269 |
mValueSpaceTriggeringProQueue = mProcessingDataBox->getValueSpaceTriggeringProcessingQueue(false); |
| 2270 |
if (mValueSpaceTriggeringProQueue && !mValueSpaceTriggeringProQueue->isEmpty()) { |
| 2271 |
mValueSpaceTriggeringProQueue = mProcessingDataBox->getValueSpaceTriggeringProcessingQueue(true); |
| 2272 |
indiProcNode = mValueSpaceTriggeringProQueue->takeNextProcessIndividual(); |
| 2273 |
mIndiNodeFromQueueType = INQT_VSTRIGGERING; |
| 2274 |
if (indiProcNode) { |
| 2275 |
indiProcNode = getLocalizedIndividual(indiProcNode,true,calcAlgContext); |
| 2276 |
} |
| 2277 |
} |
| 2278 |
} |
| 2279 |
|
| 2280 |
if (!indiProcNode) { |
| 2281 |
mBackendSyncRetestProcessingQueue = mProcessingDataBox->getBackendCacheSynchronizationProcessingQueue(false); |
| 2282 |
if (mBackendSyncRetestProcessingQueue && !mBackendSyncRetestProcessingQueue->isEmpty()) { |
| 2283 |
mBackendSyncRetestProcessingQueue = mProcessingDataBox->getBackendCacheSynchronizationProcessingQueue(true); |
| 2284 |
indiProcNode = mBackendSyncRetestProcessingQueue->takeNextProcessIndividualNode(); |
| 2285 |
mIndiNodeFromQueueType = INQT_BACKENDSYNCRETEST; |
| 2286 |
} |
| 2287 |
} |
| 2288 |
if (!indiProcNode) { |
| 2289 |
mBackendDirectInfluenceExpansionQueue = mProcessingDataBox->getBackendDirectInfluenceExpansionQueue(false); |
| 2290 |
if (mBackendDirectInfluenceExpansionQueue && !mBackendDirectInfluenceExpansionQueue->isEmpty()) { |
| 2291 |
mBackendDirectInfluenceExpansionQueue = mProcessingDataBox->getBackendDirectInfluenceExpansionQueue(true); |
| 2292 |
indiProcNode = mBackendDirectInfluenceExpansionQueue->takeNextProcessIndividualNode(); |
| 2293 |
mIndiNodeFromQueueType = INQT_BACKENDDIRECTINFLUENCEEXPANSION; |
| 2294 |
} |
| 2295 |
} |
| 2296 |
|
| 2297 |
if (!indiProcNode) { |
| 2298 |
mVarBindConBatchProcessingQueue = mProcessingDataBox->getVariableBindingConceptBatchProcessingQueue(false); |
| 2299 |
if (mVarBindConBatchProcessingQueue && !mVarBindConBatchProcessingQueue->isEmpty()) { |
| 2300 |
mVarBindConBatchProcessingQueue = mProcessingDataBox->getVariableBindingConceptBatchProcessingQueue(true); |
| 2301 |
|
| 2302 |
CConcept* varBindConcept = nullptr; |
| 2303 |
CConceptProcessDescriptor* conProDes = nullptr; |
| 2304 |
indiProcNode = nullptr; |
| 2305 |
mVarBindConBatchProcessingQueue->takeNextConceptProcessIndividual(varBindConcept,indiProcNode,conProDes); |
| 2306 |
if (indiProcNode) { |
| 2307 |
indiProcNode = getLocalizedIndividual(indiProcNode,true,calcAlgContext); |
| 2308 |
|
| 2309 |
indiProcNode->getConceptProcessingQueue(true)->insertConceptProcessDescriptor(conProDes); |
| 2310 |
|
| 2311 |
mIndiNodeFromQueueType = INQT_VARBINDBATCHQUE; |
| 2312 |
} |
| 2313 |
} |
| 2314 |
} |
| 2315 |
|
| 2316 |
|
| 2317 |
if (!indiProcNode) { |
| 2318 |
mIncrementalCompatibilityCheckingQueue = mProcessingDataBox->getIncrementalCompatibilityCheckingQueue(false); |
| 2319 |
if (mIncrementalCompatibilityCheckingQueue && !mIncrementalCompatibilityCheckingQueue->isEmpty()) { |
| 2320 |
mIncrementalCompatibilityCheckingQueue = mProcessingDataBox->getIncrementalCompatibilityCheckingQueue(true); |
| 2321 |
|
| 2322 |
|
| 2323 |
|
| 2324 |
|
| 2325 |
while (!mIncrementalCompatibilityCheckingQueue->isEmpty()) { |
| 2326 |
CIndividualProcessNode* compCheckIndiNode = mIncrementalCompatibilityCheckingQueue->takeNextProcessIndividual(); |
| 2327 |
compCheckIndiNode = getLocalizedIndividual(compCheckIndiNode,true,calcAlgContext); |
| 2328 |
compCheckIndiNode->setIncrementalCompatibilityCheckingQueued(false); |
| 2329 |
if (compCheckIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANSIONRETESTDUEDIRECTMODIFIED)) { |
| 2330 |
compCheckIndiNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANSIONRETESTDUEDIRECTMODIFIED); |
| 2331 |
} |
| 2332 |
checkCompatibilityUpdateDirectlyChangedPropagation(compCheckIndiNode,calcAlgContext); |
| 2333 |
} |
| 2334 |
} |
| 2335 |
} |
| 2336 |
if (!indiProcNode) { |
| 2337 |
mIncrementalExpansionInitializingProcessingQueue = mProcessingDataBox->getIncrementalExpansionInitializingProcessingQueue(false); |
| 2338 |
if (mIncrementalExpansionInitializingProcessingQueue && !mIncrementalExpansionInitializingProcessingQueue->isEmpty()) { |
| 2339 |
mIncrementalExpansionInitializingProcessingQueue = mProcessingDataBox->getIncrementalExpansionInitializingProcessingQueue(true); |
| 2340 |
|
| 2341 |
|
| 2342 |
//if (mIncExpCompIndiModelString.isEmpty()) { |
| 2343 |
// mIncExpCompIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 2344 |
// QFile compFile(QString("./Debugging/CompletionTasks/task-inc-exp-check-compatible-%1.txt").arg(mProcessingDataBox->getIncrementalExpansionID())); |
| 2345 |
// if (compFile.open(QIODevice::WriteOnly)) { |
| 2346 |
// compFile.write(mIncExpCompIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 2347 |
// compFile.close(); |
| 2348 |
// } |
| 2349 |
//} |
| 2350 |
|
| 2351 |
while (!mIncrementalExpansionInitializingProcessingQueue->isEmpty()) { |
| 2352 |
CIndividualProcessNode* incExpInitIndiNode = mIncrementalExpansionInitializingProcessingQueue->takeNextProcessIndividual(); |
| 2353 |
incExpInitIndiNode = getLocalizedIndividual(incExpInitIndiNode,true,calcAlgContext); |
| 2354 |
incExpInitIndiNode->setIncrementalExpansionQueued(false); |
| 2355 |
if (requiresIncrementalNodeExpansion(incExpInitIndiNode,calcAlgContext)) { |
| 2356 |
initializeIncrementalIndividualExpansion(incExpInitIndiNode,calcAlgContext); |
| 2357 |
} |
| 2358 |
} |
| 2359 |
} |
| 2360 |
} |
| 2361 |
if (!indiProcNode) { |
| 2362 |
mIncrementalExpansionProcessingQueue = mProcessingDataBox->getIncrementalExpansionProcessingQueue(false); |
| 2363 |
if (mIncrementalExpansionProcessingQueue && !mIncrementalExpansionProcessingQueue->isEmpty()) { |
| 2364 |
mIncrementalExpansionProcessingQueue = mProcessingDataBox->getIncrementalExpansionProcessingQueue(true); |
| 2365 |
while (!indiProcNode && !mIncrementalExpansionProcessingQueue->isEmpty()) { |
| 2366 |
CIndividualProcessNode* incExpIndiNode = mIncrementalExpansionProcessingQueue->takeNextProcessIndividual(); |
| 2367 |
incExpIndiNode = getLocalizedIndividual(incExpIndiNode,true,calcAlgContext); |
| 2368 |
incExpIndiNode->setIncrementalExpansionQueued(false); |
| 2369 |
if (requiresIncrementalNodeExpansion(incExpIndiNode,calcAlgContext)) { |
| 2370 |
indiProcNode = incrementalNodeExpansion(incExpIndiNode,calcAlgContext); |
| 2371 |
} |
| 2372 |
} |
| 2373 |
} |
| 2374 |
} |
| 2375 |
|
| 2376 |
if (!indiProcNode) { |
| 2377 |
if (mOptIncrementalExpansion && !mProcessingDataBox->isIncrementalExpansionCompatibleMerged()) { |
| 2378 |
|
| 2379 |
//mIncExpCompIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 2380 |
//QFile compFile(QString("./Debugging/CompletionTasks/task-inc-exp-compatible-%1.txt").arg(mProcessingDataBox->getIncrementalExpansionID())); |
| 2381 |
//if (compFile.open(QIODevice::WriteOnly)) { |
| 2382 |
// compFile.write(mIncExpCompIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 2383 |
// compFile.close(); |
| 2384 |
//} |
| 2385 |
|
| 2386 |
incrementalMergeWithPreviousDeterministicCompletionGraph(calcAlgContext); |
| 2387 |
mProcessingDataBox->setIncrementalExpansionCompatibleMerged(true); |
| 2388 |
mOptIncrementalCompatibleExpansion = false; |
| 2389 |
mOptIncrementalCachingExpansion = true; |
| 2390 |
|
| 2391 |
//mIncExpMergedIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 2392 |
//QFile mergeFile(QString("./Debugging/CompletionTasks/task-inc-exp-merged-%1.txt").arg(mProcessingDataBox->getIncrementalExpansionID())); |
| 2393 |
//if (mergeFile.open(QIODevice::WriteOnly)) { |
| 2394 |
// mergeFile.write(mIncExpMergedIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 2395 |
// mergeFile.close(); |
| 2396 |
//} |
| 2397 |
|
| 2398 |
} |
| 2399 |
} |
| 2400 |
|
| 2401 |
|
| 2402 |
if (!indiProcNode) { |
| 2403 |
mEarlyIndiReactProcessingQueue = mProcessingDataBox->getEarlyIndividualReactivationProcessingQueue(false); |
| 2404 |
if (mEarlyIndiReactProcessingQueue && !mEarlyIndiReactProcessingQueue->isEmpty()) { |
| 2405 |
mEarlyIndiReactProcessingQueue = mProcessingDataBox->getEarlyIndividualReactivationProcessingQueue(true); |
| 2406 |
CIndividualProcessNode* reactIndiNode = nullptr; |
| 2407 |
bool forceReactivation = false; |
| 2408 |
mEarlyIndiReactProcessingQueue->takeNextReactivationIndividual(reactIndiNode,forceReactivation); |
| 2409 |
indiProcNode = getLocalizedIndividual(reactIndiNode,true,calcAlgContext); |
| 2410 |
if (forceReactivation) { |
| 2411 |
if (indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED)) { |
| 2412 |
indiProcNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED); |
| 2413 |
reapplySatisfiableCachedAbsorbedDisjunctionConcepts(indiProcNode,calcAlgContext); |
| 2414 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(indiProcNode,calcAlgContext); |
| 2415 |
} |
| 2416 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED); |
| 2417 |
} |
| 2418 |
mIndiNodeFromQueueType = INQT_COMPCACHEDREACT; |
| 2419 |
} |
| 2420 |
} |
| 2421 |
if (!indiProcNode) { |
| 2422 |
if (!mProcessingDataBox->hasNominalNonDeterministicProcessingNodesSorted()) { |
| 2423 |
// sort nominal processing nodes |
| 2424 |
CXLinker<CIndividualProcessNode*>* nomNonDetProLinker = mProcessingDataBox->getSortedNominalNonDeterministicProcessingNodeLinker(); |
| 2425 |
CPROCESSINGLIST< CXLinker<CIndividualProcessNode*>* > nomNonDetProLinkerList(calcAlgContext->getUsedTaskProcessorContext()); |
| 2426 |
while (nomNonDetProLinker) { |
| 2427 |
CXLinker<CIndividualProcessNode*>* tmpNomNonDetProLinker = nomNonDetProLinker; |
| 2428 |
nomNonDetProLinker = nomNonDetProLinker->getNext(); |
| 2429 |
tmpNomNonDetProLinker->clearNext(); |
| 2430 |
nomNonDetProLinkerList.append(tmpNomNonDetProLinker); |
| 2431 |
} |
| 2432 |
mProcessingDataBox->clearSortedNominalNonDeterministicProcessingNodeLinker(); |
| 2433 |
qSort(nomNonDetProLinkerList.begin(),nomNonDetProLinkerList.end(),individualIDGreaterThan); |
| 2434 |
for (CPROCESSINGLIST< CXLinker<CIndividualProcessNode*>* >::const_iterator it = nomNonDetProLinkerList.constBegin(), itEnd = nomNonDetProLinkerList.constEnd(); it != itEnd; ++it) { |
| 2435 |
CXLinker<CIndividualProcessNode*>* tmpNomNonDetProLinker(*it); |
| 2436 |
mProcessingDataBox->addSortedNominalNonDeterministicProcessingNodeLinker(tmpNomNonDetProLinker); |
| 2437 |
} |
| 2438 |
mProcessingDataBox->setNominalNonDeterministicProcessingNodesSorted(true); |
| 2439 |
} |
| 2440 |
} |
| 2441 |
|
| 2442 |
|
| 2443 |
|
| 2444 |
|
| 2445 |
|
| 2446 |
// prepare reuse of backend expansion |
| 2447 |
if (!indiProcNode && mOptBackendExpansionReuse) { |
| 2448 |
prepareBackendExpansionReuseBranching(calcAlgContext); |
| 2449 |
} |
| 2450 |
|
| 2451 |
|
| 2452 |
if (!indiProcNode && mOptBackendExpansionReuse) { |
| 2453 |
CBackendNeighbourExpansionControllingData* expContData = mProcessingDataBox->getBackendNeighbourExpansionControllingData(true); |
| 2454 |
if (expContData->isFixedReuseExpansionMode()) { |
| 2455 |
mBackendReuseExpansionQueue = mProcessingDataBox->getBackendIndividualReuseExpansionQueue(false); |
| 2456 |
if (mBackendReuseExpansionQueue && !mBackendReuseExpansionQueue->isEmpty()) { |
| 2457 |
mBackendReuseExpansionQueue = mProcessingDataBox->getBackendIndividualReuseExpansionQueue(true); |
| 2458 |
indiProcNode = mBackendReuseExpansionQueue->takeNextProcessIndividualNode(); |
| 2459 |
mIndiNodeFromQueueType = INQT_BACKENDEXPANSIONREUSE; |
| 2460 |
} |
| 2461 |
} |
| 2462 |
} |
| 2463 |
|
| 2464 |
|
| 2465 |
|
| 2466 |
|
| 2467 |
if (!indiProcNode) { |
| 2468 |
mMinConceptProcessingPriorityLevel = 0; |
| 2469 |
mProcessingQueue = mProcessingDataBox->getIndividualProcessingQueue(false); |
| 2470 |
if (mProcessingQueue && !mProcessingQueue->isEmpty()) { |
| 2471 |
mProcessingQueue = mProcessingDataBox->getIndividualProcessingQueue(true); |
| 2472 |
CIndividualProcessNodeDescriptor* indiProcessNodeDes = mProcessingQueue->takeNextProcessIndividualDescriptor(); |
| 2473 |
indiProcNode = indiProcessNodeDes->getIndividual(); |
| 2474 |
mIndiNodeFromQueueType = INQT_OUTDATED; |
| 2475 |
} |
| 2476 |
} |
| 2477 |
if (!indiProcNode) { |
| 2478 |
// process remaining concepts on nominal nodes |
| 2479 |
mNominalProcessingQueue = mProcessingDataBox->getNominalProcessingQueue(false); |
| 2480 |
if (mNominalProcessingQueue && !mNominalProcessingQueue->isEmpty()) { |
| 2481 |
mNominalProcessingQueue = mProcessingDataBox->getNominalProcessingQueue(true); |
| 2482 |
indiProcNode = mNominalProcessingQueue->takeNextProcessIndividual(); |
| 2483 |
mIndiNodeFromQueueType = INQT_NOMINAL; |
| 2484 |
} |
| 2485 |
} |
| 2486 |
|
| 2487 |
|
| 2488 |
|
| 2489 |
|
| 2490 |
if (!indiProcNode && mOptLimitBackendNeighbourExpansion) { |
| 2491 |
// remaining backend neighbour expansion |
| 2492 |
mBackendNeighbourExpansionQueue = mProcessingDataBox->getBackendIndividualNeighbourExpansionQueue(false); |
| 2493 |
|
| 2494 |
CBackendNeighbourExpansionControllingData* expContData = mProcessingDataBox->getBackendNeighbourExpansionControllingData(true); |
| 2495 |
while (!indiProcNode && mBackendNeighbourExpansionQueue && !mBackendNeighbourExpansionQueue->isEmpty()) { |
| 2496 |
mBackendNeighbourExpansionQueue = mProcessingDataBox->getBackendIndividualNeighbourExpansionQueue(true); |
| 2497 |
|
| 2498 |
CIndividualProcessNode* baseIndiNode = mBackendNeighbourExpansionQueue->takeNextProcessIndividualNode(); |
| 2499 |
|
| 2500 |
indiProcNode = queuedIndividualBackendNeighbourExpansion(baseIndiNode, expContData, calcAlgContext); |
| 2501 |
} |
| 2502 |
} |
| 2503 |
|
| 2504 |
if (!indiProcNode && mOptLimitBackendNeighbourExpansion) { |
| 2505 |
bool propCutExpanded = false; |
| 2506 |
CBackendNeighbourExpansionControllingData* expContData = mProcessingDataBox->getBackendNeighbourExpansionControllingData(false); |
| 2507 |
if (!indiProcNode && expContData && expContData->getLastBackendExpandedEnsuringExistingIndividualLinksLinker() != mProcessingDataBox->getLastBackendCacheIntegratedIndividualNodeLinker()) { |
| 2508 |
expContData = mProcessingDataBox->getBackendNeighbourExpansionControllingData(true); |
| 2509 |
CXLinker<CIndividualProcessNode*>* expandedIndiNodeLinker = mProcessingDataBox->getLastBackendCacheIntegratedIndividualNodeLinker(); |
| 2510 |
for (CXLinker<CIndividualProcessNode*>* expandedIndiNodeLinkerIt = expandedIndiNodeLinker; expandedIndiNodeLinkerIt && expandedIndiNodeLinkerIt != expContData->getLastBackendExpandedEnsuringExistingIndividualLinksLinker(); expandedIndiNodeLinkerIt = expandedIndiNodeLinkerIt->getNext()) { |
| 2511 |
CIndividualProcessNode* expandedIndiNode = expandedIndiNodeLinkerIt->getData(); |
| 2512 |
cint64 neighbourIndiId = expandedIndiNode->getNominalIndividual()->getIndividualID(); |
| 2513 |
for (CXLinker<CIndividualProcessNode*>* propCutIndiNodeLinkerIt = expContData->getLastCutBackendNeighbourExpansionEnsuringExistingIndividualLinksLinker(); propCutIndiNodeLinkerIt; propCutIndiNodeLinkerIt = propCutIndiNodeLinkerIt->getNext()) { |
| 2514 |
CIndividualProcessNode* propCutIndiNode = propCutIndiNodeLinkerIt->getData(); |
| 2515 |
propCutIndiNode = getLocalizedIndividual(propCutIndiNode, true, calcAlgContext); |
| 2516 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locPropCutIndiBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(propCutIndiNode, calcAlgContext); |
| 2517 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* propCutIndiAssocData = locPropCutIndiBackendSyncData->getAssocitaionData(); |
| 2518 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel = propCutIndiAssocData->getNeighbourRoleSetHash()->getNeighbourRoleSetLabel(neighbourIndiId); |
| 2519 |
if (neighbourRoleSetLabel) { |
| 2520 |
cint64 arrayIndex = propCutIndiAssocData->getRoleSetNeighbourArray()->getIndexData()->getIndex(neighbourRoleSetLabel); |
| 2521 |
if (arrayIndex >= 0) { |
| 2522 |
CBackendNeighbourExpansionQueue* neighExpQueue = locPropCutIndiBackendSyncData->getBackendNeighbourExpansionQueue(false); |
| 2523 |
if (neighExpQueue) { |
| 2524 |
CBackendNeighbourExpansionQueueDataLinker* backendNeighbourExpDataLinker = neighExpQueue->findNeighbourExpansionQueueDataLinker(arrayIndex); |
| 2525 |
if (neighExpQueue->hasCuttedPropagationCutPropagation() || backendNeighbourExpDataLinker) { |
| 2526 |
ensurePropagationCutLinksToExpandedIndividual(propCutIndiNode, locPropCutIndiBackendSyncData, backendNeighbourExpDataLinker, neighbourIndiId, calcAlgContext); |
| 2527 |
propCutExpanded = true; |
| 2528 |
} |
| 2529 |
|
| 2530 |
} |
| 2531 |
} |
| 2532 |
} |
| 2533 |
} |
| 2534 |
|
| 2535 |
} |
| 2536 |
expContData->setLastBackendExpandedEnsuringExistingIndividualLinksLinker(expandedIndiNodeLinker); |
| 2537 |
} |
| 2538 |
|
| 2539 |
|
| 2540 |
if (!indiProcNode && expContData && expContData->getLastCutBackendNeighbourExpansionEnsuringExistingIndividualLinksLinker() != expContData->getCutBackendNeighbourExpansionIndividualLinker()) { |
| 2541 |
expContData = mProcessingDataBox->getBackendNeighbourExpansionControllingData(true); |
| 2542 |
for (CXLinker<CIndividualProcessNode*>* propCutIndiNodeLinkerIt = expContData->getCutBackendNeighbourExpansionIndividualLinker(); propCutIndiNodeLinkerIt && propCutIndiNodeLinkerIt != expContData->getLastCutBackendNeighbourExpansionEnsuringExistingIndividualLinksLinker(); propCutIndiNodeLinkerIt = propCutIndiNodeLinkerIt->getNext()) { |
| 2543 |
CIndividualProcessNode* propCutIndiNode = propCutIndiNodeLinkerIt->getData(); |
| 2544 |
propCutIndiNode = getLocalizedIndividual(propCutIndiNode, true, calcAlgContext); |
| 2545 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locPropCutIndiBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(propCutIndiNode, calcAlgContext); |
| 2546 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* propCutIndiAssocData = locPropCutIndiBackendSyncData->getAssocitaionData(); |
| 2547 |
CXLinker<CIndividualProcessNode*>* expandedIndiNodeLinker = mProcessingDataBox->getLastBackendCacheIntegratedIndividualNodeLinker(); |
| 2548 |
for (CXLinker<CIndividualProcessNode*>* expandedIndiNodeLinkerIt = expandedIndiNodeLinker; expandedIndiNodeLinkerIt && expandedIndiNodeLinkerIt; expandedIndiNodeLinkerIt = expandedIndiNodeLinkerIt->getNext()) { |
| 2549 |
CIndividualProcessNode* expandedIndiNode = expandedIndiNodeLinkerIt->getData(); |
| 2550 |
cint64 neighbourIndiId = expandedIndiNode->getNominalIndividual()->getIndividualID(); |
| 2551 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel = propCutIndiAssocData->getNeighbourRoleSetHash()->getNeighbourRoleSetLabel(neighbourIndiId); |
| 2552 |
if (neighbourRoleSetLabel) { |
| 2553 |
cint64 arrayIndex = propCutIndiAssocData->getRoleSetNeighbourArray()->getIndexData()->getIndex(neighbourRoleSetLabel); |
| 2554 |
if (arrayIndex >= 0) { |
| 2555 |
CBackendNeighbourExpansionQueue* neighExpQueue = locPropCutIndiBackendSyncData->getBackendNeighbourExpansionQueue(false); |
| 2556 |
if (neighExpQueue) { |
| 2557 |
CBackendNeighbourExpansionQueueDataLinker* backendNeighbourExpDataLinker = neighExpQueue->findNeighbourExpansionQueueDataLinker(arrayIndex); |
| 2558 |
if (neighExpQueue->hasCuttedPropagationCutPropagation() || backendNeighbourExpDataLinker) { |
| 2559 |
ensurePropagationCutLinksToExpandedIndividual(propCutIndiNode, locPropCutIndiBackendSyncData, backendNeighbourExpDataLinker, neighbourIndiId, calcAlgContext); |
| 2560 |
propCutExpanded = true; |
| 2561 |
} |
| 2562 |
} |
| 2563 |
} |
| 2564 |
} |
| 2565 |
} |
| 2566 |
|
| 2567 |
} |
| 2568 |
expContData->setLastCutBackendNeighbourExpansionEnsuringExistingIndividualLinksLinker(expContData->getCutBackendNeighbourExpansionIndividualLinker()); |
| 2569 |
} |
| 2570 |
if (!indiProcNode && propCutExpanded) { |
| 2571 |
indiProcNode = takeNextProcessIndividual(calcAlgContext); |
| 2572 |
} |
| 2573 |
} |
| 2574 |
|
| 2575 |
|
| 2576 |
if (!indiProcNode) { |
| 2577 |
if (mProcessingDataBox->hasSortedNominalNonDeterministicProcessingNodes()) { |
| 2578 |
indiProcNode = mProcessingDataBox->takeSortedNominalNonDeterministicProcessingNode(); |
| 2579 |
mIndiNodeFromQueueType = INQT_NOMINAL; |
| 2580 |
} |
| 2581 |
} |
| 2582 |
if (!indiProcNode) { |
| 2583 |
// depth based processing for blockable node |
| 2584 |
mDepthProcessingQueue = mProcessingDataBox->getIndividualDepthProcessingQueue(false); |
| 2585 |
if (mDepthProcessingQueue && !mDepthProcessingQueue->isEmpty()) { |
| 2586 |
mDepthProcessingQueue = mProcessingDataBox->getIndividualDepthProcessingQueue(true); |
| 2587 |
indiProcNode = mDepthProcessingQueue->takeNextProcessIndividual(); |
| 2588 |
mIndiNodeFromQueueType = INQT_DEPTHNORMAL; |
| 2589 |
} |
| 2590 |
} |
| 2591 |
if (!indiProcNode) { |
| 2592 |
// processing of new nodes with depth first |
| 2593 |
mNominalCachingLossReactivationProcessingQueue = mProcessingDataBox->getNominalCachingLossReactivationProcessingQueue(false); |
| 2594 |
if (mNominalCachingLossReactivationProcessingQueue && !mNominalCachingLossReactivationProcessingQueue->isEmpty()) { |
| 2595 |
mNominalCachingLossReactivationProcessingQueue = mProcessingDataBox->getNominalCachingLossReactivationProcessingQueue(true); |
| 2596 |
CIndividualProcessNode* tmpIndiProcNode = mNominalCachingLossReactivationProcessingQueue->takeNextProcessIndividualNode(); |
| 2597 |
tmpIndiProcNode = getUpToDateIndividual(tmpIndiProcNode,calcAlgContext); |
| 2598 |
if (tmpIndiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED)) { |
| 2599 |
indiProcNode = getLocalizedIndividual(tmpIndiProcNode,false,calcAlgContext); |
| 2600 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHEDINVALIDATED); |
| 2601 |
} |
| 2602 |
mIndiNodeFromQueueType = INQT_NOMINALCACHINGLOSSREACTIVATION; |
| 2603 |
} |
| 2604 |
} |
| 2605 |
if (!indiProcNode) { |
| 2606 |
// processing of new nodes with depth first |
| 2607 |
mDepthFirstProcessingQueue = mProcessingDataBox->getIndividualDepthFirstProcessingQueue(false); |
| 2608 |
if (mDepthFirstProcessingQueue && !mDepthFirstProcessingQueue->isEmpty()) { |
| 2609 |
mDepthFirstProcessingQueue = mProcessingDataBox->getIndividualDepthFirstProcessingQueue(true); |
| 2610 |
indiProcNode = mDepthFirstProcessingQueue->takeNextProcessIndividualNode(); |
| 2611 |
mIndiNodeFromQueueType = INQT_DEPTHFIRST; |
| 2612 |
} |
| 2613 |
} |
| 2614 |
|
| 2615 |
|
| 2616 |
if (!indiProcNode) { |
| 2617 |
mLateIndiReactProcessingQueue = mProcessingDataBox->getLateIndividualReactivationProcessingQueue(false); |
| 2618 |
if (mLateIndiReactProcessingQueue && !mLateIndiReactProcessingQueue->isEmpty()) { |
| 2619 |
mLateIndiReactProcessingQueue = mProcessingDataBox->getLateIndividualReactivationProcessingQueue(true); |
| 2620 |
CIndividualProcessNode* reactIndiNode = nullptr; |
| 2621 |
bool forceReactivation = false; |
| 2622 |
mLateIndiReactProcessingQueue->takeNextReactivationIndividual(reactIndiNode,forceReactivation); |
| 2623 |
indiProcNode = getLocalizedIndividual(reactIndiNode,true,calcAlgContext); |
| 2624 |
if (forceReactivation) { |
| 2625 |
if (indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED)) { |
| 2626 |
indiProcNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED); |
| 2627 |
reapplySatisfiableCachedAbsorbedDisjunctionConcepts(indiProcNode,calcAlgContext); |
| 2628 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(indiProcNode,calcAlgContext); |
| 2629 |
} |
| 2630 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED); |
| 2631 |
} |
| 2632 |
mIndiNodeFromQueueType = INQT_COMPCACHEDREACT; |
| 2633 |
} |
| 2634 |
} |
| 2635 |
|
| 2636 |
|
| 2637 |
if (!indiProcNode) { |
| 2638 |
mOptDetExpPreporcessing = false; |
| 2639 |
mIndiSigBlockUpdProQueue = mProcessingDataBox->getBlockingUpdateReviewProcessingQueue(false); |
| 2640 |
if (mIndiSigBlockUpdProQueue && !mIndiSigBlockUpdProQueue->isEmpty()) { |
| 2641 |
mIndiSigBlockUpdProQueue = mProcessingDataBox->getBlockingUpdateReviewProcessingQueue(true); |
| 2642 |
indiProcNode = mIndiSigBlockUpdProQueue->takeNextProcessIndividual(); |
| 2643 |
mIndiNodeFromQueueType = INQT_BLOCKUP; |
| 2644 |
} |
| 2645 |
} |
| 2646 |
if (!indiProcNode) { |
| 2647 |
mIndiBlockReactProQueue = mProcessingDataBox->getBlockedReactivationProcessingQueue(false); |
| 2648 |
if (mIndiBlockReactProQueue && !mIndiBlockReactProQueue->isEmpty()) { |
| 2649 |
mIndiBlockReactProQueue = mProcessingDataBox->getBlockedReactivationProcessingQueue(true); |
| 2650 |
indiProcNode = mIndiBlockReactProQueue->takeNextProcessIndividual(); |
| 2651 |
mIndiNodeFromQueueType = INQT_BLOCKREACT; |
| 2652 |
} |
| 2653 |
} |
| 2654 |
|
| 2655 |
if (!indiProcNode) { |
| 2656 |
mSigBlockRevSet = mProcessingDataBox->getSignatureBlockingReviewSet(false); |
| 2657 |
if (mSigBlockRevSet && !mSigBlockRevSet->isEmpty()) { |
| 2658 |
mSigBlockRevSet = mProcessingDataBox->getSignatureBlockingReviewSet(true); |
| 2659 |
bool isNonSubSetData = true; |
| 2660 |
CSignatureBlockingReviewData* reviewData = mSigBlockRevSet->getNonSubsetReviewData(); |
| 2661 |
if (reviewData->isEmpty()) { |
| 2662 |
isNonSubSetData = false; |
| 2663 |
reviewData = mSigBlockRevSet->getSubsetReviewData(); |
| 2664 |
} |
| 2665 |
|
| 2666 |
CSignatureBlockingReviewDataIterator revIt = reviewData->getIterator(); |
| 2667 |
|
| 2668 |
if (revIt.hasNext()) { |
| 2669 |
|
| 2670 |
cint64 blockedIndiID = revIt.next(false); |
| 2671 |
revIt.removeAndMoveNext(); |
| 2672 |
|
| 2673 |
indiProcNode = getLocalizedIndividual(blockedIndiID,calcAlgContext); |
| 2674 |
|
| 2675 |
if (!isNonSubSetData && mConfIndividualReusingFromSignatureBlocking) { |
| 2676 |
// try to establish individual reusing |
| 2677 |
upgradeSignatureBlockingToIndividualReusing(indiProcNode,calcAlgContext); |
| 2678 |
} |
| 2679 |
|
| 2680 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 2681 |
CSignatureBlockingIndividualNodeConceptExpansionData* locSigBlockingData = indiProcNode->getSignatureBlockingIndividualNodeConceptExpansionData(true); |
| 2682 |
if (!locSigBlockingData) { |
| 2683 |
CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockingData = indiProcNode->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 2684 |
locSigBlockingData = CObjectAllocator<CSignatureBlockingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 2685 |
locSigBlockingData->initBlockingExpansionData(sigBlockingData); |
| 2686 |
indiProcNode->setSignatureBlockingIndividualNodeConceptExpansionData(locSigBlockingData); |
| 2687 |
} |
| 2688 |
if (!locSigBlockingData->isIdenticConceptSetRequired()) { |
| 2689 |
locSigBlockingData->setIdenticConceptSetRequired(true); |
| 2690 |
indiProcNode->setLastSearchBlockerCandidateCount(0); |
| 2691 |
detectIndividualNodeSignatureBlockingStatus(indiProcNode,calcAlgContext); |
| 2692 |
} |
| 2693 |
} |
| 2694 |
|
| 2695 |
} |
| 2696 |
} |
| 2697 |
if (!indiProcNode) { |
| 2698 |
mReusingReviewData = calcAlgContext->getProcessingDataBox()->getReusingReviewData(false); |
| 2699 |
if (mReusingReviewData && !mReusingReviewData->isEmpty()) { |
| 2700 |
mReusingReviewData = calcAlgContext->getProcessingDataBox()->getReusingReviewData(false); |
| 2701 |
|
| 2702 |
while (mReusingReviewData->hasNextIndividualID() && !indiProcNode) { |
| 2703 |
cint64 indiNodeID = mReusingReviewData->takeNextIndividualID(); |
| 2704 |
|
| 2705 |
indiProcNode = getLocalizedIndividual(indiNodeID,calcAlgContext); |
| 2706 |
CReusingIndividualNodeConceptExpansionData* reuseData = indiProcNode->getReusingIndividualNodeConceptExpansionData(false); |
| 2707 |
if (!reuseData->isConceptSetStillSubset()) { |
| 2708 |
removeIndividualReusing(indiProcNode,calcAlgContext); |
| 2709 |
} else { |
| 2710 |
indiProcNode = nullptr; |
| 2711 |
} |
| 2712 |
} |
| 2713 |
} |
| 2714 |
} |
| 2715 |
|
| 2716 |
if (!indiProcNode && mOptLimitBackendNeighbourExpansion) { |
| 2717 |
mBackendLateNeighbourExpansionQueue = mProcessingDataBox->getBackendLateIndividualNeighbourExpansionQueue(false); |
| 2718 |
if (mBackendLateNeighbourExpansionQueue && !mBackendLateNeighbourExpansionQueue->isEmpty()) { |
| 2719 |
mBackendLateNeighbourExpansionQueue = mProcessingDataBox->getBackendLateIndividualNeighbourExpansionQueue(true); |
| 2720 |
mBackendNeighbourExpansionQueue = mProcessingDataBox->getBackendIndividualNeighbourExpansionQueue(true); |
| 2721 |
CBackendNeighbourExpansionControllingData* expContData = mProcessingDataBox->getBackendNeighbourExpansionControllingData(true); |
| 2722 |
while (!mBackendLateNeighbourExpansionQueue->isEmpty()) { |
| 2723 |
CIndividualProcessNode* expQueNode = mBackendLateNeighbourExpansionQueue->takeNextProcessIndividualNode(); |
| 2724 |
if (!indiProcNode) { |
| 2725 |
indiProcNode = queuedIndividualBackendNeighbourExpansion(expQueNode, expContData, calcAlgContext); |
| 2726 |
} else { |
| 2727 |
mBackendNeighbourExpansionQueue->insertIndiviudalProcessNode(expQueNode); |
| 2728 |
} |
| 2729 |
} |
| 2730 |
} |
| 2731 |
} |
| 2732 |
|
| 2733 |
if (!indiProcNode && mOptBackendExpansionReuse) { |
| 2734 |
CBackendNeighbourExpansionControllingData* expContData = mProcessingDataBox->getBackendNeighbourExpansionControllingData(true); |
| 2735 |
if (expContData->isPrioritizedReuseExpansionMode()) { |
| 2736 |
mBackendReuseExpansionQueue = mProcessingDataBox->getBackendIndividualReuseExpansionQueue(false); |
| 2737 |
if (mBackendReuseExpansionQueue && !mBackendReuseExpansionQueue->isEmpty()) { |
| 2738 |
mBackendReuseExpansionQueue = mProcessingDataBox->getBackendIndividualReuseExpansionQueue(true); |
| 2739 |
indiProcNode = mBackendReuseExpansionQueue->takeNextProcessIndividualNode(); |
| 2740 |
mIndiNodeFromQueueType = INQT_BACKENDEXPANSIONREUSE; |
| 2741 |
} |
| 2742 |
} |
| 2743 |
} |
| 2744 |
|
| 2745 |
|
| 2746 |
if (!indiProcNode) { |
| 2747 |
mDelayedNominalProcessingQueue = mProcessingDataBox->getDelayingNominalProcessingQueue(false); |
| 2748 |
if (mDelayedNominalProcessingQueue) { |
| 2749 |
mDelayedNominalProcessingQueue = mProcessingDataBox->getDelayingNominalProcessingQueue(true); |
| 2750 |
indiProcNode = mDelayedNominalProcessingQueue->takeNextProcessIndividualNode(); |
| 2751 |
mIndiNodeFromQueueType = INQT_DELAYEDNOMINAL; |
| 2752 |
} |
| 2753 |
} |
| 2754 |
|
| 2755 |
if (!indiProcNode) { |
| 2756 |
mBackendIndirectCompatibilityExpansionQueue = mProcessingDataBox->getBackendIndirectCompatibilityExpansionQueue(false); |
| 2757 |
while (!indiProcNode && mBackendIndirectCompatibilityExpansionQueue && !mBackendIndirectCompatibilityExpansionQueue->isEmpty()) { |
| 2758 |
mBackendIndirectCompatibilityExpansionQueue = mProcessingDataBox->getBackendIndirectCompatibilityExpansionQueue(true); |
| 2759 |
indiProcNode = mBackendIndirectCompatibilityExpansionQueue->takeNextProcessIndividualNode(); |
| 2760 |
mIndiNodeFromQueueType = INQT_BACKENDINDIRECTCOMPATIBILITYEXPANSION; |
| 2761 |
|
| 2762 |
if (!indiProcNode->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 2763 |
cint64 prevId = indiProcNode->getIndividualNodeID(); |
| 2764 |
indiProcNode = getCorrectedNominalIndividualNode(prevId, calcAlgContext); |
| 2765 |
indiProcNode = getLocalizedIndividual(indiProcNode, false, calcAlgContext); |
| 2766 |
if (!indiProcNode->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 2767 |
if (!indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED) && !indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDFULLEXPANSION)) { |
| 2768 |
detectIndividualNodeBackendCacheSynchronized(indiProcNode, calcAlgContext); |
| 2769 |
} |
| 2770 |
expandDirectlyInfluencedIndividualNeighbourNodesFromBackendCache(indiProcNode, calcAlgContext); |
| 2771 |
|
| 2772 |
if (indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSINGINDIVIDUAL) && !indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSEDISCARDED)) { |
| 2773 |
reuseIndividualBackendExpansion(indiProcNode, calcAlgContext); |
| 2774 |
} else { |
| 2775 |
|
| 2776 |
// Check whether this is indeed necessary in case of backend expansion reuse |
| 2777 |
expandIndirectCompatibleRequiredIndividualNeighbourNodesFromBackendCache(indiProcNode, calcAlgContext); |
| 2778 |
} |
| 2779 |
} else { |
| 2780 |
indiProcNode = nullptr; |
| 2781 |
} |
| 2782 |
} else { |
| 2783 |
indiProcNode = nullptr; |
| 2784 |
} |
| 2785 |
} |
| 2786 |
} |
| 2787 |
|
| 2788 |
|
| 2789 |
return indiProcNode; |
| 2790 |
} |
| 2791 |
|
| 2792 |
|
| 2793 |
|
| 2794 |
void CCalculationTableauCompletionTaskHandleAlgorithm::analyzeCompletionGraphStatistics(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2795 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 2796 |
CIndividualProcessNodeVector* indiNodeVec = processingDataBox->getIndividualProcessNodeVector(); |
| 2797 |
cint64 indiCount = indiNodeVec->getItemCount(); |
| 2798 |
cint64 indiStart = indiNodeVec->getItemMinIndex(); |
| 2799 |
for (cint64 indiIdx = indiStart; indiIdx < indiCount; ++indiIdx) { |
| 2800 |
CIndividualProcessNode* indiNode = getLocalizedIndividual(indiIdx,calcAlgContext); |
| 2801 |
if (indiNode) { |
| 2802 |
cint64 conSigValue = indiNode->getReapplyConceptLabelSet(false)->getConceptSignatureValue(); |
| 2803 |
mSignatureIndiNodeStatusHash.insertMulti(conSigValue,indiNode->getProcessingRestrictionFlags()); |
| 2804 |
|
| 2805 |
if (!mSignatureIndiNodePredDepHash.contains(conSigValue)) { |
| 2806 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 2807 |
if (conSet && indiNode->getIndividualAncestorDepth() > 0) { |
| 2808 |
cint64 conFromPredCount = 0; |
| 2809 |
CConceptDescriptor* conDesIt = conSet->getAddingSortedConceptDescriptionLinker(); |
| 2810 |
while (conDesIt) { |
| 2811 |
if (conDesIt->getConceptTag() != 1) { |
| 2812 |
if (isConceptFromPredecessorDependent(indiNode,conDesIt,conDesIt->getDependencyTrackPoint(),calcAlgContext)) { |
| 2813 |
++conFromPredCount; |
| 2814 |
} |
| 2815 |
} |
| 2816 |
conDesIt = conDesIt->getNext(); |
| 2817 |
} |
| 2818 |
mSignatureIndiNodePredDepHash.insert(conSigValue,conFromPredCount); |
| 2819 |
} |
| 2820 |
} |
| 2821 |
} |
| 2822 |
} |
| 2823 |
mIndiNodeCountMap.insert(indiCount,mIndiNodeCountMap.value(indiCount,0)+1); |
| 2824 |
mIndiNodeCountList.append(indiCount); |
| 2825 |
} |
| 2826 |
|
| 2827 |
|
| 2828 |
|
| 2829 |
|
| 2830 |
|
| 2831 |
|
| 2832 |
|
| 2833 |
|
| 2834 |
|
| 2835 |
|
| 2836 |
|
| 2837 |
|
| 2838 |
|
| 2839 |
|
| 2840 |
|
| 2841 |
|
| 2842 |
|
| 2843 |
|
| 2844 |
|
| 2845 |
|
| 2846 |
|
| 2847 |
|
| 2848 |
|
| 2849 |
|
| 2850 |
|
| 2851 |
|
| 2852 |
|
| 2853 |
|
| 2854 |
|
| 2855 |
|
| 2856 |
|
| 2857 |
|
| 2858 |
|
| 2859 |
|
| 2860 |
|
| 2861 |
|
| 2862 |
|
| 2863 |
|
| 2864 |
|
| 2865 |
|
| 2866 |
|
| 2867 |
|
| 2868 |
|
| 2869 |
|
| 2870 |
|
| 2871 |
|
| 2872 |
|
| 2873 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::areAllDependentFactsUnchanged(CIndividualProcessNode* individualNode, CIndividualProcessNode* backtrackedIndividualNode, CDependencyTrackPoint* prevConDepTrackPoint, CIndividualProcessNodeVector* prevIndiNodeVec, cint64& remBacktrackCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2874 |
if (--remBacktrackCount < 0) { |
| 2875 |
return false; |
| 2876 |
} |
| 2877 |
CDependencyNode* depNode = prevConDepTrackPoint->getDependencyNode(); |
| 2878 |
if (depNode) { |
| 2879 |
CIndividualProcessNode* assocIndiNode = depNode->getAppropriateIndividualNode(); |
| 2880 |
if (assocIndiNode) { |
| 2881 |
if (assocIndiNode->isBlockableIndividual()) { |
| 2882 |
return false; |
| 2883 |
} |
| 2884 |
CIndividualProcessNode* locAssIndiNode = calcAlgContext->getUsedProcessingDataBox()->getIndividualProcessNodeVector()->getData(assocIndiNode->getIndividualNodeID()); |
| 2885 |
if (locAssIndiNode) { |
| 2886 |
return false; |
| 2887 |
} |
| 2888 |
} |
| 2889 |
bool addRoleExistDep = false; |
| 2890 |
CDependencyIterator addDepIt = depNode->getAdditionalDependencyIterator(true,true); |
| 2891 |
while (addDepIt.hasNext()) { |
| 2892 |
CDependency* addDep = addDepIt.nextDependency(); |
| 2893 |
CDependencyTrackPoint* prevAddDepTrackPoint = addDep->getPreviousDependencyTrackPoint(); |
| 2894 |
CDependencyNode* prevAddDepNode = addDep->getPreviousTrackedDependency(); |
| 2895 |
if (prevAddDepNode->getDependencyType() == CDependencyNode::DNTROLEASSERTIONDEPENDENCY) { |
| 2896 |
if (addRoleExistDep) { |
| 2897 |
return false; |
| 2898 |
} |
| 2899 |
addRoleExistDep = true; |
| 2900 |
} else if (prevAddDepNode->getDependencyType() == CDependencyNode::DNTSOMEDEPENDENCY) { |
| 2901 |
if (addRoleExistDep) { |
| 2902 |
return false; |
| 2903 |
} |
| 2904 |
CIndividualProcessNode* addAssocIndiNode = prevAddDepNode->getAppropriateIndividualNode(); |
| 2905 |
if (addAssocIndiNode && addAssocIndiNode->isBlockableIndividual()) { |
| 2906 |
return false; |
| 2907 |
} |
| 2908 |
if (!areAllDependentFactsUnchanged(individualNode,addAssocIndiNode?addAssocIndiNode:backtrackedIndividualNode,prevAddDepTrackPoint,prevIndiNodeVec,remBacktrackCount,calcAlgContext)) { |
| 2909 |
return false; |
| 2910 |
} |
| 2911 |
addRoleExistDep = true; |
| 2912 |
} else if (prevAddDepTrackPoint) { |
| 2913 |
if (!areAllDependentFactsUnchanged(individualNode,assocIndiNode?assocIndiNode:backtrackedIndividualNode,prevAddDepTrackPoint,prevIndiNodeVec,remBacktrackCount,calcAlgContext)) { |
| 2914 |
return false; |
| 2915 |
} |
| 2916 |
} |
| 2917 |
} |
| 2918 |
if (depNode->getDependencyType() != CDependencyNode::DNTINDEPENDENTBASE) { |
| 2919 |
CDependencyTrackPoint* prevDepTrackPoint = depNode->getPreviousDependencyTrackPoint(); |
| 2920 |
if (prevDepTrackPoint) { |
| 2921 |
if (!areAllDependentFactsUnchanged(individualNode,assocIndiNode?assocIndiNode:backtrackedIndividualNode,prevDepTrackPoint,prevIndiNodeVec,remBacktrackCount,calcAlgContext)) { |
| 2922 |
return false; |
| 2923 |
} |
| 2924 |
return true; |
| 2925 |
} |
| 2926 |
} else if (backtrackedIndividualNode && backtrackedIndividualNode != individualNode) { |
| 2927 |
return true; |
| 2928 |
} |
| 2929 |
|
| 2930 |
} |
| 2931 |
return false; |
| 2932 |
} |
| 2933 |
|
| 2934 |
|
| 2935 |
|
| 2936 |
|
| 2937 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::initializeIncrementalIndividualExpansion(CIndividualProcessNode* individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2938 |
CIndividualNodeIncrementalExpansionData* incExpData = individualNode->getIncrementalExpansionData(false); |
| 2939 |
if (!incExpData || !incExpData->isIncremetnalExpansionListInitialized()) { |
| 2940 |
incExpData = individualNode->getIncrementalExpansionData(true); |
| 2941 |
CIndividualProcessNodeVector* indiNodeVec = calcAlgContext->getUsedProcessingDataBox()->getIndividualProcessNodeVector(); |
| 2942 |
|
| 2943 |
CPROCESSINGSET<cint64>* searchingNodeSet = CObjectParameterizingAllocator< CPROCESSINGSET<cint64>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 2944 |
CPROCESSINGLIST<cint64>* searchingNodeList = CObjectParameterizingAllocator< CPROCESSINGLIST<cint64>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 2945 |
|
| 2946 |
CPROCESSLIST<CIndividual*>* expList = nullptr; |
| 2947 |
|
| 2948 |
CSatisfiableCalculationTask* prevCalcTask = mIncExpHandler->getPreviousDeterministicCompletionGraphTask(calcAlgContext); |
| 2949 |
CProcessingDataBox* prevDataBox = prevCalcTask->getProcessingDataBox(); |
| 2950 |
CIndividualProcessNodeVector* prevIndiNodeVec = prevDataBox->getIndividualProcessNodeVector(); |
| 2951 |
|
| 2952 |
CIndividualProcessNode* prevIndiNode = incExpData->getPreviousCompletionGraphCorrespondenceIndividualNode(); |
| 2953 |
if (prevIndiNode) { |
| 2954 |
CReapplyConceptLabelSet* conSet = individualNode->getReapplyConceptLabelSet(false); |
| 2955 |
CReapplyConceptLabelSet* prevConSet = prevIndiNode->getReapplyConceptLabelSet(false); |
| 2956 |
if (conSet && prevConSet) { |
| 2957 |
CReapplyConceptLabelSetIterator conSetIt = conSet->getConceptLabelSetIterator(true); |
| 2958 |
CReapplyConceptLabelSetIterator prevConSetIt = prevConSet->getConceptLabelSetIterator(true); |
| 2959 |
while (conSetIt.hasNext() && prevConSetIt.hasNext()) { |
| 2960 |
cint64 conTag = conSetIt.getDataTag(); |
| 2961 |
cint64 prevConTag = prevConSetIt.getDataTag(); |
| 2962 |
CConceptDescriptor* conDes = conSetIt.getConceptDescriptor(); |
| 2963 |
CConceptDescriptor* prevConDes = prevConSetIt.getConceptDescriptor(); |
| 2964 |
if (conTag == prevConTag) { |
| 2965 |
conSetIt.moveNext(); |
| 2966 |
prevConSetIt.moveNext(); |
| 2967 |
} else if (prevConTag < conTag) { |
| 2968 |
// concept is missing, analyse dependencies whether it can be directly added |
| 2969 |
CDependencyTrackPoint* prevConDepTrackPoint = prevConSetIt.getDependencyTrackPoint(); |
| 2970 |
cint64 remMaxBacktrackingCount = 15; |
| 2971 |
if (areAllDependentFactsUnchanged(individualNode,nullptr,prevConDepTrackPoint,prevIndiNodeVec,remMaxBacktrackingCount,calcAlgContext)) { |
| 2972 |
addConceptToIndividual(prevConDes->getConcept(),prevConDes->isNegated(),individualNode,prevConDepTrackPoint,false,false,calcAlgContext); |
| 2973 |
} |
| 2974 |
prevConSetIt.moveNext(); |
| 2975 |
} else if (conTag < prevConTag) { |
| 2976 |
conSetIt.moveNext(); |
| 2977 |
} |
| 2978 |
} |
| 2979 |
|
| 2980 |
while (prevConSetIt.hasNext()) { |
| 2981 |
// concept is missing, analyse dependencies whether it can be directly added |
| 2982 |
CConceptDescriptor* prevConDes = prevConSetIt.getConceptDescriptor(); |
| 2983 |
CDependencyTrackPoint* prevConDepTrackPoint = prevConSetIt.getDependencyTrackPoint(); |
| 2984 |
cint64 remMaxBacktrackingCount = 15; |
| 2985 |
if (areAllDependentFactsUnchanged(individualNode,nullptr,prevConDepTrackPoint,prevIndiNodeVec,remMaxBacktrackingCount,calcAlgContext)) { |
| 2986 |
addConceptToIndividual(prevConDes->getConcept(),prevConDes->isNegated(),individualNode,prevConDepTrackPoint,false,false,calcAlgContext); |
| 2987 |
} |
| 2988 |
prevConSetIt.moveNext(); |
| 2989 |
} |
| 2990 |
} |
| 2991 |
} |
| 2992 |
|
| 2993 |
|
| 2994 |
|
| 2995 |
searchingNodeSet->insert(individualNode->getIndividualNodeID()); |
| 2996 |
searchingNodeList->append(individualNode->getIndividualNodeID()); |
| 2997 |
|
| 2998 |
while (!searchingNodeList->isEmpty()) { |
| 2999 |
cint64 searchIndiNodeID = searchingNodeList->takeFirst(); |
| 3000 |
CIndividualProcessNode* searchIndiNode = prevIndiNodeVec->getData(searchIndiNodeID); |
| 3001 |
|
| 3002 |
if (searchIndiNode) { |
| 3003 |
|
| 3004 |
CIndividual* nominalIndi = searchIndiNode->getNominalIndividual(); |
| 3005 |
if (searchIndiNode->getIndividualNodeID() != individualNode->getIndividualNodeID()) { |
| 3006 |
if (nominalIndi) { |
| 3007 |
if (!indiNodeVec->getData(-nominalIndi->getIndividualID())) { |
| 3008 |
if (!expList) { |
| 3009 |
expList = incExpData->getIncrementalExpansionList(true); |
| 3010 |
} |
| 3011 |
expList->append(nominalIndi); |
| 3012 |
} |
| 3013 |
} |
| 3014 |
} |
| 3015 |
|
| 3016 |
if (!nominalIndi && searchIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION) || searchIndiNodeID == individualNode->getIndividualNodeID()) { |
| 3017 |
CSuccessorIterator succIt = searchIndiNode->getSuccessorIterator(); |
| 3018 |
while (succIt.hasNext()) { |
| 3019 |
CIndividualLinkEdge* succLink = succIt.nextLink(); |
| 3020 |
cint64 succIndiID = succLink->getOppositeIndividualID(searchIndiNodeID); |
| 3021 |
if (!searchingNodeSet->contains(succIndiID)) { |
| 3022 |
searchingNodeSet->insert(succIndiID); |
| 3023 |
searchingNodeList->append(succIndiID); |
| 3024 |
} |
| 3025 |
} |
| 3026 |
CConnectionSuccessorSetIterator connIt = searchIndiNode->getConnectionSuccessorIterator(); |
| 3027 |
while (connIt.hasNext()) { |
| 3028 |
cint64 connIndiID = connIt.next(); |
| 3029 |
if (!searchingNodeSet->contains(connIndiID)) { |
| 3030 |
searchingNodeSet->insert(connIndiID); |
| 3031 |
searchingNodeList->append(connIndiID); |
| 3032 |
} |
| 3033 |
} |
| 3034 |
CIndividualMergingHash* mergeHash = searchIndiNode->getIndividualMergingHash(false); |
| 3035 |
if (mergeHash) { |
| 3036 |
for (CPROCESSHASH<cint64,CIndividualMergingHashData>::const_iterator it = mergeHash->constBegin(), itEnd = mergeHash->constEnd(); it != itEnd; ++it) { |
| 3037 |
cint64 mergedIndiID = it.key(); |
| 3038 |
if (it.value().isMergedWithIndividual() && !searchingNodeSet->contains(mergedIndiID)) { |
| 3039 |
searchingNodeSet->insert(mergedIndiID); |
| 3040 |
searchingNodeList->append(mergedIndiID); |
| 3041 |
} |
| 3042 |
} |
| 3043 |
} |
| 3044 |
} |
| 3045 |
} |
| 3046 |
} |
| 3047 |
incExpData->setIncremetnalExpansionListInitialized(true); |
| 3048 |
addIndividualToIncrementalExpansionQueue(individualNode,calcAlgContext); |
| 3049 |
return true; |
| 3050 |
} |
| 3051 |
return false; |
| 3052 |
} |
| 3053 |
|
| 3054 |
|
| 3055 |
|
| 3056 |
|
| 3057 |
|
| 3058 |
CIndividual* CCalculationTableauCompletionTaskHandleAlgorithm::getNextIncrementalExpansionIndividual(CIndividualProcessNode* individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3059 |
CIndividualNodeIncrementalExpansionData* incExpData = individualNode->getIncrementalExpansionData(false); |
| 3060 |
if (incExpData && incExpData->requiresFurtherIncrementalExpansion()) { |
| 3061 |
incExpData = individualNode->getIncrementalExpansionData(true); |
| 3062 |
while (incExpData->requiresFurtherIncrementalExpansion()) { |
| 3063 |
CIndividual* nextIndi = incExpData->takeNextIncrementalExpansionIndividual(); |
| 3064 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 3065 |
if (!indiProcNodeVec->getData(-nextIndi->getIndividualID())) { |
| 3066 |
return nextIndi; |
| 3067 |
} |
| 3068 |
} |
| 3069 |
} |
| 3070 |
return nullptr; |
| 3071 |
} |
| 3072 |
|
| 3073 |
|
| 3074 |
|
| 3075 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::incrementalNodeExpansion(CIndividualProcessNode* expandNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3076 |
|
| 3077 |
CIndividual* expIndi = getNextIncrementalExpansionIndividual(expandNode,calcAlgContext); |
| 3078 |
if (expIndi) { |
| 3079 |
CIndividualProcessNode* expandedIndiNode = getUpToDateIndividual(-expIndi->getIndividualID(),calcAlgContext); |
| 3080 |
addIndividualToIncrementalExpansionQueue(expandNode,calcAlgContext); |
| 3081 |
return expandedIndiNode; |
| 3082 |
} |
| 3083 |
return nullptr; |
| 3084 |
} |
| 3085 |
|
| 3086 |
|
| 3087 |
|
| 3088 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::requiresIncrementalNodeExpansion(CIndividualProcessNode* individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3089 |
CIndividualNodeIncrementalExpansionData* incExpData = individualNode->getIncrementalExpansionData(false); |
| 3090 |
if (!incExpData->isPreviousCompletionGraphCompatible() && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3091 |
return true; |
| 3092 |
} |
| 3093 |
return false; |
| 3094 |
} |
| 3095 |
|
| 3096 |
|
| 3097 |
|
| 3098 |
|
| 3099 |
|
| 3100 |
|
| 3101 |
|
| 3102 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::incrementalMergeWithPreviousNondeterministicCompletionGraph(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3103 |
CIndividualProcessNodeVector* indiNodeVec = calcAlgContext->getUsedProcessingDataBox()->getIndividualProcessNodeVector(); |
| 3104 |
cint64 indiCount = indiNodeVec->getItemCount(); |
| 3105 |
cint64 indiStart = indiNodeVec->getItemMinIndex(); |
| 3106 |
|
| 3107 |
CSatisfiableCalculationTask* prevDetCalcTask = mIncExpHandler->getPreviousDeterministicCompletionGraphTask(calcAlgContext); |
| 3108 |
CSatisfiableCalculationTask* prevNondetCalcTask = mIncExpHandler->getPreviousNondeterministicCompletionGraphTask(calcAlgContext); |
| 3109 |
|
| 3110 |
if (prevDetCalcTask && prevNondetCalcTask && prevDetCalcTask != prevNondetCalcTask) { |
| 3111 |
CProcessingDataBox* prevDetDataBox = prevDetCalcTask->getProcessingDataBox(); |
| 3112 |
CIndividualProcessNodeVector* prevDetIndiNodeVec = prevDetDataBox->getIndividualProcessNodeVector(); |
| 3113 |
cint64 prevDetIndiNodeCount = prevDetIndiNodeVec->getItemCount(); |
| 3114 |
|
| 3115 |
CProcessingDataBox* prevNondetDataBox = prevNondetCalcTask->getProcessingDataBox(); |
| 3116 |
CIndividualProcessNodeVector* prevNondetIndiNodeVec = prevNondetDataBox->getIndividualProcessNodeVector(); |
| 3117 |
cint64 prevNondetIndiNodeCount = prevNondetIndiNodeVec->getItemCount(); |
| 3118 |
|
| 3119 |
|
| 3120 |
CPROCESSINGSET<cint64>* transformNodeSet = CObjectParameterizingAllocator< CPROCESSINGSET<cint64>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 3121 |
|
| 3122 |
|
| 3123 |
CIndividualProcessNodeVector* mergedIndiNodeVec = CObjectParameterizingAllocator< CIndividualProcessNodeVector,CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getProcessContext()); |
| 3124 |
mergedIndiNodeVec->referenceVector(indiNodeVec); |
| 3125 |
calcAlgContext->getUsedProcessingDataBox()->setIndividualProcessNodeVector(mergedIndiNodeVec); |
| 3126 |
|
| 3127 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 3128 |
CIndividualProcessNode* indiNode = indiNodeVec->getData(i); |
| 3129 |
CIndividualProcessNode* prevDetIndiNode = prevDetIndiNodeVec->getData(i); |
| 3130 |
CIndividualProcessNode* prevNondetIndiNode = prevNondetIndiNodeVec->getData(i); |
| 3131 |
if (!indiNode && prevNondetIndiNode) { |
| 3132 |
mergedIndiNodeVec->setLocalData(i,prevNondetIndiNode); |
| 3133 |
} else if (indiNode == prevDetIndiNode) { |
| 3134 |
if (prevNondetIndiNode != prevDetIndiNode) { |
| 3135 |
mergedIndiNodeVec->setLocalData(i,prevNondetIndiNode); |
| 3136 |
} |
| 3137 |
} else { |
| 3138 |
if (!indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 3139 |
if (indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED) && !indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALID | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED)) { |
| 3140 |
transformNodeSet->insert(i); |
| 3141 |
} |
| 3142 |
} |
| 3143 |
} |
| 3144 |
} |
| 3145 |
|
| 3146 |
for (CPROCESSINGSET<cint64>::const_iterator it = transformNodeSet->constBegin(), itEnd = transformNodeSet->constEnd(); it != itEnd; ++it) { |
| 3147 |
cint64 transformNodeID(*it); |
| 3148 |
CIndividualProcessNode* locIndiNode = getLocalizedIndividual(transformNodeID,calcAlgContext); |
| 3149 |
CIndividualProcessNode* prevNondetIndiNode = prevNondetIndiNodeVec->getData(transformNodeID); |
| 3150 |
locIndiNode->setReapplyConceptLabelSet(prevNondetIndiNode->getReapplyConceptLabelSet(false)); |
| 3151 |
|
| 3152 |
CSuccessorIterator prevSuccIt = prevNondetIndiNode->getSuccessorIterator(); |
| 3153 |
while (prevSuccIt.hasNext()) { |
| 3154 |
CIndividualLinkEdge* succLinkEdge = prevSuccIt.nextLink(); |
| 3155 |
cint64 succIndiID = succLinkEdge->getOppositeIndividualID(transformNodeID); |
| 3156 |
CIndividualProcessNode* succIndiNode = getUpToDateIndividual(succIndiID,calcAlgContext); |
| 3157 |
if (!succIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 3158 |
CIndividualProcessNode* locSuccIndiNode = getLocalizedIndividual(succIndiNode,false,calcAlgContext); |
| 3159 |
CSuccessorRoleIterator succRoleIt = prevNondetIndiNode->getSuccessorRoleIterator(locSuccIndiNode); |
| 3160 |
while (succRoleIt.hasNext()) { |
| 3161 |
CIndividualLinkEdge* succLink = succRoleIt.next(); |
| 3162 |
if (!locSuccIndiNode->hasRoleSuccessorToIndividual(succLink->getLinkRole(),locIndiNode,true)) { |
| 3163 |
CIndividualLinkEdge* newSuccLink = CObjectParameterizingAllocator< CIndividualLinkEdge,CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getUsedProcessContext()); |
| 3164 |
newSuccLink->initIndividualLinkEdge(succLink); |
| 3165 |
CReapplyQueueIterator reapplyIterator = installIndividualNodeRoleLinkReapplied(locIndiNode,locSuccIndiNode,newSuccLink,calcAlgContext); |
| 3166 |
applyReapplyQueueConceptsRestricted(locIndiNode,&reapplyIterator,newSuccLink,calcAlgContext); |
| 3167 |
} |
| 3168 |
} |
| 3169 |
} |
| 3170 |
} |
| 3171 |
|
| 3172 |
CConnectionSuccessorSetIterator connIt = prevNondetIndiNode->getConnectionSuccessorIterator(); |
| 3173 |
if (connIt.hasNext()) { |
| 3174 |
CConnectionSuccessorSet* connSet = locIndiNode->getConnectionSuccessorSet(false); |
| 3175 |
CConnectionSuccessorSet* locConnSet = nullptr; |
| 3176 |
while (connIt.hasNext()) { |
| 3177 |
cint64 connID = connIt.next(); |
| 3178 |
if (!connSet || !connSet->hasConnectionSuccessor(connID)) { |
| 3179 |
CIndividualProcessNode* connIndiNode = getUpToDateIndividual(connID,calcAlgContext); |
| 3180 |
if (!connIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 3181 |
if (!locConnSet) { |
| 3182 |
locConnSet = locIndiNode->getConnectionSuccessorSet(true); |
| 3183 |
} |
| 3184 |
locConnSet->insertConnectionSuccessor(connID); |
| 3185 |
} |
| 3186 |
} |
| 3187 |
} |
| 3188 |
} |
| 3189 |
|
| 3190 |
CDistinctHash* prevDistinctHash = prevNondetIndiNode->getDistinctHash(false); |
| 3191 |
if (prevDistinctHash) { |
| 3192 |
CDistinctHash* distinctHash = locIndiNode->getDistinctHash(false); |
| 3193 |
CDistinctHash* locDistinctHash = nullptr; |
| 3194 |
for (CDistinctHash::const_iterator it = distinctHash->constBegin(), itEnd = distinctHash->constEnd(); it != itEnd; ++it) { |
| 3195 |
cint64 distinctIndiID(it.key()); |
| 3196 |
CDistinctEdge* distinctEdge(it.value()); |
| 3197 |
if (!distinctHash || distinctHash->isIndividualDistinct(distinctIndiID)) { |
| 3198 |
CIndividualProcessNode* distinctIndiNode = getUpToDateIndividual(distinctIndiID,calcAlgContext); |
| 3199 |
if (!distinctIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 3200 |
if (!locDistinctHash) { |
| 3201 |
locDistinctHash = locIndiNode->getDistinctHash(true); |
| 3202 |
} |
| 3203 |
CDistinctEdge* newDistinctLink = CObjectParameterizingAllocator< CDistinctEdge,CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getUsedProcessContext()); |
| 3204 |
newDistinctLink->initDistinctEdge(locIndiNode,distinctIndiNode,distinctEdge->getDependencyTrackPoint()); |
| 3205 |
locDistinctHash->insertDistinctIndividual(distinctIndiID,newDistinctLink); |
| 3206 |
} |
| 3207 |
} |
| 3208 |
} |
| 3209 |
} |
| 3210 |
|
| 3211 |
CIndividualMergingHash* prevIndiMergingHash = prevNondetIndiNode->getIndividualMergingHash(false); |
| 3212 |
if (prevIndiMergingHash) { |
| 3213 |
CIndividualMergingHash* indiMergingHash = locIndiNode->getIndividualMergingHash(false); |
| 3214 |
CIndividualMergingHash* locIndiMergingHash = nullptr; |
| 3215 |
for (CIndividualMergingHash::const_iterator it = indiMergingHash->constBegin(), itEnd = indiMergingHash->constEnd(); it != itEnd; ++it) { |
| 3216 |
cint64 mergedIndiId(it.key()); |
| 3217 |
CIndividualMergingHashData prevMergingData = it.value(); |
| 3218 |
if (!indiMergingHash || indiMergingHash->contains(mergedIndiId)) { |
| 3219 |
if (!locIndiMergingHash) { |
| 3220 |
locIndiMergingHash = locIndiNode->getIndividualMergingHash(true); |
| 3221 |
} |
| 3222 |
CIndividualMergingHashData& locMergingData = (*locIndiMergingHash)[mergedIndiId]; |
| 3223 |
if (!prevMergingData.getReapplyQueue()->isEmpty()) { |
| 3224 |
CCondensedReapplyQueueIterator reapplyIt = prevMergingData.getReapplyQueue()->getIterator(true, true); |
| 3225 |
applyReapplyQueueConcepts(locIndiNode, &reapplyIt, calcAlgContext); |
| 3226 |
} |
| 3227 |
if (!locMergingData.isMergedWithIndividual()) { |
| 3228 |
locMergingData.setMergedWithIndividual(prevMergingData.isMergedWithIndividual()); |
| 3229 |
} |
| 3230 |
if (!locMergingData.getDependencyTrackPoint()) { |
| 3231 |
CDependencyTrackPoint* depTrackPoint(it.value().getDependencyTrackPoint()); |
| 3232 |
locMergingData.setDependencyTrackPoint(prevMergingData.getDependencyTrackPoint()); |
| 3233 |
} |
| 3234 |
} |
| 3235 |
} |
| 3236 |
} |
| 3237 |
} |
| 3238 |
return true; |
| 3239 |
|
| 3240 |
} |
| 3241 |
return false; |
| 3242 |
} |
| 3243 |
|
| 3244 |
|
| 3245 |
|
| 3246 |
|
| 3247 |
|
| 3248 |
|
| 3249 |
|
| 3250 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::incrementalMergeWithPreviousDeterministicCompletionGraph(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3251 |
CIndividualProcessNodeVector* indiNodeVec = calcAlgContext->getUsedProcessingDataBox()->getIndividualProcessNodeVector(); |
| 3252 |
cint64 indiMaxIdx = indiNodeVec->getItemMaxIndex(); |
| 3253 |
cint64 indiMinIdx = indiNodeVec->getItemMinIndex(); |
| 3254 |
|
| 3255 |
CSatisfiableCalculationTask* prevCalcTask = mIncExpHandler->getPreviousDeterministicCompletionGraphTask(calcAlgContext); |
| 3256 |
if (prevCalcTask) { |
| 3257 |
CPROCESSINGSET<cint64>* nonCompatibleChangedNominalNodeSet = CObjectParameterizingAllocator< CPROCESSINGSET<cint64>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 3258 |
CPROCESSINGSET<cint64>* compatibleNominalNodeSet = CObjectParameterizingAllocator< CPROCESSINGSET<cint64>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 3259 |
CPROCESSINGSET<cint64>* redundantNodeSet = CObjectParameterizingAllocator< CPROCESSINGSET<cint64>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 3260 |
CPROCESSINGSET<cint64>* newNodeSet = CObjectParameterizingAllocator< CPROCESSINGSET<cint64>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 3261 |
|
| 3262 |
identifyCompatibilityChangedNominalIndividualNodes(nonCompatibleChangedNominalNodeSet,compatibleNominalNodeSet,redundantNodeSet,newNodeSet,calcAlgContext); |
| 3263 |
|
| 3264 |
CPROCESSINGSET<cint64>* pruningNodeSet = CObjectParameterizingAllocator< CPROCESSINGSET<cint64>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 3265 |
|
| 3266 |
|
| 3267 |
|
| 3268 |
CProcessingDataBox* prevDataBox = prevCalcTask->getProcessingDataBox(); |
| 3269 |
CIndividualProcessNodeVector* prevIndiNodeVec = prevDataBox->getIndividualProcessNodeVector(); |
| 3270 |
cint64 prevIndiNodeMaxIdx = prevIndiNodeVec->getItemMaxIndex(); |
| 3271 |
cint64 prevIndiNodeMinIdx = prevIndiNodeVec->getItemMinIndex(); |
| 3272 |
|
| 3273 |
for (CPROCESSINGSET<cint64>::const_iterator it = redundantNodeSet->constBegin(), itEnd = redundantNodeSet->constEnd(); it != itEnd; ++it) { |
| 3274 |
cint64 redundantNodeID(*it); |
| 3275 |
CIndividualProcessNode* redundantNode = indiNodeVec->getData(redundantNodeID); |
| 3276 |
if (redundantNode && redundantNode->getNominalIndividual()) { |
| 3277 |
redundantNode = getLocalizedIndividual(redundantNode,false,calcAlgContext); |
| 3278 |
pruneIncrementalRemovedSuccessors(redundantNode,compatibleNominalNodeSet,pruningNodeSet,calcAlgContext); |
| 3279 |
} |
| 3280 |
} |
| 3281 |
|
| 3282 |
CIndividualProcessNodeVector* mergedIndiNodeVec = CObjectParameterizingAllocator< CIndividualProcessNodeVector,CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getProcessContext()); |
| 3283 |
mergedIndiNodeVec->referenceVector(prevIndiNodeVec); |
| 3284 |
calcAlgContext->getUsedProcessingDataBox()->setIndividualProcessNodeVector(mergedIndiNodeVec); |
| 3285 |
|
| 3286 |
|
| 3287 |
for (CPROCESSINGSET<cint64>::const_iterator it = nonCompatibleChangedNominalNodeSet->constBegin(), itEnd = nonCompatibleChangedNominalNodeSet->constEnd(); it != itEnd; ++it) { |
| 3288 |
cint64 changedNominalID(*it); |
| 3289 |
CIndividualProcessNode* prevChangedNode = mergedIndiNodeVec->getData(changedNominalID); |
| 3290 |
if (prevChangedNode) { |
| 3291 |
prevChangedNode = getLocalizedIndividual(prevChangedNode,false,calcAlgContext); |
| 3292 |
pruneIncrementalRemovedSuccessors(prevChangedNode,compatibleNominalNodeSet,pruningNodeSet,calcAlgContext); |
| 3293 |
} |
| 3294 |
} |
| 3295 |
|
| 3296 |
for (CPROCESSINGSET<cint64>::const_iterator it = nonCompatibleChangedNominalNodeSet->constBegin(), itEnd = nonCompatibleChangedNominalNodeSet->constEnd(); it != itEnd; ++it) { |
| 3297 |
cint64 changedNominalID(*it); |
| 3298 |
CIndividualProcessNode* changedNode = indiNodeVec->getData(changedNominalID); |
| 3299 |
mergedIndiNodeVec->setData(changedNominalID,changedNode); |
| 3300 |
} |
| 3301 |
|
| 3302 |
for (CPROCESSINGSET<cint64>::const_iterator it = compatibleNominalNodeSet->constBegin(), itEnd = compatibleNominalNodeSet->constEnd(); it != itEnd; ++it) { |
| 3303 |
cint64 compNominalID(*it); |
| 3304 |
CIndividualProcessNode* newCompNode = indiNodeVec->getData(compNominalID); |
| 3305 |
mergedIndiNodeVec->setData(compNominalID,newCompNode); |
| 3306 |
|
| 3307 |
// TODO: add nodes to cached completion graph checking queue? |
| 3308 |
|
| 3309 |
CIndividualProcessNode* prevCompIndiNode = prevIndiNodeVec->getData(compNominalID); |
| 3310 |
if (prevCompIndiNode) { |
| 3311 |
|
| 3312 |
CIndividualProcessNode* locNewCompNode = getLocalizedIndividual(newCompNode,false,calcAlgContext); |
| 3313 |
|
| 3314 |
CSuccessorIterator prevSuccIt = prevCompIndiNode->getSuccessorIterator(); |
| 3315 |
while (prevSuccIt.hasNext()) { |
| 3316 |
CIndividualLinkEdge* succLinkEdge = prevSuccIt.nextLink(); |
| 3317 |
CIndividualProcessNode* succIndiNode = getSuccessorIndividual(prevCompIndiNode,succLinkEdge,calcAlgContext); |
| 3318 |
if (succIndiNode->isNominalIndividualNode() || succIndiNode->hasProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 3319 |
cint64 succIndiID = succIndiNode->getIndividualNodeID(); |
| 3320 |
if (!compatibleNominalNodeSet->contains(succIndiID) && !nonCompatibleChangedNominalNodeSet->contains(succIndiID) && !pruningNodeSet->contains(succIndiID)) { |
| 3321 |
CSuccessorRoleIterator succRoleIt = prevCompIndiNode->getSuccessorRoleIterator(succIndiNode); |
| 3322 |
while (succRoleIt.hasNext()) { |
| 3323 |
CIndividualLinkEdge* succLink = succRoleIt.next(); |
| 3324 |
|
| 3325 |
CIndividualLinkEdge* newSuccLink = CObjectParameterizingAllocator< CIndividualLinkEdge,CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getUsedProcessContext()); |
| 3326 |
newSuccLink->initIndividualLinkEdge(succLink); |
| 3327 |
|
| 3328 |
CReapplyQueueIterator reapplyIterator = installIndividualNodeRoleLinkReapplied(locNewCompNode,succIndiNode,newSuccLink,calcAlgContext); |
| 3329 |
applyReapplyQueueConceptsRestricted(locNewCompNode,&reapplyIterator,newSuccLink,calcAlgContext); |
| 3330 |
} |
| 3331 |
} |
| 3332 |
} |
| 3333 |
} |
| 3334 |
|
| 3335 |
CConnectionSuccessorSetIterator conIt = prevCompIndiNode->getConnectionSuccessorIterator(); |
| 3336 |
while (conIt.hasNext()) { |
| 3337 |
cint64 connNodeID = conIt.next(); |
| 3338 |
if (!compatibleNominalNodeSet->contains(connNodeID) && !nonCompatibleChangedNominalNodeSet->contains(connNodeID) && !pruningNodeSet->contains(connNodeID)) { |
| 3339 |
locNewCompNode->getConnectionSuccessorSet(true)->insertConnectionSuccessor(connNodeID); |
| 3340 |
} |
| 3341 |
} |
| 3342 |
|
| 3343 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 3344 |
CIndividualReactivationProcessingQueue* reactProcQueue = nullptr; |
| 3345 |
if (mConfDelayCompletionGraphCachingReactivation) { |
| 3346 |
reactProcQueue = processingDataBox->getLateIndividualReactivationProcessingQueue(true); |
| 3347 |
} else { |
| 3348 |
reactProcQueue = processingDataBox->getEarlyIndividualReactivationProcessingQueue(true); |
| 3349 |
} |
| 3350 |
reactProcQueue->insertReactivationIndiviudal(locNewCompNode,false); |
| 3351 |
|
| 3352 |
} |
| 3353 |
} |
| 3354 |
|
| 3355 |
for (cint64 i = prevIndiNodeMinIdx; i >= indiMinIdx; --i) { |
| 3356 |
CIndividualProcessNode* newIndiNode = indiNodeVec->getData(i); |
| 3357 |
if (newIndiNode) { |
| 3358 |
mergedIndiNodeVec->setData(i,newIndiNode); |
| 3359 |
} |
| 3360 |
} |
| 3361 |
for (cint64 i = prevIndiNodeMaxIdx; i <= indiMaxIdx; ++i) { |
| 3362 |
CIndividualProcessNode* newIndiNode = indiNodeVec->getData(i); |
| 3363 |
if (newIndiNode) { |
| 3364 |
mergedIndiNodeVec->setData(i,newIndiNode); |
| 3365 |
} |
| 3366 |
} |
| 3367 |
|
| 3368 |
|
| 3369 |
return true; |
| 3370 |
} |
| 3371 |
return false; |
| 3372 |
} |
| 3373 |
|
| 3374 |
|
| 3375 |
|
| 3376 |
|
| 3377 |
|
| 3378 |
|
| 3379 |
|
| 3380 |
|
| 3381 |
|
| 3382 |
|
| 3383 |
|
| 3384 |
void CCalculationTableauCompletionTaskHandleAlgorithm::pruneIncrementalRemovedSuccessors(CIndividualProcessNode*& indi, CPROCESSINGSET<cint64>* compatibleNominalNodeSet, CPROCESSINGSET<cint64>* pruningNodeSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3385 |
|
| 3386 |
CPROCESSINGLIST<CIndividualProcessNode*>* pruningNodeList = CObjectParameterizingAllocator< CPROCESSINGLIST<CIndividualProcessNode*>,CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 3387 |
pruningNodeList->append(indi); |
| 3388 |
|
| 3389 |
while (!pruningNodeList->isEmpty()) { |
| 3390 |
CIndividualProcessNode* pruningNode = pruningNodeList->takeFirst(); |
| 3391 |
|
| 3392 |
if (pruningNode != indi && !pruningNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 3393 |
pruningNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED); |
| 3394 |
eliminiateBlockedIndividuals(pruningNode,calcAlgContext); |
| 3395 |
} |
| 3396 |
|
| 3397 |
CConnectionSuccessorSet* connSuccSet = pruningNode->getConnectionSuccessorSet(false); |
| 3398 |
if (connSuccSet) { |
| 3399 |
if (connSuccSet->getConnectionSuccessorCount() > 0) { |
| 3400 |
CConnectionSuccessorSetIterator conSuccIt = connSuccSet->getConnectionSuccessorIterator(); |
| 3401 |
while (conSuccIt.hasNext()) { |
| 3402 |
cint64 connID = conSuccIt.next(true); |
| 3403 |
if (!pruningNodeSet->contains(connID) && !compatibleNominalNodeSet->contains(connID)) { |
| 3404 |
CIndividualProcessNode* nomIndi = getUpToDateIndividual(connID,calcAlgContext); |
| 3405 |
if (!nomIndi->getNominalIndividual() && !nomIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 3406 |
pruningNodeSet->insert(connID); |
| 3407 |
CIndividualProcessNode* locNomIndi = getLocalizedIndividual(nomIndi,false,calcAlgContext); |
| 3408 |
pruningNodeList->append(locNomIndi); |
| 3409 |
} |
| 3410 |
} |
| 3411 |
} |
| 3412 |
} |
| 3413 |
} |
| 3414 |
|
| 3415 |
|
| 3416 |
CSuccessorIterator succIt = pruningNode->getSuccessorIterator(); |
| 3417 |
cint64 ancDepth = pruningNode->getIndividualAncestorDepth(); |
| 3418 |
while (succIt.hasNext()) { |
| 3419 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 3420 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(pruningNode,succLink,calcAlgContext); |
| 3421 |
if (!succIndi->getNominalIndividual() && !succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 3422 |
cint64 succIndiID = succIndi->getIndividualNodeID(); |
| 3423 |
if (!pruningNodeSet->contains(succIndiID) && !compatibleNominalNodeSet->contains(succIndiID)) { |
| 3424 |
pruningNodeSet->insert(succIndiID); |
| 3425 |
CIndividualProcessNode* locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 3426 |
pruningNodeList->append(locSuccIndi); |
| 3427 |
} |
| 3428 |
} |
| 3429 |
} |
| 3430 |
} |
| 3431 |
} |
| 3432 |
|
| 3433 |
|
| 3434 |
|
| 3435 |
|
| 3436 |
|
| 3437 |
|
| 3438 |
|
| 3439 |
|
| 3440 |
|
| 3441 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::identifyCompatibilityChangedNominalIndividualNodes(CPROCESSINGSET<cint64>* nonCompatibleChangedNominalNodeSet, CPROCESSINGSET<cint64>* compatibleNominalNodeSet, CPROCESSINGSET<cint64>* redundantNodeSet, CPROCESSINGSET<cint64>* newNodeSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3442 |
CIndividualProcessNodeVector* indiNodeVec = calcAlgContext->getUsedProcessingDataBox()->getIndividualProcessNodeVector(); |
| 3443 |
cint64 indiCount = indiNodeVec->getItemCount(); |
| 3444 |
cint64 indiStart = indiNodeVec->getItemMinIndex(); |
| 3445 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 3446 |
CIndividualProcessNode* indiNode = indiNodeVec->getData(i); |
| 3447 |
if (indiNode) { |
| 3448 |
CIndividualNodeIncrementalExpansionData* incExpData = indiNode->getIncrementalExpansionData(false); |
| 3449 |
if (indiNode->getNominalIndividual()) { |
| 3450 |
if (incExpData && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3451 |
if (!incExpData->isPreviousCompletionGraphCompatible()) { |
| 3452 |
nonCompatibleChangedNominalNodeSet->insert(i); |
| 3453 |
} else { |
| 3454 |
compatibleNominalNodeSet->insert(i); |
| 3455 |
} |
| 3456 |
} |
| 3457 |
} else { |
| 3458 |
if (incExpData && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3459 |
newNodeSet->insert(i); |
| 3460 |
} |
| 3461 |
} |
| 3462 |
if (!incExpData || (!incExpData->hasDirectlyChangedNeighbourConnection() && !incExpData->isDirectlyChanged())) { |
| 3463 |
redundantNodeSet->insert(i); |
| 3464 |
} |
| 3465 |
} |
| 3466 |
} |
| 3467 |
return true; |
| 3468 |
} |
| 3469 |
|
| 3470 |
|
| 3471 |
|
| 3472 |
|
| 3473 |
|
| 3474 |
|
| 3475 |
|
| 3476 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::checkCompatibilityUpdateDirectlyChangedPropagation(CIndividualProcessNode* individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3477 |
bool compatible = mIncExpHandler->isIndividualNodePreviousCompletionGraphCompatible(individualNode,calcAlgContext); |
| 3478 |
CIndividualNodeIncrementalExpansionData* incExpData = individualNode->getIncrementalExpansionData(false); |
| 3479 |
if (compatible) { |
| 3480 |
clearPropagatedDirectlyChangedNeighbourConnection(individualNode,true,calcAlgContext); |
| 3481 |
} else { |
| 3482 |
if (incExpData->isDirectlyChanged()) { |
| 3483 |
addIndividualToIncrementalExpansionQueue(individualNode,calcAlgContext); |
| 3484 |
} |
| 3485 |
if (!incExpData->isDirectlyChanged() && !incExpData->hasDirectlyChangedNeighbourConnection()) { |
| 3486 |
CIndividualProcessNode* directlyChangedConnNode = searchDirectlyChangedNeighbourNodeConnection(individualNode,calcAlgContext); |
| 3487 |
if (directlyChangedConnNode && establishDirectlyChangedNeighbourConnection(individualNode,directlyChangedConnNode,true,calcAlgContext)) { |
| 3488 |
propagateDirectlyChangedNeighbourNodeConnection(individualNode,true,calcAlgContext); |
| 3489 |
} |
| 3490 |
} |
| 3491 |
} |
| 3492 |
return compatible; |
| 3493 |
} |
| 3494 |
|
| 3495 |
|
| 3496 |
|
| 3497 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::linkCreationDirectlyChangedNeighbourConnectionUpdate(CIndividualProcessNode* sourceIndi, CIndividualProcessNode* destIndi, bool queueIncrementalExpansion, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3498 |
bool updatedNeighbourConnection = false; |
| 3499 |
if (establishDirectlyChangedNeighbourConnection(sourceIndi,destIndi,true,calcAlgContext)) { |
| 3500 |
propagateDirectlyChangedNeighbourNodeConnection(sourceIndi,true,calcAlgContext); |
| 3501 |
updatedNeighbourConnection = true; |
| 3502 |
} |
| 3503 |
if (establishDirectlyChangedNeighbourConnection(destIndi,sourceIndi,true,calcAlgContext)) { |
| 3504 |
propagateDirectlyChangedNeighbourNodeConnection(destIndi,true,calcAlgContext); |
| 3505 |
updatedNeighbourConnection = true; |
| 3506 |
} |
| 3507 |
return updatedNeighbourConnection; |
| 3508 |
} |
| 3509 |
|
| 3510 |
|
| 3511 |
|
| 3512 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::establishDirectlyChangedNeighbourConnection(CIndividualProcessNode* individualNode, CIndividualProcessNode* neighbourNodeCandidate, bool queueIncrementalExpansion, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3513 |
CIndividualNodeIncrementalExpansionData* incExpData = individualNode->getIncrementalExpansionData(false); |
| 3514 |
if (!incExpData || !incExpData->hasDirectlyChangedNeighbourConnection() && !incExpData->isDirectlyChanged()) { |
| 3515 |
CIndividualNodeIncrementalExpansionData* candIncExpData = neighbourNodeCandidate->getIncrementalExpansionData(false); |
| 3516 |
if (candIncExpData && (candIncExpData->hasDirectlyChangedNeighbourConnection() || candIncExpData->isDirectlyChanged())) { |
| 3517 |
CIndividualNodeIncrementalExpansionData* locIncExpData = individualNode->getIncrementalExpansionData(true); |
| 3518 |
CIndividualProcessNode* locNeighbourNodeCandidate = getLocalizedIndividual(neighbourNodeCandidate,false,calcAlgContext); |
| 3519 |
locIncExpData->setDirectlyChangedNeighbourConnectionNode(locNeighbourNodeCandidate); |
| 3520 |
CIndividualNodeIncrementalExpansionData* locCandIncExpData = locNeighbourNodeCandidate->getIncrementalExpansionData(true); |
| 3521 |
locCandIncExpData->addNeighbourPropagatedDirectlyChanged(individualNode); |
| 3522 |
if (queueIncrementalExpansion && individualNode->getNominalIndividual()) { |
| 3523 |
addIndividualToIncrementalExpansionQueue(individualNode,calcAlgContext); |
| 3524 |
} |
| 3525 |
return true; |
| 3526 |
} |
| 3527 |
} |
| 3528 |
return false; |
| 3529 |
} |
| 3530 |
|
| 3531 |
|
| 3532 |
|
| 3533 |
|
| 3534 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateDirectlyChangedNeighbourNodeConnection(CIndividualProcessNode* individualNode, bool queueIncrementalExpansion, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3535 |
|
| 3536 |
CPROCESSINGLIST<CIndividualProcessNode*> propNodeList(calcAlgContext->getUsedTaskProcessorContext()); |
| 3537 |
propNodeList.append(individualNode); |
| 3538 |
bool propagatedDirectlyChanged = false; |
| 3539 |
|
| 3540 |
while (!propNodeList.isEmpty()) { |
| 3541 |
CIndividualProcessNode* propIndiNode = propNodeList.takeFirst(); |
| 3542 |
|
| 3543 |
CSuccessorIterator succIt(propIndiNode->getSuccessorIterator()); |
| 3544 |
while (succIt.hasNext()) { |
| 3545 |
CIndividualLinkEdge* succLink = succIt.nextLink(); |
| 3546 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(propIndiNode,succLink,calcAlgContext); |
| 3547 |
CIndividualNodeIncrementalExpansionData* incExpData = succIndi->getIncrementalExpansionData(false); |
| 3548 |
if (!incExpData || (!incExpData->hasDirectlyChangedNeighbourConnection() && !incExpData->isDirectlyChanged() && !incExpData->isPreviousCompletionGraphCompatible())) { |
| 3549 |
CIndividualProcessNode* locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 3550 |
if (establishDirectlyChangedNeighbourConnection(locSuccIndi,propIndiNode,queueIncrementalExpansion,calcAlgContext)) { |
| 3551 |
propagatedDirectlyChanged = true; |
| 3552 |
propNodeList.append(locSuccIndi); |
| 3553 |
} |
| 3554 |
} |
| 3555 |
} |
| 3556 |
CConnectionSuccessorSetIterator connIt(propIndiNode->getConnectionSuccessorIterator()); |
| 3557 |
while (connIt.hasNext()) { |
| 3558 |
cint64 connID = connIt.next(); |
| 3559 |
CIndividualProcessNode* connIndiNode = getUpToDateIndividual(connID,calcAlgContext); |
| 3560 |
CIndividualNodeIncrementalExpansionData* incExpData = connIndiNode->getIncrementalExpansionData(false); |
| 3561 |
if (!incExpData || (!incExpData->hasDirectlyChangedNeighbourConnection() && !incExpData->isDirectlyChanged() && !incExpData->isPreviousCompletionGraphCompatible())) { |
| 3562 |
CIndividualProcessNode* locConnIndiNode = getLocalizedIndividual(connIndiNode,false,calcAlgContext); |
| 3563 |
if (establishDirectlyChangedNeighbourConnection(locConnIndiNode,propIndiNode,queueIncrementalExpansion,calcAlgContext)) { |
| 3564 |
propagatedDirectlyChanged = true; |
| 3565 |
propNodeList.append(locConnIndiNode); |
| 3566 |
} |
| 3567 |
} |
| 3568 |
} |
| 3569 |
if (propIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 3570 |
for (CXLinker<CIndividualProcessNode*>* blockedNodeLinkerIt = propIndiNode->getBlockedIndividualsLinker(); blockedNodeLinkerIt; blockedNodeLinkerIt = blockedNodeLinkerIt->getNext()) { |
| 3571 |
CIndividualProcessNode* blockedIndiNode = getUpToDateIndividual(blockedNodeLinkerIt->getData(),calcAlgContext); |
| 3572 |
CIndividualNodeIncrementalExpansionData* incExpData = blockedIndiNode->getIncrementalExpansionData(false); |
| 3573 |
if (!incExpData || (!incExpData->hasDirectlyChangedNeighbourConnection() && !incExpData->isDirectlyChanged() && !incExpData->isPreviousCompletionGraphCompatible())) { |
| 3574 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNode,false,calcAlgContext); |
| 3575 |
if (establishDirectlyChangedNeighbourConnection(locBlockedIndiNode,propIndiNode,queueIncrementalExpansion,calcAlgContext)) { |
| 3576 |
propagatedDirectlyChanged = true; |
| 3577 |
propNodeList.append(locBlockedIndiNode); |
| 3578 |
} |
| 3579 |
} |
| 3580 |
} |
| 3581 |
for (CXLinker<CIndividualProcessNode*>* blockedNodeLinkerIt = propIndiNode->getProcessingBlockedIndividualsLinker(); blockedNodeLinkerIt; blockedNodeLinkerIt = blockedNodeLinkerIt->getNext()) { |
| 3582 |
CIndividualProcessNode* blockedIndiNode = getUpToDateIndividual(blockedNodeLinkerIt->getData(),calcAlgContext); |
| 3583 |
CIndividualNodeIncrementalExpansionData* incExpData = blockedIndiNode->getIncrementalExpansionData(false); |
| 3584 |
if (!incExpData || (!incExpData->hasDirectlyChangedNeighbourConnection() && !incExpData->isDirectlyChanged() && !incExpData->isPreviousCompletionGraphCompatible())) { |
| 3585 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNode,false,calcAlgContext); |
| 3586 |
if (establishDirectlyChangedNeighbourConnection(locBlockedIndiNode,propIndiNode,queueIncrementalExpansion,calcAlgContext)) { |
| 3587 |
propagatedDirectlyChanged = true; |
| 3588 |
propNodeList.append(locBlockedIndiNode); |
| 3589 |
} |
| 3590 |
} |
| 3591 |
} |
| 3592 |
CBlockingFollowSet* followSet = propIndiNode->getBlockingFollowSet(false); |
| 3593 |
if (followSet) { |
| 3594 |
for (CBlockingFollowSet::const_iterator it = followSet->constBegin(), itEnd = followSet->constEnd(); it != itEnd; ++it) { |
| 3595 |
cint64 blockedIndiNodeID = *it; |
| 3596 |
CIndividualProcessNode* blockedIndiNode = getUpToDateIndividual(blockedIndiNodeID,calcAlgContext); |
| 3597 |
CIndividualNodeIncrementalExpansionData* incExpData = blockedIndiNode->getIncrementalExpansionData(false); |
| 3598 |
if (!incExpData || (!incExpData->hasDirectlyChangedNeighbourConnection() && !incExpData->isDirectlyChanged() && !incExpData->isPreviousCompletionGraphCompatible())) { |
| 3599 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNode,false,calcAlgContext); |
| 3600 |
if (establishDirectlyChangedNeighbourConnection(locBlockedIndiNode,propIndiNode,queueIncrementalExpansion,calcAlgContext)) { |
| 3601 |
propagatedDirectlyChanged = true; |
| 3602 |
propNodeList.append(locBlockedIndiNode); |
| 3603 |
} |
| 3604 |
} |
| 3605 |
} |
| 3606 |
} |
| 3607 |
CIndividualProcessNode* blockerIndiNode = propIndiNode->getBlockerIndividualNode(); |
| 3608 |
if (blockerIndiNode) { |
| 3609 |
blockerIndiNode = getUpToDateIndividual(blockerIndiNode,calcAlgContext); |
| 3610 |
CIndividualNodeIncrementalExpansionData* incExpData = blockerIndiNode->getIncrementalExpansionData(false); |
| 3611 |
if (!incExpData || (!incExpData->hasDirectlyChangedNeighbourConnection() && !incExpData->isDirectlyChanged() && !incExpData->isPreviousCompletionGraphCompatible())) { |
| 3612 |
CIndividualProcessNode* locBlockerIndiNode = getLocalizedIndividual(blockerIndiNode,false,calcAlgContext); |
| 3613 |
if (establishDirectlyChangedNeighbourConnection(locBlockerIndiNode,propIndiNode,queueIncrementalExpansion,calcAlgContext)) { |
| 3614 |
propagatedDirectlyChanged = true; |
| 3615 |
propNodeList.append(locBlockerIndiNode); |
| 3616 |
} |
| 3617 |
} |
| 3618 |
} |
| 3619 |
CIndividualProcessNode* followingIndiNode = propIndiNode->getFollowingIndividualNode(); |
| 3620 |
if (followingIndiNode) { |
| 3621 |
followingIndiNode = getUpToDateIndividual(followingIndiNode,calcAlgContext); |
| 3622 |
CIndividualNodeIncrementalExpansionData* incExpData = followingIndiNode->getIncrementalExpansionData(false); |
| 3623 |
if (!incExpData || (!incExpData->hasDirectlyChangedNeighbourConnection() && !incExpData->isDirectlyChanged() && !incExpData->isPreviousCompletionGraphCompatible())) { |
| 3624 |
CIndividualProcessNode* locFollowingIndiNode = getLocalizedIndividual(followingIndiNode,false,calcAlgContext); |
| 3625 |
if (establishDirectlyChangedNeighbourConnection(locFollowingIndiNode,propIndiNode,queueIncrementalExpansion,calcAlgContext)) { |
| 3626 |
propagatedDirectlyChanged = true; |
| 3627 |
propNodeList.append(locFollowingIndiNode); |
| 3628 |
} |
| 3629 |
} |
| 3630 |
} |
| 3631 |
} |
| 3632 |
} |
| 3633 |
return propagatedDirectlyChanged; |
| 3634 |
} |
| 3635 |
|
| 3636 |
|
| 3637 |
|
| 3638 |
|
| 3639 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::searchDirectlyChangedNeighbourNodeConnection(CIndividualProcessNode* individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3640 |
CSuccessorIterator succIt(individualNode->getSuccessorIterator()); |
| 3641 |
while (succIt.hasNext()) { |
| 3642 |
CIndividualLinkEdge* succLink = succIt.nextLink(); |
| 3643 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(individualNode,succLink,calcAlgContext); |
| 3644 |
CIndividualNodeIncrementalExpansionData* incExpData = succIndi->getIncrementalExpansionData(false); |
| 3645 |
if (incExpData && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3646 |
return succIndi; |
| 3647 |
} |
| 3648 |
} |
| 3649 |
CConnectionSuccessorSetIterator connIt(individualNode->getConnectionSuccessorIterator()); |
| 3650 |
while (connIt.hasNext()) { |
| 3651 |
cint64 connID = connIt.next(); |
| 3652 |
CIndividualProcessNode* connIndiNode = getUpToDateIndividual(connID,calcAlgContext); |
| 3653 |
CIndividualNodeIncrementalExpansionData* incExpData = connIndiNode->getIncrementalExpansionData(false); |
| 3654 |
if (incExpData && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3655 |
return connIndiNode; |
| 3656 |
} |
| 3657 |
} |
| 3658 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 3659 |
for (CXLinker<CIndividualProcessNode*>* blockedNodeLinkerIt = individualNode->getBlockedIndividualsLinker(); blockedNodeLinkerIt; blockedNodeLinkerIt = blockedNodeLinkerIt->getNext()) { |
| 3660 |
CIndividualProcessNode* blockedIndiNode = getUpToDateIndividual(blockedNodeLinkerIt->getData(),calcAlgContext); |
| 3661 |
CIndividualNodeIncrementalExpansionData* incExpData = blockedIndiNode->getIncrementalExpansionData(false); |
| 3662 |
if (incExpData && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3663 |
return blockedIndiNode; |
| 3664 |
} |
| 3665 |
} |
| 3666 |
for (CXLinker<CIndividualProcessNode*>* blockedNodeLinkerIt = individualNode->getProcessingBlockedIndividualsLinker(); blockedNodeLinkerIt; blockedNodeLinkerIt = blockedNodeLinkerIt->getNext()) { |
| 3667 |
CIndividualProcessNode* blockedIndiNode = getUpToDateIndividual(blockedNodeLinkerIt->getData(),calcAlgContext); |
| 3668 |
CIndividualNodeIncrementalExpansionData* incExpData = blockedIndiNode->getIncrementalExpansionData(false); |
| 3669 |
if (incExpData && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3670 |
return blockedIndiNode; |
| 3671 |
} |
| 3672 |
} |
| 3673 |
CBlockingFollowSet* followSet = individualNode->getBlockingFollowSet(false); |
| 3674 |
if (followSet) { |
| 3675 |
for (CBlockingFollowSet::const_iterator it = followSet->constBegin(), itEnd = followSet->constEnd(); it != itEnd; ++it) { |
| 3676 |
cint64 blockedIndiNodeID = *it; |
| 3677 |
CIndividualProcessNode* blockedIndiNode = getUpToDateIndividual(blockedIndiNodeID,calcAlgContext); |
| 3678 |
CIndividualNodeIncrementalExpansionData* incExpData = blockedIndiNode->getIncrementalExpansionData(false); |
| 3679 |
if (incExpData && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3680 |
return blockedIndiNode; |
| 3681 |
} |
| 3682 |
} |
| 3683 |
} |
| 3684 |
CIndividualProcessNode* blockerIndiNode = individualNode->getBlockerIndividualNode(); |
| 3685 |
if (blockerIndiNode) { |
| 3686 |
blockerIndiNode = getUpToDateIndividual(blockerIndiNode,calcAlgContext); |
| 3687 |
CIndividualNodeIncrementalExpansionData* incExpData = blockerIndiNode->getIncrementalExpansionData(false); |
| 3688 |
if (incExpData && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3689 |
return blockerIndiNode; |
| 3690 |
} |
| 3691 |
} |
| 3692 |
CIndividualProcessNode* followingIndiNode = individualNode->getFollowingIndividualNode(); |
| 3693 |
if (followingIndiNode) { |
| 3694 |
followingIndiNode = getUpToDateIndividual(followingIndiNode,calcAlgContext); |
| 3695 |
CIndividualNodeIncrementalExpansionData* incExpData = followingIndiNode->getIncrementalExpansionData(false); |
| 3696 |
if (incExpData && (incExpData->hasDirectlyChangedNeighbourConnection() || incExpData->isDirectlyChanged())) { |
| 3697 |
return followingIndiNode; |
| 3698 |
} |
| 3699 |
} |
| 3700 |
} |
| 3701 |
return nullptr; |
| 3702 |
} |
| 3703 |
|
| 3704 |
|
| 3705 |
|
| 3706 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::clearDirectlyChangedNeighbourConnection(CIndividualProcessNode* individualNode, bool queueCompatibilityChecks, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3707 |
CIndividualNodeIncrementalExpansionData* incExpData = individualNode->getIncrementalExpansionData(false); |
| 3708 |
if (incExpData && incExpData->hasDirectlyChangedNeighbourConnection()) { |
| 3709 |
CIndividualNodeIncrementalExpansionData* locIncExpData = individualNode->getIncrementalExpansionData(true); |
| 3710 |
locIncExpData->setDirectlyChangedNeighbourConnectionNode(nullptr); |
| 3711 |
if (queueCompatibilityChecks && individualNode->isNominalIndividualNode()) { |
| 3712 |
calcAlgContext->getUsedProcessingDataBox()->getIncrementalCompatibilityCheckingQueue(true)->insertProcessIndiviudal(individualNode); |
| 3713 |
} |
| 3714 |
clearPropagatedDirectlyChangedNeighbourConnection(individualNode,true,calcAlgContext); |
| 3715 |
return true; |
| 3716 |
} |
| 3717 |
return false; |
| 3718 |
} |
| 3719 |
|
| 3720 |
|
| 3721 |
|
| 3722 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::clearPropagatedDirectlyChangedNeighbourConnection(CIndividualProcessNode* individualNode, bool queueCompatibilityChecks, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3723 |
bool propCleared = false; |
| 3724 |
CIndividualNodeIncrementalExpansionData* incExpData = individualNode->getIncrementalExpansionData(false); |
| 3725 |
if (incExpData && incExpData->hasNeighbourPropagatedDirectlyChanged()) { |
| 3726 |
CPROCESSINGLIST<CIndividualProcessNode*> clearPropNodeList(calcAlgContext->getUsedTaskProcessorContext()); |
| 3727 |
clearPropNodeList.append(individualNode); |
| 3728 |
while (!clearPropNodeList.isEmpty()) { |
| 3729 |
CIndividualProcessNode* clearPropIndiNode = clearPropNodeList.takeFirst(); |
| 3730 |
CIndividualNodeIncrementalExpansionData* clearIncExpData = clearPropIndiNode->getIncrementalExpansionData(false); |
| 3731 |
|
| 3732 |
CPROCESSLIST<CIndividualProcessNode*>* propIndiNodeList = clearIncExpData->getNeighbourPropagatedDirectlyChangedList(false); |
| 3733 |
if (propIndiNodeList && !propIndiNodeList->isEmpty()) { |
| 3734 |
clearIncExpData = clearPropIndiNode->getIncrementalExpansionData(true); |
| 3735 |
propIndiNodeList = clearIncExpData->getNeighbourPropagatedDirectlyChangedList(true); |
| 3736 |
|
| 3737 |
for (CPROCESSLIST<CIndividualProcessNode*>::const_iterator it = propIndiNodeList->constBegin(), itEnd = propIndiNodeList->constEnd(); it != itEnd; ++it) { |
| 3738 |
CIndividualProcessNode* propNode(*it); |
| 3739 |
propNode = getUpToDateIndividual(propNode,calcAlgContext); |
| 3740 |
CIndividualNodeIncrementalExpansionData* propIncExpData = propNode->getIncrementalExpansionData(false); |
| 3741 |
if (propIncExpData && propIncExpData->hasDirectlyChangedNeighbourConnection()) { |
| 3742 |
if (propIncExpData->getDirectlyChangedNeighbourConnectionNode()->getIndividualNodeID() == clearPropIndiNode->getIndividualNodeID()) { |
| 3743 |
propCleared = true; |
| 3744 |
propNode = getLocalizedIndividual(propNode,false,calcAlgContext); |
| 3745 |
propIncExpData = propNode->getIncrementalExpansionData(true); |
| 3746 |
propIncExpData->setDirectlyChangedNeighbourConnectionNode(nullptr); |
| 3747 |
if (propIncExpData->hasNeighbourPropagatedDirectlyChanged()) { |
| 3748 |
clearPropNodeList.append(propNode); |
| 3749 |
} |
| 3750 |
if (queueCompatibilityChecks && individualNode->isNominalIndividualNode()) { |
| 3751 |
calcAlgContext->getUsedProcessingDataBox()->getIncrementalCompatibilityCheckingQueue(true)->insertProcessIndiviudal(individualNode); |
| 3752 |
} |
| 3753 |
} |
| 3754 |
} |
| 3755 |
} |
| 3756 |
clearIncExpData->clearNeighbourPropagatedDirectlyChangedList(); |
| 3757 |
} |
| 3758 |
} |
| 3759 |
} |
| 3760 |
return false; |
| 3761 |
} |
| 3762 |
|
| 3763 |
|
| 3764 |
|
| 3765 |
|
| 3766 |
|
| 3767 |
|
| 3768 |
|
| 3769 |
|
| 3770 |
|
| 3771 |
|
| 3772 |
|
| 3773 |
|
| 3774 |
|
| 3775 |
|
| 3776 |
|
| 3777 |
|
| 3778 |
|
| 3779 |
|
| 3780 |
|
| 3781 |
|
| 3782 |
|
| 3783 |
|
| 3784 |
|
| 3785 |
|
| 3786 |
|
| 3787 |
|
| 3788 |
|
| 3789 |
|
| 3790 |
|
| 3791 |
|
| 3792 |
|
| 3793 |
|
| 3794 |
|
| 3795 |
|
| 3796 |
|
| 3797 |
|
| 3798 |
|
| 3799 |
|
| 3800 |
|
| 3801 |
|
| 3802 |
|
| 3803 |
|
| 3804 |
|
| 3805 |
|
| 3806 |
|
| 3807 |
|
| 3808 |
|
| 3809 |
|
| 3810 |
|
| 3811 |
|
| 3812 |
|
| 3813 |
|
| 3814 |
|
| 3815 |
|
| 3816 |
|
| 3817 |
|
| 3818 |
|
| 3819 |
|
| 3820 |
|
| 3821 |
|
| 3822 |
|
| 3823 |
|
| 3824 |
|
| 3825 |
|
| 3826 |
|
| 3827 |
|
| 3828 |
|
| 3829 |
|
| 3830 |
|
| 3831 |
|
| 3832 |
|
| 3833 |
|
| 3834 |
|
| 3835 |
|
| 3836 |
|
| 3837 |
|
| 3838 |
|
| 3839 |
|
| 3840 |
|
| 3841 |
|
| 3842 |
|
| 3843 |
|
| 3844 |
|
| 3845 |
|
| 3846 |
|
| 3847 |
|
| 3848 |
|
| 3849 |
|
| 3850 |
|
| 3851 |
|
| 3852 |
|
| 3853 |
|
| 3854 |
|
| 3855 |
|
| 3856 |
|
| 3857 |
|
| 3858 |
|
| 3859 |
|
| 3860 |
|
| 3861 |
|
| 3862 |
|
| 3863 |
|
| 3864 |
|
| 3865 |
|
| 3866 |
|
| 3867 |
|
| 3868 |
|
| 3869 |
|
| 3870 |
|
| 3871 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::trackIndividualReferredDependence(cint64 indiID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3872 |
return trackIndividualDependence(indiID,true,false,calcAlgContext); |
| 3873 |
} |
| 3874 |
|
| 3875 |
|
| 3876 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::trackIndividualExtendedDependence(cint64 indiID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3877 |
return trackIndividualDependence(indiID,false,true,calcAlgContext); |
| 3878 |
} |
| 3879 |
|
| 3880 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::trackIndividualDependence(cint64 indiID, bool indiReferred, bool indiExtended, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3881 |
if (calcAlgContext->getUsedProcessingDataBox()->isIndividualDependenceTrackingRequired()) { |
| 3882 |
CReferredIndividualTrackingVector* indiTrackVec = calcAlgContext->getUsedProcessingDataBox()->getReferredIndividualTrackingVector(); |
| 3883 |
if (!indiTrackVec) { |
| 3884 |
CSatisfiableCalculationTask* satCalcTask = calcAlgContext->getSatisfiableCalculationTask(); |
| 3885 |
CSatisfiableTaskIndividualDependenceTrackingAdapter* indiDepTrackAdapter = satCalcTask->getSatisfiableTaskIndividualDependenceTrackingAdapter(); |
| 3886 |
if (indiDepTrackAdapter) { |
| 3887 |
CIndividualDependenceTrackingMarker* indiDepTrackMarker = indiDepTrackAdapter->getIndividualDependenceTrackingMarker(); |
| 3888 |
if (indiDepTrackMarker) { |
| 3889 |
indiDepTrackMarker->setIndividualDependenceTracked(); |
| 3890 |
} |
| 3891 |
CIndividualDependenceTrackingObserver* indDepTrackObserver = indiDepTrackAdapter->getIndividualDependenceTrackingObserver(); |
| 3892 |
if (indDepTrackObserver) { |
| 3893 |
CIndividualDependenceTracking* extendingIndiDepTrack = indDepTrackObserver->getExtendingIndividualDependenceTracking(); |
| 3894 |
CReferredIndividualTrackingVector* extendingRefIndiTrackVec = nullptr; |
| 3895 |
if (extendingIndiDepTrack) { |
| 3896 |
extendingRefIndiTrackVec = dynamic_cast<CReferredIndividualTrackingVector*>(extendingIndiDepTrack); |
| 3897 |
} |
| 3898 |
if (!extendingRefIndiTrackVec) { |
| 3899 |
cint64 aboxIndiCount = calcAlgContext->getProcessingDataBox()->getOntology()->getABox()->getIndividualCount(); |
| 3900 |
cint64 trackIndiCount = aboxIndiCount; |
| 3901 |
CConsistenceData* consData = calcAlgContext->getProcessingDataBox()->getOntology()->getConsistence()->getConsistenceModelData(); |
| 3902 |
if (consData) { |
| 3903 |
CConsistenceTaskData* consTaskData = dynamic_cast<CConsistenceTaskData*>(consData); |
| 3904 |
if (consTaskData) { |
| 3905 |
CSatisfiableCalculationTask* cachedSatTask = consTaskData->getDeterministicSatisfiableTask(); |
| 3906 |
if (cachedSatTask) { |
| 3907 |
trackIndiCount = qMax(trackIndiCount,cachedSatTask->getProcessingDataBox()->getIndividualProcessNodeVector()->getItemCount()); |
| 3908 |
} |
| 3909 |
} |
| 3910 |
} |
| 3911 |
extendingRefIndiTrackVec = new CReferredIndividualTrackingVector(); |
| 3912 |
extendingRefIndiTrackVec->initReferredIndividualTrackingVector(trackIndiCount,aboxIndiCount); |
| 3913 |
|
| 3914 |
indiTrackVec = dynamic_cast<CReferredIndividualTrackingVector*>(indDepTrackObserver->installIndividualDependenceTracking(extendingRefIndiTrackVec)); |
| 3915 |
} else { |
| 3916 |
indiTrackVec = extendingRefIndiTrackVec; |
| 3917 |
} |
| 3918 |
|
| 3919 |
satCalcTask->getProcessingDataBox()->setReferredIndividualTrackingVector(indiTrackVec); |
| 3920 |
} |
| 3921 |
} |
| 3922 |
} |
| 3923 |
|
| 3924 |
if (indiTrackVec) { |
| 3925 |
|
| 3926 |
//CIndividualProcessNode* indiNode = calcAlgContext->getUsedProcessingDataBox()->getIndividualProcessNodeVector()->getData(indiID); |
| 3927 |
//if (indiNode->getNominalIndividual()) { |
| 3928 |
// if (!indiNode->getNominalIndividual()->getIndividualNominalConcept()) { |
| 3929 |
// bool bug = true; |
| 3930 |
// } |
| 3931 |
// if (CIRIName::getRecentIRIName(indiNode->getNominalIndividual()->getIndividualNameLinker()) == "http://www.Department17.University0.edu/SystemsStaff12") { |
| 3932 |
// bool bug = true; |
| 3933 |
// } |
| 3934 |
//} |
| 3935 |
|
| 3936 |
if (indiExtended) { |
| 3937 |
indiTrackVec->setIndividualReferredAndExtended(-indiID); |
| 3938 |
} else if (indiReferred) { |
| 3939 |
indiTrackVec->setIndividualReferred(-indiID); |
| 3940 |
} |
| 3941 |
return true; |
| 3942 |
} |
| 3943 |
} |
| 3944 |
return false; |
| 3945 |
} |
| 3946 |
|
| 3947 |
|
| 3948 |
|
| 3949 |
|
| 3950 |
|
| 3951 |
|
| 3952 |
|
| 3953 |
|
| 3954 |
|
| 3955 |
|
| 3956 |
|
| 3957 |
|
| 3958 |
|
| 3959 |
|
| 3960 |
|
| 3961 |
|
| 3962 |
|
| 3963 |
|
| 3964 |
|
| 3965 |
|
| 3966 |
|
| 3967 |
|
| 3968 |
|
| 3969 |
|
| 3970 |
|
| 3971 |
|
| 3972 |
|
| 3973 |
|
| 3974 |
|
| 3975 |
|
| 3976 |
|
| 3977 |
|
| 3978 |
|
| 3979 |
|
| 3980 |
|
| 3981 |
|
| 3982 |
|
| 3983 |
|
| 3984 |
|
| 3985 |
|
| 3986 |
|
| 3987 |
|
| 3988 |
|
| 3989 |
|
| 3990 |
|
| 3991 |
|
| 3992 |
|
| 3993 |
|
| 3994 |
|
| 3995 |
|
| 3996 |
|
| 3997 |
|
| 3998 |
|
| 3999 |
|
| 4000 |
|
| 4001 |
|
| 4002 |
|
| 4003 |
|
| 4004 |
|
| 4005 |
|
| 4006 |
|
| 4007 |
|
| 4008 |
|
| 4009 |
|
| 4010 |
|
| 4011 |
|
| 4012 |
|
| 4013 |
|
| 4014 |
|
| 4015 |
|
| 4016 |
|
| 4017 |
|
| 4018 |
|
| 4019 |
|
| 4020 |
|
| 4021 |
|
| 4022 |
|
| 4023 |
|
| 4024 |
|
| 4025 |
|
| 4026 |
|
| 4027 |
|
| 4028 |
|
| 4029 |
|
| 4030 |
|
| 4031 |
|
| 4032 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isConceptFromPredecessorDependent(CIndividualProcessNode*& individualNode, CConceptDescriptor* conDes, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4033 |
cint64 ancDepth = individualNode->getIndividualAncestorDepth(); |
| 4034 |
bool dependencyToAncestor = false; |
| 4035 |
CDependencyNode* depNode = depTrackPoint->getDependencyNode(); |
| 4036 |
if (depTrackPoint->isPointingToIndependentDependencyNode()) { |
| 4037 |
dependencyToAncestor = true; |
| 4038 |
} else if (depNode->hasAppropriateIndividualNode()) { |
| 4039 |
CIndividualProcessNode* appIndiNode = depNode->getAppropriateIndividualNode(); |
| 4040 |
cint64 appIndiAncDepth = appIndiNode->getIndividualAncestorDepth(); |
| 4041 |
if (appIndiAncDepth < ancDepth) { |
| 4042 |
dependencyToAncestor = true; |
| 4043 |
} |
| 4044 |
} |
| 4045 |
return dependencyToAncestor; |
| 4046 |
} |
| 4047 |
|
| 4048 |
|
| 4049 |
void CCalculationTableauCompletionTaskHandleAlgorithm::testCompletionGraphCachingAndBlocking(CCalculationAlgorithmContextBase* calcAlgContext, CIndividualProcessNode* exceptIndividualNode) { |
| 4050 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 4051 |
CIndividualProcessNodeVector* indiNodeVec = processingDataBox->getIndividualProcessNodeVector(); |
| 4052 |
cint64 indiCount = indiNodeVec->getItemCount(); |
| 4053 |
cint64 indiStart = indiNodeVec->getItemMinIndex(); |
| 4054 |
for (cint64 indiIdx = indiStart; indiIdx < indiCount; ++indiIdx) { |
| 4055 |
CIndividualProcessNode* indiNode = getLocalizedIndividual(indiIdx,calcAlgContext); |
| 4056 |
if (indiNode && indiNode != exceptIndividualNode) { |
| 4057 |
CConceptProcessingQueue* conProQue = indiNode->getConceptProcessingQueue(false); |
| 4058 |
if (conProQue) { |
| 4059 |
if (!conProQue->isEmpty()) { |
| 4060 |
if (!indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED | CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFINDIRECTBLOCKED | CIndividualProcessNode::PRFPURGEDBLOCKED | CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFDIRECTBLOCKED) ) { |
| 4061 |
if (!indiNode->isImmediatelyProcessingQueued() && !indiNode->isBlockedReactivationProcessingQueued() && !indiNode->isDeterministicExpandingProcessingQueued() && !indiNode->isRegularDepthProcessingQueued() && !indiNode->isProcessingQueued()) { |
| 4062 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 4063 |
QFile file(QString("caching-error.txt")); |
| 4064 |
if (file.open(QIODevice::WriteOnly)) { |
| 4065 |
file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 4066 |
file.close(); |
| 4067 |
} |
| 4068 |
bool bug = true; |
| 4069 |
} |
| 4070 |
} |
| 4071 |
|
| 4072 |
if (indiNode->getIndividualNodeID() <= calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID() && indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED)) { |
| 4073 |
if (!indiNode->isImmediatelyProcessingQueued() && !indiNode->isBlockedReactivationProcessingQueued() && !indiNode->isDeterministicExpandingProcessingQueued() && !indiNode->isRegularDepthProcessingQueued() && !indiNode->isProcessingQueued() && !calcAlgContext->getProcessingDataBox()->getEarlyIndividualReactivationProcessingQueue(false)->hasQueuedIndividual(indiNode) && !calcAlgContext->getProcessingDataBox()->getLateIndividualReactivationProcessingQueue(false)->hasQueuedIndividual(indiNode)) { |
| 4074 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 4075 |
QFile file(QString("caching-error.txt")); |
| 4076 |
if (file.open(QIODevice::WriteOnly)) { |
| 4077 |
file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 4078 |
file.close(); |
| 4079 |
} |
| 4080 |
bool bug = true; |
| 4081 |
} |
| 4082 |
} |
| 4083 |
} |
| 4084 |
} |
| 4085 |
if (indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED)) { |
| 4086 |
CIndividualProcessNode* ancNode = getAncestorIndividual(indiNode,calcAlgContext); |
| 4087 |
if (!ancNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED | CIndividualProcessNode::PRFSATISFIABLECACHED)) { |
| 4088 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 4089 |
bool bug = true; |
| 4090 |
} |
| 4091 |
} |
| 4092 |
} |
| 4093 |
} |
| 4094 |
} |
| 4095 |
|
| 4096 |
|
| 4097 |
void CCalculationTableauCompletionTaskHandleAlgorithm::analyzeABoxCompressionPossibilities(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4098 |
CProcessingDataBox* dataBox = calcAlgContext->getProcessingDataBox(); |
| 4099 |
CIndividualProcessNodeVector* indiProVec = dataBox->getIndividualProcessNodeVector(); |
| 4100 |
|
| 4101 |
QHash<cint64,cint64> signatureCountHash; |
| 4102 |
QHash<cint64,cint64> signatureLabelSizeHash; |
| 4103 |
QHash<cint64,bool> signatureNonDetHash; |
| 4104 |
QHash<cint64,cint64> signatureFirstIndiNodeHash; |
| 4105 |
|
| 4106 |
cint64 indiCount = indiProVec->getItemCount(); |
| 4107 |
cint64 indiStart = indiProVec->getItemMinIndex(); |
| 4108 |
cint64 nonDetCount = 0; |
| 4109 |
for (cint64 indiID = indiStart; indiID < indiCount; ++indiID) { |
| 4110 |
CIndividualProcessNode* indiNode = indiProVec->getData(indiID); |
| 4111 |
if (indiNode->isNominalIndividualNode()) { |
| 4112 |
CIndividual* indiNominal = indiNode->getNominalIndividual(); |
| 4113 |
CConcept* nominalConcept = indiNominal->getIndividualNominalConcept(); |
| 4114 |
CConceptSetSignature conSetSignature; |
| 4115 |
bool nonDet = false; |
| 4116 |
CReapplyConceptLabelSet* labelSet = indiNode->getReapplyConceptLabelSet(false); |
| 4117 |
if (labelSet) { |
| 4118 |
for (CConceptDescriptor* conDesIt = labelSet->getAddingSortedConceptDescriptionLinker(); conDesIt; conDesIt = conDesIt->getNextConceptDesciptor()) { |
| 4119 |
CConcept* concept = conDesIt->getConcept(); |
| 4120 |
bool conNegation = conDesIt->isNegated(); |
| 4121 |
if (conDesIt->getDependencyTrackPoint()->getBranchingTag() > 0) { |
| 4122 |
nonDet = true; |
| 4123 |
} |
| 4124 |
if (concept != nominalConcept) { |
| 4125 |
conSetSignature.addConceptSignature(concept,conNegation); |
| 4126 |
} |
| 4127 |
} |
| 4128 |
cint64 signature = conSetSignature.getSignatureValue(); |
| 4129 |
cint64& sigCount = signatureCountHash[signature]; |
| 4130 |
++sigCount; |
| 4131 |
if (sigCount <= 1) { |
| 4132 |
signatureLabelSizeHash[signature] = labelSet->getConceptCount(); |
| 4133 |
signatureNonDetHash[signature] = nonDet; |
| 4134 |
if (nonDet) { |
| 4135 |
++nonDetCount; |
| 4136 |
} |
| 4137 |
signatureFirstIndiNodeHash[signature] = indiNode->getIndividualNodeID(); |
| 4138 |
} |
| 4139 |
} |
| 4140 |
} |
| 4141 |
} |
| 4142 |
|
| 4143 |
cout<<"\nNumber of signatures: "<<signatureCountHash.size()<<"\n"; |
| 4144 |
for (QHash<cint64,cint64>::const_iterator it = signatureCountHash.constBegin(), itEnd = signatureCountHash.constEnd(); it != itEnd; ++it) { |
| 4145 |
cint64 signature = it.key(); |
| 4146 |
cint64 sigCount = it.value(); |
| 4147 |
bool nonDet = signatureNonDetHash[signature]; |
| 4148 |
cint64 labelSize = signatureLabelSizeHash[signature]; |
| 4149 |
cout<<"Count: "<<sigCount<<" \tSize: "<<labelSize<<" \tSignature: "<<signature; |
| 4150 |
if (nonDet) { |
| 4151 |
cout<<" (n)"; |
| 4152 |
} else { |
| 4153 |
cout<<" (d)"; |
| 4154 |
} |
| 4155 |
cout<<"\t IndiID: "<<signatureFirstIndiNodeHash[signature]<<"\n"; |
| 4156 |
cout<<"\n"; |
| 4157 |
} |
| 4158 |
signatureCountHash.clear(); |
| 4159 |
} |
| 4160 |
|
| 4161 |
|
| 4162 |
|
| 4163 |
void CCalculationTableauCompletionTaskHandleAlgorithm::analyzeBranchingMemoryWasting(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4164 |
CProcessingDataBox* dataBox = calcAlgContext->getProcessingDataBox(); |
| 4165 |
CIndividualProcessNodeVector* indiProVec = dataBox->getIndividualProcessNodeVector(); |
| 4166 |
|
| 4167 |
cint64 allocatedMemory = 0; |
| 4168 |
cint64 usedMemory = 0; |
| 4169 |
cint64 wastedMemory = 0; |
| 4170 |
CSatisfiableCalculationTask* satTask = calcAlgContext->getSatisfiableCalculationTask(); |
| 4171 |
while (satTask) { |
| 4172 |
CMemoryPool* memoryPool = satTask->getMemoryPools(); |
| 4173 |
while (memoryPool) { |
| 4174 |
allocatedMemory += memoryPool->getMemoryBlockSize(); |
| 4175 |
|
| 4176 |
char* memBlockEnd = memoryPool->getMemoryBlockEnd(); |
| 4177 |
char* memBlockPointer = memoryPool->getMemoryBlockPointer(); |
| 4178 |
char* memBlockBegin = memoryPool->getMemoryBlockData(); |
| 4179 |
|
| 4180 |
usedMemory += (memBlockPointer - memBlockBegin); |
| 4181 |
wastedMemory += (memBlockEnd - memBlockPointer); |
| 4182 |
|
| 4183 |
memoryPool = memoryPool->getNext(); |
| 4184 |
} |
| 4185 |
satTask = (CSatisfiableCalculationTask*)satTask->getParentTask(); |
| 4186 |
} |
| 4187 |
|
| 4188 |
cout << "\nTasks memory consumption : " << allocatedMemory << " Bytes, used " << usedMemory << " Bytes, wasted " << wastedMemory << " Bytes\r\n"; |
| 4189 |
|
| 4190 |
} |
| 4191 |
|
| 4192 |
|
| 4193 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodeValidBlocker(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4194 |
if (individualNode->isNominalIndividualNode()) { |
| 4195 |
return false; |
| 4196 |
} |
| 4197 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION)) { |
| 4198 |
return false; |
| 4199 |
} |
| 4200 |
|
| 4201 |
if (calcAlgContext->hasCompletionGraphCachedIndividualNodes() && !individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) && |
| 4202 |
individualNode->getIndividualNodeID() <= calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 4203 |
return false; |
| 4204 |
} |
| 4205 |
return true; |
| 4206 |
} |
| 4207 |
|
| 4208 |
|
| 4209 |
|
| 4210 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodeCompletionGraphCached(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4211 |
detectIndividualNodeCompletionGraphCached(individualNode,calcAlgContext); |
| 4212 |
return false; |
| 4213 |
} |
| 4214 |
|
| 4215 |
|
| 4216 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodeBackendCacheSynchronizationProcessingBlocked(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4217 |
bool wasNeigbourExpansionBlocked = individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED); |
| 4218 |
detectIndividualNodeBackendCacheSynchronized(individualNode,calcAlgContext); |
| 4219 |
if (wasNeigbourExpansionBlocked) { |
| 4220 |
if (!individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED)) { |
| 4221 |
if (individualNode->getReverseAssertionRoleLinker() || individualNode->getAssertionRoleLinker() || individualNode->getAdditionalRoleAssertionsLinker()) { |
| 4222 |
calcAlgContext->getProcessingDataBox()->getRoleAssertionExpansionProcessingQueue(true)->insertIndiviudalProcessNode(individualNode); |
| 4223 |
} |
| 4224 |
} |
| 4225 |
} |
| 4226 |
return individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED); |
| 4227 |
} |
| 4228 |
|
| 4229 |
|
| 4230 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::detectIndividualNodeBackendCacheSynchronized(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4231 |
bool synchronized = false; |
| 4232 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKEND | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED)) { |
| 4233 |
|
| 4234 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTBACKENDSYNCHRONIZATIONDUEDIRECTMODIFIED)) { |
| 4235 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTBACKENDSYNCHRONIZATIONDUEDIRECTMODIFIED); |
| 4236 |
|
| 4237 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKEND)) { |
| 4238 |
if (!testIndividualNodeBackendCacheConceptsSynchronization(individualNode,calcAlgContext)) { |
| 4239 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKEND); |
| 4240 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED); |
| 4241 |
} |
| 4242 |
} |
| 4243 |
|
| 4244 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED)) { |
| 4245 |
if (testIndividualNodeBackendCacheSameMergedBlockingCritical(individualNode, calcAlgContext)) { |
| 4246 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED); |
| 4247 |
} |
| 4248 |
} |
| 4249 |
|
| 4250 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED)) { |
| 4251 |
if (testIndividualNodeBackendCacheNeighbourExpansionBlockingCritical(individualNode, calcAlgContext)) { |
| 4252 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED); |
| 4253 |
} |
| 4254 |
} |
| 4255 |
|
| 4256 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED)) { |
| 4257 |
if (testIndividualNodeBackendCacheExpansionBlockingCriticalCardinality(individualNode, calcAlgContext)) { |
| 4258 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED); |
| 4259 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED); |
| 4260 |
} |
| 4261 |
} |
| 4262 |
|
| 4263 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED)) { |
| 4264 |
if (testIndividualNodeBackendCacheNominalIndirectConnectionBlockingCritical(individualNode, calcAlgContext)) { |
| 4265 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED); |
| 4266 |
} |
| 4267 |
} |
| 4268 |
|
| 4269 |
//TODO: use same condition as indirectly connected individual integration check |
| 4270 |
if (!individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED)) { |
| 4271 |
if (individualNode->isCachingLossNodeReactivationInstalled()) { |
| 4272 |
checkIndividualNodesReactivationDueToNominalCachingLoss(individualNode,calcAlgContext); |
| 4273 |
} |
| 4274 |
} |
| 4275 |
|
| 4276 |
} |
| 4277 |
} |
| 4278 |
synchronized = individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKEND); |
| 4279 |
return synchronized; |
| 4280 |
} |
| 4281 |
|
| 4282 |
|
| 4283 |
|
| 4284 |
void CCalculationTableauCompletionTaskHandleAlgorithm::clearCompletionGraphCaching(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4285 |
|
| 4286 |
trackIndividualExtendedDependence(individualNode->getIndividualNodeID(), calcAlgContext); |
| 4287 |
|
| 4288 |
if (mConfCollectCachingUpdatedBlockableIndiNodes && individualNode->isBlockableIndividual()) { |
| 4289 |
CXLinker<CIndividualProcessNode*>* updatedCachedIndiNodeLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 4290 |
updatedCachedIndiNodeLinker->initLinker(individualNode); |
| 4291 |
calcAlgContext->getUsedProcessingDataBox()->addBlockableIndividualNodeUpdatedLinker(updatedCachedIndiNodeLinker); |
| 4292 |
} |
| 4293 |
|
| 4294 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED)) { |
| 4295 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED); |
| 4296 |
reapplySatisfiableCachedAbsorbedDisjunctionConcepts(individualNode, calcAlgContext); |
| 4297 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(individualNode, calcAlgContext); |
| 4298 |
} |
| 4299 |
individualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED); |
| 4300 |
|
| 4301 |
if (individualNode->isCachingLossNodeReactivationInstalled()) { |
| 4302 |
checkIndividualNodesReactivationDueToNominalCachingLoss(individualNode, calcAlgContext); |
| 4303 |
} |
| 4304 |
|
| 4305 |
|
| 4306 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 4307 |
CIndividualReactivationProcessingQueue* reactProcQueue = nullptr; |
| 4308 |
if (mConfDelayCompletionGraphCachingReactivation) { |
| 4309 |
reactProcQueue = processingDataBox->getLateIndividualReactivationProcessingQueue(true); |
| 4310 |
} else { |
| 4311 |
reactProcQueue = processingDataBox->getEarlyIndividualReactivationProcessingQueue(true); |
| 4312 |
} |
| 4313 |
bool reactivatedIndis = mCompGraphCacheHandler->getReactivationIndividuals(individualNode, reactProcQueue, calcAlgContext); |
| 4314 |
} |
| 4315 |
|
| 4316 |
|
| 4317 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::detectIndividualNodeCompletionGraphCached(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4318 |
bool indiNodeCompGraphCached = false; |
| 4319 |
if (mCompGraphCacheHandler && mConfCompletionGraphCaching) { |
| 4320 |
if (!individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) && individualNode->getIndividualNodeID() <= calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 4321 |
individualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHEDNODELOCATED); |
| 4322 |
|
| 4323 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTCOMPLETIONGRAPHCACHEDDUEDIRECTMODIFIED)) { |
| 4324 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTCOMPLETIONGRAPHCACHEDDUEDIRECTMODIFIED); |
| 4325 |
} |
| 4326 |
|
| 4327 |
if (!individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALID | CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING)) { |
| 4328 |
bool conceptSetExtended = false; |
| 4329 |
indiNodeCompGraphCached = mCompGraphCacheHandler->isIndividualNodeCompletionGraphConsistenceBlocked(individualNode,conceptSetExtended,calcAlgContext); |
| 4330 |
if (conceptSetExtended) { |
| 4331 |
individualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHEDNODEEXTENDED); |
| 4332 |
} |
| 4333 |
} |
| 4334 |
if (!indiNodeCompGraphCached) { |
| 4335 |
|
| 4336 |
clearCompletionGraphCaching(individualNode, calcAlgContext); |
| 4337 |
|
| 4338 |
} else { |
| 4339 |
individualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED); |
| 4340 |
} |
| 4341 |
} |
| 4342 |
} |
| 4343 |
return indiNodeCompGraphCached; |
| 4344 |
} |
| 4345 |
|
| 4346 |
|
| 4347 |
|
| 4348 |
|
| 4349 |
|
| 4350 |
void CCalculationTableauCompletionTaskHandleAlgorithm::commitCacheMessages(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4351 |
CSatisfiableExpanderCacheHandler* satExpHandler = calcAlgContext->getUsedSatisfiableExpanderCacheHandler(); |
| 4352 |
if (satExpHandler) { |
| 4353 |
satExpHandler->commitCacheMessages(calcAlgContext); |
| 4354 |
} |
| 4355 |
CSaturationNodeExpansionCacheHandler* satNodeExpHandler = calcAlgContext->getUsedSaturationNodeExpansionCacheHandler(); |
| 4356 |
if (satNodeExpHandler) { |
| 4357 |
satNodeExpHandler->commitCacheMessages(calcAlgContext); |
| 4358 |
} |
| 4359 |
} |
| 4360 |
|
| 4361 |
|
| 4362 |
|
| 4363 |
void CCalculationTableauCompletionTaskHandleAlgorithm::testIndividualNodeUnsatisfiableCached(CIndividualProcessNode* individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4364 |
if (mConfTestOccurUnsatCached) { |
| 4365 |
cint64 conSetSize = 0; |
| 4366 |
if (mLastUnsatCacheTestedIndiNode != individualNode && (conSetSize = individualNode->getReapplyConceptLabelSet(false)->getConceptCount()) != mLastUnsatCacheTestedIndiNodeConceptSetSize) { |
| 4367 |
CUnsatisfiableCacheHandler* unsatCacheHandler = calcAlgContext->getUsedUnsatisfiableCacheHandler(); |
| 4368 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 4369 |
|
| 4370 |
if (unsatCacheHandler) { |
| 4371 |
KONCLUCE_TASK_ALGORITHM_TIME_MEASURE_INSTRUCTION(mUnsatCacheRetrieval.start()); |
| 4372 |
bool unsatCached = unsatCacheHandler->isIndividualNodeUnsatisfiableCached(individualNode,clashDescriptors,calcAlgContext); |
| 4373 |
KONCLUCE_TASK_ALGORITHM_TIME_MEASURE_INSTRUCTION( |
| 4374 |
cint64 timeElapsed = mUnsatCacheRetrieval.elapsed(); |
| 4375 |
STATINCM(TIMEUNSATCACHERETRIVAL,timeElapsed,calcAlgContext); |
| 4376 |
); |
| 4377 |
|
| 4378 |
if (unsatCached) { |
| 4379 |
if (!mConfUnsatCachingUseNodeSignatureSet || mUnsatCachingSignatureSet.contains(individualNode->getReapplyConceptLabelSet(false)->getConceptSignatureValue())) { |
| 4380 |
if (mConfUnsatCachingUseFullNodeDependency) { |
| 4381 |
clashDescriptors = createClashedIndividualNodeDescriptor(nullptr,individualNode,calcAlgContext); |
| 4382 |
} |
| 4383 |
STATINC(UNSATCACHEUSEDCOUNT,calcAlgContext); |
| 4384 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 4385 |
} |
| 4386 |
} |
| 4387 |
} |
| 4388 |
mLastUnsatCacheTestedIndiNode = individualNode; |
| 4389 |
mLastUnsatCacheTestedIndiNodeConceptSetSize = conSetSize; |
| 4390 |
} |
| 4391 |
} |
| 4392 |
} |
| 4393 |
|
| 4394 |
|
| 4395 |
CClashedDependencyDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createClashedIndividualNodeDescriptor(CClashedDependencyDescriptor* prevClashes, CIndividualProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4396 |
CClashedDependencyDescriptor* clashDes = prevClashes; |
| 4397 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 4398 |
CConceptDescriptor* conDesIt = conSet->getAddingSortedConceptDescriptionLinker(); |
| 4399 |
while (conDesIt) { |
| 4400 |
CConceptDescriptor* conDes = conDesIt; |
| 4401 |
clashDes = createClashedConceptDescriptor(clashDes,processIndi,conDes,conDes->getDependencyTrackPoint(),calcAlgContext); |
| 4402 |
conDesIt = conDesIt->getNext(); |
| 4403 |
} |
| 4404 |
return clashDes; |
| 4405 |
} |
| 4406 |
|
| 4407 |
|
| 4408 |
void CCalculationTableauCompletionTaskHandleAlgorithm::testProblematicConceptSet(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4409 |
if (true) { |
| 4410 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 4411 |
CIndividualProcessNodeVector* indiNodeVec = processingDataBox->getIndividualProcessNodeVector(); |
| 4412 |
cint64 indiCount = indiNodeVec->getItemCount(); |
| 4413 |
cint64 indiIdx = 0; |
| 4414 |
for (; indiIdx < indiCount; ++indiIdx) { |
| 4415 |
CIndividualProcessNode* indiNode = getUpToDateIndividual(indiIdx,calcAlgContext); |
| 4416 |
if (indiNode) { |
| 4417 |
if (!indiNode->isNominalIndividualNode()) { |
| 4418 |
if (!indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION | CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 4419 |
if (!calcAlgContext->hasCompletionGraphCachedIndividualNodes() || indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || indiNode->getIndividualNodeID() > calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 4420 |
indiNode = getLocalizedIndividual(indiNode,false,calcAlgContext); |
| 4421 |
|
| 4422 |
|
| 4423 |
if (true) { |
| 4424 |
bool base1Con = false; |
| 4425 |
bool base2Con = false; |
| 4426 |
CConceptDescriptor* conDes = indiNode->getReapplyConceptLabelSet(false)->getAddingSortedConceptDescriptionLinker(); |
| 4427 |
for (CConceptDescriptor* conDesIt = conDes; conDesIt; conDesIt = conDesIt->getNext()) { |
| 4428 |
if (!conDesIt->isNegated() && CIRIName::getRecentIRIName(conDesIt->getData()->getClassNameLinker()) == "http://www.w3.org/TR/2003/CR-owl-guide-20030818/food#SweetFruitCourse") { |
| 4429 |
base1Con = true; |
| 4430 |
} |
| 4431 |
if (!conDesIt->isNegated() && CIRIName::getRecentIRIName(conDesIt->getData()->getClassNameLinker()) == "http://www.w3.org/TR/2003/CR-owl-guide-20030818/food#FruitCourse") { |
| 4432 |
base2Con = true; |
| 4433 |
} |
| 4434 |
} |
| 4435 |
if (!base2Con && base1Con) { |
| 4436 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 4437 |
QFile file(QString("caching-error.txt")); |
| 4438 |
if (file.open(QIODevice::WriteOnly)) { |
| 4439 |
file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 4440 |
file.close(); |
| 4441 |
} |
| 4442 |
bool bug = true; |
| 4443 |
} |
| 4444 |
} |
| 4445 |
|
| 4446 |
|
| 4447 |
//QStringList conSetList = generateExtendedDebugConceptSetStringList(indiNode->getReapplyConceptLabelSet(false),nullptr,nullptr,calcAlgContext); |
| 4448 |
//debugTestCriticalConceptSet(conSetList,calcAlgContext); |
| 4449 |
|
| 4450 |
} |
| 4451 |
} |
| 4452 |
} |
| 4453 |
} |
| 4454 |
} |
| 4455 |
} |
| 4456 |
} |
| 4457 |
|
| 4458 |
|
| 4459 |
|
| 4460 |
|
| 4461 |
|
| 4462 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::analyseBranchingStatistics(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4463 |
CBranchTreeNode* branchTreeNode = calcAlgContext->getBranchTreeNode(); |
| 4464 |
while (mConfBranchingStatisticsAnalysing && branchTreeNode) { |
| 4465 |
|
| 4466 |
CNonDeterministicDependencyTrackPoint* nonDetDepTrackPoint = branchTreeNode->getDependencyTrackPoint(); |
| 4467 |
if (nonDetDepTrackPoint) { |
| 4468 |
CDependencyNode* dependencyNode = nonDetDepTrackPoint->getDependencyNode(); |
| 4469 |
if (dependencyNode) { |
| 4470 |
if (dependencyNode->getDependencyType() == CDependencyNode::DNTORDEPENDENCY) { |
| 4471 |
CORDependencyNode* orDependencyNode = (CORDependencyNode*)dependencyNode; |
| 4472 |
CConceptDescriptor* conDes = orDependencyNode->getConceptDescriptor(); |
| 4473 |
CConcept* orConcept = conDes->getConcept(); |
| 4474 |
CConceptProcessData* conProData = (CConceptProcessData*)orConcept->getConceptData(); |
| 4475 |
if (conProData) { |
| 4476 |
CDisjunctionBranchingStatistics* disjunctionBranchingStatistics = (CDisjunctionBranchingStatistics*)conProData->getBranchingStatistics(); |
| 4477 |
if (disjunctionBranchingStatistics) { |
| 4478 |
disjunctionBranchingStatistics->incExpandedCount(); |
| 4479 |
disjunctionBranchingStatistics->incSatisfiableOccurrenceCount(); |
| 4480 |
} |
| 4481 |
} |
| 4482 |
CORDisjunctDependencyTrackPoint* orDepTrackPoint = (CORDisjunctDependencyTrackPoint*)nonDetDepTrackPoint; |
| 4483 |
CDisjunctBranchingStatistics* disjunctBranchStats = orDepTrackPoint->getDisjunctBranchingStatistics(); |
| 4484 |
if (disjunctBranchStats) { |
| 4485 |
disjunctBranchStats->incExpandedCount(); |
| 4486 |
disjunctBranchStats->incSatisfiableOccurrenceCount(); |
| 4487 |
} |
| 4488 |
} |
| 4489 |
} |
| 4490 |
} |
| 4491 |
|
| 4492 |
if (branchTreeNode != branchTreeNode->getRootNode()) { |
| 4493 |
branchTreeNode = branchTreeNode->getParentNode(); |
| 4494 |
} else { |
| 4495 |
branchTreeNode = nullptr; |
| 4496 |
} |
| 4497 |
} |
| 4498 |
return true; |
| 4499 |
} |
| 4500 |
|
| 4501 |
|
| 4502 |
|
| 4503 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::cacheSatisfiableIndividualNodes(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4504 |
bool nodeCached = false; |
| 4505 |
CSatisfiableExpanderCacheHandler* satisfiableExpHandler = calcAlgContext->getUsedSatisfiableExpanderCacheHandler(); |
| 4506 |
CSaturationNodeExpansionCacheHandler* saturationExpHandler = calcAlgContext->getUsedSaturationNodeExpansionCacheHandler(); |
| 4507 |
if (mConfSatExpCacheWriting && satisfiableExpHandler || mConfSaturationSatisfiabilitiyExpansionCacheWriting && saturationExpHandler) { |
| 4508 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 4509 |
CIndividualProcessNodeVector* indiNodeVec = processingDataBox->getIndividualProcessNodeVector(); |
| 4510 |
cint64 indiMax = indiNodeVec->getItemMaxIndex() + 1; |
| 4511 |
cint64 indiIdx = 1; |
| 4512 |
indiIdx = qMax(processingDataBox->getMaxIncrementalPreviousCompletionGraphNodeID(),indiIdx); |
| 4513 |
|
| 4514 |
if (mConfCollectCachingUpdatedBlockableIndiNodes) { |
| 4515 |
|
| 4516 |
for (CXLinker<CIndividualProcessNode*>* updatedCachedIndiNodeLinker = processingDataBox->getBlockableIndividualNodeUpdatedLinker(); updatedCachedIndiNodeLinker; updatedCachedIndiNodeLinker = updatedCachedIndiNodeLinker->getNext()) { |
| 4517 |
CIndividualProcessNode* indiNode = updatedCachedIndiNodeLinker->getData(); |
| 4518 |
if (indiNode && indiNode->getIndividualNodeID() >= 0) { |
| 4519 |
indiNode = getUpToDateIndividual(indiIdx,calcAlgContext); |
| 4520 |
if (indiNode && !indiNode->isNominalIndividualNode()) { |
| 4521 |
if (mConfSatExpCacheWriting && satisfiableExpHandler && !indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION | CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION | CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED)) { |
| 4522 |
if (!calcAlgContext->hasCompletionGraphCachedIndividualNodes() || indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || indiNode->getIndividualNodeID() > calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 4523 |
indiNode = getLocalizedIndividual(indiNode,false,calcAlgContext); |
| 4524 |
nodeCached |= satisfiableExpHandler->cacheIndividualNodeSatisfiable(indiNode,calcAlgContext); |
| 4525 |
} |
| 4526 |
} |
| 4527 |
|
| 4528 |
|
| 4529 |
|
| 4530 |
if (mConfSaturationSatisfiabilitiyExpansionCacheWriting && saturationExpHandler && !indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION | CIndividualProcessNode::PRFSUCCESSORNEWNOMINALCONNECTION | CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED)) { |
| 4531 |
if (!calcAlgContext->hasCompletionGraphCachedIndividualNodes() || indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || indiNode->getIndividualNodeID() > calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 4532 |
nodeCached |= saturationExpHandler->tryNodeSatisfiableCaching(indiNode,calcAlgContext); |
| 4533 |
} |
| 4534 |
} |
| 4535 |
} |
| 4536 |
} |
| 4537 |
|
| 4538 |
} |
| 4539 |
indiIdx = qMax(calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()+1,indiIdx); |
| 4540 |
} |
| 4541 |
|
| 4542 |
for (; indiIdx < indiMax; ++indiIdx) { |
| 4543 |
CIndividualProcessNode* indiNode = getUpToDateIndividual(indiIdx,calcAlgContext); |
| 4544 |
if (indiNode) { |
| 4545 |
if (!indiNode->isNominalIndividualNode()) { |
| 4546 |
if (mConfSatExpCacheWriting && satisfiableExpHandler && !indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION | CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION | CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED)) { |
| 4547 |
if (!calcAlgContext->hasCompletionGraphCachedIndividualNodes() || indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || indiNode->getIndividualNodeID() > calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 4548 |
indiNode = getLocalizedIndividual(indiNode,false,calcAlgContext); |
| 4549 |
|
| 4550 |
|
| 4551 |
//CConceptProcessingQueue* conProQue = indiNode->getConceptProcessingQueue(false); |
| 4552 |
//if (conProQue) { |
| 4553 |
// if (!conProQue->isEmpty()) { |
| 4554 |
// mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 4555 |
// QFile file(QString("caching-error.txt")); |
| 4556 |
// if (file.open(QIODevice::WriteOnly)) { |
| 4557 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 4558 |
// file.close(); |
| 4559 |
// } |
| 4560 |
// bool bug = true; |
| 4561 |
// } |
| 4562 |
//} |
| 4563 |
|
| 4564 |
|
| 4565 |
//CConceptDescriptor* conDes = indiNode->getReapplyConceptLabelSet(false)->getAddingSortedConceptDescriptionLinker(); |
| 4566 |
//bool amountSubstanceFound = false; |
| 4567 |
//for (CConceptDescriptor* conDesIt = conDes; conDesIt; conDesIt = conDesIt->getNext()) { |
| 4568 |
// CConcept* concept = conDesIt->getConcept(); |
| 4569 |
// if (concept->getOperatorCode() == CCIMPLALL) { |
| 4570 |
// if (CIRIName::getRecentIRIName(concept->getRole()->getPropertyNameLinker()) == "http://purl.org/biotop/biotop.owl#granularPartOf") { |
| 4571 |
// CConcept* orCocnept = concept->getOperandList()->getData(); |
| 4572 |
// if (orCocnept->getOperatorCode() == CCOR) { |
| 4573 |
// for (CSortedNegLinker<CConcept*>* opLinker = orCocnept->getOperandList(); opLinker; opLinker = opLinker->getNext()) { |
| 4574 |
// if (opLinker->getData()->getOperatorCode() == CCSUB && CIRIName::getRecentIRIName(opLinker->getData()->getClassNameLinker()) == "http://purl.org/imbi/dco/dco#AmountOfSubstance") { |
| 4575 |
// amountSubstanceFound = true; |
| 4576 |
// } |
| 4577 |
// } |
| 4578 |
// } |
| 4579 |
// } |
| 4580 |
// } |
| 4581 |
//} |
| 4582 |
//if (amountSubstanceFound) { |
| 4583 |
// bool base1Con = false; |
| 4584 |
// bool base2Con = false; |
| 4585 |
// CConceptDescriptor* conDes = indiNode->getReapplyConceptLabelSet(false)->getAddingSortedConceptDescriptionLinker(); |
| 4586 |
// for (CConceptDescriptor* conDesIt = conDes; conDesIt; conDesIt = conDesIt->getNext()) { |
| 4587 |
// if (!conDesIt->isNegated() && CIRIName::getRecentIRIName(conDesIt->getData()->getClassNameLinker()) == "http://purl.org/biotop/biotop.owl#AmountOfPureSubstance") { |
| 4588 |
// base1Con = true; |
| 4589 |
// } |
| 4590 |
// if (!conDesIt->isNegated() && CIRIName::getRecentIRIName(conDesIt->getData()->getClassNameLinker()) == "http://purl.org/imbi/dco/dco#AmountOfSubstance") { |
| 4591 |
// base2Con = true; |
| 4592 |
// } |
| 4593 |
// } |
| 4594 |
// if (!base2Con && base1Con) { |
| 4595 |
// mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 4596 |
// QFile file(QString("caching-error.txt")); |
| 4597 |
// if (file.open(QIODevice::WriteOnly)) { |
| 4598 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 4599 |
// file.close(); |
| 4600 |
// } |
| 4601 |
// bool bug = true; |
| 4602 |
// } |
| 4603 |
//} |
| 4604 |
|
| 4605 |
|
| 4606 |
//QStringList conSetList = generateExtendedDebugConceptSetStringList(indiNode->getReapplyConceptLabelSet(false),nullptr,nullptr,calcAlgContext); |
| 4607 |
//debugTestCriticalConceptSet(conSetList,calcAlgContext); |
| 4608 |
|
| 4609 |
nodeCached |= satisfiableExpHandler->cacheIndividualNodeSatisfiable(indiNode,calcAlgContext); |
| 4610 |
} |
| 4611 |
} |
| 4612 |
|
| 4613 |
|
| 4614 |
|
| 4615 |
if (mConfSaturationSatisfiabilitiyExpansionCacheWriting && saturationExpHandler && !indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION | CIndividualProcessNode::PRFSUCCESSORNEWNOMINALCONNECTION | CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED)) { |
| 4616 |
if (!calcAlgContext->hasCompletionGraphCachedIndividualNodes() || indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || indiNode->getIndividualNodeID() > calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 4617 |
nodeCached |= saturationExpHandler->tryNodeSatisfiableCaching(indiNode,calcAlgContext); |
| 4618 |
} |
| 4619 |
} |
| 4620 |
} |
| 4621 |
} |
| 4622 |
} |
| 4623 |
} |
| 4624 |
return nodeCached; |
| 4625 |
} |
| 4626 |
|
| 4627 |
|
| 4628 |
void CCalculationTableauCompletionTaskHandleAlgorithm::debugTestCriticalConceptSet(QStringList& conSetList, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4629 |
if (conSetList.count() == 67) { |
| 4630 |
bool containAll = true; |
| 4631 |
QSet<QString> testConceptSetStringSet; |
| 4632 |
for (QStringList::const_iterator it = conSetList.constBegin(), itEnd = conSetList.constEnd(); containAll && it != itEnd; ++it) { |
| 4633 |
const QString& conString = *it; |
| 4634 |
QString testString = conString; |
| 4635 |
testString = testString.remove("^"); |
| 4636 |
testString = testString.remove("0"); |
| 4637 |
testString = testString.remove("1"); |
| 4638 |
testString = testString.remove("2"); |
| 4639 |
testString = testString.remove("3"); |
| 4640 |
testString = testString.remove("4"); |
| 4641 |
testString = testString.remove("5"); |
| 4642 |
testString = testString.remove("6"); |
| 4643 |
testString = testString.remove("7"); |
| 4644 |
testString = testString.remove("8"); |
| 4645 |
testString = testString.remove("9"); |
| 4646 |
testString = testString.trimmed(); |
| 4647 |
testConceptSetStringSet.insert(testString); |
| 4648 |
} |
| 4649 |
|
| 4650 |
if (testConceptSetStringSet.count() >= mCriticalConceptSetStringSet.count()) { |
| 4651 |
foreach (const QString& testString, mCriticalConceptSetStringSet) { |
| 4652 |
if (!testConceptSetStringSet.contains(testString)) { |
| 4653 |
containAll = false; |
| 4654 |
} |
| 4655 |
} |
| 4656 |
} else { |
| 4657 |
containAll = false; |
| 4658 |
} |
| 4659 |
|
| 4660 |
if (containAll && !mFoundCriticalConceptSet) { |
| 4661 |
mFoundCriticalConceptSet = true; |
| 4662 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 4663 |
mFoundCriticalConceptSet = false; |
| 4664 |
bool debug = true; |
| 4665 |
} |
| 4666 |
} |
| 4667 |
} |
| 4668 |
|
| 4669 |
|
| 4670 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::testAllSuccessorsProcessedAndWriteSatisfiableCache(CIndividualProcessNode* indiNode, CPROCESSINGSET<CIndividualProcessNode*>* processedNodeSet, CSatisfiableExpanderCacheHandler* satExpHandler, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4671 |
|
| 4672 |
if (!indiNode->isNominalIndividualNode() && !indiNode->hasBackwardDependencyToAncestorIndividualNode()) { |
| 4673 |
if (!indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION | CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 4674 |
if (!calcAlgContext->hasCompletionGraphCachedIndividualNodes() || indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || indiNode->getIndividualNodeID() > calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 4675 |
CConceptProcessingQueue* conProQue = indiNode->getConceptProcessingQueue(false); |
| 4676 |
if (!conProQue || conProQue->isEmpty()) { |
| 4677 |
|
| 4678 |
if (!processedNodeSet->contains(indiNode)) { |
| 4679 |
processedNodeSet->insert(indiNode); |
| 4680 |
|
| 4681 |
CIndividualProcessNode* ancIndi = getAncestorIndividual(indiNode,calcAlgContext); |
| 4682 |
CSuccessorIterator succIt(indiNode->getSuccessorIterator()); |
| 4683 |
while (succIt.hasNext()) { |
| 4684 |
CIndividualLinkEdge* succLink = succIt.nextLink(); |
| 4685 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indiNode,succLink,calcAlgContext); |
| 4686 |
if (!ancIndi || succIndi->getIndividualNodeID() != ancIndi->getIndividualNodeID()) { |
| 4687 |
if (!testAllSuccessorsProcessedAndWriteSatisfiableCache(succIndi,processedNodeSet,satExpHandler,calcAlgContext)) { |
| 4688 |
return false; |
| 4689 |
} |
| 4690 |
} |
| 4691 |
} |
| 4692 |
|
| 4693 |
indiNode = getLocalizedIndividual(indiNode,false,calcAlgContext); |
| 4694 |
satExpHandler->cacheIndividualNodeSatisfiable(indiNode,calcAlgContext); |
| 4695 |
|
| 4696 |
return true; |
| 4697 |
} |
| 4698 |
} |
| 4699 |
} |
| 4700 |
} |
| 4701 |
} |
| 4702 |
return false; |
| 4703 |
} |
| 4704 |
|
| 4705 |
|
| 4706 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::writeSatisfiableCachedIndividualNodesOfUnsatisfiableBranch(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4707 |
bool nodeCached = false; |
| 4708 |
CSatisfiableExpanderCacheHandler* satExpHandler = calcAlgContext->getUsedSatisfiableExpanderCacheHandler(); |
| 4709 |
if (mConfUnsatBranchSatisfiableCaching && mConfSatExpCacheWriting && satExpHandler) { |
| 4710 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 4711 |
CIndividualProcessNodeVector* indiNodeVec = processingDataBox->getIndividualProcessNodeVector(); |
| 4712 |
|
| 4713 |
CPROCESSINGSET<CIndividualProcessNode*>* processedNodeSet = CObjectParameterizingAllocator< CPROCESSINGSET<CIndividualProcessNode*>,CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getUsedTaskProcessorContext()); |
| 4714 |
cint64 indiCount = indiNodeVec->getItemCount(); |
| 4715 |
cint64 indiStart = indiNodeVec->getItemMinIndex(); |
| 4716 |
for (cint64 indiIdx = indiStart; indiIdx < indiCount; ++indiIdx) { |
| 4717 |
CIndividualProcessNode* indiNode = getUpToDateIndividual(indiIdx,calcAlgContext); |
| 4718 |
if (indiNode) { |
| 4719 |
if (!indiNode->isNominalIndividualNode()) { |
| 4720 |
if (!indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION | CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 4721 |
if (!calcAlgContext->hasCompletionGraphCachedIndividualNodes() || indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) || indiNode->getIndividualNodeID() > calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 4722 |
CConceptProcessingQueue* conProQue = indiNode->getConceptProcessingQueue(false); |
| 4723 |
if (!conProQue || conProQue->isEmpty()) { |
| 4724 |
// test whether all successor nodes are already processed |
| 4725 |
nodeCached |= testAllSuccessorsProcessedAndWriteSatisfiableCache(indiNode,processedNodeSet,satExpHandler,calcAlgContext); |
| 4726 |
} |
| 4727 |
} |
| 4728 |
} |
| 4729 |
} |
| 4730 |
} |
| 4731 |
} |
| 4732 |
} |
| 4733 |
return nodeCached; |
| 4734 |
} |
| 4735 |
|
| 4736 |
|
| 4737 |
|
| 4738 |
|
| 4739 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isSaturationCachedProcessingBlocked(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4740 |
bool processingBlocked = false; |
| 4741 |
bool saturationCached = detectIndividualNodeSaturationCached(individualNode,calcAlgContext); |
| 4742 |
if (saturationCached) { |
| 4743 |
// block processing only for successors of saturation cached nodes |
| 4744 |
processingBlocked = individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED); |
| 4745 |
} |
| 4746 |
return processingBlocked; |
| 4747 |
} |
| 4748 |
|
| 4749 |
|
| 4750 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::detectIndividualNodeSaturationCached(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4751 |
|
| 4752 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED) && !individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATURATIONBLOCKINGCACHEDDUEDIRECTMODIFIED)) { |
| 4753 |
return true; |
| 4754 |
} |
| 4755 |
|
| 4756 |
bool prevSatCached = individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED | CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED); |
| 4757 |
bool prevSatSuccCreationBlocked = individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED); |
| 4758 |
|
| 4759 |
|
| 4760 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED)) { |
| 4761 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHEDABOLISHED)) { |
| 4762 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHEDABOLISHED); |
| 4763 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED); |
| 4764 |
} else { |
| 4765 |
return true; |
| 4766 |
} |
| 4767 |
} |
| 4768 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATURATIONBLOCKINGCACHEDDUEDIRECTMODIFIED)) { |
| 4769 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATURATIONBLOCKINGCACHEDDUEDIRECTMODIFIED); |
| 4770 |
} |
| 4771 |
bool stillSaturationCached = false; |
| 4772 |
if (!individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHEDINVALIDATED)) { |
| 4773 |
|
| 4774 |
CSaturationNodeExpansionCacheHandler* satNodeExpCacheHandler = calcAlgContext->getSaturationNodeExpansionCacheHandler(); |
| 4775 |
if (!stillSaturationCached && satNodeExpCacheHandler && mConfSaturationExpansionCacheReading) { |
| 4776 |
CSaturationNodeAssociatedConceptExpansion* expansion = nullptr; |
| 4777 |
|
| 4778 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHEDRETESTDUETOMODIFICATION)) { |
| 4779 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHEDRETESTDUETOMODIFICATION); |
| 4780 |
if (satNodeExpCacheHandler->isNodeSatisfiableCached(individualNode,expansion,calcAlgContext)) { |
| 4781 |
stillSaturationCached = true; |
| 4782 |
if (expansion && expansion->getDependentNominalSet(false) && !mConfSaturationCachingWithNominals) { |
| 4783 |
stillSaturationCached = false; |
| 4784 |
} else if (expansion) { |
| 4785 |
installSaturationCachingReactivation(individualNode,expansion->getDependentNominalSet(false),calcAlgContext); |
| 4786 |
|
| 4787 |
if (prevSatSuccCreationBlocked && expansion->getHasTightAtMostRestriction()) { |
| 4788 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED); |
| 4789 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(individualNode,calcAlgContext); |
| 4790 |
} |
| 4791 |
if (!prevSatSuccCreationBlocked && !expansion->getHasTightAtMostRestriction()) { |
| 4792 |
individualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED); |
| 4793 |
} |
| 4794 |
} |
| 4795 |
} |
| 4796 |
} |
| 4797 |
} |
| 4798 |
} |
| 4799 |
if (!stillSaturationCached) { |
| 4800 |
if (prevSatCached) { |
| 4801 |
STATINC(SATURATIONCACHELOSECOUNT,calcAlgContext); |
| 4802 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED); |
| 4803 |
reactivateIndirectSaturationCachedSuccessors(individualNode,false,calcAlgContext); |
| 4804 |
} |
| 4805 |
if (prevSatSuccCreationBlocked) { |
| 4806 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED); |
| 4807 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(individualNode,calcAlgContext); |
| 4808 |
} |
| 4809 |
} else { |
| 4810 |
if (!prevSatCached) { |
| 4811 |
STATINC(SATURATIONCACHEESTABLISHCOUNT,calcAlgContext); |
| 4812 |
individualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED); |
| 4813 |
propagateIndirectSuccessorSaturationBlocked(individualNode,calcAlgContext); |
| 4814 |
} |
| 4815 |
} |
| 4816 |
return stillSaturationCached; |
| 4817 |
} |
| 4818 |
|
| 4819 |
|
| 4820 |
|
| 4821 |
|
| 4822 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isSatisfiableCachedProcessingBlocked(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4823 |
bool processingBlocked = false; |
| 4824 |
bool satisfiableCached = detectIndividualNodeSatisfiableExpandedCached(individualNode,calcAlgContext); |
| 4825 |
if (satisfiableCached) { |
| 4826 |
// block processing only for successors of satisfiable cached nodes |
| 4827 |
processingBlocked = individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED); |
| 4828 |
} |
| 4829 |
return processingBlocked; |
| 4830 |
} |
| 4831 |
|
| 4832 |
|
| 4833 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::detectIndividualNodeSatisfiableExpandedCached(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4834 |
|
| 4835 |
bool prevSatCached = individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED); |
| 4836 |
|
| 4837 |
|
| 4838 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED)) { |
| 4839 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHEDABOLISHED)) { |
| 4840 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHEDABOLISHED); |
| 4841 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED); |
| 4842 |
} else { |
| 4843 |
return true; |
| 4844 |
} |
| 4845 |
} |
| 4846 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATISFIABLECACHEDDUEDIRECTMODIFIED)) { |
| 4847 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATISFIABLECACHEDDUEDIRECTMODIFIED); |
| 4848 |
} |
| 4849 |
|
| 4850 |
|
| 4851 |
//QStringList conSetList = generateExtendedDebugConceptSetStringList(individualNode->getReapplyConceptLabelSet(false),nullptr,nullptr,calcAlgContext); |
| 4852 |
//debugTestCriticalConceptSet(conSetList,calcAlgContext); |
| 4853 |
|
| 4854 |
|
| 4855 |
bool newSatCached = false; |
| 4856 |
|
| 4857 |
CSatisfiableExpanderCacheHandler* satExpHandler = calcAlgContext->getUsedSatisfiableExpanderCacheHandler(); |
| 4858 |
if (!individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION | CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING | CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED)) { |
| 4859 |
// can only satisfiable cached if there is no nominal |
| 4860 |
if (mConfSatExpCacheRetrieval && satExpHandler) { |
| 4861 |
bool satisfiableCached = false; |
| 4862 |
CSignatureSatisfiableExpanderCacheEntry* entry = nullptr; |
| 4863 |
STATINC(SATEXPCACHERETRIEVALCOUNT,calcAlgContext); |
| 4864 |
if (satExpHandler->isIndividualNodeExpandCached(individualNode,&satisfiableCached,&entry,calcAlgContext)) { |
| 4865 |
STATINC(SATEXPCACHERETRIEVALSUCCESSCOUNT,calcAlgContext); |
| 4866 |
if (mConfSatExpCacheConceptExpansion) { |
| 4867 |
expandCachedConcepts(individualNode,entry,calcAlgContext); |
| 4868 |
if (mConfSatExpCacheSatisfiableBlocking && satisfiableCached && !individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING)) { |
| 4869 |
STATINC(SATEXPCACHERETRIEVALFOUNDSATISFIABLECOUNT,calcAlgContext); |
| 4870 |
bool satCompatible = false; |
| 4871 |
CExpanderBranchedLinker* satBranchCompatibleLinker = nullptr; |
| 4872 |
if (entry->isSatisfiableWithoutBranchedConcepts()) { |
| 4873 |
satCompatible = true; |
| 4874 |
} else { |
| 4875 |
CExpanderBranchedLinker* satBranchLinker = entry->getExpanderBranchedLinker(); |
| 4876 |
if (!satBranchLinker) { |
| 4877 |
satCompatible = true; |
| 4878 |
} else { |
| 4879 |
CIndividualProcessNode* ancestorIndiNode = getAncestorIndividual(individualNode,calcAlgContext); |
| 4880 |
CExpanderBranchedLinker* satBranchLinkerIt = satBranchLinker; |
| 4881 |
while (satBranchLinkerIt && !satCompatible) { |
| 4882 |
bool allSatCompatible = true; |
| 4883 |
STATINC(SATEXPCACHERETRIEVALCOMPATIBILITYTESTCOUNT,calcAlgContext); |
| 4884 |
allSatCompatible = isSatisfiableCachedCompatible(individualNode,satBranchLinkerIt,ancestorIndiNode,calcAlgContext); |
| 4885 |
if (allSatCompatible) { |
| 4886 |
satBranchCompatibleLinker = satBranchLinkerIt; |
| 4887 |
satCompatible = true; |
| 4888 |
} |
| 4889 |
satBranchLinkerIt = satBranchLinkerIt->getNext(); |
| 4890 |
} |
| 4891 |
} |
| 4892 |
} |
| 4893 |
|
| 4894 |
if (satCompatible) { |
| 4895 |
|
| 4896 |
//QStringList conSetList = generateExtendedDebugConceptSetStringList(individualNode->getReapplyConceptLabelSet(false),nullptr,nullptr,calcAlgContext); |
| 4897 |
//debugTestCriticalConceptSet(conSetList,calcAlgContext); |
| 4898 |
|
| 4899 |
STATINC(SATEXPCACHERETRIEVALCOMPATIBLESATCOUNT,calcAlgContext); |
| 4900 |
newSatCached = true; |
| 4901 |
if (!prevSatCached) { |
| 4902 |
individualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED); |
| 4903 |
propagateIndirectSuccessorSatisfiableCached(individualNode,calcAlgContext); |
| 4904 |
} |
| 4905 |
} else { |
| 4906 |
STATINC(SATEXPCACHERETRIEVALINCOMPATIBLESATCOUNT,calcAlgContext); |
| 4907 |
} |
| 4908 |
} |
| 4909 |
} |
| 4910 |
} |
| 4911 |
} |
| 4912 |
if (mConfSatExpCacheWriting && !newSatCached) { |
| 4913 |
if (!individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED)) { |
| 4914 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 4915 |
//QFile file(QString("caching-error.txt")); |
| 4916 |
//if (file.open(QIODevice::WriteOnly)) { |
| 4917 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 4918 |
// file.close(); |
| 4919 |
//} |
| 4920 |
satExpHandler->cacheIndividualNodeExpansion(individualNode,calcAlgContext); |
| 4921 |
} |
| 4922 |
} |
| 4923 |
} |
| 4924 |
if (!newSatCached) { |
| 4925 |
if (prevSatCached) { |
| 4926 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED); |
| 4927 |
reactivateIndirectSatisfiableCachedSuccessors(individualNode,false,calcAlgContext); |
| 4928 |
|
| 4929 |
reapplySatisfiableCachedAbsorbedDisjunctionConcepts(individualNode,calcAlgContext); |
| 4930 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(individualNode,calcAlgContext); |
| 4931 |
} |
| 4932 |
} |
| 4933 |
|
| 4934 |
|
| 4935 |
//if (satExpHandler) { |
| 4936 |
// bool satisfiableCached = false; |
| 4937 |
// CSignatureSatisfiableExpanderCacheEntry* entry = nullptr; |
| 4938 |
// satExpHandler->isIndividualNodeExpandCached(individualNode,&satisfiableCached,&entry,calcAlgContext); |
| 4939 |
// if (entry && !individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING)) { |
| 4940 |
// CReapplyConceptLabelSet* conSet = individualNode->getReapplyConceptLabelSet(false); |
| 4941 |
// cint64 conSetCount = conSet->getConceptCount(); |
| 4942 |
// cint64 expandCount = entry->getExpanderCacheValueCount(); |
| 4943 |
// if (conSetCount != expandCount) { |
| 4944 |
// bool bug = true; |
| 4945 |
// } |
| 4946 |
// } |
| 4947 |
//} |
| 4948 |
return newSatCached; |
| 4949 |
} |
| 4950 |
|
| 4951 |
|
| 4952 |
|
| 4953 |
|
| 4954 |
|
| 4955 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasCompatibleConceptSetReuse(CIndividualProcessNode* indiNode, CReapplyConceptLabelSet* subConceptSet, CIndividualProcessNode* reuseNodeCand, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4956 |
CReapplyConceptLabelSet* superConceptSet = reuseNodeCand->getReapplyConceptLabelSet(false); |
| 4957 |
bool isSubset = isLabelConceptSubSet(subConceptSet,superConceptSet,nullptr,nullptr,calcAlgContext); |
| 4958 |
if (!isSubset) { |
| 4959 |
return false; |
| 4960 |
} |
| 4961 |
|
| 4962 |
CReapplyConceptLabelSetIterator superConSetIt = superConceptSet->getConceptLabelSetIterator(false,false,false); |
| 4963 |
while (superConSetIt.hasNext()) { |
| 4964 |
CConceptDescriptor* conDes = superConSetIt.next(); |
| 4965 |
if (isConceptSignatureBlockingCritical(reuseNodeCand,conDes,conDes->getDependencyTrackPoint(),calcAlgContext)) { |
| 4966 |
indiNode->setInvalidSignatureBlocking(true); |
| 4967 |
return false; |
| 4968 |
} |
| 4969 |
} |
| 4970 |
|
| 4971 |
return true; |
| 4972 |
} |
| 4973 |
|
| 4974 |
|
| 4975 |
|
| 4976 |
|
| 4977 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::searchSignatureReusingIndividualNode(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4978 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 4979 |
CSignatureBlockingCandidateHash* sigBlockCandHash = processingDataBox->getSignatureBlockingCandidateHash(false); |
| 4980 |
CReapplyConceptLabelSet* conSet = individualNode->getReapplyConceptLabelSet(false); |
| 4981 |
if (sigBlockCandHash && conSet) { |
| 4982 |
cint64 conCount = conSet->getConceptCount(); |
| 4983 |
if (!individualNode->isInvalidSignatureBlocking() && individualNode->getLastConceptCountSearchBlockingCandidate() != conCount) { |
| 4984 |
individualNode->setLastConceptCountSearchBlockingCandidate(conCount); |
| 4985 |
|
| 4986 |
cint64 conSig = conSet->getConceptSignatureValue(); |
| 4987 |
cint64 newCandCount = sigBlockCandHash->getBlockingCandidatesCount(conSig); |
| 4988 |
cint64 lastCandCount = individualNode->getLastSearchBlockerCandidateCount(); |
| 4989 |
cint64 lastCandSignature = individualNode->getLastSearchBlockerCandidateSignature(); |
| 4990 |
if (lastCandSignature != conSig) { |
| 4991 |
lastCandCount = 0; |
| 4992 |
} |
| 4993 |
individualNode->setLastSearchBlockerCandidateSignature(conSig); |
| 4994 |
if (newCandCount != lastCandCount) { |
| 4995 |
|
| 4996 |
cint64 candDiffCount = newCandCount - lastCandCount; |
| 4997 |
|
| 4998 |
CSignatureBlockingCandidateIterator candIt(sigBlockCandHash->getBlockingCandidatesIterator(conSig)); |
| 4999 |
while (candIt.hasNext() && candDiffCount-- > 0 && !individualNode->isInvalidSignatureBlocking()) { |
| 5000 |
cint64 candIndiID = candIt.next(true); |
| 5001 |
if (candIndiID != individualNode->getIndividualNodeID()) { |
| 5002 |
CIndividualProcessNode* candIndiNode = getUpToDateIndividual(candIndiID,calcAlgContext); |
| 5003 |
if (isIndividualNodeValidBlocker(candIndiNode,calcAlgContext)) { |
| 5004 |
bool compatible = hasCompatibleConceptSetReuse(individualNode,conSet,candIndiNode,calcAlgContext); |
| 5005 |
if (compatible) { |
| 5006 |
individualNode->setLastSearchBlockerCandidateCount(newCandCount-candDiffCount); |
| 5007 |
return candIndiNode; |
| 5008 |
} |
| 5009 |
} |
| 5010 |
} |
| 5011 |
} |
| 5012 |
individualNode->setLastSearchBlockerCandidateCount(newCandCount); |
| 5013 |
|
| 5014 |
} |
| 5015 |
} |
| 5016 |
} |
| 5017 |
return nullptr; |
| 5018 |
} |
| 5019 |
|
| 5020 |
|
| 5021 |
void CCalculationTableauCompletionTaskHandleAlgorithm::removeIndividualReusing(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5022 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFREUSINGINDIVIDUAL); |
| 5023 |
removeReusingBlockerFollowing(individualNode,calcAlgContext); |
| 5024 |
reactivateIndirectReuseSuccessors(individualNode,true,calcAlgContext); |
| 5025 |
} |
| 5026 |
|
| 5027 |
|
| 5028 |
void CCalculationTableauCompletionTaskHandleAlgorithm::updateIndividualReusing(CIndividualProcessNode* processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5029 |
if (processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFREUSINGINDIVIDUAL)) { |
| 5030 |
// 1. update non-deterministic expansions, 2. update deterministic expansions |
| 5031 |
CReusingIndividualNodeConceptExpansionData* reusingData = processIndi->getReusingIndividualNodeConceptExpansionData(false); |
| 5032 |
CIndividualProcessNode* reuseIndi = reusingData->getBlockerIndividualNode(); |
| 5033 |
reuseIndi = getUpToDateIndividual(reuseIndi,calcAlgContext); |
| 5034 |
|
| 5035 |
// test whether reused individual is now invalid or blocked |
| 5036 |
if (isIndividualNodeValidBlocker(reuseIndi,calcAlgContext)) { |
| 5037 |
// search other reuseable individual |
| 5038 |
removeReusingBlockerFollowing(processIndi,calcAlgContext); |
| 5039 |
|
| 5040 |
reuseIndi = searchSignatureReusingIndividualNode(processIndi,calcAlgContext); |
| 5041 |
if (reuseIndi) { |
| 5042 |
|
| 5043 |
CReusingIndividualNodeConceptExpansionData* locReusingData = processIndi->getReusingIndividualNodeConceptExpansionData(true); |
| 5044 |
if (!locReusingData) { |
| 5045 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5046 |
locReusingData = CObjectAllocator<CReusingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5047 |
locReusingData->initBlockingExpansionData(reusingData); |
| 5048 |
reusingData = locReusingData; |
| 5049 |
processIndi->setReusingIndividualNodeConceptExpansionData(locReusingData); |
| 5050 |
} |
| 5051 |
locReusingData->setBlockerIndividualNode(reuseIndi); |
| 5052 |
locReusingData->setBlockingConceptCount(0); |
| 5053 |
locReusingData->setBlockingConceptSignature(0); |
| 5054 |
locReusingData->setLastSubsetTestedConceptDescriptor(nullptr); |
| 5055 |
locReusingData->setContinuousExpandedContainedConceptCount(0); |
| 5056 |
locReusingData->setLastUpdatedConceptCount(0); |
| 5057 |
locReusingData->setLastUpdatedConceptExpansionCount(0); |
| 5058 |
locReusingData->setLastNonDeterministicExpansionLinker(nullptr); |
| 5059 |
|
| 5060 |
addReusingBlockerFollowing(processIndi,calcAlgContext); |
| 5061 |
} else { |
| 5062 |
|
| 5063 |
reactivateIndirectReuseSuccessors(processIndi,true,calcAlgContext); |
| 5064 |
processIndi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFREUSINGINDIVIDUAL); |
| 5065 |
if (reusingData->isBlockingReviewMarked()) { |
| 5066 |
CReusingReviewData* reusingReviewData = calcAlgContext->getProcessingDataBox()->getReusingReviewData(true); |
| 5067 |
reusingReviewData->remove(processIndi->getIndividualNodeID()); |
| 5068 |
} |
| 5069 |
|
| 5070 |
} |
| 5071 |
} |
| 5072 |
|
| 5073 |
bool reusingIndiCompatible = true; |
| 5074 |
|
| 5075 |
if (reuseIndi) { |
| 5076 |
anlyzeIndiviudalNodesConceptExpansion(reuseIndi,calcAlgContext); |
| 5077 |
|
| 5078 |
|
| 5079 |
CIndividualNodeAnalizedConceptExpansionData* blockerAnalizedConExpData = reuseIndi->getAnalizedConceptExpansionData(false); |
| 5080 |
CXLinker<CConceptDescriptor*>* nonDetExpLinker = blockerAnalizedConExpData->getAnalysedNonDeterministicConceptExpansionLinker(); |
| 5081 |
reusingIndiCompatible &= !blockerAnalizedConExpData->isInvalidBlocker(); |
| 5082 |
|
| 5083 |
CXLinker<CConceptDescriptor*>* lastNonDetExpLinker = reusingData->getLastNonDeterministicExpansionLinker(); |
| 5084 |
CReapplyConceptLabelSet* processIndiLabelSet = processIndi->getReapplyConceptLabelSet(false); |
| 5085 |
|
| 5086 |
if (nonDetExpLinker != lastNonDetExpLinker) { |
| 5087 |
processIndiLabelSet = processIndi->getReapplyConceptLabelSet(true); |
| 5088 |
|
| 5089 |
CReusingIndividualNodeConceptExpansionData* locReusingData = processIndi->getReusingIndividualNodeConceptExpansionData(true); |
| 5090 |
if (!locReusingData) { |
| 5091 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5092 |
locReusingData = CObjectAllocator<CReusingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5093 |
locReusingData->initBlockingExpansionData(reusingData); |
| 5094 |
reusingData = locReusingData; |
| 5095 |
processIndi->setReusingIndividualNodeConceptExpansionData(locReusingData); |
| 5096 |
} |
| 5097 |
|
| 5098 |
CNonDeterministicDependencyTrackPoint* lastReuseConceptsDepTrackPoint = locReusingData->getReuseConceptsDependencyTrackPoint(); |
| 5099 |
|
| 5100 |
|
| 5101 |
CREUSECONCEPTSDependencyNode* reuseConceptsDepNode = createREUSECONCEPTSDependency(processIndi,nullptr,lastReuseConceptsDepTrackPoint,calcAlgContext); |
| 5102 |
CNonDeterministicDependencyTrackPoint* reuseConceptsDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseConceptsDepNode,true,calcAlgContext); |
| 5103 |
|
| 5104 |
for (CXLinker<CConceptDescriptor*>* nonDetExpLinkerIt = nonDetExpLinker; nonDetExpLinkerIt; nonDetExpLinkerIt = nonDetExpLinkerIt->getNext()) { |
| 5105 |
CConceptDescriptor* reusingConDes = nonDetExpLinkerIt->getData(); |
| 5106 |
|
| 5107 |
if (!processIndiLabelSet->containsConceptDescriptor(reusingConDes)) { |
| 5108 |
// add non-deterministically the missing concept |
| 5109 |
addConceptToIndividual(reusingConDes->getConcept(),reusingConDes->isNegated(),processIndi,reuseConceptsDependencyTrackPoint,false,true,calcAlgContext); |
| 5110 |
} |
| 5111 |
} |
| 5112 |
|
| 5113 |
locReusingData->setReuseConceptsDependencyTrackPoint(reuseConceptsDependencyTrackPoint); |
| 5114 |
locReusingData->setLastNonDeterministicExpansionLinker(nonDetExpLinker); |
| 5115 |
|
| 5116 |
} |
| 5117 |
|
| 5118 |
CConceptDescriptor* addingSortedConDes = processIndiLabelSet->getAddingSortedConceptDescriptionLinker(); |
| 5119 |
CConceptDescriptor* lastSubSetTestConDes = reusingData->getLastSubsetTestedConceptDescriptor(); |
| 5120 |
|
| 5121 |
if (addingSortedConDes != lastSubSetTestConDes || blockerAnalizedConExpData->getExpansionConceptCount() != reusingData->getLastUpdatedConceptExpansionCount()) { |
| 5122 |
CReusingIndividualNodeConceptExpansionData* locReusingData = processIndi->getReusingIndividualNodeConceptExpansionData(true); |
| 5123 |
if (!locReusingData) { |
| 5124 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5125 |
locReusingData = CObjectAllocator<CReusingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5126 |
locReusingData->initBlockingExpansionData(reusingData); |
| 5127 |
reusingData = locReusingData; |
| 5128 |
processIndi->setReusingIndividualNodeConceptExpansionData(locReusingData); |
| 5129 |
} |
| 5130 |
updateSignatureBlockingConceptExpansion(processIndi,locReusingData,reuseIndi,blockerAnalizedConExpData,calcAlgContext); |
| 5131 |
|
| 5132 |
CReapplyConceptLabelSet* reuseIndiLabelSet = reuseIndi->getReapplyConceptLabelSet(false); |
| 5133 |
|
| 5134 |
// validate still subset |
| 5135 |
bool stillSubset = locReusingData->isConceptSetStillSubset(); |
| 5136 |
if (stillSubset) { |
| 5137 |
CConceptDescriptor* addingSortedConDesIt = addingSortedConDes; |
| 5138 |
while (addingSortedConDesIt != lastSubSetTestConDes && stillSubset) { |
| 5139 |
CConcept* concept = addingSortedConDesIt->getConcept(); |
| 5140 |
bool conNegation = addingSortedConDesIt->isNegated(); |
| 5141 |
if (!processIndiLabelSet->containsConcept(concept,conNegation)) { |
| 5142 |
stillSubset = false; |
| 5143 |
} |
| 5144 |
addingSortedConDesIt = addingSortedConDesIt->getNext(); |
| 5145 |
} |
| 5146 |
locReusingData->setConceptSetStillSubset(stillSubset); |
| 5147 |
} |
| 5148 |
locReusingData->setLastSubsetTestedConceptDescriptor(addingSortedConDes); |
| 5149 |
|
| 5150 |
if (!stillSubset) { |
| 5151 |
reusingIndiCompatible = false; |
| 5152 |
} |
| 5153 |
} |
| 5154 |
} |
| 5155 |
|
| 5156 |
if (reuseIndi) { |
| 5157 |
if (!reusingIndiCompatible) { |
| 5158 |
CReusingIndividualNodeConceptExpansionData* locReusingData = processIndi->getReusingIndividualNodeConceptExpansionData(true); |
| 5159 |
if (!locReusingData) { |
| 5160 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5161 |
locReusingData = CObjectAllocator<CReusingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5162 |
locReusingData->initBlockingExpansionData(reusingData); |
| 5163 |
reusingData = locReusingData; |
| 5164 |
processIndi->setReusingIndividualNodeConceptExpansionData(locReusingData); |
| 5165 |
} |
| 5166 |
|
| 5167 |
|
| 5168 |
if (!locReusingData->isBlockingReviewMarked()) { |
| 5169 |
locReusingData->setBlockingReviewMarked(true); |
| 5170 |
CReusingReviewData* reusingReviewData = calcAlgContext->getProcessingDataBox()->getReusingReviewData(true); |
| 5171 |
reusingReviewData->insert(processIndi->getIndividualAncestorDepth(),processIndi->getIndividualNodeID()); |
| 5172 |
} |
| 5173 |
} |
| 5174 |
} |
| 5175 |
|
| 5176 |
|
| 5177 |
} |
| 5178 |
} |
| 5179 |
|
| 5180 |
|
| 5181 |
void CCalculationTableauCompletionTaskHandleAlgorithm::upgradeSignatureBlockingToIndividualReusing(CIndividualProcessNode* processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5182 |
CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockData = processIndi->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 5183 |
CIndividualProcessNode* reuseIndi = sigBlockData->getBlockerIndividualNode(); |
| 5184 |
|
| 5185 |
processIndi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED); |
| 5186 |
reactivateIndirectSignatureBlockedSuccessors(processIndi,false,calcAlgContext); |
| 5187 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(processIndi,calcAlgContext); |
| 5188 |
|
| 5189 |
establishIndividualReusing(processIndi,reuseIndi,calcAlgContext); |
| 5190 |
} |
| 5191 |
|
| 5192 |
|
| 5193 |
void CCalculationTableauCompletionTaskHandleAlgorithm::establishIndividualReusing(CIndividualProcessNode* processIndi, CIndividualProcessNode* reuseIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5194 |
CREUSEINDIVIDUALDependencyNode* reuseDepNode = createREUSEINDIVIDUALDependency(processIndi,nullptr,nullptr,calcAlgContext); |
| 5195 |
|
| 5196 |
CSatisfiableCalculationTask* newTaskList = createDependendBranchingTaskList(2,calcAlgContext); |
| 5197 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 5198 |
|
| 5199 |
anlyzeIndiviudalNodesConceptExpansion(reuseIndi,calcAlgContext); |
| 5200 |
CIndividualNodeAnalizedConceptExpansionData* blockerAnalizedConExpData = reuseIndi->getAnalizedConceptExpansionData(false); |
| 5201 |
if (blockerAnalizedConExpData) { |
| 5202 |
|
| 5203 |
CXLinker<CConceptDescriptor*>* nonDetExpLinker = blockerAnalizedConExpData->getAnalysedNonDeterministicConceptExpansionLinker(); |
| 5204 |
|
| 5205 |
CSatisfiableCalculationTask* newTaskIt = newTaskList; |
| 5206 |
for (cint64 i = 0; i < 2; ++i) { |
| 5207 |
|
| 5208 |
bool reusingAlternative = i == 0; |
| 5209 |
|
| 5210 |
CSatisfiableCalculationTask* newSatCalcTask = newTaskIt; |
| 5211 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 5212 |
|
| 5213 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext,newProcessContext,newSatCalcTask); |
| 5214 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 5215 |
|
| 5216 |
CProcessTagger* newProcessTagger = newCalcAlgContext->getUsedProcessTagger(); |
| 5217 |
newProcessTagger->incBranchingTag(); |
| 5218 |
newProcessTagger->incLocalizationTag(); |
| 5219 |
|
| 5220 |
CIndividualProcessNode* newLocIndiNode = getLocalizedIndividual(processIndi,false,newCalcAlgContext); |
| 5221 |
CConceptProcessingQueue* newConProcQueue = newLocIndiNode->getConceptProcessingQueue(true); |
| 5222 |
|
| 5223 |
|
| 5224 |
CReusingIndividualNodeConceptExpansionData* locReusingData = newLocIndiNode->getReusingIndividualNodeConceptExpansionData(true); |
| 5225 |
if (!locReusingData) { |
| 5226 |
CMemoryAllocationManager* taskMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5227 |
CReusingIndividualNodeConceptExpansionData* reusingData = newLocIndiNode->getReusingIndividualNodeConceptExpansionData(false); |
| 5228 |
locReusingData = CObjectAllocator<CReusingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5229 |
locReusingData->initBlockingExpansionData(reusingData); |
| 5230 |
newLocIndiNode->setReusingIndividualNodeConceptExpansionData(locReusingData); |
| 5231 |
} |
| 5232 |
locReusingData->incReusingTriedCount(); |
| 5233 |
|
| 5234 |
locReusingData->setBlockingConceptCount(0); |
| 5235 |
locReusingData->setBlockingConceptSignature(0); |
| 5236 |
locReusingData->setLastSubsetTestedConceptDescriptor(nullptr); |
| 5237 |
locReusingData->setContinuousExpandedContainedConceptCount(0); |
| 5238 |
locReusingData->setBlockerIndividualNode(nullptr); |
| 5239 |
locReusingData->setLastUpdatedConceptCount(0); |
| 5240 |
locReusingData->setLastUpdatedConceptExpansionCount(0); |
| 5241 |
locReusingData->setBlockingReviewMarked(false); |
| 5242 |
|
| 5243 |
|
| 5244 |
|
| 5245 |
if (reusingAlternative) { |
| 5246 |
|
| 5247 |
CNonDeterministicDependencyTrackPoint* newDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseDepNode,false,newCalcAlgContext); |
| 5248 |
|
| 5249 |
CREUSECONCEPTSDependencyNode* reuseConceptsDepNode = createREUSECONCEPTSDependency(processIndi,nullptr,newDependencyTrackPoint,newCalcAlgContext); |
| 5250 |
CNonDeterministicDependencyTrackPoint* reuseConceptsDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseConceptsDepNode,true,newCalcAlgContext); |
| 5251 |
|
| 5252 |
locReusingData->setReuseConceptsDependencyTrackPoint(reuseConceptsDependencyTrackPoint); |
| 5253 |
|
| 5254 |
CReapplyConceptLabelSet* indiLabelSet = newLocIndiNode->getReapplyConceptLabelSet(true); |
| 5255 |
|
| 5256 |
|
| 5257 |
locReusingData->setBlockingConceptCount(indiLabelSet->getConceptCount()); |
| 5258 |
locReusingData->setBlockingConceptSignature(indiLabelSet->getConceptSignatureValue()); |
| 5259 |
locReusingData->setLastSubsetTestedConceptDescriptor(indiLabelSet->getAddingSortedConceptDescriptionLinker()); |
| 5260 |
locReusingData->setContinuousExpandedContainedConceptCount(0); |
| 5261 |
locReusingData->setBlockerIndividualNode(reuseIndi); |
| 5262 |
locReusingData->setLastUpdatedConceptCount(0); |
| 5263 |
locReusingData->setLastUpdatedConceptExpansionCount(0); |
| 5264 |
|
| 5265 |
|
| 5266 |
for (CXLinker<CConceptDescriptor*>* nonDetExpLinkerIt = nonDetExpLinker; nonDetExpLinkerIt; nonDetExpLinkerIt = nonDetExpLinkerIt->getNext()) { |
| 5267 |
CConceptDescriptor* reusingConDes = nonDetExpLinkerIt->getData(); |
| 5268 |
|
| 5269 |
if (!indiLabelSet->containsConceptDescriptor(reusingConDes)) { |
| 5270 |
// add non-deterministically the missing concept |
| 5271 |
addConceptToIndividual(reusingConDes->getConcept(),reusingConDes->isNegated(),newLocIndiNode,reuseConceptsDependencyTrackPoint,false,true,newCalcAlgContext); |
| 5272 |
} |
| 5273 |
} |
| 5274 |
|
| 5275 |
newLocIndiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFREUSINGINDIVIDUAL); |
| 5276 |
|
| 5277 |
addReusingBlockerFollowing(newLocIndiNode,newCalcAlgContext); |
| 5278 |
propagateIndirectSuccessorReuseBlocked(newLocIndiNode,newCalcAlgContext); |
| 5279 |
} else { |
| 5280 |
CNonDeterministicDependencyTrackPoint* newDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseDepNode,false,newCalcAlgContext); |
| 5281 |
locReusingData->incReusingFailedCount(); |
| 5282 |
locReusingData->addReusingFailedSignatureAndIndividual(reuseIndi->getReapplyConceptLabelSet(false)->getConceptSignatureValue(),reuseIndi->getIndividualNodeID()); |
| 5283 |
} |
| 5284 |
|
| 5285 |
prepareBranchedTaskProcessing(newLocIndiNode,newTaskIt,newCalcAlgContext); |
| 5286 |
|
| 5287 |
// set new task priority |
| 5288 |
double newTaskPriority = calcAlgContext->getUsedTaskPriorityStrategy()->getPriorityForTaskReusing(newSatCalcTask,calcAlgContext->getUsedSatisfiableCalculationTask(),reusingAlternative); |
| 5289 |
newSatCalcTask->setTaskPriority(newTaskPriority); |
| 5290 |
|
| 5291 |
newTaskIt = (CSatisfiableCalculationTask*)newTaskIt->getNext(); |
| 5292 |
} |
| 5293 |
|
| 5294 |
processorContext->getTaskProcessorCommunicator()->communicateTaskCreation(newTaskList); |
| 5295 |
|
| 5296 |
throw CCalculationStopProcessingException(true); |
| 5297 |
} |
| 5298 |
} |
| 5299 |
|
| 5300 |
|
| 5301 |
|
| 5302 |
|
| 5303 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addReusingBlockerFollowing(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5304 |
CReusingIndividualNodeConceptExpansionData* reusingData = individualNode->getReusingIndividualNodeConceptExpansionData(false); |
| 5305 |
if (reusingData) { |
| 5306 |
CIndividualProcessNode* blockerIndividualNode = reusingData->getBlockerIndividualNode(); |
| 5307 |
CIndividualProcessNode* locBlockerIndividualNode = getLocalizedIndividual(blockerIndividualNode,true,calcAlgContext); |
| 5308 |
CBlockingFollowSet* followSet = locBlockerIndividualNode->getBlockingFollowSet(true); |
| 5309 |
followSet->insert(individualNode->getIndividualNodeID()); |
| 5310 |
individualNode->setFollowingIndividualNode(locBlockerIndividualNode); |
| 5311 |
return true; |
| 5312 |
} |
| 5313 |
return false; |
| 5314 |
} |
| 5315 |
|
| 5316 |
|
| 5317 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::removeReusingBlockerFollowing(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5318 |
individualNode->setFollowingIndividualNode(nullptr); |
| 5319 |
CReusingIndividualNodeConceptExpansionData* reusingData = individualNode->getReusingIndividualNodeConceptExpansionData(false); |
| 5320 |
if (reusingData) { |
| 5321 |
CIndividualProcessNode* blockerIndividualNode = reusingData->getBlockerIndividualNode(); |
| 5322 |
CIndividualProcessNode* locBlockerIndividualNode = getLocalizedIndividual(blockerIndividualNode,true,calcAlgContext); |
| 5323 |
CBlockingFollowSet* followSet = locBlockerIndividualNode->getBlockingFollowSet(true); |
| 5324 |
followSet->remove(individualNode->getIndividualNodeID()); |
| 5325 |
return true; |
| 5326 |
} |
| 5327 |
return false; |
| 5328 |
} |
| 5329 |
|
| 5330 |
|
| 5331 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isSignatureBlockedProcessingBlocked(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5332 |
bool processingBlocked = false; |
| 5333 |
bool sigBlocked = detectIndividualNodeSignatureBlockingStatus(individualNode,calcAlgContext); |
| 5334 |
if (sigBlocked) { |
| 5335 |
// block processing only for successors of satisfiable cached nodes |
| 5336 |
processingBlocked = individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED); |
| 5337 |
} |
| 5338 |
return processingBlocked; |
| 5339 |
} |
| 5340 |
|
| 5341 |
|
| 5342 |
|
| 5343 |
|
| 5344 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::testAlternativeBlocked(CIndividualProcessNode*& individualNode, CBlockingAlternativeData* blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5345 |
bool blocked = false; |
| 5346 |
|
| 5347 |
if (blockAltData->getBlockingAlternativeDataType() == CBlockingAlternativeData::BADSIGNATUREBLOCKINGCANDIDATE) { |
| 5348 |
if (mConfSignatureMirroringBlocking) { |
| 5349 |
CBlockingAlternativeSignatureBlockingCandidateData* sigBlockCandData = (CBlockingAlternativeSignatureBlockingCandidateData*)blockAltData; |
| 5350 |
CIndividualProcessNode* blockerNode = sigBlockCandData->getSignatureBlockingCandidateNode(); |
| 5351 |
|
| 5352 |
|
| 5353 |
STATINC(SIGNATUREMIRRORINGBLOCKINGESTABLISHCOUNT,calcAlgContext); |
| 5354 |
cint64 prevBlockerConSetCount = blockerNode->getReapplyConceptLabelSet(false)->getConceptCount(); |
| 5355 |
if (establishIndividualNodeSignatureBlocking(individualNode,blockerNode,calcAlgContext)) { |
| 5356 |
|
| 5357 |
//if (blockerNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 5358 |
// propagateIndividualNodeNominalConnectionToAncestors(individualNode,calcAlgContext); |
| 5359 |
//} |
| 5360 |
if (blockerNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 5361 |
propagateIndividualNodeNominalConnectionStatusToAncestors(individualNode,blockerNode,calcAlgContext); |
| 5362 |
} |
| 5363 |
|
| 5364 |
if (prevBlockerConSetCount != blockerNode->getReapplyConceptLabelSet(false)->getConceptCount()) { |
| 5365 |
addIndividualToBlockingUpdateReviewProcessingQueue(individualNode,calcAlgContext); |
| 5366 |
} |
| 5367 |
addSignatureBlockingBlockerFollowing(individualNode,calcAlgContext); |
| 5368 |
STATINC(SIGNATUREMIRRORINGBLOCKINGADDFOLLOWINGCOUNT,calcAlgContext); |
| 5369 |
calcAlgContext->getProcessTagger()->incCurrentBlockingFollowTag(); |
| 5370 |
|
| 5371 |
individualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED); |
| 5372 |
propagateIndirectSuccessorSignatureBlocked(individualNode,calcAlgContext); |
| 5373 |
|
| 5374 |
updateBlockingReviewMarking(individualNode,true,calcAlgContext); |
| 5375 |
blocked = true; |
| 5376 |
} |
| 5377 |
} |
| 5378 |
} |
| 5379 |
|
| 5380 |
return blocked; |
| 5381 |
} |
| 5382 |
|
| 5383 |
|
| 5384 |
|
| 5385 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::detectIndividualNodeSignatureBlockingStatus(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5386 |
// TODO: 1. search nodes with identical signatures, 2. check signature compatibility, 3. expand concepts and establish blocking status, 4. block successor generation, |
| 5387 |
// 5. hold blocking status as long subset, 6. validate or remove blocking status at the end of completion graph construction |
| 5388 |
|
| 5389 |
|
| 5390 |
bool wasBlockingCached = individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED); |
| 5391 |
|
| 5392 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED)) { |
| 5393 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHEDABOLISHED)) { |
| 5394 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHEDABOLISHED); |
| 5395 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED); |
| 5396 |
} else { |
| 5397 |
return true; |
| 5398 |
} |
| 5399 |
} |
| 5400 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSIGNATUREBLOCKINGCACHEDDUEDIRECTMODIFIED)) { |
| 5401 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSIGNATUREBLOCKINGCACHEDDUEDIRECTMODIFIED); |
| 5402 |
} |
| 5403 |
|
| 5404 |
bool newBlockingCached = wasBlockingCached; |
| 5405 |
|
| 5406 |
if (mConfSignatureMirroringBlocking) { |
| 5407 |
bool continueBlockerSearch = true; |
| 5408 |
if (individualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING | CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED)) { |
| 5409 |
continueBlockerSearch = false; |
| 5410 |
} |
| 5411 |
if (wasBlockingCached) { |
| 5412 |
STATINC(SIGNATUREMIRRORINGBLOCKINGREFRESHCOUNT,calcAlgContext); |
| 5413 |
if (continueBlockerSearch) { |
| 5414 |
newBlockingCached = refreshIndividualNodeSignatureBlocking(individualNode,calcAlgContext); |
| 5415 |
} |
| 5416 |
if (!newBlockingCached) { |
| 5417 |
// remove connection from blocker node |
| 5418 |
STATINC(SIGNATUREMIRRORINGBLOCKINGREFRESHLOSEDCOUNT,calcAlgContext); |
| 5419 |
STATINC(SIGNATUREMIRRORINGBLOCKINGREMOVEFOLLOWINGCOUNT,calcAlgContext); |
| 5420 |
removeSignatureBlockingBlockerFollowing(individualNode,calcAlgContext); |
| 5421 |
} else { |
| 5422 |
calcAlgContext->getProcessTagger()->incCurrentBlockingFollowTag(); |
| 5423 |
} |
| 5424 |
} |
| 5425 |
|
| 5426 |
while (continueBlockerSearch && !newBlockingCached) { |
| 5427 |
STATINC(SIGNATUREMIRRORINGBLOCKINGSEARCHCOUNT,calcAlgContext); |
| 5428 |
CIndividualProcessNode* blockerNode = searchSignatureIndividualNodeBlocker(individualNode,calcAlgContext); |
| 5429 |
if (blockerNode) { |
| 5430 |
STATINC(SIGNATUREMIRRORINGBLOCKINGESTABLISHCOUNT,calcAlgContext); |
| 5431 |
cint64 prevBlockerConSetCount = blockerNode->getReapplyConceptLabelSet(false)->getConceptCount(); |
| 5432 |
if (establishIndividualNodeSignatureBlocking(individualNode,blockerNode,calcAlgContext)) { |
| 5433 |
|
| 5434 |
//if (blockerNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 5435 |
// propagateIndividualNodeNominalConnectionToAncestors(individualNode,calcAlgContext); |
| 5436 |
//} |
| 5437 |
if (blockerNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 5438 |
propagateIndividualNodeNominalConnectionStatusToAncestors(individualNode,blockerNode,calcAlgContext); |
| 5439 |
} |
| 5440 |
|
| 5441 |
newBlockingCached = true; |
| 5442 |
if (prevBlockerConSetCount != blockerNode->getReapplyConceptLabelSet(false)->getConceptCount()) { |
| 5443 |
addIndividualToBlockingUpdateReviewProcessingQueue(individualNode,calcAlgContext); |
| 5444 |
} |
| 5445 |
addSignatureBlockingBlockerFollowing(individualNode,calcAlgContext); |
| 5446 |
STATINC(SIGNATUREMIRRORINGBLOCKINGADDFOLLOWINGCOUNT,calcAlgContext); |
| 5447 |
calcAlgContext->getProcessTagger()->incCurrentBlockingFollowTag(); |
| 5448 |
} |
| 5449 |
} else { |
| 5450 |
continueBlockerSearch = false; |
| 5451 |
} |
| 5452 |
} |
| 5453 |
|
| 5454 |
updateBlockingReviewMarking(individualNode,newBlockingCached,calcAlgContext); |
| 5455 |
|
| 5456 |
if (newBlockingCached && !wasBlockingCached) { |
| 5457 |
// activate caching status |
| 5458 |
individualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED); |
| 5459 |
propagateIndirectSuccessorSignatureBlocked(individualNode,calcAlgContext); |
| 5460 |
} else if (wasBlockingCached && !newBlockingCached) { |
| 5461 |
// deactivate caching status |
| 5462 |
individualNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED); |
| 5463 |
reactivateIndirectSignatureBlockedSuccessors(individualNode,false,calcAlgContext); |
| 5464 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(individualNode,calcAlgContext); |
| 5465 |
} |
| 5466 |
} |
| 5467 |
return newBlockingCached; |
| 5468 |
} |
| 5469 |
|
| 5470 |
|
| 5471 |
|
| 5472 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addSignatureBlockingBlockerFollowing(CIndividualProcessNode*& blockingIndividualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5473 |
CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 5474 |
if (sigBlockingData) { |
| 5475 |
CIndividualProcessNode* blockerIndividualNode = sigBlockingData->getBlockerIndividualNode(); |
| 5476 |
CIndividualProcessNode* locBlockerIndividualNode = getLocalizedIndividual(blockerIndividualNode,true,calcAlgContext); |
| 5477 |
CBlockingFollowSet* sigFollowSet = locBlockerIndividualNode->getBlockingFollowSet(true); |
| 5478 |
sigFollowSet->insert(blockingIndividualNode->getIndividualNodeID()); |
| 5479 |
blockingIndividualNode->setFollowingIndividualNode(locBlockerIndividualNode); |
| 5480 |
return true; |
| 5481 |
} |
| 5482 |
return false; |
| 5483 |
} |
| 5484 |
|
| 5485 |
|
| 5486 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::removeSignatureBlockingBlockerFollowing(CIndividualProcessNode*& blockingIndividualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5487 |
blockingIndividualNode->setFollowingIndividualNode(nullptr); |
| 5488 |
CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 5489 |
if (sigBlockingData) { |
| 5490 |
CIndividualProcessNode* blockerIndividualNode = sigBlockingData->getBlockerIndividualNode(); |
| 5491 |
CIndividualProcessNode* locBlockerIndividualNode = getLocalizedIndividual(blockerIndividualNode,true,calcAlgContext); |
| 5492 |
CBlockingFollowSet* sigFollowSet = locBlockerIndividualNode->getBlockingFollowSet(true); |
| 5493 |
sigFollowSet->remove(blockingIndividualNode->getIndividualNodeID()); |
| 5494 |
return true; |
| 5495 |
} |
| 5496 |
return false; |
| 5497 |
} |
| 5498 |
|
| 5499 |
|
| 5500 |
|
| 5501 |
|
| 5502 |
void CCalculationTableauCompletionTaskHandleAlgorithm::rebuildSignatureBlockingCandidateHash(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5503 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5504 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 5505 |
|
| 5506 |
|
| 5507 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 5508 |
CSignatureBlockingCandidateHash* sigBlockCandHash = processingDataBox->getSignatureBlockingCandidateHash(false); |
| 5509 |
|
| 5510 |
if (sigBlockCandHash) { |
| 5511 |
|
| 5512 |
CSignatureBlockingCandidateHash* newSigBlockCandHash = CObjectParameterizingAllocator< CSignatureBlockingCandidateHash,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,processContext); |
| 5513 |
|
| 5514 |
CSignatureIterator sigIt(sigBlockCandHash->getSignatureIterator()); |
| 5515 |
while (sigIt.hasNext()) { |
| 5516 |
cint64 signature = sigIt.getSignature(); |
| 5517 |
CXLinker<cint64>* newCandidateLinker = nullptr; |
| 5518 |
CXLinker<cint64>* candidateLinker = sigIt.getCandidateLinker(); |
| 5519 |
for (CXLinker<cint64>* candidateLinkerIt = candidateLinker; candidateLinkerIt; candidateLinkerIt = candidateLinkerIt->getNext()) { |
| 5520 |
cint64 candIndiID = candidateLinkerIt->getData(); |
| 5521 |
CIndividualProcessNode* candIndiNode = getUpToDateIndividual(candIndiID,calcAlgContext); |
| 5522 |
if (isIndividualNodeValidBlocker(candIndiNode,calcAlgContext)) { |
| 5523 |
CXLinker<cint64>* tmpNewCandLinker = CObjectAllocator< CXLinker<cint64> >::allocateAndConstruct(taskMemMan); |
| 5524 |
newCandidateLinker = tmpNewCandLinker->initLinker(candIndiNode->getIndividualNodeID(),newCandidateLinker); |
| 5525 |
} |
| 5526 |
} |
| 5527 |
if (newCandidateLinker) { |
| 5528 |
newSigBlockCandHash->insertSignatureBlockingCandidates(signature,newCandidateLinker); |
| 5529 |
} |
| 5530 |
sigIt.moveNext(); |
| 5531 |
} |
| 5532 |
processingDataBox->setSignatureBlockingCandidateHash(newSigBlockCandHash); |
| 5533 |
} |
| 5534 |
} |
| 5535 |
|
| 5536 |
|
| 5537 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::searchSignatureIndividualNodeBlocker(CIndividualProcessNode*& blockingNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5538 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 5539 |
CSignatureBlockingCandidateHash* sigBlockCandHash = processingDataBox->getSignatureBlockingCandidateHash(false); |
| 5540 |
CReapplyConceptLabelSet* conSet = blockingNode->getReapplyConceptLabelSet(false); |
| 5541 |
if (sigBlockCandHash && conSet) { |
| 5542 |
cint64 conCount = conSet->getConceptCount(); |
| 5543 |
if (!blockingNode->isInvalidSignatureBlocking() && blockingNode->getLastConceptCountSearchBlockingCandidate() != conCount) { |
| 5544 |
blockingNode->setLastConceptCountSearchBlockingCandidate(conCount); |
| 5545 |
|
| 5546 |
cint64 conSig = conSet->getConceptSignatureValue(); |
| 5547 |
cint64 newCandCount = sigBlockCandHash->getBlockingCandidatesCount(conSig); |
| 5548 |
cint64 lastCandCount = blockingNode->getLastSearchBlockerCandidateCount(); |
| 5549 |
cint64 lastCandSignature = blockingNode->getLastSearchBlockerCandidateSignature(); |
| 5550 |
if (lastCandSignature != conSig) { |
| 5551 |
lastCandCount = 0; |
| 5552 |
} |
| 5553 |
blockingNode->setLastSearchBlockerCandidateSignature(conSig); |
| 5554 |
if (newCandCount != lastCandCount) { |
| 5555 |
|
| 5556 |
cint64 candDiffCount = newCandCount - lastCandCount; |
| 5557 |
|
| 5558 |
CSignatureBlockingCandidateIterator candIt(sigBlockCandHash->getBlockingCandidatesIterator(conSig)); |
| 5559 |
while (candIt.hasNext() && candDiffCount-- > 0 && !blockingNode->isInvalidSignatureBlocking()) { |
| 5560 |
cint64 candIndiID = candIt.next(true); |
| 5561 |
if (candIndiID != blockingNode->getIndividualNodeID()) { |
| 5562 |
CIndividualProcessNode* candIndiNode = getUpToDateIndividual(candIndiID,calcAlgContext); |
| 5563 |
STATINC(SIGNATUREMIRRORINGBLOCKINGCANDIDATEREGARDEDCOUNT,calcAlgContext); |
| 5564 |
if (isIndividualNodeValidBlocker(candIndiNode,calcAlgContext)) { |
| 5565 |
bool compatible = hasCompatibleConceptSetSignature(blockingNode,conSet,candIndiNode,calcAlgContext); |
| 5566 |
if (compatible) { |
| 5567 |
blockingNode->setLastSearchBlockerCandidateCount(newCandCount-candDiffCount); |
| 5568 |
return candIndiNode; |
| 5569 |
} else { |
| 5570 |
STATINC(SIGNATUREMIRRORINGBLOCKINGCANDIDATEREGARDEDINCOMPATIBLECOUNT,calcAlgContext); |
| 5571 |
} |
| 5572 |
} else { |
| 5573 |
STATINC(SIGNATUREMIRRORINGBLOCKINGCANDIDATEREGARDEDINVALIDCOUNT,calcAlgContext); |
| 5574 |
} |
| 5575 |
} |
| 5576 |
} |
| 5577 |
blockingNode->setLastSearchBlockerCandidateCount(newCandCount); |
| 5578 |
|
| 5579 |
} |
| 5580 |
} |
| 5581 |
} |
| 5582 |
return nullptr; |
| 5583 |
} |
| 5584 |
|
| 5585 |
|
| 5586 |
|
| 5587 |
|
| 5588 |
|
| 5589 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addSignatureIndividualNodeBlockerCandidate(CIndividualProcessNode*& indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5590 |
if (indiNode->getBlockingCachingSavedCandidateCount() <= mMaxBlockingCachingSavedCandidateCount) { |
| 5591 |
indiNode->incBlockingCachingSavedCandidateCount(); |
| 5592 |
if (isIndividualNodeValidBlocker(indiNode,calcAlgContext)) { |
| 5593 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 5594 |
if (conSet) { |
| 5595 |
cint64 conCount = conSet->getConceptCount(); |
| 5596 |
if (indiNode->getLastConceptCountCachedBlockingCandidate() != conCount) { |
| 5597 |
STATINC(SIGNATURESAVINGCOUNT,calcAlgContext); |
| 5598 |
cint64 conSig = conSet->getConceptSignatureValue(); |
| 5599 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 5600 |
CSignatureBlockingCandidateHash* sigBlockCandHash = processingDataBox->getSignatureBlockingCandidateHash(true); |
| 5601 |
sigBlockCandHash->insertSignatureBlockingCandidate(conSig,indiNode); |
| 5602 |
indiNode->setLastConceptCountCachedBlockingCandidate(conCount); |
| 5603 |
return true; |
| 5604 |
} |
| 5605 |
} |
| 5606 |
} |
| 5607 |
} |
| 5608 |
return false; |
| 5609 |
} |
| 5610 |
|
| 5611 |
|
| 5612 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::establishIndividualNodeSignatureBlocking(CIndividualProcessNode*& blockingIndividualNode, CIndividualProcessNode*& blockerIndividualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5613 |
bool blockingEstablished = false; |
| 5614 |
anlyzeIndiviudalNodesConceptExpansion(blockerIndividualNode,calcAlgContext); |
| 5615 |
CIndividualNodeAnalizedConceptExpansionData* blockerAnalizedConExpData = blockerIndividualNode->getAnalizedConceptExpansionData(false); |
| 5616 |
if (blockerAnalizedConExpData) { |
| 5617 |
if (!blockerAnalizedConExpData->isInvalidBlocker()) { |
| 5618 |
CReapplyConceptLabelSet* blockingConSet = blockingIndividualNode->getReapplyConceptLabelSet(true); |
| 5619 |
cint64 blockingConSetCount = blockingConSet->getConceptCount(); |
| 5620 |
cint64 blockingConSetSignature = blockingConSet->getConceptSignatureValue(); |
| 5621 |
CConceptDescriptor* blockingLastConDes = blockingConSet->getAddingSortedConceptDescriptionLinker(); |
| 5622 |
CSignatureBlockingIndividualNodeConceptExpansionData* locSigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(true); |
| 5623 |
if (!locSigBlockingData) { |
| 5624 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5625 |
CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 5626 |
locSigBlockingData = CObjectAllocator<CSignatureBlockingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5627 |
locSigBlockingData->initBlockingExpansionData(sigBlockingData); |
| 5628 |
blockingIndividualNode->setSignatureBlockingIndividualNodeConceptExpansionData(locSigBlockingData); |
| 5629 |
} |
| 5630 |
locSigBlockingData->setBlockingConceptCount(blockingConSetCount); |
| 5631 |
locSigBlockingData->setBlockingConceptSignature(blockingConSetSignature); |
| 5632 |
locSigBlockingData->setLastSubsetTestedConceptDescriptor(blockingLastConDes); |
| 5633 |
locSigBlockingData->setContinuousExpandedContainedConceptCount(0); |
| 5634 |
locSigBlockingData->setBlockerIndividualNode(blockerIndividualNode); |
| 5635 |
locSigBlockingData->setLastUpdatedConceptCount(0); |
| 5636 |
locSigBlockingData->setLastUpdatedConceptExpansionCount(0); |
| 5637 |
|
| 5638 |
updateSignatureBlockingConceptExpansion(blockingIndividualNode,locSigBlockingData,blockerIndividualNode,blockerAnalizedConExpData,calcAlgContext); |
| 5639 |
|
| 5640 |
|
| 5641 |
// set blocking status |
| 5642 |
blockingEstablished = true; |
| 5643 |
|
| 5644 |
// is still subset after added expansions concepts |
| 5645 |
CReapplyConceptLabelSet* blockerConSet = blockerIndividualNode->getReapplyConceptLabelSet(false); |
| 5646 |
if (locSigBlockingData->isIdenticConceptSetRequired()) { |
| 5647 |
if (blockingConSet->getConceptSignatureValue() != blockerConSet->getConceptSignatureValue()) { |
| 5648 |
return false; |
| 5649 |
} |
| 5650 |
if (blockingConSet->getConceptCount() != blockerConSet->getConceptCount()) { |
| 5651 |
return false; |
| 5652 |
} |
| 5653 |
} |
| 5654 |
CConceptDescriptor* lastSubSetTestConDes = locSigBlockingData->getLastSubsetTestedConceptDescriptor(); |
| 5655 |
CConceptDescriptor* addingSortedConDes = blockingConSet->getAddingSortedConceptDescriptionLinker(); |
| 5656 |
if (addingSortedConDes != lastSubSetTestConDes) { |
| 5657 |
bool stillSubset = true; |
| 5658 |
CConceptDescriptor* addingSortedConDesIt = addingSortedConDes; |
| 5659 |
while (blockingEstablished && addingSortedConDesIt != lastSubSetTestConDes && stillSubset) { |
| 5660 |
CConcept* concept = addingSortedConDesIt->getConcept(); |
| 5661 |
if (!blockerConSet->containsConcept(concept)) { |
| 5662 |
stillSubset = false; |
| 5663 |
} |
| 5664 |
addingSortedConDesIt = addingSortedConDesIt->getNext(); |
| 5665 |
} |
| 5666 |
if (!stillSubset && mOptSignatureMirroringBlockingForceSubset) { |
| 5667 |
blockingEstablished = false; |
| 5668 |
} |
| 5669 |
locSigBlockingData->setConceptSetStillSubset(stillSubset); |
| 5670 |
if (stillSubset) { |
| 5671 |
locSigBlockingData->setLastSubsetTestedConceptDescriptor(addingSortedConDes); |
| 5672 |
} |
| 5673 |
} |
| 5674 |
} else { |
| 5675 |
blockingIndividualNode->setInvalidSignatureBlocking(true); |
| 5676 |
blockingEstablished = false; |
| 5677 |
} |
| 5678 |
} |
| 5679 |
return blockingEstablished; |
| 5680 |
} |
| 5681 |
|
| 5682 |
|
| 5683 |
|
| 5684 |
|
| 5685 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::refreshIndividualNodeSignatureBlocking(CIndividualProcessNode*& blockingIndividualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5686 |
CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 5687 |
if (sigBlockingData) { |
| 5688 |
CIndividualProcessNode* blockerIndividualNode = sigBlockingData->getBlockerIndividualNode(); |
| 5689 |
blockerIndividualNode = getUpToDateIndividual(blockerIndividualNode,calcAlgContext); |
| 5690 |
if (!isIndividualNodeValidBlocker(blockerIndividualNode,calcAlgContext)) { |
| 5691 |
return false; |
| 5692 |
} |
| 5693 |
if (blockingIndividualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING)) { |
| 5694 |
return false; |
| 5695 |
} |
| 5696 |
anlyzeIndiviudalNodesConceptExpansion(blockerIndividualNode,calcAlgContext); |
| 5697 |
// test is still subset? |
| 5698 |
CReapplyConceptLabelSet* blockingConSet = blockingIndividualNode->getReapplyConceptLabelSet(false); |
| 5699 |
CReapplyConceptLabelSet* blockerConSet = blockerIndividualNode->getReapplyConceptLabelSet(false); |
| 5700 |
CConceptDescriptor* lastSubSetTestConDes = sigBlockingData->getLastSubsetTestedConceptDescriptor(); |
| 5701 |
CConceptDescriptor* addingSortedConDes = blockingConSet->getAddingSortedConceptDescriptionLinker(); |
| 5702 |
CIndividualNodeAnalizedConceptExpansionData* blockerAnalizedConExpData = blockerIndividualNode->getAnalizedConceptExpansionData(false); |
| 5703 |
if (!blockerAnalizedConExpData->isInvalidBlocker()) { |
| 5704 |
if (addingSortedConDes != lastSubSetTestConDes || blockerAnalizedConExpData->getExpansionConceptCount() != sigBlockingData->getLastUpdatedConceptExpansionCount() || sigBlockingData->isIdenticConceptSetRequired() && blockingConSet->getConceptCount() != blockerConSet->getConceptCount()) { |
| 5705 |
bool stillSubset = true; |
| 5706 |
CConceptDescriptor* addingSortedConDesIt = addingSortedConDes; |
| 5707 |
while (addingSortedConDesIt != lastSubSetTestConDes && stillSubset) { |
| 5708 |
CConcept* concept = addingSortedConDesIt->getConcept(); |
| 5709 |
bool conNegation = addingSortedConDesIt->isNegated(); |
| 5710 |
if (!blockerConSet->containsConcept(concept,conNegation)) { |
| 5711 |
stillSubset = false; |
| 5712 |
} |
| 5713 |
addingSortedConDesIt = addingSortedConDesIt->getNext(); |
| 5714 |
} |
| 5715 |
if (!stillSubset && mOptSignatureMirroringBlockingForceSubset) { |
| 5716 |
return false; |
| 5717 |
} |
| 5718 |
CSignatureBlockingIndividualNodeConceptExpansionData* locSigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(true); |
| 5719 |
if (!locSigBlockingData) { |
| 5720 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5721 |
CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 5722 |
locSigBlockingData = CObjectAllocator<CSignatureBlockingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5723 |
locSigBlockingData->initBlockingExpansionData(sigBlockingData); |
| 5724 |
blockingIndividualNode->setSignatureBlockingIndividualNodeConceptExpansionData(locSigBlockingData); |
| 5725 |
} |
| 5726 |
locSigBlockingData->setLastSubsetTestedConceptDescriptor(addingSortedConDes); |
| 5727 |
|
| 5728 |
// update expansions concepts |
| 5729 |
updateSignatureBlockingConceptExpansion(blockingIndividualNode,locSigBlockingData,blockerIndividualNode,blockerAnalizedConExpData,calcAlgContext); |
| 5730 |
|
| 5731 |
if (mConfDirectRulePreprocessing || locSigBlockingData->isIdenticConceptSetRequired()) { |
| 5732 |
blockingConSet = blockingIndividualNode->getReapplyConceptLabelSet(false); |
| 5733 |
if (locSigBlockingData->isIdenticConceptSetRequired()) { |
| 5734 |
if (blockingConSet->getConceptSignatureValue() != blockerConSet->getConceptSignatureValue()) { |
| 5735 |
return false; |
| 5736 |
} |
| 5737 |
if (blockingConSet->getConceptCount() != blockerConSet->getConceptCount()) { |
| 5738 |
return false; |
| 5739 |
} |
| 5740 |
} |
| 5741 |
// validate still subset |
| 5742 |
addingSortedConDes = blockingConSet->getAddingSortedConceptDescriptionLinker(); |
| 5743 |
lastSubSetTestConDes = locSigBlockingData->getLastSubsetTestedConceptDescriptor(); |
| 5744 |
if (addingSortedConDes != lastSubSetTestConDes) { |
| 5745 |
CConceptDescriptor* addingSortedConDesIt = addingSortedConDes; |
| 5746 |
while (addingSortedConDesIt != lastSubSetTestConDes && stillSubset) { |
| 5747 |
CConcept* concept = addingSortedConDesIt->getConcept(); |
| 5748 |
bool conNegation = addingSortedConDesIt->isNegated(); |
| 5749 |
if (!blockerConSet->containsConcept(concept,conNegation)) { |
| 5750 |
stillSubset = false; |
| 5751 |
} |
| 5752 |
addingSortedConDesIt = addingSortedConDesIt->getNext(); |
| 5753 |
} |
| 5754 |
locSigBlockingData->setConceptSetStillSubset(stillSubset); |
| 5755 |
if (stillSubset) { |
| 5756 |
locSigBlockingData->setLastSubsetTestedConceptDescriptor(addingSortedConDes); |
| 5757 |
} else { |
| 5758 |
if (mOptSignatureMirroringBlockingForceSubset) { |
| 5759 |
return false; |
| 5760 |
} |
| 5761 |
} |
| 5762 |
} |
| 5763 |
} |
| 5764 |
} |
| 5765 |
return true; |
| 5766 |
} else { |
| 5767 |
blockingIndividualNode->setInvalidSignatureBlocking(true); |
| 5768 |
return false; |
| 5769 |
} |
| 5770 |
} |
| 5771 |
return false; |
| 5772 |
} |
| 5773 |
|
| 5774 |
|
| 5775 |
|
| 5776 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::updateBlockingReviewMarking(CIndividualProcessNode*& blockingIndividualNode, bool isBlocked, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5777 |
CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 5778 |
cint64 indiID = blockingIndividualNode->getIndividualNodeID(); |
| 5779 |
if (sigBlockingData) { |
| 5780 |
if (isBlocked && !sigBlockingData->isBlockingReviewMarked()) { |
| 5781 |
CIndividualProcessNode* blockerNode = getUpToDateIndividual(sigBlockingData->getBlockerIndividualNode(),calcAlgContext); |
| 5782 |
if (blockerNode->getReapplyConceptLabelSet(false)->getConceptCount() != blockingIndividualNode->getReapplyConceptLabelSet(false)->getConceptCount() || !sigBlockingData->isConceptSetStillSubset()) { |
| 5783 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 5784 |
CSignatureBlockingReviewSet* revSet = processingDataBox->getSignatureBlockingReviewSet(true); |
| 5785 |
|
| 5786 |
revSet->getReviewData(sigBlockingData->isConceptSetStillSubset())->insert(blockingIndividualNode->getIndividualAncestorDepth(),indiID); |
| 5787 |
|
| 5788 |
CSignatureBlockingIndividualNodeConceptExpansionData* locSigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(true); |
| 5789 |
if (!locSigBlockingData) { |
| 5790 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5791 |
locSigBlockingData = CObjectAllocator<CSignatureBlockingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5792 |
locSigBlockingData->initBlockingExpansionData(sigBlockingData); |
| 5793 |
blockingIndividualNode->setSignatureBlockingIndividualNodeConceptExpansionData(locSigBlockingData); |
| 5794 |
} |
| 5795 |
locSigBlockingData->setBlockingReviewMarked(true); |
| 5796 |
locSigBlockingData->setBlockingSubsetReviewMarked(sigBlockingData->isConceptSetStillSubset()); |
| 5797 |
return true; |
| 5798 |
} |
| 5799 |
} |
| 5800 |
if (sigBlockingData->isBlockingReviewMarked()) { |
| 5801 |
CIndividualProcessNode* blockerNode = getUpToDateIndividual(sigBlockingData->getBlockerIndividualNode(),calcAlgContext); |
| 5802 |
if (!isBlocked || blockerNode->getReapplyConceptLabelSet(false)->getConceptCount() == blockingIndividualNode->getReapplyConceptLabelSet(false)->getConceptCount() && sigBlockingData->isConceptSetStillSubset()) { |
| 5803 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 5804 |
CSignatureBlockingReviewSet* revSet = processingDataBox->getSignatureBlockingReviewSet(true); |
| 5805 |
|
| 5806 |
revSet->getReviewData(sigBlockingData->isBlockingSubsetReviewMarked())->remove(indiID); |
| 5807 |
|
| 5808 |
CSignatureBlockingIndividualNodeConceptExpansionData* locSigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(true); |
| 5809 |
if (!locSigBlockingData) { |
| 5810 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5811 |
locSigBlockingData = CObjectAllocator<CSignatureBlockingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5812 |
locSigBlockingData->initBlockingExpansionData(sigBlockingData); |
| 5813 |
blockingIndividualNode->setSignatureBlockingIndividualNodeConceptExpansionData(locSigBlockingData); |
| 5814 |
} |
| 5815 |
locSigBlockingData->setBlockingReviewMarked(false); |
| 5816 |
locSigBlockingData->setBlockingSubsetReviewMarked(sigBlockingData->isConceptSetStillSubset()); |
| 5817 |
|
| 5818 |
return true; |
| 5819 |
|
| 5820 |
} else if (sigBlockingData->isBlockingSubsetReviewMarked() != sigBlockingData->isConceptSetStillSubset()) { |
| 5821 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 5822 |
CSignatureBlockingReviewSet* revSet = processingDataBox->getSignatureBlockingReviewSet(true); |
| 5823 |
|
| 5824 |
revSet->getReviewData(sigBlockingData->isBlockingSubsetReviewMarked())->remove(indiID); |
| 5825 |
revSet->getReviewData(sigBlockingData->isConceptSetStillSubset())->insert(blockingIndividualNode->getIndividualAncestorDepth(),indiID); |
| 5826 |
|
| 5827 |
CSignatureBlockingIndividualNodeConceptExpansionData* locSigBlockingData = blockingIndividualNode->getSignatureBlockingIndividualNodeConceptExpansionData(true); |
| 5828 |
if (!locSigBlockingData) { |
| 5829 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5830 |
locSigBlockingData = CObjectAllocator<CSignatureBlockingIndividualNodeConceptExpansionData>::allocateAndConstruct(taskMemMan); |
| 5831 |
locSigBlockingData->initBlockingExpansionData(sigBlockingData); |
| 5832 |
blockingIndividualNode->setSignatureBlockingIndividualNodeConceptExpansionData(locSigBlockingData); |
| 5833 |
} |
| 5834 |
locSigBlockingData->setBlockingReviewMarked(false); |
| 5835 |
locSigBlockingData->setBlockingSubsetReviewMarked(sigBlockingData->isConceptSetStillSubset()); |
| 5836 |
|
| 5837 |
return true; |
| 5838 |
} |
| 5839 |
} |
| 5840 |
} |
| 5841 |
return false; |
| 5842 |
} |
| 5843 |
|
| 5844 |
|
| 5845 |
|
| 5846 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::updateSignatureBlockingConceptExpansion(CIndividualProcessNode*& blockingIndividualNode, CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockingData, CIndividualProcessNode*& blockerIndividualNode, CIndividualNodeAnalizedConceptExpansionData* blockerAnalizedConExpData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5847 |
CReapplyConceptLabelSet* blockingConSet = blockingIndividualNode->getReapplyConceptLabelSet(true); |
| 5848 |
cint64 lastUpdatedConExpCount = sigBlockingData->getLastUpdatedConceptExpansionCount(); |
| 5849 |
|
| 5850 |
bool updateDueChangedConcepts = blockingConSet->getConceptCount() != sigBlockingData->getLastUpdatedConceptCount(); |
| 5851 |
bool updateDueChangedExpansions = blockerAnalizedConExpData->getExpansionConceptCount() > lastUpdatedConExpCount; |
| 5852 |
|
| 5853 |
if (updateDueChangedConcepts || updateDueChangedExpansions) { |
| 5854 |
bool retestAllExpansionsConcepts = true; |
| 5855 |
if (lastUpdatedConExpCount > 0 && updateDueChangedExpansions && !updateDueChangedConcepts) { |
| 5856 |
retestAllExpansionsConcepts = false; |
| 5857 |
} |
| 5858 |
cint64 continuousExpConConceptCount = sigBlockingData->getContinuousExpandedContainedConceptCount(); |
| 5859 |
CAnalizedConceptExpansionLinker* analizedConExpLinkerIt = blockerAnalizedConExpData->getReverseAnalizedConceptExpansionLinker(); |
| 5860 |
cint64 skipExpConCount = continuousExpConConceptCount; |
| 5861 |
if (!retestAllExpansionsConcepts) { |
| 5862 |
skipExpConCount = lastUpdatedConExpCount; |
| 5863 |
} |
| 5864 |
cint64 conExpSearchCount = blockerAnalizedConExpData->getExpansionConceptCount() - skipExpConCount; |
| 5865 |
|
| 5866 |
//for (cint64 i = 0; i < skipExpConCount; ++i) { |
| 5867 |
// analizedConExpLinkerIt = analizedConExpLinkerIt->getNext(); |
| 5868 |
//} |
| 5869 |
cint64 updateContinuousExpandedContainedConceptCount = -1; |
| 5870 |
if (!retestAllExpansionsConcepts && sigBlockingData->getContinuousExpandedContainedConceptCount() != sigBlockingData->getLastUpdatedConceptExpansionCount()) { |
| 5871 |
updateContinuousExpandedContainedConceptCount = 0; |
| 5872 |
} |
| 5873 |
sigBlockingData->setLastUpdatedConceptExpansionCount(blockerAnalizedConExpData->getExpansionConceptCount()); |
| 5874 |
cint64 expandedContainedConceptCount = 0; |
| 5875 |
|
| 5876 |
if (sigBlockingData->isConceptSetStillSubset() && blockingConSet->getConceptCount() == blockerAnalizedConExpData->getLastConceptCount()) { |
| 5877 |
// no expansion required |
| 5878 |
sigBlockingData->setContinuousExpandedContainedConceptCount(blockerAnalizedConExpData->getExpansionConceptCount()); |
| 5879 |
sigBlockingData->setLastUpdatedConceptCount(blockingConSet->getConceptCount()); |
| 5880 |
} else { |
| 5881 |
|
| 5882 |
CPROCESSINGLIST<CAnalizedConceptExpansionLinker*> revAnalizedConExpList(calcAlgContext->getTaskProcessorContext()); |
| 5883 |
while (conExpSearchCount-- > 0 && analizedConExpLinkerIt) { |
| 5884 |
revAnalizedConExpList.prepend(analizedConExpLinkerIt); |
| 5885 |
analizedConExpLinkerIt = analizedConExpLinkerIt->getNext(); |
| 5886 |
} |
| 5887 |
|
| 5888 |
for (CPROCESSINGLIST<CAnalizedConceptExpansionLinker*>::const_iterator it = revAnalizedConExpList.constBegin(), itEnd = revAnalizedConExpList.constEnd(); it != itEnd; ++it) { |
| 5889 |
CAnalizedConceptExpansionLinker* nextAnalizedConExpLinker = *it; |
| 5890 |
CConceptDescriptor* expConDes = nextAnalizedConExpLinker->getConceptDescriptor(); |
| 5891 |
CConcept* expConcept = expConDes->getConcept(); |
| 5892 |
bool expConNegation = expConDes->getNegation(); |
| 5893 |
if (!blockingConSet->containsConcept(expConcept,expConNegation)) { |
| 5894 |
|
| 5895 |
bool allDependenciesExistings = true; |
| 5896 |
CDependency* dependencies = nullptr; |
| 5897 |
CDependencyTrackPoint* firstDepTrackPoint = nullptr; |
| 5898 |
|
| 5899 |
CXLinker<CConceptDescriptor*>* depLinker = nextAnalizedConExpLinker->getDependendConceptDescriptorLinker(); |
| 5900 |
CXLinker<CConceptDescriptor*>* depLinkerIt = depLinker; |
| 5901 |
while (allDependenciesExistings && depLinkerIt) { |
| 5902 |
CConceptDescriptor* depExpConDes = depLinkerIt->getData(); |
| 5903 |
cint64 depConTag = depExpConDes->getConceptTag(); |
| 5904 |
CConceptDescriptor* depConDes = nullptr; |
| 5905 |
CDependencyTrackPoint* depDepTrackPoint = nullptr; |
| 5906 |
if (blockingConSet->getConceptDescriptor(depConTag,depConDes,depDepTrackPoint)) { |
| 5907 |
if (depConDes->isNegated() == depExpConDes->isNegated()) { |
| 5908 |
KONCLUDE_ASSERT_X(depDepTrackPoint,"expandCachedConcepts","missing dependency"); |
| 5909 |
|
| 5910 |
CCONNECTIONDependencyNode* connDepNode = createCONNECTIONDependency(blockingIndividualNode,depConDes,depDepTrackPoint,calcAlgContext); |
| 5911 |
if (!firstDepTrackPoint) { |
| 5912 |
firstDepTrackPoint = connDepNode; |
| 5913 |
} else { |
| 5914 |
dependencies = connDepNode->append(dependencies); |
| 5915 |
} |
| 5916 |
} else { |
| 5917 |
allDependenciesExistings = false; |
| 5918 |
} |
| 5919 |
|
| 5920 |
} else { |
| 5921 |
allDependenciesExistings = false; |
| 5922 |
} |
| 5923 |
depLinkerIt = depLinkerIt->getNext(); |
| 5924 |
} |
| 5925 |
|
| 5926 |
if (allDependenciesExistings) { |
| 5927 |
STATINC(SIGNATUREMIRRORINGBLOCKINGCONCEPTEXPANSIONCOUNT,calcAlgContext); |
| 5928 |
KONCLUDE_ASSERT_X(firstDepTrackPoint,"expandCachedConcepts","missing dependency"); |
| 5929 |
|
| 5930 |
CDependencyTrackPoint* expDepTrackPoint = nullptr; |
| 5931 |
CEXPANDEDDependencyNode* expDepNode = createEXPANDEDDependency(expDepTrackPoint,blockingIndividualNode,firstDepTrackPoint,dependencies,calcAlgContext); |
| 5932 |
|
| 5933 |
addConceptToIndividualSkipANDProcessing(expConcept,expConNegation,blockingIndividualNode,expDepTrackPoint,true,false, true,calcAlgContext); |
| 5934 |
++expandedContainedConceptCount; |
| 5935 |
} else { |
| 5936 |
if (updateContinuousExpandedContainedConceptCount < 0) { |
| 5937 |
updateContinuousExpandedContainedConceptCount = expandedContainedConceptCount; |
| 5938 |
} |
| 5939 |
} |
| 5940 |
} else { |
| 5941 |
++expandedContainedConceptCount; |
| 5942 |
} |
| 5943 |
} |
| 5944 |
if (updateContinuousExpandedContainedConceptCount < 0) { |
| 5945 |
updateContinuousExpandedContainedConceptCount = expandedContainedConceptCount; |
| 5946 |
} |
| 5947 |
sigBlockingData->setContinuousExpandedContainedConceptCount(continuousExpConConceptCount+updateContinuousExpandedContainedConceptCount); |
| 5948 |
sigBlockingData->setLastUpdatedConceptCount(blockingConSet->getConceptCount()); |
| 5949 |
} |
| 5950 |
|
| 5951 |
return true; |
| 5952 |
|
| 5953 |
} |
| 5954 |
return false; |
| 5955 |
} |
| 5956 |
|
| 5957 |
|
| 5958 |
|
| 5959 |
|
| 5960 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasCompatibleConceptSetSignature(CIndividualProcessNode*& blockingNode, CReapplyConceptLabelSet* conSet, CIndividualProcessNode* compatibleTestNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5961 |
// is conSet a compatible concept set to compatibleTestNode |
| 5962 |
CReapplyConceptLabelSet* compTestConSet = compatibleTestNode->getReapplyConceptLabelSet(false); |
| 5963 |
cint64 conCount = conSet->getConceptCount(); |
| 5964 |
cint64 compTestConCount = compTestConSet->getConceptCount(); |
| 5965 |
if (conCount <= 0 || compTestConCount < conCount) { |
| 5966 |
return false; |
| 5967 |
} |
| 5968 |
cint64 diffCount = compTestConCount - conCount; |
| 5969 |
CConceptDescriptor* compTestConDesIt = compTestConSet->getAddingSortedConceptDescriptionLinker(); |
| 5970 |
CConceptDescriptor* conDesIt = conSet->getAddingSortedConceptDescriptionLinker(); |
| 5971 |
while (diffCount-- > 0) { |
| 5972 |
compTestConDesIt = compTestConDesIt->getNext(); |
| 5973 |
} |
| 5974 |
bool orderingCompatible = true; |
| 5975 |
while (orderingCompatible && conDesIt) { |
| 5976 |
CConcept* concept = conDesIt->getConcept(); |
| 5977 |
bool conNeg = conDesIt->getNegation(); |
| 5978 |
if (compTestConDesIt->getData() == concept && compTestConDesIt->getNegation() == conNeg) { |
| 5979 |
if (isConceptSignatureBlockingCritical(blockingNode,conDesIt,conDesIt->getDependencyTrackPoint(),calcAlgContext)) { |
| 5980 |
blockingNode->setInvalidSignatureBlocking(true); |
| 5981 |
return false; |
| 5982 |
} |
| 5983 |
conDesIt = conDesIt->getNext(); |
| 5984 |
compTestConDesIt = compTestConDesIt->getNext(); |
| 5985 |
} else { |
| 5986 |
orderingCompatible = false; |
| 5987 |
} |
| 5988 |
} |
| 5989 |
if (!orderingCompatible) { |
| 5990 |
while (conDesIt) { |
| 5991 |
CConcept* concept = conDesIt->getConcept(); |
| 5992 |
bool conNeg = conDesIt->getNegation(); |
| 5993 |
if (isConceptSignatureBlockingCritical(blockingNode,conDesIt,conDesIt->getDependencyTrackPoint(),calcAlgContext)) { |
| 5994 |
blockingNode->setInvalidSignatureBlocking(true); |
| 5995 |
return false; |
| 5996 |
} |
| 5997 |
if (!conSet->containsConcept(concept,conNeg)) { |
| 5998 |
return false; |
| 5999 |
} |
| 6000 |
conDesIt = conDesIt->getNext(); |
| 6001 |
} |
| 6002 |
} |
| 6003 |
return true; |
| 6004 |
} |
| 6005 |
|
| 6006 |
|
| 6007 |
|
| 6008 |
|
| 6009 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::anlyzeIndiviudalNodesConceptExpansion(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6010 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 6011 |
CReapplyConceptLabelSet* conSet = individualNode->getReapplyConceptLabelSet(false); |
| 6012 |
if (conSet) { |
| 6013 |
CConceptDescriptor* lastAddedConDes = conSet->getAddingSortedConceptDescriptionLinker(); |
| 6014 |
CIndividualNodeAnalizedConceptExpansionData* anlConExpData = individualNode->getAnalizedConceptExpansionData(false); |
| 6015 |
bool update = false; |
| 6016 |
if (anlConExpData) { |
| 6017 |
if (!anlConExpData->isInvalidBlocker()) { |
| 6018 |
CConceptDescriptor* lastAnalyzedConDes = anlConExpData->getLastConceptDescriptor(); |
| 6019 |
if (lastAddedConDes != lastAnalyzedConDes) { |
| 6020 |
update = true; |
| 6021 |
} |
| 6022 |
} |
| 6023 |
} else { |
| 6024 |
if (lastAddedConDes) { |
| 6025 |
update = true; |
| 6026 |
} |
| 6027 |
} |
| 6028 |
if (update) { |
| 6029 |
cint64 conSignature = conSet->getConceptSignatureValue(); |
| 6030 |
cint64 conceptCount = conSet->getConceptCount(); |
| 6031 |
individualNode = getLocalizedIndividual(individualNode,false,calcAlgContext); |
| 6032 |
CIndividualNodeAnalizedConceptExpansionData* locAnlConExpData = individualNode->getAnalizedConceptExpansionData(true); |
| 6033 |
cint64 minValidConCount = locAnlConExpData->getMinimalValidConceptCountLimit(); |
| 6034 |
CConceptDescriptor* lastAnalizedConDes = locAnlConExpData->getLastConceptDescriptor(); |
| 6035 |
|
| 6036 |
|
| 6037 |
CAnalizedConceptExpansionLinker* lastAnaConExpLinker = nullptr; |
| 6038 |
CAnalizedConceptExpansionLinker* firstAnaConExpLinker = nullptr; |
| 6039 |
|
| 6040 |
CConceptDescriptor* conDesIt = lastAddedConDes; |
| 6041 |
cint64 currAnalizingCount = conceptCount; |
| 6042 |
bool invalidBlocking = locAnlConExpData->isInvalidBlocker(); |
| 6043 |
CXLinker<CConceptDescriptor*>* nonDetConLinker = nullptr; |
| 6044 |
while (conDesIt && conDesIt != lastAnalizedConDes && !invalidBlocking) { |
| 6045 |
CConceptDescriptor* conDes = conDesIt; |
| 6046 |
CDependencyTrackPoint* depTrackPoint = conDes->getDependencyTrackPoint(); |
| 6047 |
if (isConceptSignatureBlockingCritical(individualNode,conDes,depTrackPoint,calcAlgContext)) { |
| 6048 |
invalidBlocking = true; |
| 6049 |
} else { |
| 6050 |
bool directDependentFlag = false; |
| 6051 |
if (isConceptFromDirectOrPredecessorOrNondeterminismusDependent(individualNode,conDes,depTrackPoint,&directDependentFlag,calcAlgContext)) { |
| 6052 |
if (!directDependentFlag) { |
| 6053 |
// do not add to expansions concepts |
| 6054 |
CXLinker<CConceptDescriptor*>* newNonDetConLinker = CObjectAllocator< CXLinker<CConceptDescriptor*> >::allocateAndConstruct(taskMemMan); |
| 6055 |
newNonDetConLinker->initLinker(conDes); |
| 6056 |
nonDetConLinker = newNonDetConLinker->append(nonDetConLinker); |
| 6057 |
} |
| 6058 |
} else { |
| 6059 |
// try to find dependencies |
| 6060 |
CXLinker<CConceptDescriptor*>* depLinker = nullptr; |
| 6061 |
if (getConceptDependenciesToSameIndividualNode(individualNode,conDes,depTrackPoint,depLinker,calcAlgContext)) { |
| 6062 |
CAnalizedConceptExpansionLinker* analizedConExpLinker = CObjectAllocator<CAnalizedConceptExpansionLinker>::allocateAndConstruct(taskMemMan); |
| 6063 |
analizedConExpLinker->initAnalizedConceptExpansion(depLinker,conDes); |
| 6064 |
if (lastAnaConExpLinker) { |
| 6065 |
lastAnaConExpLinker->setNext(analizedConExpLinker); |
| 6066 |
lastAnaConExpLinker = analizedConExpLinker; |
| 6067 |
} else { |
| 6068 |
lastAnaConExpLinker = analizedConExpLinker; |
| 6069 |
firstAnaConExpLinker = analizedConExpLinker; |
| 6070 |
} |
| 6071 |
} else { |
| 6072 |
CXLinker<CConceptDescriptor*>* newNonDetConLinker = CObjectAllocator< CXLinker<CConceptDescriptor*> >::allocateAndConstruct(taskMemMan); |
| 6073 |
newNonDetConLinker->initLinker(conDes); |
| 6074 |
nonDetConLinker = newNonDetConLinker->append(nonDetConLinker); |
| 6075 |
} |
| 6076 |
} |
| 6077 |
} |
| 6078 |
conDesIt = conDesIt->getNextConceptDesciptor(); |
| 6079 |
--currAnalizingCount; |
| 6080 |
} |
| 6081 |
|
| 6082 |
if (firstAnaConExpLinker) { |
| 6083 |
locAnlConExpData->addAnalizedConceptExpansionLinker(firstAnaConExpLinker); |
| 6084 |
} |
| 6085 |
locAnlConExpData->addAnalysedNonDeterministicConceptExpansionLinker(nonDetConLinker); |
| 6086 |
locAnlConExpData->setInvalidBlocker(invalidBlocking); |
| 6087 |
|
| 6088 |
locAnlConExpData->setLastConceptDescriptor(lastAddedConDes); |
| 6089 |
locAnlConExpData->setLastConceptSignature(conSignature); |
| 6090 |
locAnlConExpData->setLastConceptCount(conceptCount); |
| 6091 |
return true; |
| 6092 |
} |
| 6093 |
} |
| 6094 |
return false; |
| 6095 |
} |
| 6096 |
|
| 6097 |
|
| 6098 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isConceptSignatureBlockingCritical(CIndividualProcessNode*& individualNode, CConceptDescriptor* conDes, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6099 |
CConcept* concept = conDes->getConcept(); |
| 6100 |
bool conNeg = conDes->getNegation(); |
| 6101 |
cint64 opCode = concept->getOperatorCode(); |
| 6102 |
cint64 param = concept->getParameter(); |
| 6103 |
cint64 cardinality = concept->getParameter() + 1*conNeg; |
| 6104 |
if (cardinality > 1 && (!conNeg && opCode == CCATMOST || conNeg && opCode == CCATLEAST)) { |
| 6105 |
return true; |
| 6106 |
} |
| 6107 |
return false; |
| 6108 |
} |
| 6109 |
|
| 6110 |
|
| 6111 |
|
| 6112 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isConceptFromDirectOrPredecessorOrNondeterminismusDependent(CIndividualProcessNode*& individualNode, CConceptDescriptor* conDes, CDependencyTrackPoint* depTrackPoint, bool* directDependentFlag, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6113 |
cint64 ancDepth = individualNode->getIndividualAncestorDepth(); |
| 6114 |
bool dependencyToAncestor = false; |
| 6115 |
CDependencyNode* depNode = depTrackPoint->getDependencyNode(); |
| 6116 |
if (!depTrackPoint->isPointingToDeterministicDependencyNode()) { |
| 6117 |
dependencyToAncestor = true; |
| 6118 |
} else { |
| 6119 |
if (depTrackPoint->isPointingToIndependentDependencyNode()) { |
| 6120 |
dependencyToAncestor = true; |
| 6121 |
} else if (depNode->hasAppropriateIndividualNode()) { |
| 6122 |
CIndividualProcessNode* appIndiNode = depNode->getAppropriateIndividualNode(); |
| 6123 |
cint64 appIndiAncDepth = appIndiNode->getIndividualAncestorDepth(); |
| 6124 |
if (appIndiAncDepth < ancDepth) { |
| 6125 |
dependencyToAncestor = true; |
| 6126 |
} else if (/*mConfDirectRulePreprocessing && */appIndiAncDepth == ancDepth) { |
| 6127 |
dependencyToAncestor = !depNode->hasAdditionalDependencies(); |
| 6128 |
if (*directDependentFlag) { |
| 6129 |
*directDependentFlag = true; |
| 6130 |
} |
| 6131 |
} |
| 6132 |
} else { |
| 6133 |
CDependencyNode::DEPENDENCNODEYTYPE depType = depNode->getDependencyType(); |
| 6134 |
if (depType == CDependencyNode::DNTMERGEDCONCEPT) { |
| 6135 |
dependencyToAncestor = true; |
| 6136 |
} |
| 6137 |
} |
| 6138 |
} |
| 6139 |
return dependencyToAncestor; |
| 6140 |
} |
| 6141 |
|
| 6142 |
|
| 6143 |
|
| 6144 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::getConceptDependenciesToSameIndividualNode(CIndividualProcessNode*& individualNode, CConceptDescriptor* conDes, CDependencyTrackPoint* depTrackPoint, CXLinker<CConceptDescriptor*>*& depLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6145 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 6146 |
|
| 6147 |
CDependencyNode* depNode = depTrackPoint->getDependencyNode(); |
| 6148 |
CConceptDescriptor* dependendConDes = depNode->getConceptDescriptor(); |
| 6149 |
|
| 6150 |
bool simpleSameNodeDeps = false; |
| 6151 |
if (depNode->hasAppropriateIndividualNode()) { |
| 6152 |
CIndividualProcessNode* appIndiNode = depNode->getAppropriateIndividualNode(); |
| 6153 |
cint64 appIndiDepth = appIndiNode->getIndividualAncestorDepth(); |
| 6154 |
cint64 baseDepth = individualNode->getIndividualAncestorDepth(); |
| 6155 |
if (appIndiDepth == baseDepth) { |
| 6156 |
simpleSameNodeDeps = true; |
| 6157 |
} |
| 6158 |
} else { |
| 6159 |
simpleSameNodeDeps = true; |
| 6160 |
} |
| 6161 |
if (simpleSameNodeDeps) { |
| 6162 |
if (!depTrackPoint->isPointingToIndependentDependencyNode()) { |
| 6163 |
if (!dependendConDes || depNode->hasAdditionalDependencies()) { |
| 6164 |
simpleSameNodeDeps = false; |
| 6165 |
} |
| 6166 |
} |
| 6167 |
} |
| 6168 |
|
| 6169 |
if (simpleSameNodeDeps) { |
| 6170 |
if (/*!mConfDirectRulePreprocessing*/true) { |
| 6171 |
CXLinker<CConceptDescriptor*>* depedendConDesLinker = CObjectAllocator< CXLinker<CConceptDescriptor*> >::allocateAndConstruct(taskMemMan); |
| 6172 |
depedendConDesLinker->initLinker(dependendConDes,depLinker); |
| 6173 |
depLinker = depedendConDesLinker; |
| 6174 |
return true; |
| 6175 |
} else { |
| 6176 |
return false; |
| 6177 |
} |
| 6178 |
} else { |
| 6179 |
cint64 baseAncDepth = individualNode->getIndividualAncestorDepth(); |
| 6180 |
typedef QPair<cint64,CDependencyTrackPoint*> CDepthDependencyPair; |
| 6181 |
CPROCESSINGSET<CDepthDependencyPair> depSet(calcAlgContext->getTaskProcessorContext()); |
| 6182 |
CPROCESSINGLIST<CDepthDependencyPair> depList(calcAlgContext->getTaskProcessorContext()); |
| 6183 |
depSet.insert(CDepthDependencyPair(baseAncDepth,depTrackPoint)); |
| 6184 |
depList.append(CDepthDependencyPair(baseAncDepth,depTrackPoint)); |
| 6185 |
|
| 6186 |
|
| 6187 |
while (!depList.isEmpty()) { |
| 6188 |
CDepthDependencyPair depthDepPair(depList.takeFirst()); |
| 6189 |
cint64 ancDepth = depthDepPair.first; |
| 6190 |
CDependencyTrackPoint* depTrackPoint = depthDepPair.second; |
| 6191 |
|
| 6192 |
if (!depTrackPoint->isPointingToDeterministicDependencyNode()) { |
| 6193 |
return false; |
| 6194 |
} |
| 6195 |
|
| 6196 |
CDependencyNode* depNode = depTrackPoint->getDependencyNode(); |
| 6197 |
CIndividualProcessNode* appIndiNode = depNode->getAppropriateIndividualNode(); |
| 6198 |
cint64 newAncDepth = ancDepth; |
| 6199 |
bool continueDepLoading = true; |
| 6200 |
if (appIndiNode) { |
| 6201 |
newAncDepth = appIndiNode->getIndividualAncestorDepth(); |
| 6202 |
} |
| 6203 |
if (newAncDepth == baseAncDepth) { |
| 6204 |
CConceptDescriptor* nextConDes = depNode->getConceptDescriptor(); |
| 6205 |
if (nextConDes) { |
| 6206 |
continueDepLoading = false; |
| 6207 |
|
| 6208 |
CXLinker<CConceptDescriptor*>* depedendConDesLinker = CObjectAllocator< CXLinker<CConceptDescriptor*> >::allocateAndConstruct(taskMemMan); |
| 6209 |
depedendConDesLinker->initLinker(nextConDes,depLinker); |
| 6210 |
depLinker = depedendConDesLinker; |
| 6211 |
} |
| 6212 |
} |
| 6213 |
if (newAncDepth < baseAncDepth || depTrackPoint->isPointingToIndependentDependencyNode()) { |
| 6214 |
return false; |
| 6215 |
} |
| 6216 |
if (continueDepLoading) { |
| 6217 |
CDependencyTrackPoint* prevDepTrackPoint = depNode->getPreviousDependencyTrackPoint(); |
| 6218 |
cint64 nextAncDepth = newAncDepth; |
| 6219 |
CDependencyNode* nextDepNode = prevDepTrackPoint->getDependencyNode(); |
| 6220 |
if (nextDepNode && nextDepNode->hasAppropriateIndividualNode()) { |
| 6221 |
nextAncDepth = nextDepNode->getAppropriateIndividualNode()->getIndividualAncestorDepth(); |
| 6222 |
} |
| 6223 |
if (!depSet.contains(CDepthDependencyPair(nextAncDepth,prevDepTrackPoint))) { |
| 6224 |
depSet.insert(CDepthDependencyPair(nextAncDepth,prevDepTrackPoint)); |
| 6225 |
depList.append(CDepthDependencyPair(nextAncDepth,prevDepTrackPoint)); |
| 6226 |
} |
| 6227 |
} |
| 6228 |
|
| 6229 |
CDependencyIterator depIt = depNode->getAdditionalDependencyIterator(); |
| 6230 |
while (depIt.hasNext()) { |
| 6231 |
CDependency* dependency = depIt.nextDependency(); |
| 6232 |
// load additional dependencies |
| 6233 |
CDependencyTrackPoint* prevDepTrackPoint = dependency->getPreviousDependencyTrackPoint(); |
| 6234 |
cint64 nextAncDepth = ancDepth; |
| 6235 |
CDependencyNode* nextDepNode = prevDepTrackPoint->getDependencyNode(); |
| 6236 |
if (nextDepNode && nextDepNode->hasAppropriateIndividualNode()) { |
| 6237 |
nextAncDepth = nextDepNode->getAppropriateIndividualNode()->getIndividualAncestorDepth(); |
| 6238 |
} |
| 6239 |
if (!depSet.contains(CDepthDependencyPair(ancDepth,prevDepTrackPoint))) { |
| 6240 |
depSet.insert(CDepthDependencyPair(ancDepth,prevDepTrackPoint)); |
| 6241 |
depList.append(CDepthDependencyPair(ancDepth,prevDepTrackPoint)); |
| 6242 |
} |
| 6243 |
} |
| 6244 |
} |
| 6245 |
return true; |
| 6246 |
} |
| 6247 |
} |
| 6248 |
|
| 6249 |
|
| 6250 |
|
| 6251 |
|
| 6252 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::reapplySatisfiableCachedAbsorbedDisjunctionConcepts(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6253 |
bool conceptsReapplyed = false; |
| 6254 |
|
| 6255 |
CConceptProcessingQueue* conProQueue = individualNode->getConceptProcessingQueue(true); |
| 6256 |
CReapplyConceptDescriptor* absorbedReapplyConDesLinker = individualNode->getSatisfiableCachedAbsorbedDisjunctionsLinker(); |
| 6257 |
while (absorbedReapplyConDesLinker) { |
| 6258 |
|
| 6259 |
conceptsReapplyed = true; |
| 6260 |
|
| 6261 |
CConceptDescriptor* conDes = absorbedReapplyConDesLinker->getConceptDescriptor(); |
| 6262 |
CDependencyTrackPoint* depTrackPoint = absorbedReapplyConDesLinker->getDependencyTrackPoint(); |
| 6263 |
CProcessingRestrictionSpecification* procRest = absorbedReapplyConDesLinker->getReapplyProcessingRestriction(); |
| 6264 |
|
| 6265 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,conProQueue,individualNode,absorbedReapplyConDesLinker->isStaticDescriptor(),procRest,calcAlgContext); |
| 6266 |
|
| 6267 |
absorbedReapplyConDesLinker = absorbedReapplyConDesLinker->getNext(); |
| 6268 |
} |
| 6269 |
individualNode->clearSatisfiableCachedAbsorbedDisjunctionsLinker(); |
| 6270 |
|
| 6271 |
return conceptsReapplyed; |
| 6272 |
} |
| 6273 |
|
| 6274 |
|
| 6275 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::reapplySatisfiableCachedAbsorbedGeneratingConcepts(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6276 |
bool conceptsReapplyed = false; |
| 6277 |
|
| 6278 |
CConceptProcessingQueue* conProQueue = individualNode->getConceptProcessingQueue(true); |
| 6279 |
CReapplyConceptDescriptor* absorbedReapplyConDesLinker = individualNode->getSatisfiableCachedAbsorbedGeneratingLinker(); |
| 6280 |
while (absorbedReapplyConDesLinker) { |
| 6281 |
|
| 6282 |
conceptsReapplyed = true; |
| 6283 |
|
| 6284 |
CConceptDescriptor* conDes = absorbedReapplyConDesLinker->getConceptDescriptor(); |
| 6285 |
CDependencyTrackPoint* depTrackPoint = absorbedReapplyConDesLinker->getDependencyTrackPoint(); |
| 6286 |
|
| 6287 |
addConceptToProcessingQueue(conDes,depTrackPoint,conProQueue,individualNode,false,calcAlgContext); |
| 6288 |
|
| 6289 |
absorbedReapplyConDesLinker = absorbedReapplyConDesLinker->getNext(); |
| 6290 |
} |
| 6291 |
individualNode->clearSatisfiableCachedAbsorbedGeneratingLinker(); |
| 6292 |
|
| 6293 |
return conceptsReapplyed; |
| 6294 |
} |
| 6295 |
|
| 6296 |
|
| 6297 |
|
| 6298 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addSatisfiableCachedAbsorbedDisjunctionConcept(CConceptDescriptor *conceptDescriptor, CIndividualProcessNode*& processIndi, CProcessingRestrictionSpecification* procRest, CDependencyTrackPoint* dependencyTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6299 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 6300 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 6301 |
CReapplyConceptDescriptor* reapplyConDes = CObjectAllocator<CReapplyConceptDescriptor>::allocateAndConstruct(taskMemMan); |
| 6302 |
reapplyConDes->initReapllyDescriptor(conceptDescriptor,dependencyTrackPoint,procRest); |
| 6303 |
processIndi->addSatisfiableCachedAbsorbedDisjunctionsLinker(reapplyConDes); |
| 6304 |
} |
| 6305 |
|
| 6306 |
|
| 6307 |
|
| 6308 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addSatisfiableCachedAbsorbedGeneratingConcept(CConceptDescriptor *conceptDescriptor, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* dependencyTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6309 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 6310 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 6311 |
CReapplyConceptDescriptor* reapplyConDes = CObjectAllocator<CReapplyConceptDescriptor>::allocateAndConstruct(taskMemMan); |
| 6312 |
reapplyConDes->initReapllyDescriptor(conceptDescriptor,dependencyTrackPoint); |
| 6313 |
processIndi->addSatisfiableCachedAbsorbedGeneratingLinker(reapplyConDes); |
| 6314 |
} |
| 6315 |
|
| 6316 |
|
| 6317 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndirectSuccessorSignatureBlocked(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6318 |
propagateAddingBlockedProcessingRestrictionToSuccessors(indi,CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED,true,CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED,calcAlgContext); |
| 6319 |
} |
| 6320 |
|
| 6321 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndirectSuccessorSatisfiableCached(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6322 |
propagateAddingBlockedProcessingRestrictionToSuccessors(indi,CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED,true,CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED,calcAlgContext); |
| 6323 |
} |
| 6324 |
|
| 6325 |
|
| 6326 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndirectSuccessorReuseBlocked(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6327 |
propagateAddingBlockedProcessingRestrictionToSuccessors(indi,CIndividualProcessNode::PRFREUSINGINDIVIDUAL,true,CIndividualProcessNode::PRFANCESTORREUSINGINDIVIDUALBLOCKED,calcAlgContext); |
| 6328 |
} |
| 6329 |
|
| 6330 |
|
| 6331 |
|
| 6332 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isSatisfiableCachedAutomatConceptCompatible(CIndividualProcessNode*& individualNode, CConcept* concept, bool negated, CIndividualProcessNode* ancestorIndiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6333 |
cint64 opCode = concept->getOperatorCode(); |
| 6334 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 6335 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 6336 |
if (!negated && (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQALL_TYPE))) { |
| 6337 |
CRole* role = concept->getRole(); |
| 6338 |
CReapplyConceptLabelSet* ancConSet = ancestorIndiNode->getReapplyConceptLabelSet(false); |
| 6339 |
if (individualNode->hasRoleSuccessorToIndividual(role,ancestorIndiNode,true)) { |
| 6340 |
if (!containsIndividualNodeConcepts(ancConSet,opConLinker,false,calcAlgContext)) { |
| 6341 |
return false; |
| 6342 |
} |
| 6343 |
} |
| 6344 |
} else if (!negated && (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_TYPE))) { |
| 6345 |
CSortedNegLinker<CConcept*>* opConLinkerIt = opConLinker; |
| 6346 |
while (opConLinkerIt) { |
| 6347 |
CConcept* opCon = opConLinkerIt->getData(); |
| 6348 |
bool opNeg = opConLinkerIt->isNegated(); |
| 6349 |
if (!isSatisfiableCachedAutomatConceptCompatible(individualNode,opCon,opNeg,ancestorIndiNode,calcAlgContext)) { |
| 6350 |
return false; |
| 6351 |
} |
| 6352 |
opConLinkerIt = opConLinkerIt->getNext(); |
| 6353 |
} |
| 6354 |
} |
| 6355 |
return true; |
| 6356 |
} |
| 6357 |
|
| 6358 |
|
| 6359 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isSatisfiableCachedCompatible(CIndividualProcessNode*& individualNode, CExpanderBranchedLinker* satBranchLinker, CIndividualProcessNode* ancestorIndiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6360 |
if (ancestorIndiNode) { |
| 6361 |
CSuccessorRoleIterator ancRoleIt = individualNode->getSuccessorRoleIterator(ancestorIndiNode); |
| 6362 |
if (!ancRoleIt.hasNext()) { |
| 6363 |
return true; |
| 6364 |
} |
| 6365 |
CReapplyConceptLabelSet* ancConSet = ancestorIndiNode->getReapplyConceptLabelSet(false); |
| 6366 |
CCACHINGLIST<CCacheValue>* cacheValueList = satBranchLinker->getCacheValueList(); |
| 6367 |
for (CCACHINGLIST<CCacheValue>::const_iterator it = cacheValueList->constBegin(), itEnd = cacheValueList->constEnd(); it != itEnd; ++it) { |
| 6368 |
CCacheValue cacheValue(*it); |
| 6369 |
CConcept* concept = (CConcept*)cacheValue.getIdentification(); |
| 6370 |
bool conceptNeg = cacheValue.getCacheValueIdentifier() == CCacheValue::CACHEVALTAGANDNEGATEDCONCEPT; |
| 6371 |
|
| 6372 |
CRole* role = concept->getRole(); |
| 6373 |
cint64 opCode = concept->getOperatorCode(); |
| 6374 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 6375 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 6376 |
if (!conceptNeg && (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_TYPE)) || conceptNeg && opCode == CCSOME) { |
| 6377 |
bool operandNeg = opCode == CCSOME; |
| 6378 |
if (individualNode->hasRoleSuccessorToIndividual(role,ancestorIndiNode,true)) { |
| 6379 |
if (!containsIndividualNodeConcepts(ancConSet,opConLinker,operandNeg,calcAlgContext)) { |
| 6380 |
return false; |
| 6381 |
} |
| 6382 |
} |
| 6383 |
} else if (!conceptNeg && opCode == CCATMOST || conceptNeg && opCode == CCATLEAST) { |
| 6384 |
if (!opConLinker) { |
| 6385 |
if (individualNode->hasRoleSuccessorToIndividual(role,ancestorIndiNode,true)) { |
| 6386 |
return false; |
| 6387 |
} |
| 6388 |
} else { |
| 6389 |
if (individualNode->hasRoleSuccessorToIndividual(role,ancestorIndiNode,true)) { |
| 6390 |
if (!containsIndividualNodeConcepts(ancConSet,opConLinker,true,calcAlgContext)) { |
| 6391 |
return false; |
| 6392 |
} |
| 6393 |
} |
| 6394 |
} |
| 6395 |
} else if (!conceptNeg && (opCode == CCSOME || opCode == CCATLEAST || opCode == CCAQSOME) || conceptNeg && (opCode == CCALL || opCode == CCATMOST)) { |
| 6396 |
CRole* minSuperRole = nullptr; |
| 6397 |
cint64 minSuperRoleCount = 0; |
| 6398 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 6399 |
while (superRoleIt) { |
| 6400 |
CRole* superRole = superRoleIt->getData(); |
| 6401 |
cint64 superRoleCount = superRole->getIndirectSuperRoleList()->getCount(); |
| 6402 |
if (!minSuperRole || superRoleCount < minSuperRoleCount) { |
| 6403 |
minSuperRoleCount = superRoleCount; |
| 6404 |
minSuperRole = superRole; |
| 6405 |
} |
| 6406 |
superRoleIt = superRoleIt->getNext(); |
| 6407 |
} |
| 6408 |
if (individualNode->hasRoleSuccessorToIndividual(minSuperRole,ancestorIndiNode,true)) { |
| 6409 |
return false; |
| 6410 |
} |
| 6411 |
} else if (!conceptNeg && (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_AQALL_TYPE))) { |
| 6412 |
if (!isSatisfiableCachedAutomatConceptCompatible(individualNode,concept,conceptNeg,ancestorIndiNode,calcAlgContext)) { |
| 6413 |
return false; |
| 6414 |
} |
| 6415 |
} |
| 6416 |
|
| 6417 |
} |
| 6418 |
} |
| 6419 |
return true; |
| 6420 |
} |
| 6421 |
|
| 6422 |
|
| 6423 |
void CCalculationTableauCompletionTaskHandleAlgorithm::expandCachedConcepts(CIndividualProcessNode*& individualNode, CSignatureSatisfiableExpanderCacheEntry* entry, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6424 |
if (entry) { |
| 6425 |
CReapplyConceptLabelSet* conSet = individualNode->getReapplyConceptLabelSet(true); |
| 6426 |
CMemoryAllocationManager* memMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 6427 |
CDependencyFactory* depFactory = calcAlgContext->getDependencyFactory(); |
| 6428 |
cint64 conSetCount = conSet->getConceptCount(); |
| 6429 |
cint64 expandCount = entry->getExpanderCacheValueCount(); |
| 6430 |
CExpanderCacheValueLinker* expLinker = entry->getExpanderCacheValueLinker(); |
| 6431 |
CCACHINGHASH<cint64,CExpanderCacheValueLinker*>* expTagHash = entry->getTagExpanderCacheValueHash(); |
| 6432 |
for (cint64 i = 0; i < conSetCount; ++i) { |
| 6433 |
expLinker = expLinker->getNext(); |
| 6434 |
} |
| 6435 |
CExpanderCacheValueLinker* expLinkerIt = expLinker; |
| 6436 |
bool expanded = false; |
| 6437 |
while (expLinkerIt) { |
| 6438 |
|
| 6439 |
CCacheValue* cacheValue = expLinkerIt->getCacheValue(); |
| 6440 |
CConcept* concept = (CConcept*)cacheValue->getIdentification(); |
| 6441 |
bool conceptNeg = cacheValue->getCacheValueIdentifier() == CCacheValue::CACHEVALTAGANDNEGATEDCONCEPT; |
| 6442 |
|
| 6443 |
if (!conSet->hasConcept(concept)) { |
| 6444 |
|
| 6445 |
STATINC(SATEXPCACHERETRIEVALEXPANDEDCONCEPTSCOUNT,calcAlgContext); |
| 6446 |
if (!expanded) { |
| 6447 |
STATINC(SATEXPCACHERETRIEVALFOUNDEXPANSIONCOUNT,calcAlgContext); |
| 6448 |
expanded = true; |
| 6449 |
} |
| 6450 |
CDependency* dependencies = nullptr; |
| 6451 |
CDependencyTrackPoint* firstDepTrackPoint = nullptr; |
| 6452 |
CCACHINGLIST<CExpanderCacheValueLinker*>* depList = expLinkerIt->getExpanderDependencyList(); |
| 6453 |
for (CCACHINGLIST<CExpanderCacheValueLinker*>::const_iterator depIt = depList->constBegin(), depEndIt = depList->constEnd(); depIt != depEndIt; ++depIt) { |
| 6454 |
CExpanderCacheValueLinker* depLinker(*depIt); |
| 6455 |
cint64 depTag = depLinker->getCacheValue()->getTag(); |
| 6456 |
|
| 6457 |
CDependencyTrackPoint* depTrackPoint = nullptr; |
| 6458 |
CConceptDescriptor* depConDes = nullptr; |
| 6459 |
conSet->getConceptDescriptor(depTag,depConDes,depTrackPoint); |
| 6460 |
|
| 6461 |
KONCLUDE_ASSERT_X(depTrackPoint,"expandCachedConcepts","missing dependency"); |
| 6462 |
|
| 6463 |
CCONNECTIONDependencyNode* connDepNode = createCONNECTIONDependency(individualNode,depConDes,depTrackPoint,calcAlgContext); |
| 6464 |
if (!firstDepTrackPoint) { |
| 6465 |
firstDepTrackPoint = connDepNode; |
| 6466 |
} else { |
| 6467 |
dependencies = connDepNode->append(dependencies); |
| 6468 |
} |
| 6469 |
} |
| 6470 |
|
| 6471 |
KONCLUDE_ASSERT_X(firstDepTrackPoint,"expandCachedConcepts","missing dependency"); |
| 6472 |
|
| 6473 |
CDependencyTrackPoint* expDepTrackPoint = nullptr; |
| 6474 |
CEXPANDEDDependencyNode* expDepNode = createEXPANDEDDependency(expDepTrackPoint,individualNode,firstDepTrackPoint,dependencies,calcAlgContext); |
| 6475 |
|
| 6476 |
addConceptToIndividualSkipANDProcessing(concept,conceptNeg,individualNode,expDepTrackPoint,true,false, true,calcAlgContext); |
| 6477 |
} |
| 6478 |
|
| 6479 |
expLinkerIt = expLinkerIt->getNext(); |
| 6480 |
} |
| 6481 |
} |
| 6482 |
} |
| 6483 |
|
| 6484 |
|
| 6485 |
|
| 6486 |
void CCalculationTableauCompletionTaskHandleAlgorithm::reactivateIndirectReuseSuccessors(CIndividualProcessNode*& indi, bool recursive, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6487 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 6488 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 6489 |
while (succIt.hasNext()) { |
| 6490 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 6491 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 6492 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 6493 |
if (succAncDepth > ancDepth) { |
| 6494 |
if (succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORREUSINGINDIVIDUALBLOCKED)) { |
| 6495 |
|
| 6496 |
if (!succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORREUSINGINDIVIDUALBLOCKEDABOLISHED)) { |
| 6497 |
CIndividualProcessNode* locIndiNode = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 6498 |
locIndiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORREUSINGINDIVIDUALBLOCKEDABOLISHED); |
| 6499 |
} |
| 6500 |
} |
| 6501 |
} |
| 6502 |
} |
| 6503 |
} |
| 6504 |
|
| 6505 |
void CCalculationTableauCompletionTaskHandleAlgorithm::reactivateIndirectSignatureBlockedSuccessors(CIndividualProcessNode*& indi, bool recursive, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6506 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 6507 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 6508 |
while (succIt.hasNext()) { |
| 6509 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 6510 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 6511 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 6512 |
if (succAncDepth > ancDepth) { |
| 6513 |
if (succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED)) { |
| 6514 |
|
| 6515 |
if (!succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHEDABOLISHED)) { |
| 6516 |
CIndividualProcessNode* locIndiNode = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 6517 |
locIndiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHEDABOLISHED); |
| 6518 |
addIndividualToProcessingQueue(locIndiNode,calcAlgContext); |
| 6519 |
} |
| 6520 |
|
| 6521 |
} |
| 6522 |
} |
| 6523 |
} |
| 6524 |
} |
| 6525 |
|
| 6526 |
|
| 6527 |
void CCalculationTableauCompletionTaskHandleAlgorithm::reactivateIndirectSatisfiableCachedSuccessors(CIndividualProcessNode*& indi, bool recursive, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6528 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 6529 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 6530 |
while (succIt.hasNext()) { |
| 6531 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 6532 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 6533 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 6534 |
if (succAncDepth > ancDepth) { |
| 6535 |
if (succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED)) { |
| 6536 |
|
| 6537 |
if (!succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHEDABOLISHED)) { |
| 6538 |
CIndividualProcessNode* locIndiNode = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 6539 |
locIndiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHEDABOLISHED); |
| 6540 |
addIndividualToProcessingQueue(locIndiNode,calcAlgContext); |
| 6541 |
} |
| 6542 |
|
| 6543 |
} |
| 6544 |
} |
| 6545 |
} |
| 6546 |
} |
| 6547 |
|
| 6548 |
void CCalculationTableauCompletionTaskHandleAlgorithm::reactivateIndirectSaturationCachedSuccessors(CIndividualProcessNode*& indi, bool recursive, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6549 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 6550 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 6551 |
while (succIt.hasNext()) { |
| 6552 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 6553 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 6554 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 6555 |
if (succAncDepth > ancDepth) { |
| 6556 |
if (succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED)) { |
| 6557 |
|
| 6558 |
if (!succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHEDABOLISHED)) { |
| 6559 |
CIndividualProcessNode* locIndiNode = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 6560 |
locIndiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHEDABOLISHED); |
| 6561 |
addIndividualToProcessingQueue(locIndiNode,calcAlgContext); |
| 6562 |
} |
| 6563 |
|
| 6564 |
} |
| 6565 |
} |
| 6566 |
} |
| 6567 |
} |
| 6568 |
|
| 6569 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugTrackedClashedDescriptorSummaryString(CTrackedClashedDescriptor* trackedClashDescriptors, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6570 |
QString clashString; |
| 6571 |
CTrackedClashedDescriptor* trackedClashDescriptorIt = trackedClashDescriptors; |
| 6572 |
while (trackedClashDescriptorIt) { |
| 6573 |
CConceptDescriptor* conDes = trackedClashDescriptorIt->getConceptDescriptor(); |
| 6574 |
QString conceptString("null"); |
| 6575 |
if (conDes) { |
| 6576 |
conceptString = CConceptTextFormater::getConceptString(conDes->getConcept(),conDes->isNegated()); |
| 6577 |
} |
| 6578 |
if (!clashString.isEmpty()) { |
| 6579 |
clashString += QString(", "); |
| 6580 |
} |
| 6581 |
clashString += conceptString; |
| 6582 |
trackedClashDescriptorIt = trackedClashDescriptorIt->getNextDescriptor(); |
| 6583 |
} |
| 6584 |
return clashString; |
| 6585 |
} |
| 6586 |
|
| 6587 |
|
| 6588 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugTrackedClashedDescriptorString(CTrackedClashedDescriptor* trackedClashDescriptors, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6589 |
QString clashListString; |
| 6590 |
CTrackedClashedDescriptor* trackedClashDescriptorIt = trackedClashDescriptors; |
| 6591 |
while (trackedClashDescriptorIt) { |
| 6592 |
CConceptDescriptor* conDes = trackedClashDescriptorIt->getConceptDescriptor(); |
| 6593 |
QString conceptString("null"); |
| 6594 |
if (conDes) { |
| 6595 |
conceptString = CConceptTextFormater::getConceptString(conDes->getConcept(),conDes->isNegated()); |
| 6596 |
} |
| 6597 |
|
| 6598 |
CDependencyTrackPoint* depTrackPoint = trackedClashDescriptorIt->getDependencyTrackPoint(); |
| 6599 |
|
| 6600 |
QString dependencyString = QString("null"); |
| 6601 |
if (depTrackPoint) { |
| 6602 |
QString depTypeString; |
| 6603 |
CDependencyNode* depNode = depTrackPoint->getDependencyNode(); |
| 6604 |
switch (depNode->getDependencyType()) { |
| 6605 |
case CDependencyNode::DNTINDEPENDENTBASE: { |
| 6606 |
depTypeString = QString("INDEPENDENT"); |
| 6607 |
break; |
| 6608 |
} |
| 6609 |
case CDependencyNode::DNTALLDEPENDENCY: { |
| 6610 |
depTypeString = QString("ALL"); |
| 6611 |
break; |
| 6612 |
} |
| 6613 |
case CDependencyNode::DNTSOMEDEPENDENCY: { |
| 6614 |
depTypeString = QString("SOME"); |
| 6615 |
break; |
| 6616 |
} |
| 6617 |
case CDependencyNode::DNTANDDEPENDENCY: { |
| 6618 |
depTypeString = QString("AND"); |
| 6619 |
break; |
| 6620 |
} |
| 6621 |
case CDependencyNode::DNTORDEPENDENCY: { |
| 6622 |
depTypeString = QString("OR"); |
| 6623 |
break; |
| 6624 |
} |
| 6625 |
case CDependencyNode::DNTATLEASTDEPENDENCY: { |
| 6626 |
depTypeString = QString("ATLEAST"); |
| 6627 |
break; |
| 6628 |
} |
| 6629 |
case CDependencyNode::DNTAUTOMATCHOOSEDEPENDENCY: { |
| 6630 |
depTypeString = QString("AUTOMATCHOOSE"); |
| 6631 |
break; |
| 6632 |
} |
| 6633 |
case CDependencyNode::DNTAUTOMATTRANSACTIONDEPENDENCY: { |
| 6634 |
depTypeString = QString("AUTOMATTRANSACTION"); |
| 6635 |
break; |
| 6636 |
} |
| 6637 |
case CDependencyNode::DNTSELFDEPENDENCY: { |
| 6638 |
depTypeString = QString("SELF"); |
| 6639 |
break; |
| 6640 |
} |
| 6641 |
case CDependencyNode::DNTVALUEDEPENDENCY: { |
| 6642 |
depTypeString = QString("VALUE"); |
| 6643 |
break; |
| 6644 |
} |
| 6645 |
case CDependencyNode::DNTNEGVALUEDEPENDENCY: { |
| 6646 |
depTypeString = QString("NEGVALUE"); |
| 6647 |
break; |
| 6648 |
} |
| 6649 |
case CDependencyNode::DNTDISTINCTDEPENDENCY: { |
| 6650 |
depTypeString = QString("DISTINCT"); |
| 6651 |
break; |
| 6652 |
} |
| 6653 |
case CDependencyNode::DNTMERGEDCONCEPT: { |
| 6654 |
depTypeString = QString("MERGEDCONCEPT"); |
| 6655 |
break; |
| 6656 |
} |
| 6657 |
case CDependencyNode::DNTMERGEDLINK: { |
| 6658 |
depTypeString = QString("MERGEDLINK"); |
| 6659 |
break; |
| 6660 |
} |
| 6661 |
case CDependencyNode::DNTMERGEDEPENDENCY: { |
| 6662 |
depTypeString = QString("MERGE"); |
| 6663 |
break; |
| 6664 |
} |
| 6665 |
case CDependencyNode::DNTATMOSTDEPENDENCY: { |
| 6666 |
depTypeString = QString("ATMOST"); |
| 6667 |
break; |
| 6668 |
} |
| 6669 |
case CDependencyNode::DNTQUALIFYDEPENDENCY: { |
| 6670 |
depTypeString = QString("QUALIFY"); |
| 6671 |
break; |
| 6672 |
} |
| 6673 |
case CDependencyNode::DNTFUNCTIONALDEPENDENCY: { |
| 6674 |
depTypeString = QString("FUNCTIONAL"); |
| 6675 |
break; |
| 6676 |
} |
| 6677 |
case CDependencyNode::DNTNOMINALDEPENDENCY: { |
| 6678 |
depTypeString = QString("NOMINAL"); |
| 6679 |
break; |
| 6680 |
} |
| 6681 |
case CDependencyNode::DNTIMPLICATIONDEPENDENCY: { |
| 6682 |
depTypeString = QString("IMPLICATION"); |
| 6683 |
break; |
| 6684 |
} |
| 6685 |
case CDependencyNode::DNTEXPANDEDDEPENDENCY: { |
| 6686 |
depTypeString = QString("EXPANDED"); |
| 6687 |
break; |
| 6688 |
} |
| 6689 |
case CDependencyNode::DNTDATATYPETRIGGERDEPENDENCY: { |
| 6690 |
depTypeString = QString("DATATYPETRIGGER"); |
| 6691 |
break; |
| 6692 |
} |
| 6693 |
|
| 6694 |
} |
| 6695 |
|
| 6696 |
CConceptDescriptor* depNodeConDes = depNode->getConceptDescriptor(); |
| 6697 |
QString conceptDepNodeString("null"); |
| 6698 |
if (depNodeConDes) { |
| 6699 |
conceptDepNodeString = CConceptTextFormater::getConceptString(depNodeConDes->getConcept(),depNodeConDes->isNegated()); |
| 6700 |
} |
| 6701 |
QString depInfoString; |
| 6702 |
if (depNode->isNonDeterministiDependencyNode()) { |
| 6703 |
CNonDeterministicDependencyNode* nonDetDepNode = (CNonDeterministicDependencyNode*)depNode; |
| 6704 |
depInfoString += QString(" NonDetDep, <%1/%2>").arg(nonDetDepNode->getOpenedDependencyTrackingPointsCount()).arg(nonDetDepNode->getBranchTrackPoints()->getCount()); |
| 6705 |
} |
| 6706 |
depInfoString += QString(" + ...(%1)").arg(depNode->getAdditionalDependencyCount()); |
| 6707 |
dependencyString = QString("%1-Dependency: {%2}%3").arg(depTypeString).arg(conceptDepNodeString).arg(depInfoString); |
| 6708 |
} |
| 6709 |
|
| 6710 |
QString clashString = QString("\t[ID:%1 / L:%2 | B:%3]: {%4} --> %5\r\n").arg(trackedClashDescriptorIt->getAppropriatedIndividualID()).arg(trackedClashDescriptorIt->getAppropriatedIndividualLevel()).arg(trackedClashDescriptorIt->getBranchingLevelTag()).arg(conceptString).arg(dependencyString); |
| 6711 |
|
| 6712 |
clashListString += clashString; |
| 6713 |
|
| 6714 |
trackedClashDescriptorIt = trackedClashDescriptorIt->getNextDescriptor(); |
| 6715 |
} |
| 6716 |
clashListString.replace("\r\n","<br>"); |
| 6717 |
return clashListString; |
| 6718 |
} |
| 6719 |
|
| 6720 |
|
| 6721 |
|
| 6722 |
|
| 6723 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::writeDebugTrackingLineStringToFile(const QString& debugDataString, const QString& fileNameString, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6724 |
QString tmpDebugDataString = debugDataString; |
| 6725 |
QFile file(QString("./Debugging/CompletionTasks/backtrack-task-%1-%2-%3.txt").arg(calcAlgContext->getUsedSatisfiableCalculationTask()->getTaskDepth()).arg(calcAlgContext->getUsedSatisfiableCalculationTask()->getTaskID()).arg(fileNameString)); |
| 6726 |
if (file.open(QIODevice::WriteOnly)) { |
| 6727 |
file.write(tmpDebugDataString.replace("<br>","\r\n").toLocal8Bit()); |
| 6728 |
file.close(); |
| 6729 |
} |
| 6730 |
|
| 6731 |
QFile conFile(QString("./Debugging/CompletionTasks/backtrack-task-%1-%2-continued.txt").arg(calcAlgContext->getUsedSatisfiableCalculationTask()->getTaskDepth()).arg(calcAlgContext->getUsedSatisfiableCalculationTask()->getTaskID())); |
| 6732 |
if (conFile.open(QIODevice::Append)) { |
| 6733 |
conFile.write((QString("\r\nBacktracking %1:\r\n*******************************************************\r\n").arg(fileNameString)).toLocal8Bit()); |
| 6734 |
conFile.write(tmpDebugDataString.replace("<br>", "\r\n").toLocal8Bit()); |
| 6735 |
conFile.write("\r\n\r\n"); |
| 6736 |
conFile.close(); |
| 6737 |
} |
| 6738 |
return debugDataString; |
| 6739 |
} |
| 6740 |
|
| 6741 |
|
| 6742 |
|
| 6743 |
|
| 6744 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugTrackingLineString(CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6745 |
QString trackLineString = QString("branching level: %1, individual node level: %2\r\n").arg(trackingLine->getBranchingLevel()).arg(trackingLine->getIndividualNodeLevel()); |
| 6746 |
|
| 6747 |
CTrackedClashedDescriptor* trackedClashDescriptors = nullptr; |
| 6748 |
|
| 6749 |
trackedClashDescriptors = trackingLine->getIndependentTrackedClashedDescriptors(); |
| 6750 |
trackLineString += QString("\r\n$ tracked clashes, independent\r\n%1").arg(generateDebugTrackedClashedDescriptorString(trackedClashDescriptors,calcAlgContext)); |
| 6751 |
|
| 6752 |
trackedClashDescriptors = trackingLine->getLevelTrackedBranchingClashedDescriptors(); |
| 6753 |
trackLineString += QString("\r\n$ tracked clashes, current branching level %2, current individual node level %3\r\n%1").arg(generateDebugTrackedClashedDescriptorString(trackedClashDescriptors,calcAlgContext)).arg(trackingLine->getBranchingLevel()).arg(trackingLine->getIndividualNodeLevel()); |
| 6754 |
|
| 6755 |
trackedClashDescriptors = trackingLine->getLevelTrackedClashedDescriptors(); |
| 6756 |
trackLineString += QString("\r\n$ tracked clashes, current individual node level %3\r\n%1").arg(generateDebugTrackedClashedDescriptorString(trackedClashDescriptors,calcAlgContext)).arg(trackingLine->getIndividualNodeLevel()); |
| 6757 |
|
| 6758 |
trackedClashDescriptors = trackingLine->getPerviousLevelTrackedClashedDescriptors(); |
| 6759 |
trackLineString += QString("\r\n$ tracked clashes, previous individual node levels, not non-deterministic\r\n%1").arg(generateDebugTrackedClashedDescriptorString(trackedClashDescriptors,calcAlgContext)); |
| 6760 |
|
| 6761 |
trackedClashDescriptors = trackingLine->getPerviousLevelTrackedNonDeterministicBranchingClashedDescriptors(); |
| 6762 |
trackLineString += QString("\r\n$ tracked clashes, previous individual node levels, non-deterministic current branching level %2\r\n%1").arg(generateDebugTrackedClashedDescriptorString(trackedClashDescriptors,calcAlgContext)).arg(trackingLine->getBranchingLevel()); |
| 6763 |
|
| 6764 |
trackedClashDescriptors = trackingLine->getPerviousLevelTrackedNonDeterministicClashedDescriptors(); |
| 6765 |
trackLineString += QString("\r\n$ tracked clashes, previous individual node levels, non-deterministic, not current branching level\r\n%1").arg(generateDebugTrackedClashedDescriptorString(trackedClashDescriptors,calcAlgContext)); |
| 6766 |
|
| 6767 |
trackLineString.replace("\r\n","<br>"); |
| 6768 |
|
| 6769 |
return trackLineString; |
| 6770 |
} |
| 6771 |
|
| 6772 |
|
| 6773 |
|
| 6774 |
void CCalculationTableauCompletionTaskHandleAlgorithm::clashedBacktracking(CClashedDependencyDescriptor* clashes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6775 |
|
| 6776 |
calcAlgContext->getProcessingDataBox()->setClashedDescriptorLinker(clashes); |
| 6777 |
|
| 6778 |
//if (!mConfDependencyBackjumping) { |
| 6779 |
// if (!calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableCalculationTaskResult()->hasResult()) { |
| 6780 |
// calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableCalculationTaskResult()->installResult(false); |
| 6781 |
// } |
| 6782 |
// return; |
| 6783 |
|
| 6784 |
//} |
| 6785 |
|
| 6786 |
|
| 6787 |
|
| 6788 |
|
| 6789 |
|
| 6790 |
|
| 6791 |
KONCLUCE_TASK_ALGORITHM_TIME_MEASURE_INSTRUCTION(mTimerBacktracing.start()); |
| 6792 |
|
| 6793 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 6794 |
//mEndTaskDebugIndiModelString = writeGeneratedExtendedDebugIndiModelStringList("./Debugging/CompletionTasks/backtracking.txt", calcAlgContext); |
| 6795 |
|
| 6796 |
STATINC(CLASHEDBACKTRACKINGSTARTCOUNT,calcAlgContext); |
| 6797 |
CMemoryAllocationManager* tmpMemMan = calcAlgContext->getUsedTemporaryMemoryAllocationManager(); |
| 6798 |
CTrackedClashedDescriptor* trackedClashDescriptors = createTrackedClashesDescriptors(clashes,calcAlgContext); |
| 6799 |
|
| 6800 |
|
| 6801 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 6802 |
if (mBacktrackDebug) { |
| 6803 |
mBeginBacktrackingClashString = generateDebugTrackedClashedDescriptorSummaryString(trackedClashDescriptors,calcAlgContext); |
| 6804 |
} |
| 6805 |
) |
| 6806 |
|
| 6807 |
for (CTrackedClashedDescriptor* trackedClashDesIt = trackedClashDescriptors; trackedClashDesIt; trackedClashDesIt = trackedClashDesIt->getNextDescriptor()) { |
| 6808 |
if (trackedClashDesIt->getAppropriatedIndividualID() <= calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 6809 |
trackIndividualExtendedDependence(trackedClashDesIt->getAppropriatedIndividualID(),calcAlgContext); |
| 6810 |
} |
| 6811 |
} |
| 6812 |
|
| 6813 |
|
| 6814 |
CPROCESSINGSET<CTrackedClashedDescriptorHasher> clashedSet(calcAlgContext->getUsedTaskProcessorContext()); |
| 6815 |
CTrackedClashedDependencyLine trackingLine(&clashedSet); |
| 6816 |
|
| 6817 |
|
| 6818 |
CBackendNeighbourExpansionControllingData* expContData = calcAlgContext->getProcessingDataBox()->getBackendNeighbourExpansionControllingData(false); |
| 6819 |
if (expContData && expContData->isFixedReuseExpansionMode()) { |
| 6820 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 6821 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 6822 |
CPROCESSINGSET<cint64>* involvedIndividualSet = CObjectParameterizingAllocator<CPROCESSINGSET<cint64>, CProcessContext*>::allocateAndConstructAndParameterize(taskMemMan, processContext); |
| 6823 |
trackingLine.setInvolvedIndividualTrackingSet(involvedIndividualSet); |
| 6824 |
|
| 6825 |
|
| 6826 |
//LOG(INFO, "::Konclude::Reasoner::Kernel::Algorithm::TableauCompletionAlgorihm", logTr("Fixed reuse branch backtracked."), this); |
| 6827 |
|
| 6828 |
} |
| 6829 |
|
| 6830 |
if (initializeTrackingLine(&trackingLine,trackedClashDescriptors,calcAlgContext)) { |
| 6831 |
|
| 6832 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 6833 |
if (mBacktrackDebug) { |
| 6834 |
mBeginBacktrackingTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(&trackingLine,calcAlgContext),"begin",&trackingLine,calcAlgContext); |
| 6835 |
} |
| 6836 |
) |
| 6837 |
|
| 6838 |
if (trackingLine.getBranchingLevel() == 0) { |
| 6839 |
// jump back to root task / cancellation |
| 6840 |
cancellationRootTask(calcAlgContext); |
| 6841 |
} |
| 6842 |
|
| 6843 |
if (trackingLine.hasOnlyCurrentIndividualNodeLevelClashesDescriptors()) { |
| 6844 |
writeClashDescriptorsToCache(&trackingLine,calcAlgContext); |
| 6845 |
} |
| 6846 |
|
| 6847 |
backtrackFromTrackingLine(&trackingLine,calcAlgContext); |
| 6848 |
|
| 6849 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 6850 |
if (mBacktrackDebug) { |
| 6851 |
mEndBacktrackingTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(&trackingLine,calcAlgContext),"end",&trackingLine,calcAlgContext); |
| 6852 |
} |
| 6853 |
) |
| 6854 |
} |
| 6855 |
|
| 6856 |
KONCLUCE_TASK_ALGORITHM_TIME_MEASURE_INSTRUCTION( |
| 6857 |
cint64 timeElapsed = mTimerBacktracing.elapsed(); |
| 6858 |
STATINCM(TIMEBACKTRACING,timeElapsed,calcAlgContext); |
| 6859 |
); |
| 6860 |
|
| 6861 |
} |
| 6862 |
|
| 6863 |
|
| 6864 |
|
| 6865 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::rootUnsatisfiabilityWriteCaches(CSatisfiableCalculationTask* task, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6866 |
CSatisfiableTaskClassificationMessageAdapter* adapter = task->getClassificationMessageAdapter(); |
| 6867 |
if (adapter) { |
| 6868 |
CConcept* concept = adapter->getTestingConcept(); |
| 6869 |
if (concept && adapter->hasExtractionFlags(CSatisfiableTaskClassificationMessageAdapter::EFEXTRACTSUBSUMERSROOTNODE)) { |
| 6870 |
CUnsatisfiableCacheHandler* unsatCacheHandler = calcAlgContext->getUsedUnsatisfiableCacheHandler(); |
| 6871 |
if (unsatCacheHandler && mConfTestedConceptWriteUnsatCaching) { |
| 6872 |
unsatCacheHandler->writeUnsatisfiableClashedConcept(concept,calcAlgContext); |
| 6873 |
} |
| 6874 |
|
| 6875 |
CSaturationNodeExpansionCacheHandler* satNodeExpanderCacheHandler = calcAlgContext->getUsedSaturationNodeExpansionCacheHandler(); |
| 6876 |
if (satNodeExpanderCacheHandler && mConfSaturationConceptUnsatisfiabilitySaturatedCacheWriting) { |
| 6877 |
satNodeExpanderCacheHandler->cacheUnsatisfiableConcept(concept,calcAlgContext); |
| 6878 |
} |
| 6879 |
|
| 6880 |
} |
| 6881 |
} |
| 6882 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 6883 |
CIndividualProcessNode* constIndiNode = processingDataBox->getConstructedIndividualNode(); |
| 6884 |
if (!processingDataBox->hasMultipleConstructionIndividualNodes() && constIndiNode && constIndiNode->isNominalIndividualNode()) { |
| 6885 |
CXSortedNegLinker<CConcept*>* initConLinker = constIndiNode->getInitializingConceptLinker(); |
| 6886 |
CIndividual* individual = constIndiNode->getNominalIndividual(); |
| 6887 |
if (initConLinker && !initConLinker->hasNext()) { |
| 6888 |
CConcept* initConcept = initConLinker->getData(); |
| 6889 |
bool conNegation = initConLinker->isNegated(); |
| 6890 |
|
| 6891 |
if (mConfCacheComputedConsequences && mCompConsCacheHandler && initConcept->getTerminology()) { |
| 6892 |
mCompConsCacheHandler->tryCacheTypeConcept(individual,initConcept,!conNegation,calcAlgContext); |
| 6893 |
} |
| 6894 |
} |
| 6895 |
} |
| 6896 |
return false; |
| 6897 |
} |
| 6898 |
|
| 6899 |
|
| 6900 |
|
| 6901 |
|
| 6902 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::cancellationRootTask(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6903 |
CSatisfiableCalculationTask* rootTask = (CSatisfiableCalculationTask*)calcAlgContext->getSatisfiableCalculationTask()->getRootTask(); |
| 6904 |
STATINC(TASKROOTBACKJUMPINGCOUNT,calcAlgContext); |
| 6905 |
STATINC(ROOTTASKUNSATISFIABLECOUNT,calcAlgContext); |
| 6906 |
|
| 6907 |
|
| 6908 |
rootUnsatisfiabilityWriteCaches(rootTask,calcAlgContext); |
| 6909 |
|
| 6910 |
//bool xDebug = false; |
| 6911 |
//if (xDebug) { |
| 6912 |
// mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 6913 |
// QFile file(QString("./Debugging/CompletionTasks/task-root-clashed.txt")); |
| 6914 |
// if (file.open(QIODevice::WriteOnly)) { |
| 6915 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>", "\r\n").toLocal8Bit()); |
| 6916 |
// file.close(); |
| 6917 |
// } |
| 6918 |
//} |
| 6919 |
|
| 6920 |
//mBranchLevelClosedCountString.clear(); |
| 6921 |
//cint64 maxBraLevel = mClosedBranchLevelCountHash.size(); |
| 6922 |
//cint64 foundLevel = 0; |
| 6923 |
//for (cint64 i = 0; foundLevel < maxBraLevel; ++i) { |
| 6924 |
// cint64 levelCount = mClosedBranchLevelCountHash.value(i,0); |
| 6925 |
// if (levelCount > 0) { |
| 6926 |
// ++foundLevel; |
| 6927 |
// } |
| 6928 |
// mBranchLevelClosedCountString += QString("%1: %2\n").arg(i).arg(levelCount); |
| 6929 |
//} |
| 6930 |
|
| 6931 |
return cancellationTask(rootTask,calcAlgContext); |
| 6932 |
} |
| 6933 |
|
| 6934 |
|
| 6935 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::cancellationTask(CSatisfiableCalculationTask* task, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6936 |
if (!task->getSatisfiableCalculationTaskResult()->hasResult()) { |
| 6937 |
task->getSatisfiableCalculationTaskResult()->installResult(false); |
| 6938 |
if (mConfDependencyBackjumping) { |
| 6939 |
STATINC(TASKBACKJUMPINGCOUNT,calcAlgContext); |
| 6940 |
if (calcAlgContext->getUsedSatisfiableCalculationTask() != task) { |
| 6941 |
STATINC(TASKAWAYBACKJUMPINGCOUNT,calcAlgContext); |
| 6942 |
} |
| 6943 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 6944 |
processorContext->getTaskProcessorCommunicator()->communicateTaskStatusUpdate(task); |
| 6945 |
return true; |
| 6946 |
} |
| 6947 |
} |
| 6948 |
return false; |
| 6949 |
} |
| 6950 |
|
| 6951 |
|
| 6952 |
CTrackedClashedDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::getFreeTrackedClashedDescriptor(CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6953 |
CTrackedClashedDescriptor* des = trackingLine->takeNextFreeTrackedClashedDescriptor(); |
| 6954 |
if (!des) { |
| 6955 |
CMemoryAllocationManager* tmpMemMan = calcAlgContext->getUsedTemporaryMemoryAllocationManager(); |
| 6956 |
des = CObjectAllocator< CTrackedClashedDescriptor >::allocateAndConstruct(tmpMemMan); |
| 6957 |
} |
| 6958 |
return des; |
| 6959 |
} |
| 6960 |
|
| 6961 |
|
| 6962 |
|
| 6963 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::backtrackFromTrackingLine(CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6964 |
cint64 backtrackStep = 0; |
| 6965 |
while (backtrackFromTrackingLineStep(trackingLine,calcAlgContext)) { |
| 6966 |
// until backtracking failed |
| 6967 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 6968 |
if (mBacktrackDebug) { |
| 6969 |
mFileBacktrackingStepTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(trackingLine,calcAlgContext),QString("step-%1").arg(backtrackStep++),trackingLine,calcAlgContext); |
| 6970 |
} |
| 6971 |
) |
| 6972 |
} |
| 6973 |
return false; |
| 6974 |
} |
| 6975 |
|
| 6976 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::backtrackFromTrackingLineStep(CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6977 |
bool trackingSuccess = true; |
| 6978 |
bool prevLevelBacktracked = false; |
| 6979 |
STATINC(CLASHEDBACKTRACKINGSTEPSCOUNT,calcAlgContext); |
| 6980 |
|
| 6981 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 6982 |
if (mBacktrackDebug) { |
| 6983 |
mBeginBacktrackingStepTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(trackingLine, calcAlgContext), "line-step-begin", trackingLine, calcAlgContext); |
| 6984 |
} |
| 6985 |
) |
| 6986 |
|
| 6987 |
// step 1: backtrack all deterministic dependencies in previous individual node levels |
| 6988 |
while (trackingLine->hasPerviousLevelTrackedClashedDescriptors() && trackingSuccess) { |
| 6989 |
CTrackedClashedDescriptor* trackedClashedDes = trackingLine->takeNextPerviousLevelTrackedClashedDescriptor(); |
| 6990 |
STATINC(CLASHEDBACKTRACKINGPREVNODELEVELCOUNT,calcAlgContext); |
| 6991 |
|
| 6992 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 6993 |
if (mBacktrackDebug) { |
| 6994 |
mBeginDetPrevBacktrackingStepTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(trackingLine, calcAlgContext), "line-step-det-prev-indi-levels-begin", trackingLine, calcAlgContext); |
| 6995 |
} |
| 6996 |
) |
| 6997 |
trackingSuccess &= backtrackDeterministicClashedDescriptorFromPreviousIndividualNodeLevels(trackedClashedDes,trackingLine,calcAlgContext); |
| 6998 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 6999 |
if (mBacktrackDebug) { |
| 7000 |
mEndDetPrevBacktrackingStepTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(trackingLine, calcAlgContext), "line-step-det-prev-indi-levels-end", trackingLine, calcAlgContext); |
| 7001 |
} |
| 7002 |
) |
| 7003 |
|
| 7004 |
prevLevelBacktracked = true; |
| 7005 |
} |
| 7006 |
if (prevLevelBacktracked) { |
| 7007 |
if (trackingLine->hasOnlyCurrentIndividualNodeLevelClashesDescriptors()) { |
| 7008 |
// write clashes to cache |
| 7009 |
writeClashDescriptorsToCache(trackingLine,calcAlgContext); |
| 7010 |
} |
| 7011 |
} |
| 7012 |
// step 2: backtrack non-deterministic dependencies in previous individual node levels with current branching level |
| 7013 |
if (trackingLine->hasPerviousLevelTrackedNonDeterministicBranchingClashedDescriptors()) { |
| 7014 |
CTrackedClashedDescriptor* trackedClashedDes = trackingLine->takeNextPerviousLevelTrackedNonDeterministicBranchingClashedDescriptor(); |
| 7015 |
STATINC(CLASHEDBACKTRACKINGPREVNODELEVELBRANCHCOUNT,calcAlgContext); |
| 7016 |
|
| 7017 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7018 |
if (mBacktrackDebug) { |
| 7019 |
mBeginNonDetPrevBacktrackingStepTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(trackingLine, calcAlgContext), "line-step-prev-levels-non-det-begin", trackingLine, calcAlgContext); |
| 7020 |
} |
| 7021 |
) |
| 7022 |
trackingSuccess &= backtrackNonDeterministicBranchingClashedDescriptorFromPreviousIndividualNodeLevel(trackedClashedDes,trackingLine,calcAlgContext); |
| 7023 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7024 |
if (mBacktrackDebug) { |
| 7025 |
mEndNonDetPrevBacktrackingStepTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(trackingLine, calcAlgContext), "line-step-prev-levels-non-det-end", trackingLine, calcAlgContext); |
| 7026 |
} |
| 7027 |
) |
| 7028 |
|
| 7029 |
} else |
| 7030 |
// step 3: backtrack to next individual node level |
| 7031 |
if (trackingLine->hasLevelTrackedBranchingClashedDescriptors()) { |
| 7032 |
CTrackedClashedDescriptor* trackedClashedDes = trackingLine->takeNextLevelTrackedBranchingClashedDescriptor(); |
| 7033 |
STATINC(CLASHEDBACKTRACKINGCURRNODELEVELBRANCHCOUNT,calcAlgContext); |
| 7034 |
if (trackedClashedDes->isPointingToNonDeterministicDependencyNode()) { |
| 7035 |
|
| 7036 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7037 |
if (mBacktrackDebug) { |
| 7038 |
mBeginNonDetPrevBacktrackingStepTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(trackingLine, calcAlgContext), "line-step-next-indi-level-begin", trackingLine, calcAlgContext); |
| 7039 |
} |
| 7040 |
) |
| 7041 |
trackingSuccess &= backtrackNonDeterministicBranchingClashedDescriptorFromCurrentIndividualNodeLevel(trackedClashedDes,trackingLine,calcAlgContext); |
| 7042 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7043 |
if (mBacktrackDebug) { |
| 7044 |
mEndNonDetPrevBacktrackingStepTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(trackingLine, calcAlgContext), "line-step-next-indi-level-end", trackingLine, calcAlgContext); |
| 7045 |
} |
| 7046 |
) |
| 7047 |
|
| 7048 |
} else { |
| 7049 |
trackingSuccess &= backtrackDeterministicBranchingClashedDescriptorFromCurrentIndividualNodeLevel(trackedClashedDes,trackingLine,calcAlgContext); |
| 7050 |
} |
| 7051 |
} else { |
| 7052 |
// check all dependencies independent |
| 7053 |
if (trackingLine->hasOnlyIndependentTrackedClashedDescriptorsRemaining()) { |
| 7054 |
STATINC(CLASHEDBACKTRACKINGINDEPENDENTCOUNT,calcAlgContext); |
| 7055 |
// caching |
| 7056 |
writeClashDescriptorsToCache(trackingLine,calcAlgContext); |
| 7057 |
// no more tracking |
| 7058 |
trackingSuccess = false; |
| 7059 |
} else { |
| 7060 |
|
| 7061 |
// something failed, should never happen |
| 7062 |
trackingSuccess = false; |
| 7063 |
} |
| 7064 |
} |
| 7065 |
|
| 7066 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7067 |
if (mBacktrackDebug) { |
| 7068 |
mEndBacktrackingStepTracklineString = writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(trackingLine, calcAlgContext), "line-step-end", trackingLine, calcAlgContext); |
| 7069 |
} |
| 7070 |
) |
| 7071 |
|
| 7072 |
return trackingSuccess; |
| 7073 |
} |
| 7074 |
|
| 7075 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::backtrackNonDeterministicBranchingClashedDescriptorFromCurrentIndividualNodeLevel(CTrackedClashedDescriptor* trackedClashedDes, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7076 |
return backtrackNonDeterministicBranchingClashedDescriptor(trackedClashedDes,trackingLine,calcAlgContext); |
| 7077 |
} |
| 7078 |
|
| 7079 |
|
| 7080 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::backtrackNonDeterministicBranchingClashedDescriptorFromPreviousIndividualNodeLevel(CTrackedClashedDescriptor* trackedClashedDes, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7081 |
return backtrackNonDeterministicBranchingClashedDescriptor(trackedClashedDes,trackingLine,calcAlgContext); |
| 7082 |
} |
| 7083 |
|
| 7084 |
|
| 7085 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::backtrackNonDeterministicBranchingClashedDescriptor(CTrackedClashedDescriptor* trackedClashedDes, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7086 |
STATINC(CLASHEDBACKTRACKGNONDETERMINISTICCOUNT,calcAlgContext); |
| 7087 |
CDependencyTrackPoint* depTrackPoint = trackedClashedDes->getDependencyTrackPoint(); |
| 7088 |
CNonDeterministicDependencyTrackPoint* nonDetDepTrackPoint = (CNonDeterministicDependencyTrackPoint*)depTrackPoint; |
| 7089 |
CNonDeterministicDependencyNode* nonDetDependencyNode = (CNonDeterministicDependencyNode*)nonDetDepTrackPoint->getDependencyNode(); |
| 7090 |
|
| 7091 |
CSatisfiableCalculationTask* nonDetAccTask = nonDetDependencyNode->getBranchNode()->getSatisfiableCalculationTask(); |
| 7092 |
CSatisfiableCalculationTask* branchAccTask = nonDetDepTrackPoint->getBranchNode()->getSatisfiableCalculationTask(); |
| 7093 |
|
| 7094 |
|
| 7095 |
|
| 7096 |
cancellationTask(branchAccTask,calcAlgContext); |
| 7097 |
|
| 7098 |
//cint64 branchDiff = calcAlgContext->getSatisfiableCalculationTask()->getProcessingDataBox()->getProcessContext()->getProcessTagger()->getCurrentBranchingTag() - branchAccTask->getProcessingDataBox()->getProcessContext()->getProcessTagger()->getCurrentBranchingTag(); |
| 7099 |
//if (branchDiff > 0) { |
| 7100 |
// mOverJumpedNonDeterministicDecisionCount += branchDiff; |
| 7101 |
//} |
| 7102 |
|
| 7103 |
if (nonDetDepTrackPoint->isClashedOrIrelevantBranch()) { |
| 7104 |
// perhaps clash set by another thread |
| 7105 |
STATINC(CLASHEDBACKTRACKGNONDETALREADYCLASHFAILEDCOUNT,calcAlgContext); |
| 7106 |
return false; |
| 7107 |
} |
| 7108 |
|
| 7109 |
CMemoryTemporaryAllocationManager* tmpMemMan = calcAlgContext->getUsedTemporaryMemoryAllocationManager(); |
| 7110 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 7111 |
|
| 7112 |
|
| 7113 |
|
| 7114 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7115 |
if (mBacktrackDebug) { |
| 7116 |
mNonDetDependencyTrackPointReasonString = generateDebugTrackedClashedDescriptorString(trackedClashedDes,calcAlgContext); |
| 7117 |
} |
| 7118 |
) |
| 7119 |
|
| 7120 |
|
| 7121 |
cint64 procTag = nonDetDependencyNode->getProcessingTag(); |
| 7122 |
// backtrack all clashes before the processing tag of the non-deterministic dependency for current branch |
| 7123 |
CTrackedClashedDescriptor* trackedClashedDescriptorBeforeProcTagList = nullptr; |
| 7124 |
while (trackingLine->hasMoreTrackedClashedList()) { |
| 7125 |
CTrackedClashedDescriptor* trackedClashedDesList = trackingLine->takeNextTrackedClashedList(); |
| 7126 |
CTrackedClashedDescriptor* trackedClashedDescriptorsBeforeProcTag = getBacktrackedDeterministicClashedDescriptorsBeforeProcessingTag(trackedClashedDesList,procTag,trackingLine,calcAlgContext); |
| 7127 |
if (trackedClashedDescriptorsBeforeProcTag) { |
| 7128 |
trackedClashedDescriptorBeforeProcTagList = trackedClashedDescriptorsBeforeProcTag->append(trackedClashedDescriptorBeforeProcTagList); |
| 7129 |
} |
| 7130 |
} |
| 7131 |
|
| 7132 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7133 |
if (mBacktrackDebug) { |
| 7134 |
mNonDetDependencyBeforeProcessedTrackedString = generateDebugTrackedClashedDescriptorString(trackedClashedDescriptorBeforeProcTagList,calcAlgContext); |
| 7135 |
} |
| 7136 |
) |
| 7137 |
|
| 7138 |
|
| 7139 |
writeClashDescriptorsToCache(trackedClashedDescriptorBeforeProcTagList,trackedClashedDes,trackingLine,calcAlgContext); |
| 7140 |
|
| 7141 |
|
| 7142 |
|
| 7143 |
|
| 7144 |
CBackendNeighbourExpansionControllingData* expContData = calcAlgContext->getUsedProcessingDataBox()->getBackendNeighbourExpansionControllingData(false); |
| 7145 |
if (expContData && expContData->isFixedReuseExpansionMode()) { |
| 7146 |
CREUSEBACKENDEXPANSIONMODESDependencyNode* modesDepNode = calcAlgContext->getUsedProcessingDataBox()->getBackendNeighbourExpansionControllingData(true)->getReuseModesDependencyNode(); |
| 7147 |
|
| 7148 |
if (nonDetDependencyNode->getDependencyType() == Process::Dependency::CDependencyNode::DNTREUSEBACKENDFIXEDINDIVIDUALEXPANSIONDEPENDENCY) { |
| 7149 |
CREUSEBACKENDFIXEDINDIVIDUALEXPANSIONDependencyNode* reuseFixedIndiExpDepNode = (CREUSEBACKENDFIXEDINDIVIDUALEXPANSIONDependencyNode*)nonDetDependencyNode; |
| 7150 |
CIndividualProcessNode* reuseIndiNode = reuseFixedIndiExpDepNode->getAppropriateIndividualNode(); |
| 7151 |
trackingLine->addInvolvedIndividual(reuseIndiNode); |
| 7152 |
} |
| 7153 |
|
| 7154 |
|
| 7155 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7156 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 7157 |
CPROCESSINGSET<cint64>* existingInvolvedIndiSet = CObjectParameterizingAllocator<CPROCESSINGSET<cint64>, CProcessContext*>::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(), processContext); |
| 7158 |
CXLinker<cint64>* existingIndiLinker = modesDepNode->getAffectedIndividualIdLinker(); |
| 7159 |
for (CXLinker<cint64>* existingIndiLinkerIt = existingIndiLinker; existingIndiLinkerIt; existingIndiLinkerIt = existingIndiLinkerIt->getNext()) { |
| 7160 |
cint64 indiId = existingIndiLinkerIt->getData(); |
| 7161 |
existingInvolvedIndiSet->insert(indiId); |
| 7162 |
} |
| 7163 |
|
| 7164 |
CMemoryPoolContainer memoryContainer; |
| 7165 |
CTaskMemoryPoolAllocationManager invIndiBranchMemMan(&memoryContainer, calcAlgContext->getTemporaryMemoryAllocationManager()); |
| 7166 |
CXLinker<cint64>* newInvolvedIndiLinker = existingIndiLinker; |
| 7167 |
bool foundNewInvolvedIndis = false; |
| 7168 |
CPROCESSINGSET<cint64>* involvedIndiSet = trackingLine->getInvolvedIndividualTrackingSet(); |
| 7169 |
if (involvedIndiSet) { |
| 7170 |
for (CPROCESSINGSET<cint64>::const_iterator it = involvedIndiSet->constBegin(), itEnd = involvedIndiSet->constEnd(); it != itEnd; ++it) { |
| 7171 |
cint64 indiId = *it; |
| 7172 |
if (!existingInvolvedIndiSet->contains(indiId)) { |
| 7173 |
CXLinker<cint64>* tmpInvolvedIndiLinker = CObjectAllocator<CXLinker<cint64>>::allocateAndConstruct(&invIndiBranchMemMan); |
| 7174 |
tmpInvolvedIndiLinker->initLinker(indiId, newInvolvedIndiLinker); |
| 7175 |
newInvolvedIndiLinker = tmpInvolvedIndiLinker; |
| 7176 |
foundNewInvolvedIndis = true; |
| 7177 |
} |
| 7178 |
} |
| 7179 |
} |
| 7180 |
|
| 7181 |
if (foundNewInvolvedIndis) { |
| 7182 |
if (modesDepNode->addAffectedIndividualIdLinker(existingIndiLinker, newInvolvedIndiLinker)) { |
| 7183 |
processorContext->getTaskProcessorCommunicator()->communicateTaskAdditionalAllocation(modesDepNode->getBranchNode()->getSatisfiableCalculationTask(), memoryContainer.takeMemoryPools()); |
| 7184 |
} else { |
| 7185 |
calcAlgContext->getTemporaryMemoryAllocationManager()->releaseMemoryPoolContainer(&memoryContainer); |
| 7186 |
} |
| 7187 |
} else { |
| 7188 |
calcAlgContext->getTemporaryMemoryAllocationManager()->releaseMemoryPoolContainer(&memoryContainer); |
| 7189 |
} |
| 7190 |
} |
| 7191 |
|
| 7192 |
|
| 7193 |
|
| 7194 |
|
| 7195 |
|
| 7196 |
|
| 7197 |
// copy clashes to memory container |
| 7198 |
CMemoryPoolContainer memoryContainer; |
| 7199 |
CTaskMemoryPoolAllocationManager conBranchMemMan(&memoryContainer,calcAlgContext->getTemporaryMemoryAllocationManager()); |
| 7200 |
|
| 7201 |
|
| 7202 |
|
| 7203 |
CXLinker<cint64>* newInvolvedIndiLinker = nullptr; |
| 7204 |
CPROCESSINGSET<cint64>* involvedIndiSet = trackingLine->getInvolvedIndividualTrackingSet(); |
| 7205 |
if (involvedIndiSet) { |
| 7206 |
for (CPROCESSINGSET<cint64>::const_iterator it = involvedIndiSet->constBegin(), itEnd = involvedIndiSet->constEnd(); it != itEnd; ++it) { |
| 7207 |
cint64 indiId = *it; |
| 7208 |
CXLinker<cint64>* tmpInvolvedIndiLinker = CObjectAllocator<CXLinker<cint64>>::allocateAndConstruct(&conBranchMemMan); |
| 7209 |
tmpInvolvedIndiLinker->initLinker(indiId, newInvolvedIndiLinker); |
| 7210 |
newInvolvedIndiLinker = tmpInvolvedIndiLinker; |
| 7211 |
} |
| 7212 |
} |
| 7213 |
|
| 7214 |
|
| 7215 |
|
| 7216 |
if (expContData && expContData->isFixedReuseExpansionMode() && nonDetDependencyNode->getDependencyType() == Process::Dependency::CDependencyNode::DNTREUSEBACKENDEXPANSIONMODESDEPENDENCY) { |
| 7217 |
// prepare reporting of problematic individuals to backend cache |
| 7218 |
|
| 7219 |
CREUSEBACKENDEXPANSIONMODESDependencyNode* modesDepNode = calcAlgContext->getUsedProcessingDataBox()->getBackendNeighbourExpansionControllingData(true)->getReuseModesDependencyNode(); |
| 7220 |
modesDepNode->setInvolvedIndividualIdLinker(newInvolvedIndiLinker); |
| 7221 |
|
| 7222 |
processorContext->getTaskProcessorCommunicator()->communicateTaskAdditionalAllocation(nonDetAccTask, memoryContainer.takeMemoryPools()); |
| 7223 |
return false; |
| 7224 |
} |
| 7225 |
|
| 7226 |
|
| 7227 |
// create branch clash descriptors with memory pool which will sent to corresponding task, because other threads could be using the clash descriptors after installation |
| 7228 |
CTrackedClashedDescriptor* branchMemConClashedDesList = createTrackedClashesDescriptors(trackedClashedDescriptorBeforeProcTagList, calcAlgContext, &conBranchMemMan, true); |
| 7229 |
|
| 7230 |
|
| 7231 |
if (nonDetDepTrackPoint->isClashedOrIrelevantBranch()) { |
| 7232 |
// perhaps clash set by another thread, release memory pools |
| 7233 |
calcAlgContext->getTemporaryMemoryAllocationManager()->releaseMemoryPoolContainer(&memoryContainer); |
| 7234 |
STATINC(CLASHEDBACKTRACKGNONDETALREADYCLASHFAILEDCOUNT,calcAlgContext); |
| 7235 |
return false; |
| 7236 |
} |
| 7237 |
// otherwise install clash descriptors |
| 7238 |
nonDetDepTrackPoint->setClashes(branchMemConClashedDesList,true); |
| 7239 |
if (newInvolvedIndiLinker) { |
| 7240 |
nonDetDepTrackPoint->setInvolvedIndividualIdsLinker(newInvolvedIndiLinker); |
| 7241 |
} |
| 7242 |
|
| 7243 |
|
| 7244 |
|
| 7245 |
|
| 7246 |
if (mConfBranchingStatisticsAnalysing) { |
| 7247 |
if (nonDetDependencyNode->getDependencyType() == CDependencyNode::DNTORDEPENDENCY) { |
| 7248 |
CORDisjunctDependencyTrackPoint* orDisjunctDepTrackPoint = (CORDisjunctDependencyTrackPoint*)nonDetDepTrackPoint; |
| 7249 |
CDisjunctBranchingStatistics* disjunctBranchStats = orDisjunctDepTrackPoint->getDisjunctBranchingStatistics(); |
| 7250 |
if (disjunctBranchStats) { |
| 7251 |
disjunctBranchStats->incExpandedCount(); |
| 7252 |
disjunctBranchStats->incClashInvolvedCount(); |
| 7253 |
} |
| 7254 |
} |
| 7255 |
if (!mLastAnalysingBranchNodeTree) { |
| 7256 |
mLastAnalysingBranchNodeTree = calcAlgContext->getUsedBranchTreeNode(); |
| 7257 |
} |
| 7258 |
while (mLastAnalysingBranchNodeTree && mLastAnalysingBranchNodeTree != nonDetDepTrackPoint->getBranchNode()) { |
| 7259 |
CDependencyTrackPoint* analDepTrackPoint = mLastAnalysingBranchNodeTree->getDependencyTrackPoint(); |
| 7260 |
if (analDepTrackPoint) { |
| 7261 |
CDependencyNode* analDepNode = analDepTrackPoint->getDependencyNode(); |
| 7262 |
if (analDepNode->getDependencyType() == CDependencyNode::DNTORDEPENDENCY) { |
| 7263 |
CORDisjunctDependencyTrackPoint* orDisjunctAnalDepTrackPoint = (CORDisjunctDependencyTrackPoint*)analDepTrackPoint; |
| 7264 |
CDisjunctBranchingStatistics* analDisjunctBranchStats = orDisjunctAnalDepTrackPoint->getDisjunctBranchingStatistics(); |
| 7265 |
if (analDisjunctBranchStats) { |
| 7266 |
analDisjunctBranchStats->incExpandedCount(); |
| 7267 |
} |
| 7268 |
} |
| 7269 |
CConceptDescriptor* analOrConDes = analDepNode->getConceptDescriptor(); |
| 7270 |
if (analOrConDes) { |
| 7271 |
CConcept* analOrConcept = analOrConDes->getConcept(); |
| 7272 |
CConceptProcessData* analConProData = (CConceptProcessData*)analOrConcept->getConceptData(); |
| 7273 |
if (analConProData) { |
| 7274 |
CDisjunctionBranchingStatistics* analDisjunctionBranchStatistics = (CDisjunctionBranchingStatistics*)analConProData->getBranchingStatistics(); |
| 7275 |
if (analDisjunctionBranchStatistics) { |
| 7276 |
analDisjunctionBranchStatistics->incExpandedCount(); |
| 7277 |
} |
| 7278 |
} |
| 7279 |
} |
| 7280 |
|
| 7281 |
} |
| 7282 |
mLastAnalysingBranchNodeTree = mLastAnalysingBranchNodeTree->getParentNode(); |
| 7283 |
} |
| 7284 |
} |
| 7285 |
|
| 7286 |
|
| 7287 |
if (trackedClashedDescriptorBeforeProcTagList) { |
| 7288 |
// and send memory pools to corresponding task |
| 7289 |
processorContext->getTaskProcessorCommunicator()->communicateTaskAdditionalAllocation(nonDetAccTask,memoryContainer.takeMemoryPools()); |
| 7290 |
} |
| 7291 |
|
| 7292 |
|
| 7293 |
// test whether all branches has clash descriptors |
| 7294 |
bool otherOpenedTrackPoints = nonDetDependencyNode->hasOtherOpenedDependencyTrackingPoints(nonDetDepTrackPoint); |
| 7295 |
if (!otherOpenedTrackPoints) { |
| 7296 |
|
| 7297 |
if (mConfBranchingStatisticsAnalysing && nonDetDependencyNode->getDependencyType() == CDependencyNode::DNTORDEPENDENCY) { |
| 7298 |
CConceptDescriptor* orConDes = nonDetDependencyNode->getConceptDescriptor(); |
| 7299 |
if (orConDes) { |
| 7300 |
CConcept* orConcept = orConDes->getConcept(); |
| 7301 |
CConceptProcessData* conProData = (CConceptProcessData*)orConcept->getConceptData(); |
| 7302 |
if (conProData) { |
| 7303 |
CDisjunctionBranchingStatistics* branchingStatistics = (CDisjunctionBranchingStatistics*)conProData->getBranchingStatistics(); |
| 7304 |
if (branchingStatistics) { |
| 7305 |
branchingStatistics->incExpandedCount(); |
| 7306 |
branchingStatistics->incClashFullyInvolvedCount(); |
| 7307 |
} |
| 7308 |
} |
| 7309 |
} |
| 7310 |
} |
| 7311 |
|
| 7312 |
++mRelevantNonDeterministicDecisionCount; |
| 7313 |
|
| 7314 |
// collect clash descriptors of all branches and add dependency of closed dependency node |
| 7315 |
STATINC(CLASHEDBACKTRACKGNONDETCLOSEDCOUNT,calcAlgContext); |
| 7316 |
CTrackedClashedDescriptor* collectedTrackedClashedDes = getCollectedFilteredClashedDescriptorsFromBranch(trackedClashedDes,nonDetDependencyNode,trackingLine,calcAlgContext); |
| 7317 |
|
| 7318 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7319 |
if (mBacktrackDebug) { |
| 7320 |
mNonDetDependencyCollectedTrackedString = generateDebugTrackedClashedDescriptorString(collectedTrackedClashedDes,calcAlgContext); |
| 7321 |
} |
| 7322 |
) |
| 7323 |
|
| 7324 |
|
| 7325 |
if (initializeTrackingLine(trackingLine,collectedTrackedClashedDes,calcAlgContext)) { |
| 7326 |
if (trackingLine->getBranchingLevel() == 0) { |
| 7327 |
// jump back to root task / cancellation |
| 7328 |
cancellationRootTask(calcAlgContext); |
| 7329 |
} |
| 7330 |
|
| 7331 |
if (trackingLine->hasOnlyCurrentIndividualNodeLevelClashesDescriptors()) { |
| 7332 |
writeClashDescriptorsToCache(trackingLine,calcAlgContext); |
| 7333 |
} |
| 7334 |
|
| 7335 |
//// TODO: delete |
| 7336 |
//cint64 depBraLevel = nonDetDependencyNode->getBranchNode()->getBranchingLevel(); |
| 7337 |
//cint64 depBraLevelCount = mClosedBranchLevelCountHash.value(depBraLevel,0)+1; |
| 7338 |
//mClosedBranchLevelCountHash.insert(depBraLevel,depBraLevelCount); |
| 7339 |
|
| 7340 |
return true; |
| 7341 |
} |
| 7342 |
} else { |
| 7343 |
// mark all dependencies and corresponding tasks as relevant |
| 7344 |
|
| 7345 |
trackedClashedDescriptorBeforeProcTagList; |
| 7346 |
|
| 7347 |
} |
| 7348 |
return false; |
| 7349 |
} |
| 7350 |
|
| 7351 |
|
| 7352 |
void CCalculationTableauCompletionTaskHandleAlgorithm::markRelevanceForTrackedClashedDescriptors(CTrackedClashedDescriptor* descriptors, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7353 |
for (CTrackedClashedDescriptor* desIt = descriptors; desIt; desIt = desIt->getNextDescriptor()) { |
| 7354 |
CDependencyTrackPoint* depTrackPoint = desIt->getDependencyTrackPoint(); |
| 7355 |
markDependencyRelevance(depTrackPoint,calcAlgContext); |
| 7356 |
} |
| 7357 |
} |
| 7358 |
|
| 7359 |
|
| 7360 |
void CCalculationTableauCompletionTaskHandleAlgorithm::markDependencyRelevance(CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7361 |
if (!depTrackPoint->isDependencyRelevant()) { |
| 7362 |
depTrackPoint->setDependencyRelevance(true); |
| 7363 |
|
| 7364 |
CDependencyNode* depNode = depTrackPoint->getDependencyNode(); |
| 7365 |
if (depNode) { |
| 7366 |
CDependencyIterator depIt(depNode->getAdditionalDependencyIterator(true,true)); |
| 7367 |
while (depIt.hasNext()) { |
| 7368 |
CDependency* dep = depIt.nextDependency(true); |
| 7369 |
CDependencyTrackPoint* prevDepTrackPoint = dep->getPreviousDependencyTrackPoint(); |
| 7370 |
markDependencyRelevance(prevDepTrackPoint,calcAlgContext); |
| 7371 |
} |
| 7372 |
CDependencyTrackPoint* prevDepTrackPoint = depNode->getPreviousDependencyTrackPoint(); |
| 7373 |
markDependencyRelevance(prevDepTrackPoint,calcAlgContext); |
| 7374 |
} |
| 7375 |
|
| 7376 |
if (depNode->isNonDeterministiDependencyNode()) { |
| 7377 |
CNonDeterministicDependencyNode* nonDetDepNode = (CNonDeterministicDependencyNode*)depNode; |
| 7378 |
CBranchTreeNode* branchTreeNode = nonDetDepNode->getBranchNode(); |
| 7379 |
CSatisfiableCalculationTask* branchSatCalcTask = branchTreeNode->getSatisfiableCalculationTask(); |
| 7380 |
|
| 7381 |
if (!branchSatCalcTask->isTaskRelevant()) { |
| 7382 |
// TODO: add statistic for marked tasks as relevant |
| 7383 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 7384 |
processorContext->getTaskProcessorCommunicator()->communicateTaskRelevant(branchSatCalcTask); |
| 7385 |
} |
| 7386 |
} |
| 7387 |
} |
| 7388 |
} |
| 7389 |
|
| 7390 |
|
| 7391 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualNodeForCacheUnsatisfiableRetrieval(CIndividualProcessNode*& indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7392 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7393 |
CXLinker<CIndividualProcessNode*>* indiNodeLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(taskMemMan); |
| 7394 |
indiNodeLinker->initLinker(indiNode); |
| 7395 |
calcAlgContext->getUsedProcessingDataBox()->addIndividualNodeCacheTestingLinker(indiNodeLinker); |
| 7396 |
} |
| 7397 |
|
| 7398 |
|
| 7399 |
|
| 7400 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::writeClashDescriptorsToCache(CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7401 |
CTrackedClashedDescriptor* trackedClashedDesList = nullptr; |
| 7402 |
while (trackingLine->hasMoreTrackedClashedList()) { |
| 7403 |
trackedClashedDesList = trackingLine->takeNextTrackedClashedList()->append(trackedClashedDesList); |
| 7404 |
} |
| 7405 |
bool cacheWrite = writeClashDescriptorsToCache(trackedClashedDesList,trackingLine,calcAlgContext); |
| 7406 |
trackingLine->sortInTrackedClashedDescriptors(trackedClashedDesList,true); |
| 7407 |
return cacheWrite; |
| 7408 |
} |
| 7409 |
|
| 7410 |
|
| 7411 |
|
| 7412 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::writeClashDescriptorsToCache(CTrackedClashedDescriptor*& trackedClashedDes, CTrackedClashedDescriptor* additionalTrackedClashedDes, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7413 |
CTrackedClashedDescriptor* separatTrackedClashedDes = additionalTrackedClashedDes; |
| 7414 |
trackedClashedDes = additionalTrackedClashedDes->append(trackedClashedDes); |
| 7415 |
bool cacheWrite = writeClashDescriptorsToCache(trackedClashedDes,trackingLine,calcAlgContext); |
| 7416 |
if (!cacheWrite) { |
| 7417 |
trackedClashedDes = trackedClashedDes->getNextDescriptor(); |
| 7418 |
} else { |
| 7419 |
trackedClashedDes = (CTrackedClashedDescriptor*)trackedClashedDes->removeOne(additionalTrackedClashedDes); |
| 7420 |
} |
| 7421 |
additionalTrackedClashedDes->clearNext(); |
| 7422 |
return cacheWrite; |
| 7423 |
} |
| 7424 |
|
| 7425 |
|
| 7426 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::writeClashDescriptorsToCache(CTrackedClashedDescriptor*& trackedClashedDes, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7427 |
if (mConfWriteUnsatCaching && trackedClashedDes) { |
| 7428 |
STATINC(UNSATCACHEWRITINGREQUSTCOUNT,calcAlgContext); |
| 7429 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7430 |
if (mBacktrackDebug) { |
| 7431 |
mCachingClashString = generateDebugTrackedClashedDescriptorString(trackedClashedDes,calcAlgContext); |
| 7432 |
} |
| 7433 |
) |
| 7434 |
CTrackedClashedDescriptor* trackedClashedDesIt = trackedClashedDes; |
| 7435 |
bool nominalOccured = trackedClashedDesIt->isAppropriatedIndividualNominal(); |
| 7436 |
cint64 minIndiID = trackedClashedDesIt->getAppropriatedIndividualID(); |
| 7437 |
bool hasOtherIndiID = false; |
| 7438 |
cint64 minIndiLevel = trackedClashedDesIt->getAppropriatedIndividualLevel(); |
| 7439 |
bool hasOtherIndiLevel = false; |
| 7440 |
bool hasNoInvalidConDes = trackedClashedDesIt->getConceptDescriptor() != nullptr; |
| 7441 |
|
| 7442 |
trackedClashedDesIt = trackedClashedDesIt->getNextDescriptor(); |
| 7443 |
while (trackedClashedDesIt) { |
| 7444 |
CConceptDescriptor* conDes = trackedClashedDesIt->getConceptDescriptor(); |
| 7445 |
hasNoInvalidConDes &= conDes != nullptr; |
| 7446 |
if (conDes) { |
| 7447 |
CConcept* concept = conDes->getConcept(); |
| 7448 |
cint64 opCode = concept->getOperatorCode(); |
| 7449 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 7450 |
if (concept->getTerminology() == nullptr || conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_PROPAGATION_TYPE)) { |
| 7451 |
hasNoInvalidConDes = false; |
| 7452 |
} |
| 7453 |
} |
| 7454 |
nominalOccured |= trackedClashedDesIt->isAppropriatedIndividualNominal(); |
| 7455 |
if (trackedClashedDesIt->getAppropriatedIndividualID() != minIndiID) { |
| 7456 |
hasOtherIndiID = true; |
| 7457 |
if (nominalOccured) { |
| 7458 |
STATINC(UNSATCACHEWRITINGREQUSTDIFFNOMINALFAILEDCOUNT,calcAlgContext); |
| 7459 |
return false; |
| 7460 |
} |
| 7461 |
} |
| 7462 |
if (trackedClashedDesIt->getAppropriatedIndividualLevel() != minIndiLevel) { |
| 7463 |
STATINC(UNSATCACHEWRITINGREQUSTDIFFNODELEVELFAILEDCOUNT,calcAlgContext); |
| 7464 |
hasOtherIndiLevel = true; |
| 7465 |
return false; |
| 7466 |
} |
| 7467 |
trackedClashedDesIt = trackedClashedDesIt->getNextDescriptor(); |
| 7468 |
} |
| 7469 |
// TODO: unsatisfiability caching with nominals, currently deactivateds |
| 7470 |
if (hasNoInvalidConDes && !nominalOccured) { |
| 7471 |
bool writeCacheLine = false; |
| 7472 |
if (!nominalOccured) { |
| 7473 |
writeCacheLine = !hasOtherIndiLevel; |
| 7474 |
} else { |
| 7475 |
writeCacheLine = !hasOtherIndiID; |
| 7476 |
} |
| 7477 |
bool atomicClash = false; |
| 7478 |
if (writeCacheLine) { |
| 7479 |
CTrackedClashedDescriptor* trackedClashedDesIt = trackedClashedDes; |
| 7480 |
while (trackedClashedDesIt && !atomicClash) { |
| 7481 |
CConceptDescriptor* conDes = trackedClashedDesIt->getConceptDescriptor(); |
| 7482 |
CConcept* concept = conDes->getConcept(); |
| 7483 |
bool conNeg = conDes->getNegation(); |
| 7484 |
CTrackedClashedDescriptor* atomClashedDesIt = trackedClashedDesIt->getNextDescriptor(); |
| 7485 |
while (atomClashedDesIt && !atomicClash) { |
| 7486 |
CConceptDescriptor* othConDes = atomClashedDesIt->getConceptDescriptor(); |
| 7487 |
if (othConDes->getConcept() == concept && othConDes->getNegation() != conNeg) { |
| 7488 |
STATINC(UNSATCACHEWRITINGREQUSTATOMICCLASHFAILEDCOUNT,calcAlgContext); |
| 7489 |
atomicClash = true; |
| 7490 |
return false; |
| 7491 |
} |
| 7492 |
atomClashedDesIt = atomClashedDesIt->getNextDescriptor(); |
| 7493 |
} |
| 7494 |
trackedClashedDesIt = trackedClashedDesIt->getNextDescriptor(); |
| 7495 |
} |
| 7496 |
} |
| 7497 |
writeCacheLine &= !atomicClash; |
| 7498 |
if (writeCacheLine) { |
| 7499 |
|
| 7500 |
|
| 7501 |
//CConcept* orConcept = nullptr; |
| 7502 |
//for (CTrackedClashedDescriptor* cIt = trackedClashedDes; cIt; cIt = cIt->getNextDescriptor()) { |
| 7503 |
// if (cIt->getConceptDescriptor()->getConcept()->getOperatorCode() == CCAND && cIt->getConceptDescriptor()->isNegated() && cIt->getConceptDescriptor()->getConcept()->getOperandCount() > 2) { |
| 7504 |
// orConcept = cIt->getConceptDescriptor()->getConcept(); |
| 7505 |
// } |
| 7506 |
//} |
| 7507 |
//if (orConcept) { |
| 7508 |
// for (CSortedNegLinker<CConcept*>* opConIt = orConcept->getOperandList(); opConIt; opConIt = opConIt->getNext()) { |
| 7509 |
// bool found = false; |
| 7510 |
// for (CTrackedClashedDescriptor* cIt = trackedClashedDes; cIt; cIt = cIt->getNextDescriptor()) { |
| 7511 |
// if (cIt->getConceptDescriptor()->getConcept() == opConIt->getData()) { |
| 7512 |
// found = true; |
| 7513 |
// } |
| 7514 |
// } |
| 7515 |
// if (!found) { |
| 7516 |
// mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 7517 |
// QFile file(QString("caching-error.txt")); |
| 7518 |
// if (file.open(QIODevice::WriteOnly)) { |
| 7519 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 7520 |
// file.close(); |
| 7521 |
// } |
| 7522 |
// bool bug = true; |
| 7523 |
// } |
| 7524 |
// } |
| 7525 |
//} |
| 7526 |
|
| 7527 |
if (mConfUnsatCachingUseNodeSignatureSet) { |
| 7528 |
addIndiNodeSignatureOfUnsatisfiableClashedDescriptors(trackedClashedDes,calcAlgContext); |
| 7529 |
} |
| 7530 |
trackedClashedDes = getSortedClashedDescriptors(trackedClashedDes,calcAlgContext); |
| 7531 |
KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION( |
| 7532 |
if (mBacktrackDebug) { |
| 7533 |
mSortedCachingClashString = generateDebugTrackedClashedDescriptorString(trackedClashedDes,calcAlgContext); |
| 7534 |
} |
| 7535 |
) |
| 7536 |
writeUnsatisfiableClashedDescriptors(trackedClashedDes,calcAlgContext); |
| 7537 |
return true; |
| 7538 |
} |
| 7539 |
} |
| 7540 |
} |
| 7541 |
return false; |
| 7542 |
} |
| 7543 |
|
| 7544 |
|
| 7545 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndiNodeSignatureOfUnsatisfiableClashedDescriptors(CTrackedClashedDescriptor* trackedClashedDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7546 |
cint64 indiID = trackedClashedDes->getAppropriatedIndividualID(); |
| 7547 |
CIndividualProcessNode* indi = getCorrectedNominalIndividualNode(indiID,calcAlgContext); |
| 7548 |
CReapplyConceptLabelSet* conSet = indi->getReapplyConceptLabelSet(false); |
| 7549 |
cint64 conSig = conSet->getConceptSignatureValue(); |
| 7550 |
mUnsatCachingSignatureSet.insert(conSig); |
| 7551 |
return true; |
| 7552 |
} |
| 7553 |
|
| 7554 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isClashedDescriptorSortedBefore(CTrackedClashedDescriptor* trackedClashedDesBefore, CTrackedClashedDescriptor* trackedClashedDesAfter, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7555 |
return !trackedClashedDesAfter || trackedClashedDesBefore->getConceptDescriptor()->getConceptTag() <= trackedClashedDesAfter->getConceptDescriptor()->getConceptTag(); |
| 7556 |
} |
| 7557 |
|
| 7558 |
|
| 7559 |
CTrackedClashedDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::getSortedClashedDescriptors(CTrackedClashedDescriptor* trackedClashedDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7560 |
CTrackedClashedDescriptor* sortedTrackedClashedDes = trackedClashedDes; |
| 7561 |
trackedClashedDes = trackedClashedDes->getNextDescriptor(); |
| 7562 |
sortedTrackedClashedDes->clearNext(); |
| 7563 |
while (trackedClashedDes) { |
| 7564 |
CTrackedClashedDescriptor* tmpTrackedClashedDes = trackedClashedDes; |
| 7565 |
trackedClashedDes = trackedClashedDes->getNextDescriptor(); |
| 7566 |
tmpTrackedClashedDes->clearNext(); |
| 7567 |
|
| 7568 |
if (isClashedDescriptorSortedBefore(tmpTrackedClashedDes,sortedTrackedClashedDes,calcAlgContext)) { |
| 7569 |
sortedTrackedClashedDes = tmpTrackedClashedDes->append(sortedTrackedClashedDes); |
| 7570 |
} else { |
| 7571 |
CTrackedClashedDescriptor* sortedInsertPosIt = sortedTrackedClashedDes; |
| 7572 |
while (sortedInsertPosIt) { |
| 7573 |
CTrackedClashedDescriptor* nextSortedPosDes = sortedInsertPosIt->getNextDescriptor(); |
| 7574 |
if (isClashedDescriptorSortedBefore(tmpTrackedClashedDes,nextSortedPosDes,calcAlgContext)) { |
| 7575 |
sortedInsertPosIt->insertNext(tmpTrackedClashedDes); |
| 7576 |
break; |
| 7577 |
} |
| 7578 |
sortedInsertPosIt = nextSortedPosDes; |
| 7579 |
} |
| 7580 |
} |
| 7581 |
} |
| 7582 |
return sortedTrackedClashedDes; |
| 7583 |
} |
| 7584 |
|
| 7585 |
|
| 7586 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::writeUnsatisfiableClashedDescriptors(CTrackedClashedDescriptor* trackedClashedDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7587 |
CUnsatisfiableCacheHandler* unsatCacheHandler = calcAlgContext->getUsedUnsatisfiableCacheHandler(); |
| 7588 |
if (unsatCacheHandler) { |
| 7589 |
return unsatCacheHandler->writeUnsatisfiableClashedDescriptors(trackedClashedDes,calcAlgContext); |
| 7590 |
} |
| 7591 |
return false; |
| 7592 |
} |
| 7593 |
|
| 7594 |
|
| 7595 |
CTrackedClashedDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::getCollectedFilteredClashedDescriptorsFromBranch(CTrackedClashedDescriptor* nonDetClashedPointingDes, CNonDeterministicDependencyNode* nonDetBranchDepNode, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext, CMemoryAllocationManager* tmpMemMan) { |
| 7596 |
CPROCESSINGSET<CTrackedClashedDescriptorHasher> testClashedSet(calcAlgContext->getUsedTaskProcessorContext()); |
| 7597 |
CNonDeterministicDependencyTrackPoint* trackPointIt = nonDetBranchDepNode->getBranchTrackPoints(); |
| 7598 |
CTrackedClashedDescriptor* newTrackedClashedDescriptorList = nullptr; |
| 7599 |
|
| 7600 |
CTrackedClashedDescriptor* nonDetPointingFirstTrackedClashedDescriptor = nonDetClashedPointingDes; |
| 7601 |
|
| 7602 |
while (trackPointIt) { |
| 7603 |
CClashedDependencyDescriptor* clashedDepDescriptors = trackPointIt->getClashes(); |
| 7604 |
|
| 7605 |
CClashedDependencyDescriptor* clashedDepDescriptorsIt = clashedDepDescriptors; |
| 7606 |
while (clashedDepDescriptorsIt) { |
| 7607 |
CClashedDependencyDescriptor* clashedDepDescriptor = clashedDepDescriptorsIt; |
| 7608 |
if (clashedDepDescriptor->getDependencyTrackPoint()->getDependencyNode() != nonDetBranchDepNode) { |
| 7609 |
CTrackedClashedDescriptor* netTrackedClashDes = createTrackedClashesDescriptor(clashedDepDescriptor,calcAlgContext,tmpMemMan); |
| 7610 |
CTrackedClashedDescriptorHasher hasher(netTrackedClashDes); |
| 7611 |
if (!testClashedSet.contains(hasher)) { |
| 7612 |
// each dependency only once |
| 7613 |
testClashedSet.insert(hasher); |
| 7614 |
newTrackedClashedDescriptorList = netTrackedClashDes->append(newTrackedClashedDescriptorList); |
| 7615 |
} |
| 7616 |
} else { |
| 7617 |
if (!nonDetPointingFirstTrackedClashedDescriptor) { |
| 7618 |
nonDetPointingFirstTrackedClashedDescriptor = createTrackedClashesDescriptor(clashedDepDescriptor,calcAlgContext,tmpMemMan); |
| 7619 |
} |
| 7620 |
} |
| 7621 |
clashedDepDescriptorsIt = clashedDepDescriptorsIt->getNext(); |
| 7622 |
} |
| 7623 |
|
| 7624 |
for (CXLinker<cint64>* involvedIndiIdLinkerIt = trackPointIt->getInvolvedIndividualIdsLinker(); involvedIndiIdLinkerIt; involvedIndiIdLinkerIt = involvedIndiIdLinkerIt->getNext()) { |
| 7625 |
cint64 indiId = involvedIndiIdLinkerIt->getData(); |
| 7626 |
trackingLine->addInvolvedIndividual(indiId); |
| 7627 |
} |
| 7628 |
|
| 7629 |
|
| 7630 |
trackPointIt = trackPointIt->getNext(); |
| 7631 |
} |
| 7632 |
|
| 7633 |
KONCLUDE_ASSERT_X(nonDetPointingFirstTrackedClashedDescriptor,"getCollectedFilteredClashedDescriptorsFromBranch","track point for non-deterministic dependency not found"); |
| 7634 |
|
| 7635 |
CTrackedClashedDescriptor* nonDetBacktrackedClashedDes = getBacktrackedDeterministicClashedDescriptors(nonDetPointingFirstTrackedClashedDescriptor,trackingLine,nullptr,calcAlgContext); |
| 7636 |
CTrackedClashedDescriptor* nonDetBacktrackedClashedDesIt = nonDetBacktrackedClashedDes; |
| 7637 |
while (nonDetBacktrackedClashedDesIt) { |
| 7638 |
nonDetBacktrackedClashedDes = nonDetBacktrackedClashedDesIt; |
| 7639 |
nonDetBacktrackedClashedDesIt = nonDetBacktrackedClashedDesIt->getNextDescriptor(); |
| 7640 |
nonDetBacktrackedClashedDes->clearNext(); |
| 7641 |
|
| 7642 |
CTrackedClashedDescriptorHasher hasher(nonDetBacktrackedClashedDes); |
| 7643 |
if (!testClashedSet.contains(hasher)) { |
| 7644 |
// each dependency only once |
| 7645 |
testClashedSet.insert(hasher); |
| 7646 |
newTrackedClashedDescriptorList = nonDetBacktrackedClashedDes->append(newTrackedClashedDescriptorList); |
| 7647 |
} |
| 7648 |
} |
| 7649 |
|
| 7650 |
|
| 7651 |
return newTrackedClashedDescriptorList; |
| 7652 |
} |
| 7653 |
|
| 7654 |
|
| 7655 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::backtrackDeterministicBranchingClashedDescriptorFromCurrentIndividualNodeLevel(CTrackedClashedDescriptor* trackedClashedDes, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7656 |
cint64 minIndiLevel = CINT64_MAX; |
| 7657 |
CTrackedClashedDescriptor* newTrackedClashedDesList = getBacktrackedDeterministicClashedDescriptors(trackedClashedDes,trackingLine,&minIndiLevel,calcAlgContext); |
| 7658 |
trackingLine->addFreeTrackedClashedDescriptor(trackedClashedDes); |
| 7659 |
if (minIndiLevel < trackingLine->getIndividualNodeLevel()) { |
| 7660 |
// cache with old tracked clash descriptors |
| 7661 |
trackingLine->moveToNextIndividualNodeLevel(minIndiLevel); |
| 7662 |
} |
| 7663 |
trackingLine->sortInTrackedClashedDescriptors(newTrackedClashedDesList); |
| 7664 |
return true; |
| 7665 |
} |
| 7666 |
|
| 7667 |
|
| 7668 |
|
| 7669 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::backtrackDeterministicClashedDescriptorFromPreviousIndividualNodeLevels(CTrackedClashedDescriptor* trackedClashedDes, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7670 |
CTrackedClashedDescriptor* newTrackedClashedDesList = getBacktrackedDeterministicClashedDescriptors(trackedClashedDes,trackingLine,nullptr,calcAlgContext); |
| 7671 |
trackingLine->addFreeTrackedClashedDescriptor(trackedClashedDes); |
| 7672 |
trackingLine->sortInTrackedClashedDescriptors(newTrackedClashedDesList); |
| 7673 |
return true; |
| 7674 |
} |
| 7675 |
|
| 7676 |
|
| 7677 |
CTrackedClashedDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::getBacktrackedDeterministicClashedDescriptorsBeforeProcessingTag(CTrackedClashedDescriptor* trackedClashedDescriptors, cint64 processingTag, CTrackedClashedDependencyLine* trackingLine, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7678 |
CPROCESSINGSET<CTrackedClashedDescriptorHasher>* testClashedSet = trackingLine->getTrackedClashedDescriptorSet(); |
| 7679 |
CTrackedClashedDescriptor* newTrackedClashedDescriptorList = nullptr; |
| 7680 |
CTrackedClashedDescriptor* trackedClashedDescriptorIt = trackedClashedDescriptors; |
| 7681 |
while (trackedClashedDescriptorIt) { |
| 7682 |
CTrackedClashedDescriptor* trackedClashedDescriptor = trackedClashedDescriptorIt; |
| 7683 |
trackedClashedDescriptorIt = trackedClashedDescriptorIt->getNextDescriptor(); |
| 7684 |
trackedClashedDescriptor->clearNext(); |
| 7685 |
if (trackedClashedDescriptor->isPointingToNonDeterministicDependencyNode()) { |
| 7686 |
KONCLUDE_ASSERT_X(!trackedClashedDescriptor->isProcessedAfter(processingTag),"getBacktrackedDeterministicClashedDescriptorsBeforeProcessingTag","non-deterministic dependency is processed after max branching leveled dependency"); |
| 7687 |
newTrackedClashedDescriptorList = trackedClashedDescriptor->append(newTrackedClashedDescriptorList); |
| 7688 |
} else { |
| 7689 |
if (trackedClashedDescriptor->isProcessedAfter(processingTag)) { |
| 7690 |
CDependencyTrackPoint* depTrackPoint = trackedClashedDescriptor->getDependencyTrackPoint(); |
| 7691 |
//if (depTrackPoint->isPointingToIndependentDependencyNode()) { |
| 7692 |
// CTrackedClashedDescriptor* newTrackedClashedDescriptor = getFreeTrackedClashedDescriptor(trackingLine,calcAlgContext); |
| 7693 |
// newTrackedClashedDescriptor->initTrackedClashedDescriptor(trackedClashedDescriptor,nullptr,depTrackPoint); |
| 7694 |
|
| 7695 |
// CTrackedClashedDescriptorHasher hasher(newTrackedClashedDescriptor); |
| 7696 |
// if (!testClashedSet->contains(hasher)) { |
| 7697 |
// // each dependency only once |
| 7698 |
// testClashedSet->insert(hasher); |
| 7699 |
|
| 7700 |
// trackedClashedDescriptorIt = newTrackedClashedDescriptor->append(trackedClashedDescriptorIt); |
| 7701 |
// } else { |
| 7702 |
// trackingLine->addFreeTrackedClashedDescriptor(newTrackedClashedDescriptor); |
| 7703 |
// } |
| 7704 |
|
| 7705 |
//} else { |
| 7706 |
CTrackedClashedDescriptor* newTrackedClashedDescriptorIt = getBacktrackedDeterministicClashedDescriptors(trackedClashedDescriptor,trackingLine,nullptr,calcAlgContext); |
| 7707 |
while (newTrackedClashedDescriptorIt) { |
| 7708 |
CTrackedClashedDescriptor* newTrackedClashedDescriptor = newTrackedClashedDescriptorIt; |
| 7709 |
newTrackedClashedDescriptorIt = newTrackedClashedDescriptorIt->getNextDescriptor(); |
| 7710 |
newTrackedClashedDescriptor->clearNext(); |
| 7711 |
|
| 7712 |
CTrackedClashedDescriptorHasher hasher(newTrackedClashedDescriptor); |
| 7713 |
if (!testClashedSet->contains(hasher)) { |
| 7714 |
// each dependency only once |
| 7715 |
testClashedSet->insert(hasher); |
| 7716 |
|
| 7717 |
trackedClashedDescriptorIt = newTrackedClashedDescriptor->append(trackedClashedDescriptorIt); |
| 7718 |
} else { |
| 7719 |
trackingLine->addFreeTrackedClashedDescriptor(newTrackedClashedDescriptor); |
| 7720 |
} |
| 7721 |
} |
| 7722 |
//} |
| 7723 |
trackingLine->addFreeTrackedClashedDescriptor(trackedClashedDescriptor); |
| 7724 |
} else if (!trackedClashedDescriptor->getConceptDescriptor() && !trackedClashedDescriptor->isPointingToIndependentDependencyNode()) { |
| 7725 |
// try backtrack |
| 7726 |
cint64 continuedIndiID = trackedClashedDescriptor->getAppropriatedIndividualID(); |
| 7727 |
bool allIndiIDContinued = true; |
| 7728 |
CTrackedClashedDescriptor* newTrackedClashedDescriptors = getBacktrackedDeterministicClashedDescriptors(trackedClashedDescriptor,trackingLine,nullptr,calcAlgContext); |
| 7729 |
CTrackedClashedDescriptor* newTrackedClashedDescriptorIt = newTrackedClashedDescriptors; |
| 7730 |
while (newTrackedClashedDescriptorIt && allIndiIDContinued) { |
| 7731 |
if (newTrackedClashedDescriptorIt->getAppropriatedIndividualID() != continuedIndiID) { |
| 7732 |
allIndiIDContinued = false; |
| 7733 |
} |
| 7734 |
newTrackedClashedDescriptorIt = newTrackedClashedDescriptorIt->getNextDescriptor(); |
| 7735 |
} |
| 7736 |
if (!allIndiIDContinued) { |
| 7737 |
newTrackedClashedDescriptorList = trackedClashedDescriptor->append(newTrackedClashedDescriptorList); |
| 7738 |
newTrackedClashedDescriptorIt = newTrackedClashedDescriptors; |
| 7739 |
while (newTrackedClashedDescriptorIt) { |
| 7740 |
CTrackedClashedDescriptor* newTrackedClashedDescriptor = newTrackedClashedDescriptorIt; |
| 7741 |
newTrackedClashedDescriptorIt = newTrackedClashedDescriptorIt->getNextDescriptor(); |
| 7742 |
newTrackedClashedDescriptor->clearNext(); |
| 7743 |
trackingLine->addFreeTrackedClashedDescriptor(newTrackedClashedDescriptor); |
| 7744 |
} |
| 7745 |
} else { |
| 7746 |
// |
| 7747 |
newTrackedClashedDescriptorIt = newTrackedClashedDescriptors; |
| 7748 |
while (newTrackedClashedDescriptorIt) { |
| 7749 |
CTrackedClashedDescriptor* newTrackedClashedDescriptor = newTrackedClashedDescriptorIt; |
| 7750 |
newTrackedClashedDescriptorIt = newTrackedClashedDescriptorIt->getNextDescriptor(); |
| 7751 |
newTrackedClashedDescriptor->clearNext(); |
| 7752 |
|
| 7753 |
CTrackedClashedDescriptorHasher hasher(newTrackedClashedDescriptor); |
| 7754 |
if (!testClashedSet->contains(hasher)) { |
| 7755 |
// each dependency only once |
| 7756 |
testClashedSet->insert(hasher); |
| 7757 |
|
| 7758 |
trackedClashedDescriptorIt = newTrackedClashedDescriptor->append(trackedClashedDescriptorIt); |
| 7759 |
} else { |
| 7760 |
trackingLine->addFreeTrackedClashedDescriptor(newTrackedClashedDescriptor); |
| 7761 |
} |
| 7762 |
} |
| 7763 |
trackingLine->addFreeTrackedClashedDescriptor(trackedClashedDescriptor); |
| 7764 |
} |
| 7765 |
|
| 7766 |
} else { |
| 7767 |
newTrackedClashedDescriptorList = trackedClashedDescriptor->append(newTrackedClashedDescriptorList); |
| 7768 |
} |
| 7769 |
} |
| 7770 |
} |
| 7771 |
return newTrackedClashedDescriptorList; |
| 7772 |
} |
| 7773 |
|
| 7774 |
|
| 7775 |
|
| 7776 |
|
| 7777 |
|
| 7778 |
|
| 7779 |
CTrackedClashedDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::getBacktrackedDeterministicClashedDescriptors(CTrackedClashedDescriptor* trackedClashedDes, CTrackedClashedDependencyLine* trackingLine, cint64* minIndiLevel, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7780 |
STATINC(CLASHEDBACKTRACKEDDESCRIPTORSCOUNT,calcAlgContext); |
| 7781 |
CDependencyNode* depNode = trackedClashedDes->getDependencyTrackPoint()->getDependencyNode(); |
| 7782 |
CConceptDescriptor* conDes = depNode->getConceptDescriptor(); |
| 7783 |
CIndividualProcessNode* indiNode = nullptr; |
| 7784 |
CIndividualProcessNode* newIndiNode = nullptr; |
| 7785 |
CTrackedClashedDescriptor* newTrackedClashedDesList = nullptr; |
| 7786 |
if (minIndiLevel) { |
| 7787 |
*minIndiLevel = trackedClashedDes->getAppropriatedIndividualLevel(); |
| 7788 |
} |
| 7789 |
if (depNode->hasAppropriateIndividualNode()) { |
| 7790 |
trackingLine->addInvolvedIndividual(depNode->getAppropriateIndividualNode()); |
| 7791 |
newIndiNode = getCoresspondingIndividualNodeFromDependency(depNode, calcAlgContext); |
| 7792 |
trackingLine->addInvolvedIndividual(newIndiNode); |
| 7793 |
if (minIndiLevel) { |
| 7794 |
*minIndiLevel = qMin(*minIndiLevel,newIndiNode->getIndividualNominalLevelOrAncestorDepth()); |
| 7795 |
} |
| 7796 |
} |
| 7797 |
CDependencyTrackPoint* depTrackPoint = depNode->getPreviousDependencyTrackPoint(); |
| 7798 |
|
| 7799 |
|
| 7800 |
CVariableBindingPath* varBindPath = trackedClashedDes->getVariableBindingPath(); |
| 7801 |
if (depNode->isRepresentativeSelectDependencyNode()) { |
| 7802 |
CRepresentativeSelectDependencyNode* repSelDepNode = dynamic_cast<CRepresentativeSelectDependencyNode*>(depNode); |
| 7803 |
varBindPath = repSelDepNode->getSelectedVariableBindingPath(); |
| 7804 |
} else if (depNode->isRepresentativeResolveDependencyNode()) { |
| 7805 |
CRepresentativeResolveDependencyNode* repResDepNode = dynamic_cast<CRepresentativeResolveDependencyNode*>(depNode); |
| 7806 |
|
| 7807 |
CRepresentativeVariableBindingPathMap* repVarBindPathMap = repResDepNode->getResolveRepresentativeVariableBindingPathMap(); |
| 7808 |
CRepresentativePropagationMap* repPropMap = repResDepNode->getResolveRepresentativePropagationMap(); |
| 7809 |
|
| 7810 |
|
| 7811 |
//if (!repVarBindPathMap->contains(varBindPath->getPropagationID())) { |
| 7812 |
// QFile file(QString("varPropModel.txt")); |
| 7813 |
// if (file.open(QIODevice::WriteOnly)) { |
| 7814 |
// mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 7815 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>", "\r\n").toLocal8Bit()); |
| 7816 |
// file.close(); |
| 7817 |
// } |
| 7818 |
//} |
| 7819 |
|
| 7820 |
|
| 7821 |
const CRepresentativeVariableBindingPathMapData& repVarBindPathMapData = repVarBindPathMap->value(varBindPath->getPropagationID()); |
| 7822 |
varBindPath = repVarBindPathMapData.getResolveVariableBindingPath(); |
| 7823 |
|
| 7824 |
cint64 resolveRepID = repVarBindPathMapData.getResolveRepresentativeVariableBindingPathSetDataID(); |
| 7825 |
|
| 7826 |
const CRepresentativePropagationMapData& repPropMapData = repPropMap->value(resolveRepID); |
| 7827 |
CRepresentativePropagationDescriptor* repPropDes = repPropMapData.getRepresentativePropagationDescriptor(); |
| 7828 |
|
| 7829 |
depTrackPoint = repPropDes->getDependencyTrackPoint(); |
| 7830 |
} |
| 7831 |
|
| 7832 |
|
| 7833 |
CTrackedClashedDescriptor* newTrackedClashedDes = getFreeTrackedClashedDescriptor(trackingLine,calcAlgContext); |
| 7834 |
if (newIndiNode) { |
| 7835 |
newTrackedClashedDes->initTrackedClashedDescriptor(newIndiNode,conDes,varBindPath,depTrackPoint); |
| 7836 |
} else { |
| 7837 |
newTrackedClashedDes->initTrackedClashedDescriptor(trackedClashedDes,conDes,varBindPath,depTrackPoint); |
| 7838 |
} |
| 7839 |
newTrackedClashedDes = tryGetInvalidSameIndividualNodeLevelBacktrackedDeterministicClashedDescriptors(newTrackedClashedDes,trackingLine,nullptr,calcAlgContext); |
| 7840 |
newTrackedClashedDesList = newTrackedClashedDes->append(newTrackedClashedDesList); |
| 7841 |
|
| 7842 |
|
| 7843 |
CDependencyIterator depIt = depNode->getAdditionalDependencyIterator(); |
| 7844 |
while (depIt.hasNext()) { |
| 7845 |
CDependency* dependency = depIt.nextDependency(); |
| 7846 |
// load additional dependencies |
| 7847 |
CDependencyTrackPoint* depTrackPoint = dependency->getPreviousDependencyTrackPoint(); |
| 7848 |
CIndividualProcessNode* addDepNewIndiNode = getCoresspondingIndividualNodeFromDependency(depTrackPoint,calcAlgContext); |
| 7849 |
trackingLine->addInvolvedIndividual(addDepNewIndiNode); |
| 7850 |
CTrackedClashedDescriptor* newTrackedClashedDes = getFreeTrackedClashedDescriptor(trackingLine,calcAlgContext); |
| 7851 |
if (!addDepNewIndiNode) { |
| 7852 |
newTrackedClashedDes->initTrackedClashedDescriptor(trackedClashedDes,nullptr,varBindPath,depTrackPoint); |
| 7853 |
} else { |
| 7854 |
if (minIndiLevel) { |
| 7855 |
*minIndiLevel = qMin(*minIndiLevel,addDepNewIndiNode->getIndividualNominalLevelOrAncestorDepth()); |
| 7856 |
} |
| 7857 |
newTrackedClashedDes->initTrackedClashedDescriptor(addDepNewIndiNode,nullptr,varBindPath,depTrackPoint); |
| 7858 |
} |
| 7859 |
newTrackedClashedDes = tryGetInvalidSameIndividualNodeLevelBacktrackedDeterministicClashedDescriptors(newTrackedClashedDes,trackingLine,nullptr,calcAlgContext); |
| 7860 |
newTrackedClashedDesList = newTrackedClashedDes->append(newTrackedClashedDesList); |
| 7861 |
} |
| 7862 |
return newTrackedClashedDesList; |
| 7863 |
} |
| 7864 |
|
| 7865 |
|
| 7866 |
CTrackedClashedDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::tryGetInvalidSameIndividualNodeLevelBacktrackedDeterministicClashedDescriptors(CTrackedClashedDescriptor* trackedClashedDes, CTrackedClashedDependencyLine* trackingLine, cint64* minIndiLevel, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7867 |
if (trackedClashedDes->getConceptDescriptor() == nullptr && trackedClashedDes->isPointingToDeterministicDependencyNode() && !trackedClashedDes->isPointingToIndependentDependencyNode()) { |
| 7868 |
CDependencyNode* depNode = trackedClashedDes->getDependencyTrackPoint()->getDependencyNode(); |
| 7869 |
cint64 currLevel = trackedClashedDes->getAppropriatedIndividualLevel(); |
| 7870 |
CIndividualProcessNode* indiNode = nullptr; |
| 7871 |
CTrackedClashedDescriptor* newTrackedClashedDesList = nullptr; |
| 7872 |
if (minIndiLevel) { |
| 7873 |
*minIndiLevel = trackedClashedDes->getAppropriatedIndividualLevel(); |
| 7874 |
} |
| 7875 |
if (depNode->hasAppropriateIndividualNode()) { |
| 7876 |
indiNode = getCoresspondingIndividualNodeFromDependency(depNode,calcAlgContext); |
| 7877 |
if (indiNode->getIndividualNominalLevelOrAncestorDepth() != currLevel) { |
| 7878 |
return trackedClashedDes; |
| 7879 |
} |
| 7880 |
} |
| 7881 |
|
| 7882 |
CDependencyIterator depIt = depNode->getAdditionalDependencyIterator(); |
| 7883 |
while (depIt.hasNext()) { |
| 7884 |
CDependency* dependency = depIt.nextDependency(); |
| 7885 |
// load additional dependencies |
| 7886 |
CDependencyTrackPoint* depTrackPoint = dependency->getPreviousDependencyTrackPoint(); |
| 7887 |
CIndividualProcessNode* addDepNewIndiNode = getCoresspondingIndividualNodeFromDependency(depTrackPoint,calcAlgContext); |
| 7888 |
trackingLine->addInvolvedIndividual(addDepNewIndiNode); |
| 7889 |
if (addDepNewIndiNode && addDepNewIndiNode->getIndividualNominalLevelOrAncestorDepth() != currLevel) { |
| 7890 |
return trackedClashedDes; |
| 7891 |
} |
| 7892 |
} |
| 7893 |
return getBacktrackedDeterministicClashedDescriptors(trackedClashedDes,trackingLine,minIndiLevel,calcAlgContext); |
| 7894 |
} |
| 7895 |
return trackedClashedDes; |
| 7896 |
} |
| 7897 |
|
| 7898 |
|
| 7899 |
|
| 7900 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::initializeTrackingLine(CTrackedClashedDependencyLine* trackingLine, CTrackedClashedDescriptor* trackingClashes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7901 |
bool trackingError = false; |
| 7902 |
bool nominalOccured = false; |
| 7903 |
cint64 maxBranchingLevel = CINT64_MIN; |
| 7904 |
cint64 minIndividualLevel = CINT64_MAX; |
| 7905 |
CTrackedClashedDescriptor* trackingClashesIt = trackingClashes; |
| 7906 |
while (trackingClashesIt && !trackingError) { |
| 7907 |
trackingClashesIt->candidateTracking(&trackingError,&nominalOccured,&maxBranchingLevel,&minIndividualLevel); |
| 7908 |
trackingClashesIt = trackingClashesIt->getNextDescriptor(); |
| 7909 |
} |
| 7910 |
if (trackingError) { |
| 7911 |
return false; |
| 7912 |
} |
| 7913 |
trackingLine->initTrackedClashedDependencyLine(nominalOccured,minIndividualLevel,maxBranchingLevel); |
| 7914 |
trackingLine->analyseInvolvedIndividuals(trackingClashes); |
| 7915 |
trackingLine->sortInTrackedClashedDescriptors(trackingClashes, true); |
| 7916 |
return true; |
| 7917 |
} |
| 7918 |
|
| 7919 |
|
| 7920 |
|
| 7921 |
CTrackedClashedDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createTrackedClashesDescriptors(CClashedDependencyDescriptor* clashes, CCalculationAlgorithmContextBase* calcAlgContext, CMemoryAllocationManager* tmpMemMan, bool copyIndependentConceptDescriptors) { |
| 7922 |
if (!tmpMemMan) { |
| 7923 |
tmpMemMan = calcAlgContext->getUsedTemporaryMemoryAllocationManager(); |
| 7924 |
} |
| 7925 |
|
| 7926 |
CTrackedClashedDescriptor* trackingClashes = nullptr; |
| 7927 |
CClashedDependencyDescriptor* nextClash = clashes; |
| 7928 |
while (nextClash) { |
| 7929 |
CTrackedClashedDescriptor* newTrackingClash = nullptr; |
| 7930 |
newTrackingClash = createTrackedClashesDescriptor(nextClash,calcAlgContext,tmpMemMan, copyIndependentConceptDescriptors); |
| 7931 |
trackingClashes = newTrackingClash->append(trackingClashes); |
| 7932 |
nextClash = nextClash->getNext(); |
| 7933 |
} |
| 7934 |
return trackingClashes; |
| 7935 |
} |
| 7936 |
|
| 7937 |
|
| 7938 |
|
| 7939 |
CTrackedClashedDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createTrackedClashesDescriptor(CClashedDependencyDescriptor* clashDes, CCalculationAlgorithmContextBase* calcAlgContext, CMemoryAllocationManager* tmpMemMan, bool copyIndependentConceptDescriptors) { |
| 7940 |
if (!tmpMemMan) { |
| 7941 |
tmpMemMan = calcAlgContext->getUsedTemporaryMemoryAllocationManager(); |
| 7942 |
} |
| 7943 |
|
| 7944 |
CTrackedClashedDescriptor* newTrackingClash = nullptr; |
| 7945 |
CTrackedClashedDescriptor* clashedTrackDes = dynamic_cast<CTrackedClashedDescriptor*>(clashDes); |
| 7946 |
if (clashedTrackDes) { |
| 7947 |
newTrackingClash = CObjectAllocator< CTrackedClashedDescriptor >::allocateAndConstruct(tmpMemMan); |
| 7948 |
newTrackingClash->initTrackedClashedDescriptor(clashedTrackDes); |
| 7949 |
if (newTrackingClash->isPointingToIndependentDependencyNode() && copyIndependentConceptDescriptors && newTrackingClash->getConceptDescriptor()) { |
| 7950 |
CConceptDescriptor* conDes = newTrackingClash->getConceptDescriptor(); |
| 7951 |
CConceptDescriptor* conDesCopy = CObjectAllocator< CConceptDescriptor >::allocateAndConstruct(tmpMemMan); |
| 7952 |
conDesCopy->initConceptDescriptor(conDes->getConcept(), conDes->isNegated(), conDes->getDependencyTrackPoint()); |
| 7953 |
newTrackingClash->setConceptDescriptor(conDesCopy); |
| 7954 |
} |
| 7955 |
} else { |
| 7956 |
CClashedConceptDescriptor* clashedConDes = dynamic_cast<CClashedConceptDescriptor*>(clashDes); |
| 7957 |
if (clashedConDes) { |
| 7958 |
newTrackingClash = CObjectAllocator< CTrackedClashedDescriptor >::allocateAndConstruct(tmpMemMan); |
| 7959 |
newTrackingClash->initTrackedClashedDescriptor(clashedConDes->getAppropriatedIndividual(),clashedConDes->getConceptDescriptor(),nullptr,clashedConDes->getDependencyTrackPoint()); |
| 7960 |
} else { |
| 7961 |
CClashedDatatypeValueSpaceExclusionDescriptor* clashedDataVSExDes = dynamic_cast<CClashedDatatypeValueSpaceExclusionDescriptor*>(clashDes); |
| 7962 |
if (clashedDataVSExDes) { |
| 7963 |
newTrackingClash = CObjectAllocator< CTrackedClashedDescriptor >::allocateAndConstruct(tmpMemMan); |
| 7964 |
newTrackingClash->initTrackedClashedDescriptor(clashedDataVSExDes->getAppropriatedIndividual(),nullptr,nullptr,clashedDataVSExDes->getDependencyTrackPoint()); |
| 7965 |
} else { |
| 7966 |
CIndividualProcessNode* indiNode = getCoresspondingIndividualNodeFromDependency(clashDes->getDependencyTrackPoint(),calcAlgContext); |
| 7967 |
newTrackingClash = CObjectAllocator< CTrackedClashedDescriptor >::allocateAndConstruct(tmpMemMan); |
| 7968 |
newTrackingClash->initTrackedClashedDescriptor(indiNode,nullptr,nullptr,clashDes->getDependencyTrackPoint()); |
| 7969 |
} |
| 7970 |
} |
| 7971 |
} |
| 7972 |
return newTrackingClash; |
| 7973 |
} |
| 7974 |
|
| 7975 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getCoresspondingIndividualNodeFromDependency(CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7976 |
CDependencyNode* depNode = depTrackPoint->getDependencyNode(); |
| 7977 |
return getCoresspondingIndividualNodeFromDependency(depNode,calcAlgContext); |
| 7978 |
} |
| 7979 |
|
| 7980 |
|
| 7981 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getCoresspondingIndividualNodeFromDependency(CDependencyNode* depNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7982 |
CIndividualProcessNode* indi = nullptr; |
| 7983 |
indi = depNode->getAppropriateIndividualNode(); |
| 7984 |
//KONCLUDE_ASSERT_X(indi,"getCoresspondingIndividualNodeFromDependency","individual node not available"); |
| 7985 |
if (indi) { |
| 7986 |
CIndividualProcessNode* updIndi = getUpToDateIndividual(indi,calcAlgContext); |
| 7987 |
if (updIndi) { |
| 7988 |
if (updIndi->hasMergedIntoIndividualNodeID()) { |
| 7989 |
updIndi = getCorrectedNominalIndividualNode(updIndi->getMergedIntoIndividualNodeID(),calcAlgContext); |
| 7990 |
} |
| 7991 |
indi = updIndi; |
| 7992 |
} |
| 7993 |
} |
| 7994 |
return indi; |
| 7995 |
} |
| 7996 |
|
| 7997 |
|
| 7998 |
|
| 7999 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugDependentNominalsString(CIndividualProcessNode* indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8000 |
QStringList nominalDependentStringList; |
| 8001 |
CSuccessorConnectedNominalSet* connNomSet = indi->getSuccessorNominalConnectionSet(false); |
| 8002 |
if (connNomSet) { |
| 8003 |
for (CSuccessorConnectedNominalSet::const_iterator it = connNomSet->constBegin(), itEnd = connNomSet->constEnd(); it != itEnd; ++it) { |
| 8004 |
cint64 nominalID = *it; |
| 8005 |
QString nominalString = QString("%1").arg(nominalID); |
| 8006 |
nominalDependentStringList.append(nominalString); |
| 8007 |
} |
| 8008 |
} |
| 8009 |
return nominalDependentStringList.join(", "); |
| 8010 |
} |
| 8011 |
|
| 8012 |
|
| 8013 |
|
| 8014 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugIncrementalExpansionString(CIndividualProcessNode* indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8015 |
QString incExpString; |
| 8016 |
CIndividualNodeIncrementalExpansionData* incExpData = indi->getIncrementalExpansionData(false); |
| 8017 |
if (incExpData) { |
| 8018 |
QStringList statusStringList; |
| 8019 |
if (incExpData->isPreviousCompletionGraphCompatible()) { |
| 8020 |
statusStringList += QString("compatible"); |
| 8021 |
} |
| 8022 |
if (incExpData->hasDirectlyChangedNeighbourConnection()) { |
| 8023 |
statusStringList += QString("directly-changed-connection"); |
| 8024 |
} |
| 8025 |
if (incExpData->isDirectlyChanged()) { |
| 8026 |
statusStringList += QString("directly-changed-node"); |
| 8027 |
} |
| 8028 |
QString dirChangedNeighConnNodeID = "-"; |
| 8029 |
if (incExpData->getDirectlyChangedNeighbourConnectionNode()) { |
| 8030 |
dirChangedNeighConnNodeID = QString("%1").arg(incExpData->getDirectlyChangedNeighbourConnectionNode()->getIndividualNodeID()); |
| 8031 |
} |
| 8032 |
double expansionPriority = incExpData->getExpansionPriority(); |
| 8033 |
incExpString += QString("Incremental-Expansion-Status: %1\r\n Directly-Changed-Connection-Neighbour: %2\r\n Expansion-Priority: %3").arg(statusStringList.join(", ")).arg(dirChangedNeighConnNodeID).arg(expansionPriority); |
| 8034 |
} |
| 8035 |
return incExpString; |
| 8036 |
} |
| 8037 |
|
| 8038 |
|
| 8039 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugIndiStatusString(CIndividualProcessNode* indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8040 |
QStringList statusStringList; |
| 8041 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION)) { |
| 8042 |
statusStringList.append("invalid-blocker"); |
| 8043 |
} |
| 8044 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 8045 |
statusStringList.append("pruned"); |
| 8046 |
} |
| 8047 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGBLOCKED)) { |
| 8048 |
statusStringList.append("processing blocked"); |
| 8049 |
} |
| 8050 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED)) { |
| 8051 |
statusStringList.append("satisfiable-cached"); |
| 8052 |
} |
| 8053 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED)) { |
| 8054 |
statusStringList.append("ancestor-satisfiable-cached"); |
| 8055 |
} |
| 8056 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFDIRECTBLOCKED)) { |
| 8057 |
cint64 blockerIndiID = indi->getBlockerIndividualNode()->getIndividualNodeID(); |
| 8058 |
cint64 lastConTag = indi->mDebugBlockerLastConceptDes->getConceptTag(); |
| 8059 |
statusStringList.append(QString("direct-blocked by %1 (%2)").arg(blockerIndiID).arg(lastConTag)); |
| 8060 |
} |
| 8061 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINDIRECTBLOCKED)) { |
| 8062 |
statusStringList.append("indirect-blocked"); |
| 8063 |
} |
| 8064 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS)) { |
| 8065 |
statusStringList.append("indirect-blocking-loss"); |
| 8066 |
} |
| 8067 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEDIRECTMODIFIED)) { |
| 8068 |
statusStringList.append("blocking-retest-direct-modification"); |
| 8069 |
} |
| 8070 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEBLOCKERMODIFIED)) { |
| 8071 |
statusStringList.append("blocking-retest-blocker-modification"); |
| 8072 |
} |
| 8073 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEANCESTORMODIFIED)) { |
| 8074 |
statusStringList.append("blocking-retest-ancestor-modification"); |
| 8075 |
} |
| 8076 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED)) { |
| 8077 |
CSignatureBlockingIndividualNodeConceptExpansionData* locSigBlockingData = indi->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 8078 |
cint64 blockerIndiID = -1; |
| 8079 |
if (locSigBlockingData->getBlockerIndividualNode()) { |
| 8080 |
blockerIndiID = locSigBlockingData->getBlockerIndividualNode()->getIndividualNodeID(); |
| 8081 |
} |
| 8082 |
statusStringList.append(QString("signature-blocking-cached by %1").arg(blockerIndiID)); |
| 8083 |
} |
| 8084 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED)) { |
| 8085 |
statusStringList.append("ancestor-signature-blocking-cached"); |
| 8086 |
} |
| 8087 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFREUSINGINDIVIDUAL)) { |
| 8088 |
statusStringList.append("reusing-individual-blocked"); |
| 8089 |
} |
| 8090 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORREUSINGINDIVIDUALBLOCKED)) { |
| 8091 |
statusStringList.append("ancestor-reusing-individual-blocked"); |
| 8092 |
} |
| 8093 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED)) { |
| 8094 |
statusStringList.append("saturation-cached-blocked"); |
| 8095 |
} |
| 8096 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED)) { |
| 8097 |
statusStringList.append("ancestor-saturation-cached-blocked"); |
| 8098 |
} |
| 8099 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED)) { |
| 8100 |
statusStringList.append("completion-graph-cached-blocked"); |
| 8101 |
} |
| 8102 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALID)) { |
| 8103 |
statusStringList.append("completion-graph-caching-invalid"); |
| 8104 |
} |
| 8105 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHEDNODELOCATED)) { |
| 8106 |
statusStringList.append("completion-graph-caching-node-located"); |
| 8107 |
} |
| 8108 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHEDNODEEXTENDED)) { |
| 8109 |
statusStringList.append("completion-graph-caching-node-extended"); |
| 8110 |
} |
| 8111 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED)) { |
| 8112 |
statusStringList.append("completion-graph-caching-invalidated"); |
| 8113 |
} |
| 8114 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTCOMPLETIONGRAPHCACHEDDUEDIRECTMODIFIED)) { |
| 8115 |
statusStringList.append("completion-graph-caching-retest-due-to-modification"); |
| 8116 |
} |
| 8117 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 8118 |
statusStringList.append("successor-nominal-connection"); |
| 8119 |
} |
| 8120 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNEWNOMINALCONNECTION)) { |
| 8121 |
statusStringList.append("successor-new-nominal-connection"); |
| 8122 |
} |
| 8123 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCONCRETEDATAINDINODE)) { |
| 8124 |
statusStringList.append("data-node"); |
| 8125 |
} |
| 8126 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKEND)) { |
| 8127 |
statusStringList.append("backend-synchronization"); |
| 8128 |
} |
| 8129 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED)) { |
| 8130 |
statusStringList.append("backend-synchronized-nominal-indirect-connections-expansion-blocked"); |
| 8131 |
} |
| 8132 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED)) { |
| 8133 |
statusStringList.append("backend-synchronized-neighbour-expansion-blocked"); |
| 8134 |
} |
| 8135 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION)) { |
| 8136 |
statusStringList.append("backend-synchronized-neighbour-partial-expansion"); |
| 8137 |
} |
| 8138 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDFULLEXPANSION)) { |
| 8139 |
statusStringList.append("backend-synchronized-neighbour-full-expansion"); |
| 8140 |
} |
| 8141 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED)) { |
| 8142 |
statusStringList.append("backend-synchronized-successor-expansion-blocked"); |
| 8143 |
} |
| 8144 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANDING)) { |
| 8145 |
statusStringList.append("incremental-expansion"); |
| 8146 |
} |
| 8147 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANSIONRETESTDUEDIRECTMODIFIED)) { |
| 8148 |
statusStringList.append("incremental-expansion-compatibility-checking-due-to-modification"); |
| 8149 |
} |
| 8150 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFREUSINGINDIVIDUAL)) { |
| 8151 |
statusStringList.append("backend-expansion-reusing-individual"); |
| 8152 |
} |
| 8153 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSINGINDIVIDUAL)) { |
| 8154 |
statusStringList.append("backend-expansion-reusing-individual"); |
| 8155 |
} |
| 8156 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSEDISCARDED)) { |
| 8157 |
statusStringList.append("backend-expansion-reuse-discarded"); |
| 8158 |
} |
| 8159 |
if (indi->isNominalIndividualNode()) { |
| 8160 |
statusStringList.append("nominal"); |
| 8161 |
} |
| 8162 |
|
| 8163 |
CConceptProcessingQueue* conProQue = indi->getConceptProcessingQueue(false); |
| 8164 |
if (conProQue) { |
| 8165 |
if (!conProQue->isEmpty() && !indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION)) { |
| 8166 |
statusStringList.append("processing"); |
| 8167 |
} |
| 8168 |
} |
| 8169 |
|
| 8170 |
QString statusString; |
| 8171 |
statusString = statusStringList.join(", "); |
| 8172 |
return statusString; |
| 8173 |
} |
| 8174 |
|
| 8175 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugDependencyString(CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8176 |
QString dependencyString = QString("null"); |
| 8177 |
if (depTrackPoint) { |
| 8178 |
QString depTypeString; |
| 8179 |
CDependencyNode* depNode = depTrackPoint->getDependencyNode(); |
| 8180 |
switch (depNode->getDependencyType()) { |
| 8181 |
case CDependencyNode::DNTINDEPENDENTBASE: { |
| 8182 |
depTypeString = QString("INDEPENDENT"); |
| 8183 |
break; |
| 8184 |
} |
| 8185 |
case CDependencyNode::DNTALLDEPENDENCY: { |
| 8186 |
depTypeString = QString("ALL"); |
| 8187 |
break; |
| 8188 |
} |
| 8189 |
case CDependencyNode::DNTSOMEDEPENDENCY: { |
| 8190 |
depTypeString = QString("SOME"); |
| 8191 |
break; |
| 8192 |
} |
| 8193 |
case CDependencyNode::DNTANDDEPENDENCY: { |
| 8194 |
depTypeString = QString("AND"); |
| 8195 |
break; |
| 8196 |
} |
| 8197 |
case CDependencyNode::DNTORDEPENDENCY: { |
| 8198 |
depTypeString = QString("OR"); |
| 8199 |
break; |
| 8200 |
} |
| 8201 |
case CDependencyNode::DNTATLEASTDEPENDENCY: { |
| 8202 |
depTypeString = QString("ATLEAST"); |
| 8203 |
break; |
| 8204 |
} |
| 8205 |
case CDependencyNode::DNTAUTOMATCHOOSEDEPENDENCY: { |
| 8206 |
depTypeString = QString("AUTOMATCHOOSE"); |
| 8207 |
break; |
| 8208 |
} |
| 8209 |
case CDependencyNode::DNTAUTOMATTRANSACTIONDEPENDENCY: { |
| 8210 |
depTypeString = QString("AUTOMATTRANSACTION"); |
| 8211 |
break; |
| 8212 |
} |
| 8213 |
case CDependencyNode::DNTSELFDEPENDENCY: { |
| 8214 |
depTypeString = QString("SELF"); |
| 8215 |
break; |
| 8216 |
} |
| 8217 |
case CDependencyNode::DNTVALUEDEPENDENCY: { |
| 8218 |
depTypeString = QString("VALUE"); |
| 8219 |
break; |
| 8220 |
} |
| 8221 |
case CDependencyNode::DNTNEGVALUEDEPENDENCY: { |
| 8222 |
depTypeString = QString("NEGVALUE"); |
| 8223 |
break; |
| 8224 |
} |
| 8225 |
case CDependencyNode::DNTDISTINCTDEPENDENCY: { |
| 8226 |
depTypeString = QString("DISTINCT"); |
| 8227 |
break; |
| 8228 |
} |
| 8229 |
case CDependencyNode::DNTMERGEDCONCEPT: { |
| 8230 |
depTypeString = QString("MERGEDCONCEPT"); |
| 8231 |
break; |
| 8232 |
} |
| 8233 |
case CDependencyNode::DNTMERGEDLINK: { |
| 8234 |
depTypeString = QString("MERGEDLINK"); |
| 8235 |
break; |
| 8236 |
} |
| 8237 |
case CDependencyNode::DNTMERGEDEPENDENCY: { |
| 8238 |
depTypeString = QString("MERGE"); |
| 8239 |
break; |
| 8240 |
} |
| 8241 |
case CDependencyNode::DNTATMOSTDEPENDENCY: { |
| 8242 |
depTypeString = QString("ATMOST"); |
| 8243 |
break; |
| 8244 |
} |
| 8245 |
case CDependencyNode::DNTQUALIFYDEPENDENCY: { |
| 8246 |
depTypeString = QString("QUALIFY"); |
| 8247 |
break; |
| 8248 |
} |
| 8249 |
case CDependencyNode::DNTFUNCTIONALDEPENDENCY: { |
| 8250 |
depTypeString = QString("FUNCTIONAL"); |
| 8251 |
break; |
| 8252 |
} |
| 8253 |
case CDependencyNode::DNTNOMINALDEPENDENCY: { |
| 8254 |
depTypeString = QString("NOMINAL"); |
| 8255 |
break; |
| 8256 |
} |
| 8257 |
case CDependencyNode::DNTIMPLICATIONDEPENDENCY: { |
| 8258 |
depTypeString = QString("IMPLICATION"); |
| 8259 |
break; |
| 8260 |
} |
| 8261 |
case CDependencyNode::DNTEXPANDEDDEPENDENCY: { |
| 8262 |
depTypeString = QString("EXPANDED"); |
| 8263 |
break; |
| 8264 |
} |
| 8265 |
case CDependencyNode::DNTDATATYPETRIGGERDEPENDENCY: { |
| 8266 |
depTypeString = QString("DATATYPETRIGGER"); |
| 8267 |
break; |
| 8268 |
} |
| 8269 |
case CDependencyNode::DNTROLEASSERTIONDEPENDENCY: { |
| 8270 |
depTypeString = QString("ROLEASSERTION"); |
| 8271 |
break; |
| 8272 |
} |
| 8273 |
|
| 8274 |
} |
| 8275 |
|
| 8276 |
CConceptDescriptor* depNodeConDes = depNode->getConceptDescriptor(); |
| 8277 |
QString conceptDepNodeString("null"); |
| 8278 |
if (depNodeConDes) { |
| 8279 |
conceptDepNodeString = CConceptTextFormater::getConceptString(depNodeConDes->getConcept(),depNodeConDes->isNegated()); |
| 8280 |
} |
| 8281 |
QString depIndiNodeString; |
| 8282 |
CIndividualProcessNode* depIndiNode = depNode->getAppropriateIndividualNode(); |
| 8283 |
if (depIndiNode) { |
| 8284 |
depIndiNodeString = QString("@%1 ").arg(depIndiNode->getIndividualNodeID()); |
| 8285 |
} |
| 8286 |
QString depInfoString; |
| 8287 |
if (depNode->isNonDeterministiDependencyNode()) { |
| 8288 |
CNonDeterministicDependencyNode* nonDetDepNode = (CNonDeterministicDependencyNode*)depNode; |
| 8289 |
depInfoString += QString(" NonDetDep, <%1/%2>").arg(nonDetDepNode->getOpenedDependencyTrackingPointsCount()).arg(nonDetDepNode->getBranchTrackPoints()->getCount()); |
| 8290 |
} |
| 8291 |
depInfoString += QString(" + ...(%1)").arg(depNode->getAdditionalDependencyCount()); |
| 8292 |
dependencyString = QString("%1-Dependency: {%2}%3%4").arg(depTypeString).arg(conceptDepNodeString).arg(depIndiNodeString).arg(depInfoString); |
| 8293 |
} |
| 8294 |
|
| 8295 |
cint64 branchTag = depTrackPoint->getBranchingTag(); |
| 8296 |
dependencyString = QString(" ^%1 ---> %2").arg(branchTag).arg(dependencyString); |
| 8297 |
return dependencyString; |
| 8298 |
} |
| 8299 |
|
| 8300 |
|
| 8301 |
QStringList CCalculationTableauCompletionTaskHandleAlgorithm::generateExtendedDebugConceptSetStringList(CReapplyConceptLabelSet* conSet, CConceptPropagationBindingSetHash* propBindSetHash, CConceptVariableBindingPathSetHash* varBindPathSetHash, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8302 |
QStringList conSetStringList; |
| 8303 |
CReapplyConceptLabelSetIterator conSetIt = conSet->getConceptLabelSetIterator(false,false,false); |
| 8304 |
while (conSetIt.hasNext()) { |
| 8305 |
CConceptDescriptor* conDes = conSetIt.next(); |
| 8306 |
CConcept* concept = conDes->getConcept(); |
| 8307 |
cint64 conTag = conDes->getConceptTag(); |
| 8308 |
if (conTag != 1) { |
| 8309 |
QString conceptString("null"); |
| 8310 |
if (conDes) { |
| 8311 |
conceptString = CConceptTextFormater::getConceptString(conDes->getConcept(),conDes->isNegated()); |
| 8312 |
} |
| 8313 |
if (propBindSetHash) { |
| 8314 |
CPropagationBindingSet* propBindSet = propBindSetHash->getPropagationBindingSet(concept,false); |
| 8315 |
if (propBindSet) { |
| 8316 |
QString bindingString; |
| 8317 |
CPropagationBindingMap* map = propBindSet->getPropagationBindingMap(); |
| 8318 |
for (CPropagationBindingMap::const_iterator it = map->constBegin(), itEnd = map->constEnd(); it != itEnd; ++it) { |
| 8319 |
cint64 propBindingID = it.key(); |
| 8320 |
if (!bindingString.isEmpty()) { |
| 8321 |
bindingString += QString(", "); |
| 8322 |
} |
| 8323 |
bindingString += QString::number(propBindingID); |
| 8324 |
} |
| 8325 |
conceptString += QString(" ~{%1}").arg(bindingString); |
| 8326 |
} |
| 8327 |
} |
| 8328 |
if (varBindPathSetHash) { |
| 8329 |
CVariableBindingPathSet* varBindPathSet = varBindPathSetHash->getVariableBindingPathSet(concept,false); |
| 8330 |
if (varBindPathSet) { |
| 8331 |
QString bindingString; |
| 8332 |
CVariableBindingPathMap* map = varBindPathSet->getVariableBindingPathMap(); |
| 8333 |
for (CVariableBindingPathMap::const_iterator it = map->constBegin(), itEnd = map->constEnd(); it != itEnd; ++it) { |
| 8334 |
cint64 varBindingPathID = it.key(); |
| 8335 |
if (!bindingString.isEmpty()) { |
| 8336 |
bindingString += QString(", "); |
| 8337 |
} |
| 8338 |
QString bindString; |
| 8339 |
CVariableBindingPathDescriptor* varBindPathDes = it.value().getVariableBindingPathDescriptor(); |
| 8340 |
CVariableBindingPath* varBindPath = varBindPathDes->getVariableBindingPath(); |
| 8341 |
CVariableBindingDescriptor* varBindDes = varBindPath->getVariableBindingDescriptorLinker(); |
| 8342 |
for (CVariableBindingDescriptor* varBindDesIt = varBindDes; varBindDesIt; varBindDesIt = varBindDesIt->getNext()) { |
| 8343 |
CVariableBinding* varBinding = varBindDesIt->getVariableBinding(); |
| 8344 |
if (!bindString.isEmpty()) { |
| 8345 |
bindString += QString(", "); |
| 8346 |
} |
| 8347 |
bindString += QString("v-%1/i-%2").arg(varBinding->getBindedVariable()->getPathVariableID()).arg(varBinding->getBindedIndividual()->getIndividualNodeID()); |
| 8348 |
} |
| 8349 |
bindingString += QString("{%1:%2}").arg(varBindingPathID).arg(bindString); |
| 8350 |
} |
| 8351 |
conceptString += QString(" ~{%1}").arg(bindingString); |
| 8352 |
} |
| 8353 |
} |
| 8354 |
CDependencyTrackPoint* depTrackPoint = conDes->getDependencyTrackPoint(); |
| 8355 |
if (depTrackPoint) { |
| 8356 |
conceptString += generateDebugDependencyString(depTrackPoint,calcAlgContext); |
| 8357 |
} |
| 8358 |
conSetStringList.append(conceptString); |
| 8359 |
} |
| 8360 |
} |
| 8361 |
return conSetStringList; |
| 8362 |
} |
| 8363 |
|
| 8364 |
|
| 8365 |
|
| 8366 |
|
| 8367 |
|
| 8368 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::writeGeneratedExtendedDebugIndiModelStringList(const QString& filename, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8369 |
QStringList indiStringList; |
| 8370 |
QString remainingDebugString = generateExtendedDebugIndiModelStringList(calcAlgContext, &indiStringList); |
| 8371 |
|
| 8372 |
QFile file(filename); |
| 8373 |
if (file.open(QIODevice::WriteOnly)) { |
| 8374 |
|
| 8375 |
for (const QString& tmpString : indiStringList) { |
| 8376 |
QString tmpReplacedString = tmpString; |
| 8377 |
tmpReplacedString = tmpReplacedString.replace("<br>", "\r\n"); |
| 8378 |
file.write(tmpReplacedString.toLocal8Bit()); |
| 8379 |
file.write(QString("\r\n\r\n\r\n").toLocal8Bit()); |
| 8380 |
} |
| 8381 |
file.write(remainingDebugString.toLocal8Bit()); |
| 8382 |
file.close(); |
| 8383 |
} |
| 8384 |
|
| 8385 |
if (indiStringList.size() < 5000) { |
| 8386 |
mDebugIndiModelStringList = indiStringList; |
| 8387 |
mDebugIndiModelString = mDebugIndiModelStringList.join("<br><p><br>\r\n"); |
| 8388 |
|
| 8389 |
mDebugIndiModelString += remainingDebugString; |
| 8390 |
} |
| 8391 |
|
| 8392 |
return mDebugIndiModelString; |
| 8393 |
} |
| 8394 |
|
| 8395 |
|
| 8396 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateExtendedDebugIndiModelStringList(CCalculationAlgorithmContextBase* calcAlgContext, QStringList* list) { |
| 8397 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 8398 |
CIndividualProcessNodeVector* indiVec = procDataBox->getIndividualProcessNodeVector(); |
| 8399 |
cint64 indiStart = indiVec->getItemMinIndex(); |
| 8400 |
cint64 indiCount = indiVec->getItemCount(); |
| 8401 |
QStringList indiStringList; |
| 8402 |
if (indiStart > 0) { |
| 8403 |
indiStart = 0; |
| 8404 |
} |
| 8405 |
QSet<cint64> propCutIndiNodesIds; |
| 8406 |
CBackendNeighbourExpansionControllingData* expContData = calcAlgContext->getUsedProcessingDataBox()->getBackendNeighbourExpansionControllingData(false); |
| 8407 |
if (expContData && expContData->getCutBackendNeighbourExpansionIndividualLinker()) { |
| 8408 |
for (CXLinker<CIndividualProcessNode*>* propCutIndiLinkerIt = expContData->getCutBackendNeighbourExpansionIndividualLinker(); propCutIndiLinkerIt; propCutIndiLinkerIt = propCutIndiLinkerIt->getNext()) { |
| 8409 |
CIndividualProcessNode* propCutIndiNode = propCutIndiLinkerIt->getData(); |
| 8410 |
propCutIndiNodesIds.insert(propCutIndiNode->getIndividualNodeID()); |
| 8411 |
} |
| 8412 |
} |
| 8413 |
|
| 8414 |
|
| 8415 |
cint64 indiReplaceOffset = -indiStart; |
| 8416 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 8417 |
CIndividualProcessNode* indi = getAvailableUpToDateIndividual(i,calcAlgContext); |
| 8418 |
if (indi) { |
| 8419 |
CIndividualProcessNode* ancIndi = getAncestorIndividual(indi,calcAlgContext); |
| 8420 |
CReapplyConceptLabelSet* conSet = indi->getReapplyConceptLabelSet(false); |
| 8421 |
|
| 8422 |
CConceptPropagationBindingSetHash* propBindSetHash = indi->getConceptPropagationBindingSetHash(false); |
| 8423 |
CConceptVariableBindingPathSetHash* varBindPathSetHash = indi->getConceptVariableBindingPathSetHash(false); |
| 8424 |
|
| 8425 |
if (conSet) { |
| 8426 |
QString nominalString = QString(""); |
| 8427 |
if (indi->getNominalIndividual()) { |
| 8428 |
nominalString = QString(", ")+CIRIName::getRecentIRIName(indi->getNominalIndividual()->getNameLinker()); |
| 8429 |
} |
| 8430 |
QString indiString = QString("[ %1%2%3 ] = <br>").arg(ancIndi?QString("%1->").arg(ancIndi->getIndividualNodeID()):"").arg(indi->getIndividualNodeID()).arg(nominalString); |
| 8431 |
|
| 8432 |
QString statusString = QString("%1").arg(generateDebugIndiStatusString(indi,calcAlgContext)); |
| 8433 |
if (propCutIndiNodesIds.contains(i)) { |
| 8434 |
statusString += ", backend-expansion-propagation-cutted"; |
| 8435 |
} |
| 8436 |
indiString += QString("{{%1}d%2}<br>").arg(statusString).arg(indi->getIndividualNominalLevelOrAncestorDepth()); |
| 8437 |
QStringList conSetStringList = generateExtendedDebugConceptSetStringList(conSet,propBindSetHash,varBindPathSetHash,calcAlgContext); |
| 8438 |
//debugTestCriticalConceptSet(conSetStringList,calcAlgContext); |
| 8439 |
|
| 8440 |
QString depNomString = generateDebugDependentNominalsString(indi,calcAlgContext); |
| 8441 |
if (!depNomString.isEmpty()) { |
| 8442 |
indiString += QString("SuccessorDependentNominals: %1<br>\r\n").arg(depNomString); |
| 8443 |
} |
| 8444 |
|
| 8445 |
QString incExpString = generateDebugIncrementalExpansionString(indi,calcAlgContext); |
| 8446 |
if (!incExpString.isEmpty()) { |
| 8447 |
indiString += QString("%1<br>\r\n").arg(incExpString); |
| 8448 |
} |
| 8449 |
|
| 8450 |
|
| 8451 |
QString conSetString(conSetStringList.join("<br>")); |
| 8452 |
indiString += QString("$%1$<br>{%2} ").arg(conSet->getConceptSignatureValue()).arg(conSetString); |
| 8453 |
|
| 8454 |
|
| 8455 |
QString assDataLitString; |
| 8456 |
for (CProcessAssertedDataLiteralLinker* dataLitLinkerIt = indi->getAssertedDataLiteralLinker(); dataLitLinkerIt; dataLitLinkerIt = dataLitLinkerIt->getNext()) { |
| 8457 |
CDataLiteral* dataLiteral = dataLitLinkerIt->getDataLiteral(); |
| 8458 |
if (assDataLitString.isEmpty()) { |
| 8459 |
assDataLitString = "Asserted Data Literals:<br>\n"; |
| 8460 |
} |
| 8461 |
if (dataLiteral->getDatatype()) { |
| 8462 |
assDataLitString += QString("\t\t%1^^%2<br>\n").arg(dataLiteral->getLexicalDataLiteralValueString()).arg(dataLiteral->getDatatype()->getDatatypeIRI()); |
| 8463 |
} else { |
| 8464 |
assDataLitString += QString("\t\t%1<br>\n").arg(dataLiteral->getLexicalDataLiteralValueString()); |
| 8465 |
} |
| 8466 |
} |
| 8467 |
if (!assDataLitString.isEmpty()) { |
| 8468 |
indiString += QString("<br>\n%1<br>\n").arg(assDataLitString); |
| 8469 |
} |
| 8470 |
|
| 8471 |
if (indi->getIndividualBackendCacheSynchronisationData(false)) { |
| 8472 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indi->getIndividualBackendCacheSynchronisationData(false); |
| 8473 |
if (backendSyncData->getAssocitaionData()) { |
| 8474 |
CBackendNeighbourExpansionQueue* neighExpQue = backendSyncData->getBackendNeighbourExpansionQueue(false); |
| 8475 |
QString neighExpQueuedString; |
| 8476 |
if (neighExpQue && neighExpQue->hasQueuedNeighbourExpansions()) { |
| 8477 |
neighExpQueuedString += ", neighbour-expansion-queued"; |
| 8478 |
} |
| 8479 |
QStringList mergingHandlingStringList; |
| 8480 |
if (backendSyncData->hasNonDeterministicallyMergedIndividuals()) { |
| 8481 |
mergingHandlingStringList += QString("non-deterministically-merged-individuals:true"); |
| 8482 |
} else { |
| 8483 |
mergingHandlingStringList += QString("non-deterministically-merged-individuals:false"); |
| 8484 |
} |
| 8485 |
if (backendSyncData->hasNewlyMergedIndividuals()) { |
| 8486 |
mergingHandlingStringList += QString("newly-merged-individuals:true"); |
| 8487 |
} else { |
| 8488 |
mergingHandlingStringList += QString("newly-merged-individuals:false"); |
| 8489 |
} |
| 8490 |
if (backendSyncData->hasNewlyMergedAllNeighbourExpansion()) { |
| 8491 |
mergingHandlingStringList += QString("newly-merged-individuals-all-neighbour-expansion:true"); |
| 8492 |
} else { |
| 8493 |
mergingHandlingStringList += QString("newly-merged-individuals-all-neighbour-expansion:false"); |
| 8494 |
} |
| 8495 |
if (backendSyncData->hasNewlyMergedInferringNeighbourExpansion()) { |
| 8496 |
mergingHandlingStringList += QString("newly-merged-individuals-inferring-neighbour-expansion:true"); |
| 8497 |
} else { |
| 8498 |
mergingHandlingStringList += QString("newly-merged-individuals-inferring-neighbour-expansion:false"); |
| 8499 |
} |
| 8500 |
indiString += QString("<br>\n(based on backend data update id %1, cache update id %2, %3%4)<br>\n").arg(backendSyncData->getAssocitaionData()->getAssociationDataUpdateId()).arg(backendSyncData->getAssocitaionData()->getCacheUpdateId()).arg(mergingHandlingStringList.join(", ")).arg(neighExpQueuedString); |
| 8501 |
} |
| 8502 |
} |
| 8503 |
|
| 8504 |
indiStringList.append(indiString); |
| 8505 |
} else { |
| 8506 |
bool bug = true; |
| 8507 |
QString nominalString = QString(""); |
| 8508 |
if (indi->getNominalIndividual()) { |
| 8509 |
nominalString = QString(", ") + CIRIName::getRecentIRIName(indi->getNominalIndividual()->getNameLinker()); |
| 8510 |
} |
| 8511 |
QString indiString = QString("[ %1%2%3 ] = concept set missing<br>").arg(ancIndi ? QString("%1->").arg(ancIndi->getIndividualNodeID()) : "").arg(indi->getIndividualNodeID()).arg(nominalString); |
| 8512 |
indiStringList.append(indiString); |
| 8513 |
} |
| 8514 |
} else { |
| 8515 |
//indiStringList.append(QString("[ %1, --unused--]<br>").arg(i)); |
| 8516 |
indiStringList.append(QString()); |
| 8517 |
} |
| 8518 |
} |
| 8519 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 8520 |
CIndividualProcessNode* indi = getAvailableUpToDateIndividual(i,calcAlgContext); |
| 8521 |
if (indi && indi->hasMergedIntoIndividualNodeID()) { |
| 8522 |
cint64 mergedIntoID = indi->getMergedIntoIndividualNodeID(); |
| 8523 |
QString meIndiString = indiStringList.value(indiReplaceOffset + mergedIntoID); |
| 8524 |
meIndiString += QString("+%1").arg(i); |
| 8525 |
if (indiReplaceOffset+mergedIntoID < indiStringList.count()) { |
| 8526 |
indiStringList.replace(indiReplaceOffset+mergedIntoID,meIndiString); |
| 8527 |
} else { |
| 8528 |
LOG(ERROR,"::Konclude::Reasoner::Kernel::Algorithm::TableauCompletionAlgorihm",logTr("Merging of individual %1 into %2 cannot be correctly resolved for completion graph printing.").arg(i).arg(mergedIntoID),this); |
| 8529 |
} |
| 8530 |
} |
| 8531 |
} |
| 8532 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 8533 |
CIndividualProcessNode* indi = getAvailableUpToDateIndividual(i,calcAlgContext); |
| 8534 |
if (indi && indi->hasMergedIntoIndividualNodeID()) { |
| 8535 |
cint64 mergedIntoID = indi->getMergedIntoIndividualNodeID(); |
| 8536 |
QString indiString = indiStringList.value(indiReplaceOffset + i); |
| 8537 |
indiString += QString(" -> %1").arg(mergedIntoID); |
| 8538 |
if (indiReplaceOffset+i < indiStringList.count()) { |
| 8539 |
indiStringList.replace(indiReplaceOffset+i,indiString); |
| 8540 |
} else { |
| 8541 |
LOG(ERROR,"::Konclude::Reasoner::Kernel::Algorithm::TableauCompletionAlgorihm",logTr("Merging of individual %1 into %2 cannot be correctly resolved for completion graph printing.").arg(i).arg(mergedIntoID),this); |
| 8542 |
} |
| 8543 |
} |
| 8544 |
} |
| 8545 |
|
| 8546 |
cint64 succInsertions = 0; |
| 8547 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 8548 |
CIndividualProcessNode* indi = getAvailableUpToDateIndividual(i,calcAlgContext); |
| 8549 |
if (indi) { |
| 8550 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 8551 |
while (succIt.hasNext()) { |
| 8552 |
cint64 succIndi = succIt.nextIndividualID(); |
| 8553 |
QString succString = QString("\t--> %1: ").arg(succIndi); |
| 8554 |
CSuccessorRoleIterator succRoleIt = indi->getSuccessorRoleIterator(succIndi); |
| 8555 |
while (succRoleIt.hasNext()) { |
| 8556 |
CIndividualLinkEdge* link = succRoleIt.next(); |
| 8557 |
CRole* role = link->getLinkRole(); |
| 8558 |
succString += QString::number(role->getRoleTag()); |
| 8559 |
if (role->hasPropertyName()) { |
| 8560 |
succString += CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 8561 |
} |
| 8562 |
CDependencyTrackPoint* depTrackPoint = link->getDependencyTrackPoint(); |
| 8563 |
if (depTrackPoint) { |
| 8564 |
succString += generateDebugDependencyString(depTrackPoint,calcAlgContext); |
| 8565 |
} |
| 8566 |
if (succRoleIt.hasNext()) { |
| 8567 |
succString += QString(", \r\n\t\t"); |
| 8568 |
} |
| 8569 |
} |
| 8570 |
indiStringList.insert(indiReplaceOffset+i+1+succInsertions++,succString); |
| 8571 |
} |
| 8572 |
} |
| 8573 |
} |
| 8574 |
|
| 8575 |
|
| 8576 |
QStringList filteredIndiStringList; |
| 8577 |
for (QStringList::iterator it = indiStringList.begin(), itEnd = indiStringList.end(); it != itEnd; ++it) { |
| 8578 |
if (!it->isEmpty()) { |
| 8579 |
filteredIndiStringList.append(*it); |
| 8580 |
} |
| 8581 |
} |
| 8582 |
|
| 8583 |
|
| 8584 |
if (!list) { |
| 8585 |
if (filteredIndiStringList.size() >= 1000000) { |
| 8586 |
QFile file(QString("./Debugging/CompletionTasks/tmp-%1.txt").arg(calcAlgContext->getUsedSatisfiableCalculationTask()->getTaskDepth())); |
| 8587 |
if (file.open(QIODevice::WriteOnly)) { |
| 8588 |
|
| 8589 |
for (const QString& tmpString : filteredIndiStringList) { |
| 8590 |
|
| 8591 |
QString tmpReplacedString = tmpString; |
| 8592 |
tmpReplacedString = tmpReplacedString.replace("<br>", "\r\n"); |
| 8593 |
file.write(tmpReplacedString.toLocal8Bit()); |
| 8594 |
file.write(QString("\r\n\r\n\r\n").toLocal8Bit()); |
| 8595 |
} |
| 8596 |
|
| 8597 |
|
| 8598 |
file.close(); |
| 8599 |
} |
| 8600 |
} else { |
| 8601 |
|
| 8602 |
mDebugIndiModelStringList = filteredIndiStringList; |
| 8603 |
mDebugIndiModelString = mDebugIndiModelStringList.join("<br><p><br>\r\n"); |
| 8604 |
} |
| 8605 |
} else { |
| 8606 |
mDebugIndiModelString.clear(); |
| 8607 |
*list = filteredIndiStringList; |
| 8608 |
} |
| 8609 |
|
| 8610 |
|
| 8611 |
if (calcAlgContext->getProcessingDataBox()->hasClashedDescriptorLinker()) { |
| 8612 |
|
| 8613 |
CTrackedClashedDescriptor* trackedClashDescriptors = createTrackedClashesDescriptors(calcAlgContext->getProcessingDataBox()->getClashedDescriptorLinker(), calcAlgContext); |
| 8614 |
|
| 8615 |
CPROCESSINGSET<CTrackedClashedDescriptorHasher> clashedSet(calcAlgContext->getUsedTaskProcessorContext()); |
| 8616 |
CTrackedClashedDependencyLine trackingLine(&clashedSet); |
| 8617 |
QString clashedString = generateDebugTrackedClashedDescriptorSummaryString(trackedClashDescriptors, calcAlgContext); |
| 8618 |
if (initializeTrackingLine(&trackingLine, trackedClashDescriptors, calcAlgContext)) { |
| 8619 |
clashedString += "\r\n\r\n" + writeDebugTrackingLineStringToFile(generateDebugTrackingLineString(&trackingLine, calcAlgContext), "clash-details", &trackingLine, calcAlgContext); |
| 8620 |
} |
| 8621 |
|
| 8622 |
mDebugIndiModelString = mDebugIndiModelString + QString("<br><p><br>\r\n<br><p><br>\r\nClashes<br><p><br>\r\n%1").arg(clashedString); |
| 8623 |
} |
| 8624 |
return mDebugIndiModelString; |
| 8625 |
} |
| 8626 |
|
| 8627 |
|
| 8628 |
|
| 8629 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugIndiModelStringList(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8630 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 8631 |
CIndividualProcessNodeVector* indiVec = procDataBox->getIndividualProcessNodeVector(); |
| 8632 |
cint64 indiCount = indiVec->getItemCount(); |
| 8633 |
cint64 indiStart = indiVec->getItemMinIndex(); |
| 8634 |
QStringList indiStringList; |
| 8635 |
if (indiStart > 0) { |
| 8636 |
indiStart = 0; |
| 8637 |
} |
| 8638 |
cint64 indiReplaceOffset = -indiStart; |
| 8639 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 8640 |
CIndividualProcessNode* indi = getAvailableUpToDateIndividual(i,calcAlgContext); |
| 8641 |
if (indi) { |
| 8642 |
CIndividualProcessNode* ancIndi = getAncestorIndividual(indi,calcAlgContext); |
| 8643 |
CReapplyConceptLabelSet* conSet = indi->getReapplyConceptLabelSet(false); |
| 8644 |
if (conSet) { |
| 8645 |
QString nominalString = QString(""); |
| 8646 |
if (indi->getNominalIndividual()) { |
| 8647 |
nominalString = QString(", ")+CIRIName::getRecentIRIName(indi->getNominalIndividual()->getNameLinker()); |
| 8648 |
} |
| 8649 |
QString indiString = QString("[ %1%2%3 ] = ").arg(ancIndi?QString("%1->").arg(ancIndi->getIndividualNodeID()):"").arg(indi->getIndividualNodeID()).arg(nominalString); |
| 8650 |
QString conSetString; |
| 8651 |
CReapplyConceptLabelSetIterator conSetIt = conSet->getConceptLabelSetIterator(false,false,false); |
| 8652 |
while (conSetIt.hasNext()) { |
| 8653 |
CConceptDescriptor* conDes = conSetIt.next(); |
| 8654 |
CConcept* concept = conDes->getConcept(); |
| 8655 |
cint64 conTag = conDes->getConceptTag(); |
| 8656 |
if (conTag != 1) { |
| 8657 |
QString conString = QString("%1%2").arg((conDes->isNegated())?"-":"").arg(conTag); |
| 8658 |
if (concept->hasClassName()) { |
| 8659 |
conString += CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 8660 |
} |
| 8661 |
if (!conSetString.isEmpty()) { |
| 8662 |
conSetString += QString(", "); |
| 8663 |
} |
| 8664 |
conSetString += conString; |
| 8665 |
} |
| 8666 |
} |
| 8667 |
indiString += QString("{%1} ").arg(conSetString); |
| 8668 |
indiStringList.append(indiString); |
| 8669 |
} |
| 8670 |
} |
| 8671 |
} |
| 8672 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 8673 |
CIndividualProcessNode* indi = getAvailableUpToDateIndividual(i,calcAlgContext); |
| 8674 |
if (indi && indi->hasMergedIntoIndividualNodeID()) { |
| 8675 |
cint64 mergedIntoID = indi->getMergedIntoIndividualNodeID(); |
| 8676 |
QString meIndiString = indiStringList.value(mergedIntoID); |
| 8677 |
meIndiString += QString("+%1").arg(i); |
| 8678 |
indiStringList.replace(indiReplaceOffset+mergedIntoID+indiStart,meIndiString); |
| 8679 |
} |
| 8680 |
} |
| 8681 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 8682 |
CIndividualProcessNode* indi = getAvailableUpToDateIndividual(i,calcAlgContext); |
| 8683 |
if (indi && indi->hasMergedIntoIndividualNodeID()) { |
| 8684 |
cint64 mergedIntoID = indi->getMergedIntoIndividualNodeID(); |
| 8685 |
QString indiString = indiStringList.value(i); |
| 8686 |
indiString += QString(" -> %1").arg(mergedIntoID); |
| 8687 |
indiStringList.replace(indiReplaceOffset + i+indiStart,indiString); |
| 8688 |
} |
| 8689 |
} |
| 8690 |
|
| 8691 |
cint64 succInsertions = 0; |
| 8692 |
for (cint64 i = indiStart; i < indiCount; ++i) { |
| 8693 |
CIndividualProcessNode* indi = getAvailableUpToDateIndividual(i,calcAlgContext); |
| 8694 |
if (indi) { |
| 8695 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 8696 |
while (succIt.hasNext()) { |
| 8697 |
cint64 succIndi = succIt.nextIndividualID(); |
| 8698 |
QString succString = QString("\t--> %1: ").arg(succIndi); |
| 8699 |
CSuccessorRoleIterator succRoleIt = indi->getSuccessorRoleIterator(succIndi); |
| 8700 |
while (succRoleIt.hasNext()) { |
| 8701 |
CIndividualLinkEdge* link = succRoleIt.next(); |
| 8702 |
CRole* role = link->getLinkRole(); |
| 8703 |
succString += QString::number(role->getRoleTag()); |
| 8704 |
if (role->hasPropertyName()) { |
| 8705 |
succString += CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 8706 |
} |
| 8707 |
if (succRoleIt.hasNext()) { |
| 8708 |
succString += QString(", "); |
| 8709 |
} |
| 8710 |
} |
| 8711 |
indiStringList.insert(indiReplaceOffset + i+indiStart+1+succInsertions++,succString); |
| 8712 |
} |
| 8713 |
} |
| 8714 |
} |
| 8715 |
mDebugIndiModelStringList = indiStringList; |
| 8716 |
mDebugIndiModelString = mDebugIndiModelStringList.join("\n"); |
| 8717 |
return mDebugIndiModelString; |
| 8718 |
} |
| 8719 |
|
| 8720 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::initialNodeInitialize(CIndividualProcessNode*& indiProcNode, bool allowPreprocess, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8721 |
|
| 8722 |
|
| 8723 |
if (indiProcNode->getNominalIndividual() && !indiProcNode->getNominalIndividual()->isFakeIndividual() && mBackendCacheHandler && !indiProcNode->isNominalIndividualRepresentativeBackendDataLoaded() && !mOptIncrementalCompatibleExpansion) { |
| 8724 |
|
| 8725 |
if (loadIndividualNodeDataFromBackendCache(indiProcNode, calcAlgContext)) { |
| 8726 |
|
| 8727 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiProcNode->getIndividualBackendCacheSynchronisationData(false); |
| 8728 |
if (!backendSyncData || !backendSyncData->isBackendConceptSetInitialized()) { |
| 8729 |
if (!allowPreprocess || backendSyncData->isBackendConceptSetInitializationRequired() || !mOptDelayedBackendInitializiation || !tryDelayIndividualNodeInitializationWithBackendConceptSetLabel(indiProcNode, calcAlgContext)) { |
| 8730 |
initializeIndividualNodeWithBackendCache(indiProcNode, calcAlgContext); |
| 8731 |
indiProcNode->setNominalIndividualRepresentativeBackendDataLoaded(true); |
| 8732 |
tryEstablishExpansionBlockingWithBackendCacheSynchronisation(indiProcNode, calcAlgContext); |
| 8733 |
indiProcNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENPROCESSINGDELAYING); |
| 8734 |
} else { |
| 8735 |
// mark processing blocked by setting flag |
| 8736 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENPROCESSINGDELAYING); |
| 8737 |
return false; |
| 8738 |
} |
| 8739 |
} |
| 8740 |
} |
| 8741 |
} |
| 8742 |
|
| 8743 |
|
| 8744 |
bool backendExpanded = false; |
| 8745 |
if (indiProcNode->isNominalIndividualRepresentativeBackendDataLoaded()) { |
| 8746 |
backendExpanded = true; |
| 8747 |
detectIndividualNodeBackendCacheSynchronized(indiProcNode, calcAlgContext); |
| 8748 |
|
| 8749 |
if (!indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED) && !indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDFULLEXPANSION)) { |
| 8750 |
|
| 8751 |
if (allowPreprocess || mCurrentRecProcDepth < mCurrentRecProcDepthLimit) { |
| 8752 |
|
| 8753 |
if (mConfAllowBackendNeighbourExpansionBlocking) { |
| 8754 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION); |
| 8755 |
} |
| 8756 |
if (!expandDirectlyInfluencedIndividualNeighbourNodesFromBackendCache(indiProcNode, calcAlgContext)) { |
| 8757 |
|
| 8758 |
if (!mConfAllowBackendNeighbourExpansionBlocking) { |
| 8759 |
indiProcNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION); |
| 8760 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDFULLEXPANSION); |
| 8761 |
} |
| 8762 |
backendExpanded = false; |
| 8763 |
} |
| 8764 |
|
| 8765 |
if (indiProcNode->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 8766 |
return false; |
| 8767 |
} |
| 8768 |
} else { |
| 8769 |
calcAlgContext->getProcessingDataBox()->getRoleAssertionExpansionProcessingQueue(true)->insertIndiviudalProcessNode(indiProcNode); |
| 8770 |
} |
| 8771 |
} |
| 8772 |
} |
| 8773 |
|
| 8774 |
|
| 8775 |
|
| 8776 |
if (indiProcNode->hasNominalIndividualTriplesAssertions() && !indiProcNode->areNominalIndividualTriplesAssertionsLoaded()) { |
| 8777 |
|
| 8778 |
CConcreteOntology* ontology = calcAlgContext->getUsedProcessingDataBox()->getOntology(); |
| 8779 |
COntologyTriplesData* ontologyTriplesData = ontology->getOntologyTriplesData(); |
| 8780 |
if (ontologyTriplesData) { |
| 8781 |
COntologyTriplesAssertionsAccessor* triplesAssertionAccessor = ontologyTriplesData->getTripleAssertionAccessor(); |
| 8782 |
if (triplesAssertionAccessor && -indiProcNode->getIndividualNodeID() <= triplesAssertionAccessor->getMaxIndexedIndividualId()) { |
| 8783 |
if (!indiProcNode->getNominalIndividual()) { |
| 8784 |
CIndexedIndividualAssertionConvertionVisitor indiAssConvVisitor(-indiProcNode->getIndividualNodeID(), calcAlgContext); |
| 8785 |
triplesAssertionAccessor->visitIndividualAssertions(-indiProcNode->getIndividualNodeID(), &indiAssConvVisitor); |
| 8786 |
indiProcNode->setNominalIndividual(indiAssConvVisitor.getRetrievalIndividual()); |
| 8787 |
} else { |
| 8788 |
CIndexedIndividualAssertionConvertionVisitor indiAssConvVisitor(indiProcNode->getNominalIndividual(), calcAlgContext); |
| 8789 |
triplesAssertionAccessor->visitIndividualAssertions(-indiProcNode->getIndividualNodeID(), &indiAssConvVisitor); |
| 8790 |
indiProcNode->setNominalIndividual(indiAssConvVisitor.getRetrievalIndividual()); |
| 8791 |
} |
| 8792 |
CIndividual* nominalIndi = indiProcNode->getNominalIndividual(); |
| 8793 |
indiProcNode->setAssertionConceptLinker(nominalIndi->getAssertionConceptLinker()); |
| 8794 |
indiProcNode->setAssertionRoleLinker(nominalIndi->getAssertionRoleLinker()); |
| 8795 |
indiProcNode->setReverseAssertionRoleLinker(nominalIndi->getReverseAssertionRoleLinker()); |
| 8796 |
indiProcNode->setAssertionDataLinker(nominalIndi->getAssertionDataLinker()); |
| 8797 |
} |
| 8798 |
} |
| 8799 |
|
| 8800 |
indiProcNode->setNominalIndividualTriplesAssertionsLoaded(true); |
| 8801 |
} |
| 8802 |
|
| 8803 |
|
| 8804 |
CConceptAssertionLinker* assertionConceptLinker = indiProcNode->getAssertionConceptLinker(); |
| 8805 |
CRoleAssertionLinker* assertionRoleLinkerIt = indiProcNode->getAssertionRoleLinker(); |
| 8806 |
CDataAssertionLinker* assertionDataLinkerIt = indiProcNode->getAssertionDataLinker(); |
| 8807 |
CReverseRoleAssertionLinker* reverseAssertionRoleLinkerIt = indiProcNode->getReverseAssertionRoleLinker(); |
| 8808 |
CAdditionalProcessRoleAssertionsLinker* addProcRoleAssertionsLinker = indiProcNode->getAdditionalRoleAssertionsLinker(); |
| 8809 |
CAdditionalProcessDataAssertionsLinker* addProcDataAssertionsLinker = indiProcNode->getAdditionalDataAssertionsLinker(); |
| 8810 |
CXSortedNegLinker<CConcept*>* initConceptLinker = indiProcNode->getProcessInitializingConceptLinker(); |
| 8811 |
CReapplyConceptLabelSet* conSet = indiProcNode->getReapplyConceptLabelSet(false); |
| 8812 |
|
| 8813 |
bool initialized = false; |
| 8814 |
|
| 8815 |
CConceptSetSignature assInitSignature; |
| 8816 |
bool assInitSignatureBuilded = false; |
| 8817 |
|
| 8818 |
|
| 8819 |
|
| 8820 |
|
| 8821 |
if (!indiProcNode->hasBaseConceptsInitialized()) { |
| 8822 |
bool datatypeNode = indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCONCRETEDATAINDINODE); |
| 8823 |
if (assertionConceptLinker || initConceptLinker || !conSet) { |
| 8824 |
for (CConceptAssertionLinker* assertionConceptLinkerIt = assertionConceptLinker; assertionConceptLinkerIt && !datatypeNode; assertionConceptLinkerIt = assertionConceptLinkerIt->getNext()) { |
| 8825 |
CConcept* concept = assertionConceptLinkerIt->getData(); |
| 8826 |
if (concept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_DATATYPE_RELATED_TYPE)) { |
| 8827 |
datatypeNode = true; |
| 8828 |
} |
| 8829 |
} |
| 8830 |
for (CXSortedNegLinker<CConcept*>* initConceptLinkerIt = initConceptLinker; initConceptLinkerIt && !datatypeNode; initConceptLinkerIt = initConceptLinkerIt->getNext()) { |
| 8831 |
CConcept* concept = initConceptLinkerIt->getData(); |
| 8832 |
if (concept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_DATATYPE_RELATED_TYPE)) { |
| 8833 |
datatypeNode = true; |
| 8834 |
} |
| 8835 |
} |
| 8836 |
if (!datatypeNode) { |
| 8837 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 8838 |
CConcept* topConcept = calcAlgContext->getProcessingDataBox()->getOntologyTopConcept(); |
| 8839 |
addConceptToIndividual(topConcept, false, indiProcNode, depTrackPoint, allowPreprocess, true, calcAlgContext); |
| 8840 |
} else { |
| 8841 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 8842 |
CConcept* topDataConcept = calcAlgContext->getProcessingDataBox()->getOntologyTopDataRangeConcept(); |
| 8843 |
addConceptToIndividual(topDataConcept, false, indiProcNode, depTrackPoint, allowPreprocess, true, calcAlgContext); |
| 8844 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCONCRETEDATAINDINODE); |
| 8845 |
} |
| 8846 |
initialized = true; |
| 8847 |
} |
| 8848 |
if (indiProcNode->isNominalIndividualNode()) { |
| 8849 |
if (!indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 8850 |
propagateIndividualNodeNominalConnectionToAncestors(indiProcNode, calcAlgContext); |
| 8851 |
} |
| 8852 |
//propagateIndividualNodeNominalConnectionStatusToAncestors(indiProcNode,indiProcNode,calcAlgContext); |
| 8853 |
} |
| 8854 |
indiProcNode->setBaseConceptsInitialized(true); |
| 8855 |
} |
| 8856 |
|
| 8857 |
|
| 8858 |
if (!indiProcNode->hasUniversallyConnectionIndividualInitialized()) { |
| 8859 |
CConcept* univConnNomValueConcept = calcAlgContext->getProcessingDataBox()->getOntology()->getTBox()->getUniversalConnectionNominalValueConcept(); |
| 8860 |
if (univConnNomValueConcept) { |
| 8861 |
bool datatypeNode = indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCONCRETEDATAINDINODE); |
| 8862 |
if (assertionConceptLinker || initConceptLinker || indiProcNode->getNominalIndividual()) { |
| 8863 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 8864 |
if (univConnNomValueConcept && !datatypeNode) { |
| 8865 |
addConceptToIndividual(univConnNomValueConcept, false, indiProcNode, depTrackPoint, allowPreprocess, true, calcAlgContext); |
| 8866 |
} |
| 8867 |
} |
| 8868 |
indiProcNode->setUniversallyConnectionIndividualInitialized(true); |
| 8869 |
} |
| 8870 |
} |
| 8871 |
|
| 8872 |
if (assertionConceptLinker) { |
| 8873 |
|
| 8874 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 8875 |
|
| 8876 |
for (CConceptAssertionLinker* assertionConceptLinkerIt = assertionConceptLinker; assertionConceptLinkerIt; assertionConceptLinkerIt = assertionConceptLinkerIt->getNext()) { |
| 8877 |
CConcept* assertionConcept = assertionConceptLinkerIt->getData(); |
| 8878 |
bool assertionConceptNegation = assertionConceptLinkerIt->isNegated(); |
| 8879 |
if (assertionConcept->getOperatorCode() != CCNOMINAL) { |
| 8880 |
assInitSignature.addConceptSignature(assertionConcept, assertionConceptNegation); |
| 8881 |
assInitSignatureBuilded = true; |
| 8882 |
} |
| 8883 |
} |
| 8884 |
|
| 8885 |
if (mOptIncrementalCompatibleExpansion || !indiProcNode->isNominalIndividualRepresentativeBackendDataLoaded()) { |
| 8886 |
|
| 8887 |
addConceptsToIndividual(assertionConceptLinker,false,indiProcNode,depTrackPoint,allowPreprocess,true,nullptr,calcAlgContext); |
| 8888 |
|
| 8889 |
CIndividual* nominalIndi = indiProcNode->getNominalIndividual(); |
| 8890 |
if (nominalIndi) { |
| 8891 |
CConcept* nominalConcept = nominalIndi->getIndividualNominalConcept(); |
| 8892 |
if (nominalConcept) { |
| 8893 |
addConceptToIndividual(nominalConcept,false,indiProcNode,depTrackPoint,true,true,calcAlgContext); |
| 8894 |
} |
| 8895 |
} |
| 8896 |
|
| 8897 |
} |
| 8898 |
|
| 8899 |
initialized = true; |
| 8900 |
indiProcNode->clearAssertionConcepts(); |
| 8901 |
|
| 8902 |
} |
| 8903 |
if (initConceptLinker) { |
| 8904 |
|
| 8905 |
if (!calcAlgContext->getUsedProcessingDataBox()->hasConstructedIndividualNodeInitialized()) { |
| 8906 |
calcAlgContext->getUsedProcessingDataBox()->setConstructedIndividualNodeInitialized(true); |
| 8907 |
tryCompletionGraphReuse(indiProcNode,calcAlgContext); |
| 8908 |
} |
| 8909 |
|
| 8910 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 8911 |
if (!mConfExpandCreatedSuccessorsFromSaturation || !tryInitalizingFromSaturatedData(indiProcNode,initConceptLinker,depTrackPoint,allowPreprocess,calcAlgContext) || initConceptLinker->hasNext()) { |
| 8912 |
addConceptsToIndividual(initConceptLinker,false,indiProcNode,depTrackPoint,allowPreprocess,true,nullptr,calcAlgContext); |
| 8913 |
} |
| 8914 |
indiProcNode->clearProcessInitializingConcepts(); |
| 8915 |
initialized = true; |
| 8916 |
for (CXSortedNegLinker<CConcept*>* initConceptLinkerIt = initConceptLinker; initConceptLinkerIt; initConceptLinkerIt = initConceptLinkerIt->getNext()) { |
| 8917 |
CConcept* initConcept = initConceptLinkerIt->getData(); |
| 8918 |
bool initConceptNegation = initConceptLinkerIt->isNegated(); |
| 8919 |
if (initConcept->getOperatorCode() != CCNOMINAL) { |
| 8920 |
assInitSignature.addConceptSignature(initConcept,initConceptNegation); |
| 8921 |
assInitSignatureBuilded = true; |
| 8922 |
} |
| 8923 |
} |
| 8924 |
} |
| 8925 |
|
| 8926 |
if (assertionRoleLinkerIt || reverseAssertionRoleLinkerIt || addProcRoleAssertionsLinker) { |
| 8927 |
|
| 8928 |
detectIndividualNodeBackendCacheSynchronized(indiProcNode, calcAlgContext); |
| 8929 |
if (!indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED)) { |
| 8930 |
|
| 8931 |
if (allowPreprocess || mCurrentRecProcDepth < mCurrentRecProcDepthLimit) { |
| 8932 |
|
| 8933 |
if (mConfAllowBackendNeighbourExpansionBlocking) { |
| 8934 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION); |
| 8935 |
} |
| 8936 |
if (!indiProcNode->getIndividualBackendCacheSynchronisationData(false) || !expandDirectlyInfluencedIndividualNeighbourNodesFromBackendCache(indiProcNode, calcAlgContext)) { |
| 8937 |
|
| 8938 |
|
| 8939 |
if (!mConfAllowBackendNeighbourExpansionBlocking) { |
| 8940 |
indiProcNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION); |
| 8941 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDFULLEXPANSION); |
| 8942 |
} |
| 8943 |
|
| 8944 |
indiProcNode->clearAssertionRoles(); |
| 8945 |
indiProcNode->clearReverseAssertionRoles(); |
| 8946 |
indiProcNode->clearAdditionalRoleAssertionsLinker(); |
| 8947 |
indiProcNode->clearAdditionalRoleAssertionsLinker(); |
| 8948 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 8949 |
|
| 8950 |
while (assertionRoleLinkerIt) { |
| 8951 |
addRoleAssertion(indiProcNode, assertionRoleLinkerIt, depTrackPoint, calcAlgContext); |
| 8952 |
assertionRoleLinkerIt = assertionRoleLinkerIt->getNext(); |
| 8953 |
} |
| 8954 |
for (CAdditionalProcessRoleAssertionsLinker* addProcRoleAssertionsLinkerIt = addProcRoleAssertionsLinker; addProcRoleAssertionsLinkerIt; addProcRoleAssertionsLinkerIt = addProcRoleAssertionsLinkerIt->getNext()) { |
| 8955 |
assertionRoleLinkerIt = addProcRoleAssertionsLinkerIt->getRoleAssertionLinker(); |
| 8956 |
CDependencyTrackPoint* addDepTrackPoint = addProcRoleAssertionsLinkerIt->getDependencyTrackPoint(); |
| 8957 |
while (assertionRoleLinkerIt) { |
| 8958 |
addRoleAssertion(indiProcNode, assertionRoleLinkerIt, addDepTrackPoint, calcAlgContext); |
| 8959 |
assertionRoleLinkerIt = assertionRoleLinkerIt->getNext(); |
| 8960 |
} |
| 8961 |
} |
| 8962 |
indiProcNode->setRoleAssertionsInitialized(true); |
| 8963 |
while (reverseAssertionRoleLinkerIt) { |
| 8964 |
addReverseRoleAssertion(indiProcNode, reverseAssertionRoleLinkerIt, depTrackPoint, calcAlgContext); |
| 8965 |
reverseAssertionRoleLinkerIt = reverseAssertionRoleLinkerIt->getNext(); |
| 8966 |
} |
| 8967 |
for (CAdditionalProcessRoleAssertionsLinker* addProcRoleAssertionsLinkerIt = addProcRoleAssertionsLinker; addProcRoleAssertionsLinkerIt; addProcRoleAssertionsLinkerIt = addProcRoleAssertionsLinkerIt->getNext()) { |
| 8968 |
reverseAssertionRoleLinkerIt = addProcRoleAssertionsLinkerIt->getReverseRoleAssertionLinker(); |
| 8969 |
CDependencyTrackPoint* addDepTrackPoint = addProcRoleAssertionsLinkerIt->getDependencyTrackPoint(); |
| 8970 |
while (reverseAssertionRoleLinkerIt) { |
| 8971 |
addReverseRoleAssertion(indiProcNode, reverseAssertionRoleLinkerIt, addDepTrackPoint, calcAlgContext); |
| 8972 |
reverseAssertionRoleLinkerIt = reverseAssertionRoleLinkerIt->getNext(); |
| 8973 |
} |
| 8974 |
} |
| 8975 |
indiProcNode->setReverseRoleAssertionsInitialized(true); |
| 8976 |
} |
| 8977 |
|
| 8978 |
} else { |
| 8979 |
calcAlgContext->getProcessingDataBox()->getRoleAssertionExpansionProcessingQueue(true)->insertIndiviudalProcessNode(indiProcNode); |
| 8980 |
} |
| 8981 |
initialized = true; |
| 8982 |
} |
| 8983 |
|
| 8984 |
} |
| 8985 |
|
| 8986 |
|
| 8987 |
if (indiProcNode->getLastAssertedDataLiteralLinker() != indiProcNode->getAssertedDataLiteralLinker()) { |
| 8988 |
for (CProcessAssertedDataLiteralLinker* dataLiteralLinkerIt = indiProcNode->getAssertedDataLiteralLinker(); dataLiteralLinkerIt && dataLiteralLinkerIt != indiProcNode->getLastAssertedDataLiteralLinker(); dataLiteralLinkerIt = dataLiteralLinkerIt->getNext()) { |
| 8989 |
CDataLiteral* dataLiteral = dataLiteralLinkerIt->getDataLiteral(); |
| 8990 |
CDependencyTrackPoint* depTrackPoint = dataLiteralLinkerIt->getDependencyTrackPoint(); |
| 8991 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 8992 |
mDatatypeHandler->addDataLiteral(indiProcNode, dataLiteral, false, depTrackPoint, calcAlgContext); |
| 8993 |
CDatatype* datatype = dataLiteral->getDatatype(); |
| 8994 |
if (datatype && datatype->getDatatypeConcept()) { |
| 8995 |
addConceptToIndividual(datatype->getDatatypeConcept(), false, indiProcNode, depTrackPoint, true, false, calcAlgContext); |
| 8996 |
} |
| 8997 |
} |
| 8998 |
|
| 8999 |
} |
| 9000 |
indiProcNode->setLastAssertedDataLiteralLinker(indiProcNode->getAssertedDataLiteralLinker()); |
| 9001 |
} |
| 9002 |
|
| 9003 |
|
| 9004 |
if (assertionDataLinkerIt || addProcDataAssertionsLinker) { |
| 9005 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 9006 |
while (assertionDataLinkerIt && assertionDataLinkerIt != indiProcNode->getLastProcessedAssertionDataLinker()) { |
| 9007 |
addDataAssertion(indiProcNode, assertionDataLinkerIt, depTrackPoint, calcAlgContext); |
| 9008 |
assertionDataLinkerIt = assertionDataLinkerIt->getNext(); |
| 9009 |
} |
| 9010 |
indiProcNode->setLastProcessedAssertionDataLinker(indiProcNode->getAssertionDataLinker()); |
| 9011 |
|
| 9012 |
if (addProcDataAssertionsLinker != indiProcNode->getLastProcessedAdditionalDataAssertionLinker()) { |
| 9013 |
for (CAdditionalProcessDataAssertionsLinker* addProcDataAssertionsLinkerIt = indiProcNode->getAdditionalDataAssertionsLinker(); addProcDataAssertionsLinkerIt && addProcDataAssertionsLinkerIt != indiProcNode->getLastProcessedAdditionalDataAssertionLinker(); addProcDataAssertionsLinkerIt = addProcDataAssertionsLinkerIt->getNext()) { |
| 9014 |
CDependencyTrackPoint* depTrackPoint = addProcDataAssertionsLinkerIt->getDependencyTrackPoint(); |
| 9015 |
for (CDataAssertionLinker* dataLiteralLinkerIt = addProcDataAssertionsLinkerIt->getDataAssertionLinker(); dataLiteralLinkerIt && dataLiteralLinkerIt; dataLiteralLinkerIt = dataLiteralLinkerIt->getNext()) { |
| 9016 |
addDataAssertion(indiProcNode, dataLiteralLinkerIt, depTrackPoint, calcAlgContext); |
| 9017 |
} |
| 9018 |
} |
| 9019 |
indiProcNode->setLastProcessedAdditionalDataAssertionLinker(indiProcNode->getAdditionalDataAssertionsLinker()); |
| 9020 |
} |
| 9021 |
} |
| 9022 |
|
| 9023 |
if (assInitSignatureBuilded && mOptDetExpPreporcessing) { |
| 9024 |
cint64 assInitSigValue = assInitSignature.getSignatureValue(); |
| 9025 |
indiProcNode->setAssertionInitialisationSignatureValue(assInitSigValue); |
| 9026 |
|
| 9027 |
STATINC(SIGNATURESAVINGCOUNT,calcAlgContext); |
| 9028 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 9029 |
CSignatureBlockingCandidateHash* sigNomDelCandHash = processingDataBox->getSignatureNominalDelayingCandidateHash(true); |
| 9030 |
sigNomDelCandHash->insertSignatureBlockingCandidate(assInitSigValue,indiProcNode); |
| 9031 |
} |
| 9032 |
|
| 9033 |
if (mConfAddCachedComputedConsequences && indiProcNode->isNominalIndividualNode() && !mOptIncrementalExpansion) { |
| 9034 |
addCachedComputedTypes(indiProcNode,calcAlgContext); |
| 9035 |
} |
| 9036 |
|
| 9037 |
return initialized; |
| 9038 |
} |
| 9039 |
|
| 9040 |
|
| 9041 |
|
| 9042 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addCachedComputedTypes(CIndividualProcessNode*& indiProcNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9043 |
bool addedConcepts = false; |
| 9044 |
CIndividual* individual = indiProcNode->getNominalIndividual(); |
| 9045 |
if (individual && mCompConsCacheHandler && !indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCACHEDCOMPUTEDTYPESADDED)) { |
| 9046 |
indiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCACHEDCOMPUTEDTYPESADDED); |
| 9047 |
CSortedNegLinker<CConcept*>* typeConceptLinker = mCompConsCacheHandler->getCachedTypesConceptLinker(individual,calcAlgContext); |
| 9048 |
if (typeConceptLinker) { |
| 9049 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 9050 |
CDependencyTrackPoint* expDepTrackPoint = nullptr; |
| 9051 |
createANDDependency(expDepTrackPoint,indiProcNode,nullptr,depTrackPoint,calcAlgContext); |
| 9052 |
addConceptsToIndividual(typeConceptLinker,false,indiProcNode,expDepTrackPoint,true,false,nullptr,calcAlgContext); |
| 9053 |
addedConcepts = true; |
| 9054 |
} |
| 9055 |
} |
| 9056 |
return addedConcepts; |
| 9057 |
} |
| 9058 |
|
| 9059 |
|
| 9060 |
|
| 9061 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::individualNodeInitializing(CIndividualProcessNode*& indiProcNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9062 |
CIndividualProcessNode* lastIndiProcNode = indiProcNode; |
| 9063 |
indiProcNode = getLocalizedIndividual(indiProcNode,true,calcAlgContext); |
| 9064 |
|
| 9065 |
indiProcNode->setProcessingQueued(false); |
| 9066 |
indiProcNode->setExtendedQueueProcessing(true); |
| 9067 |
calcAlgContext->setCurrentIndividualNode(indiProcNode); |
| 9068 |
|
| 9069 |
|
| 9070 |
if (mIndiNodeFromQueueType == INQT_IMMEDIATE) { |
| 9071 |
indiProcNode->setImmediatelyProcessingQueued(false); |
| 9072 |
} else if (mIndiNodeFromQueueType == INQT_DELAYEDBACKENDINIT) { |
| 9073 |
|
| 9074 |
|
| 9075 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiProcNode->getIndividualBackendCacheSynchronisationData(false); |
| 9076 |
if (!backendSyncData->isBackendConceptSetInitializationRequired()) { |
| 9077 |
|
| 9078 |
|
| 9079 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHash* useBackendConceptSetLabelProcessingHash = calcAlgContext->getProcessingDataBox()->getBackendCacheConceptSetLabelProcessingHash(true); |
| 9080 |
|
| 9081 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher hasher = getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(indiProcNode, calcAlgContext); |
| 9082 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingData& processingData = (*useBackendConceptSetLabelProcessingHash)[hasher]; |
| 9083 |
processingData.decQueuedNodeInitializingCount(); |
| 9084 |
|
| 9085 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiProcNode->getIndividualBackendCacheSynchronisationData(true); |
| 9086 |
if (!locBackendSyncData) { |
| 9087 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiProcNode, calcAlgContext); |
| 9088 |
} |
| 9089 |
locBackendSyncData->setBackendConceptSetInitializationRequired(true); |
| 9090 |
} |
| 9091 |
|
| 9092 |
} else if (mIndiNodeFromQueueType == INQT_DETEXP) { |
| 9093 |
indiProcNode->setDeterministicExpandingProcessingQueued(false); |
| 9094 |
} else if (mIndiNodeFromQueueType == INQT_DEPTHNORMAL || mIndiNodeFromQueueType == INQT_NOMINAL) { |
| 9095 |
indiProcNode->setRegularDepthProcessingQueued(false); |
| 9096 |
} else if (mIndiNodeFromQueueType == INQT_BLOCKREACT) { |
| 9097 |
indiProcNode->setBlockedReactivationProcessingQueued(false); |
| 9098 |
} else if (mIndiNodeFromQueueType == INQT_DELAYEDNOMINAL) { |
| 9099 |
indiProcNode->setDelayedNominalProcessingQueued(false); |
| 9100 |
} else if (mIndiNodeFromQueueType == INQT_BACKENDSYNCRETEST) { |
| 9101 |
indiProcNode->setBackendSynchronRetestProcessingQueued(false); |
| 9102 |
} else if (mIndiNodeFromQueueType == INQT_BACKENDDIRECTINFLUENCEEXPANSION) { |
| 9103 |
indiProcNode->setBackendDirectInfluenceExpansionQueued(false); |
| 9104 |
} else if (mIndiNodeFromQueueType == INQT_BACKENDINDIRECTCOMPATIBILITYEXPANSION) { |
| 9105 |
indiProcNode->setBackendIndirectCompatibilityExpansionQueued(false); |
| 9106 |
} |
| 9107 |
|
| 9108 |
|
| 9109 |
indiProcNode->resetLastProcessingPriority(); |
| 9110 |
|
| 9111 |
//if (indiProcNode->getNominalIndividual()) { |
| 9112 |
// if (CIRIName::getRecentIRIName(indiProcNode->getNominalIndividual()->getIndividualNameLinker()) == "#robert_david_bright_1965") { |
| 9113 |
// bool bug = true; |
| 9114 |
// } |
| 9115 |
//} |
| 9116 |
//} |
| 9117 |
if (!indiProcNode->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 9118 |
initialNodeInitialize(indiProcNode, true, calcAlgContext); |
| 9119 |
|
| 9120 |
|
| 9121 |
if (mIndiNodeFromQueueType == INQT_CACHETEST) { |
| 9122 |
testIndividualNodeUnsatisfiableCached(indiProcNode, calcAlgContext); |
| 9123 |
} else if (mIndiNodeFromQueueType == INQT_VSTSATTESTING) { |
| 9124 |
checkValueSpaceDistinctSatisfiability(indiProcNode, calcAlgContext); |
| 9125 |
} else if (mIndiNodeFromQueueType == INQT_VSTRIGGERING) { |
| 9126 |
triggerValueSpaceConcepts(indiProcNode, calcAlgContext); |
| 9127 |
} else if (mIndiNodeFromQueueType == INQT_BACKENDEXPANSIONREUSE) { |
| 9128 |
indiProcNode->setBackendReuseExpansionQueued(false); |
| 9129 |
|
| 9130 |
if (!indiProcNode->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 9131 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiProcNode->getIndividualBackendCacheSynchronisationData(false); |
| 9132 |
if (!indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSEDISCARDED) && !backendSyncData->getBackendExpansionReuseDependencyTrackPoint() && checkIndividualBackendExpansionReuseable(indiProcNode, calcAlgContext)) { |
| 9133 |
CBackendNeighbourExpansionControllingData* expContData = calcAlgContext->getProcessingDataBox()->getBackendNeighbourExpansionControllingData(true); |
| 9134 |
if (expContData->isFixedReuseExpansionMode()) { |
| 9135 |
prepareBackendIndividualFixedReuseExpansion(indiProcNode, calcAlgContext); |
| 9136 |
} |
| 9137 |
if (expContData->isPrioritizedReuseExpansionMode()) { |
| 9138 |
prepareBackendIndividualPrioritizedReuseExpansion(indiProcNode, calcAlgContext); |
| 9139 |
} |
| 9140 |
} |
| 9141 |
if (!indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSEDISCARDED)) { |
| 9142 |
reuseIndividualBackendExpansion(indiProcNode, calcAlgContext); |
| 9143 |
} |
| 9144 |
} |
| 9145 |
} |
| 9146 |
|
| 9147 |
|
| 9148 |
|
| 9149 |
if (isIndividualNodeProcessingBlocked(indiProcNode, calcAlgContext)) { |
| 9150 |
eliminiateBlockedIndividuals(indiProcNode, calcAlgContext); |
| 9151 |
return false; |
| 9152 |
} |
| 9153 |
|
| 9154 |
|
| 9155 |
// counting same concept signature |
| 9156 |
//conSet = indiProcNode->getReapplyConceptLabelSet(false); |
| 9157 |
//if (conSet) { |
| 9158 |
// cint64 sigVal = conSet->getConceptSignature()->getSignatureValue(); |
| 9159 |
// cint64 prevCountVal = mIndiNodeInitConceptSigCountHash.value(sigVal,0); |
| 9160 |
// mIndiNodeInitConceptSigCountHash.insert(sigVal,prevCountVal+1); |
| 9161 |
//} |
| 9162 |
|
| 9163 |
if (mConfSignatureSaving) { |
| 9164 |
addSignatureIndividualNodeBlockerCandidate(indiProcNode, calcAlgContext); |
| 9165 |
} |
| 9166 |
return true; |
| 9167 |
} |
| 9168 |
return false; |
| 9169 |
} |
| 9170 |
|
| 9171 |
|
| 9172 |
void CCalculationTableauCompletionTaskHandleAlgorithm::checkValueSpaceDistinctSatisfiability(CIndividualProcessNode* processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9173 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 9174 |
|
| 9175 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 9176 |
//QFile file(QString("datatype-error.txt")); |
| 9177 |
//if (file.open(QIODevice::WriteOnly)) { |
| 9178 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 9179 |
// file.close(); |
| 9180 |
//} |
| 9181 |
|
| 9182 |
|
| 9183 |
CTaskProcessorContext* taskProcessorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 9184 |
CPROCESSINGSET<CIndividualProcessNode*>* distinctIndividualNodeCollectionSet = CObjectParameterizingAllocator< CPROCESSINGSET<CIndividualProcessNode*>,CContext* >::allocateAndConstructAndParameterize(taskProcessorContext->getMemoryAllocationManager(),taskProcessorContext); |
| 9185 |
CPROCESSINGLIST<CIndividualProcessNode*>* distinctIndividualNodeCollectionList = CObjectParameterizingAllocator< CPROCESSINGLIST<CIndividualProcessNode*>,CContext* >::allocateAndConstructAndParameterize(taskProcessorContext->getMemoryAllocationManager(),taskProcessorContext); |
| 9186 |
|
| 9187 |
if (mDatatypeHandler->requiresSatisfiabilityChecking(processIndi,calcAlgContext)) { |
| 9188 |
distinctIndividualNodeCollectionSet->insert(processIndi); |
| 9189 |
distinctIndividualNodeCollectionList->append(processIndi); |
| 9190 |
|
| 9191 |
while (!distinctIndividualNodeCollectionList->isEmpty()) { |
| 9192 |
CIndividualProcessNode* distinctIndiNode = distinctIndividualNodeCollectionList->takeFirst(); |
| 9193 |
CDistinctHash* distinctHash = distinctIndiNode->getDistinctHash(false); |
| 9194 |
if (distinctHash) { |
| 9195 |
CDistinctIterator distinctIterator = distinctHash->getDistinctIterator(); |
| 9196 |
while (distinctIterator.hasNext()) { |
| 9197 |
cint64 nextDistinctIndiID = distinctIterator.nextDistinctIndividualID(); |
| 9198 |
CIndividualProcessNode* nextDistinctIndiNode = getLocalizedIndividual(nextDistinctIndiID,calcAlgContext); |
| 9199 |
if (mDatatypeHandler->involveDistinctNodeForSatisfiabilityChecking(nextDistinctIndiNode,calcAlgContext)) { |
| 9200 |
if (!distinctIndividualNodeCollectionSet->contains(nextDistinctIndiNode)) { |
| 9201 |
distinctIndividualNodeCollectionSet->insert(nextDistinctIndiNode); |
| 9202 |
distinctIndividualNodeCollectionList->append(nextDistinctIndiNode); |
| 9203 |
} |
| 9204 |
} |
| 9205 |
} |
| 9206 |
} |
| 9207 |
} |
| 9208 |
} |
| 9209 |
|
| 9210 |
mDatatypeHandler->checkSatisfiability(processIndi,distinctIndividualNodeCollectionSet,calcAlgContext); |
| 9211 |
} |
| 9212 |
} |
| 9213 |
|
| 9214 |
|
| 9215 |
void CCalculationTableauCompletionTaskHandleAlgorithm::triggerValueSpaceConcepts(CIndividualProcessNode* processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9216 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 9217 |
CConceptDescriptor* triggeredConceptLinker = nullptr; |
| 9218 |
|
| 9219 |
|
| 9220 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 9221 |
//QFile file(QString("debug-model.txt")); |
| 9222 |
//if (file.open(QIODevice::WriteOnly)) { |
| 9223 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 9224 |
// file.close(); |
| 9225 |
//} |
| 9226 |
|
| 9227 |
mDatatypeHandler->triggerValueSpaceConcepts(processIndi,triggeredConceptLinker,calcAlgContext); |
| 9228 |
addtriggeredValueSpaceConcepts(processIndi, triggeredConceptLinker, calcAlgContext); |
| 9229 |
|
| 9230 |
} |
| 9231 |
} |
| 9232 |
|
| 9233 |
|
| 9234 |
|
| 9235 |
|
| 9236 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addtriggeredValueSpaceConcepts(CIndividualProcessNode* processIndi, CConceptDescriptor* triggeredConceptLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9237 |
|
| 9238 |
CConceptDescriptor* invTriggeredConceptLinker = nullptr; |
| 9239 |
while (triggeredConceptLinker) { |
| 9240 |
CConceptDescriptor* tmpTriggeredConceptLinker = triggeredConceptLinker; |
| 9241 |
triggeredConceptLinker = triggeredConceptLinker->getNextConceptDesciptor(); |
| 9242 |
tmpTriggeredConceptLinker->clearNext(); |
| 9243 |
invTriggeredConceptLinker = tmpTriggeredConceptLinker->append(invTriggeredConceptLinker); |
| 9244 |
} |
| 9245 |
|
| 9246 |
|
| 9247 |
for (CConceptDescriptor* triggeredConceptLinkerIt = invTriggeredConceptLinker; triggeredConceptLinkerIt; triggeredConceptLinkerIt = triggeredConceptLinkerIt->getNext()) { |
| 9248 |
CConcept* triggeredConcept = triggeredConceptLinkerIt->getConcept(); |
| 9249 |
bool triggeredNegation = triggeredConceptLinkerIt->isNegated(); |
| 9250 |
CDependencyTrackPoint* triggeredDependencyTrackPoint = triggeredConceptLinkerIt->getDependencyTrackPoint(); |
| 9251 |
addConceptToIndividual(triggeredConcept, triggeredNegation, processIndi, triggeredDependencyTrackPoint, true, false, calcAlgContext); |
| 9252 |
} |
| 9253 |
|
| 9254 |
} |
| 9255 |
|
| 9256 |
|
| 9257 |
void CCalculationTableauCompletionTaskHandleAlgorithm::tryCompletionGraphReuse(CIndividualProcessNode* processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9258 |
bool minimalCompletionGraph = false; |
| 9259 |
bool minimalCompletionGraphConnection = false; |
| 9260 |
if (mReuseCompGraphCacheHandler && mConfCompGraphReuseCacheRetrieval) { |
| 9261 |
STATINC(COMPLETIONGRAPHREUSECACHERETRIEVALCOUNT,calcAlgContext); |
| 9262 |
|
| 9263 |
KONCLUCE_TASK_ALGORITHM_TIME_MEASURE_INSTRUCTION( |
| 9264 |
mComplGraphReuseCacheRetrieval.start(); |
| 9265 |
); |
| 9266 |
|
| 9267 |
CReuseCompletionGraphCacheEntry* reuseCompGraphCacheEntry = mReuseCompGraphCacheHandler->getReuseCompletionGraphEntry(processIndi,&minimalCompletionGraph,&minimalCompletionGraphConnection,calcAlgContext); |
| 9268 |
|
| 9269 |
KONCLUCE_TASK_ALGORITHM_TIME_MEASURE_INSTRUCTION( |
| 9270 |
cint64 timeElapsed = mComplGraphReuseCacheRetrieval.elapsed(); |
| 9271 |
STATINCM(TIMECOMPLETIONGRAPHREUSERETRIVAL,timeElapsed,calcAlgContext); |
| 9272 |
); |
| 9273 |
|
| 9274 |
if (reuseCompGraphCacheEntry) { |
| 9275 |
STATINC(COMPLETIONGRAPHREUSECACHERETRIEVALSUCCESSCOUNT,calcAlgContext); |
| 9276 |
CXSortedNegLinker<CConcept*>* initConceptLinkerIt = processIndi->getProcessInitializingConceptLinker(); |
| 9277 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 9278 |
CSatisfiableCalculationTask* reuseSatCalcTask = (CSatisfiableCalculationTask*)reuseCompGraphCacheEntry->getJobInstantiation(); |
| 9279 |
CProcessingDataBox* reuseProcessingDataBox = reuseSatCalcTask->getProcessingDataBox(); |
| 9280 |
cint64 reuseBranchingTag = reuseProcessingDataBox->getProcessContext()->getUsedProcessTagger()->getCurrentBranchingTag(); |
| 9281 |
bool deterministicReuse = reuseBranchingTag == 0 && minimalCompletionGraph && minimalCompletionGraphConnection; |
| 9282 |
|
| 9283 |
|
| 9284 |
if (!deterministicReuse && mConfCompGraphNonDeterministicReuse || deterministicReuse && mConfCompGraphDeterministicReuse) { |
| 9285 |
|
| 9286 |
|
| 9287 |
cint64 taskCreationCount = 2; |
| 9288 |
if (deterministicReuse) { |
| 9289 |
STATINC(COMPLETIONGRAPHREUSECACHEREUSINGDETCOUNT,calcAlgContext); |
| 9290 |
taskCreationCount = 1; |
| 9291 |
} else { |
| 9292 |
STATINC(COMPLETIONGRAPHREUSECACHEREUSINGNONDETCOUNT,calcAlgContext); |
| 9293 |
} |
| 9294 |
|
| 9295 |
CSatisfiableCalculationTask* newTaskList = createDependendBranchingTaskList(taskCreationCount,calcAlgContext); |
| 9296 |
|
| 9297 |
CSatisfiableCalculationTask* newTaskIt = newTaskList; |
| 9298 |
|
| 9299 |
CREUSECOMPLETIONGRAPHDependencyNode* reuseDepNode = createREUSECOMPLETIONGRAPHDependency(processIndi,nullptr,nullptr,calcAlgContext); |
| 9300 |
|
| 9301 |
|
| 9302 |
for (cint64 i = 0; i < taskCreationCount; ++i) { |
| 9303 |
|
| 9304 |
CSatisfiableCalculationTask* newSatCalcTask = newTaskIt; |
| 9305 |
|
| 9306 |
bool reusingAlternative = i == 0; |
| 9307 |
|
| 9308 |
if (reusingAlternative) { |
| 9309 |
|
| 9310 |
CDependencyTrackPoint* newDependencyTrackPoint = nullptr; |
| 9311 |
if (deterministicReuse) { |
| 9312 |
newDependencyTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 9313 |
} else { |
| 9314 |
newDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseDepNode,false,calcAlgContext); |
| 9315 |
} |
| 9316 |
|
| 9317 |
|
| 9318 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 9319 |
newProcessingDataBox->initProcessingDataBox(reuseProcessingDataBox); |
| 9320 |
|
| 9321 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 9322 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext,newProcessContext,newSatCalcTask); |
| 9323 |
CMemoryAllocationManager* newAllocMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 9324 |
|
| 9325 |
CProcessTagger* newProcessTagger = newCalcAlgContext->getUsedProcessTagger(); |
| 9326 |
if (!deterministicReuse) { |
| 9327 |
newProcessTagger->incBranchingTag(); |
| 9328 |
if (!minimalCompletionGraphConnection) { |
| 9329 |
newProcessingDataBox->setMaximumDeterministicBranchTag(-1); |
| 9330 |
} |
| 9331 |
} |
| 9332 |
newProcessTagger->incLocalizationTag(); |
| 9333 |
|
| 9334 |
|
| 9335 |
CIndividualProcessNodeVector* indiNodeVec = newProcessingDataBox->getIndividualProcessNodeVector(); |
| 9336 |
cint64 nextIndiID = indiNodeVec->getItemMaxIndex()+1; |
| 9337 |
|
| 9338 |
|
| 9339 |
CIndividualProcessNode* newIndi = CObjectParameterizingAllocator< CIndividualProcessNode,CProcessContext* >::allocateAndConstructAndParameterize(newAllocMemMan,newProcessContext); |
| 9340 |
newIndi->setIndividualNodeID(nextIndiID); |
| 9341 |
newIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING); |
| 9342 |
newProcessingDataBox->setConstructedIndividualNode(newIndi); |
| 9343 |
indiNodeVec->setData(nextIndiID,newIndi); |
| 9344 |
|
| 9345 |
addConceptsToIndividual(initConceptLinkerIt,false,newIndi,newDependencyTrackPoint,false,true,nullptr,newCalcAlgContext); |
| 9346 |
|
| 9347 |
CConcept* topConcept = calcAlgContext->getProcessingDataBox()->getOntologyTopConcept(); |
| 9348 |
addConceptToIndividual(topConcept,false,newIndi,newDependencyTrackPoint,false,true,newCalcAlgContext); |
| 9349 |
|
| 9350 |
prepareBranchedTaskProcessing(newIndi,newSatCalcTask,newCalcAlgContext); |
| 9351 |
|
| 9352 |
|
| 9353 |
} else { |
| 9354 |
|
| 9355 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 9356 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext,newProcessContext,newSatCalcTask); |
| 9357 |
CMemoryAllocationManager* newAllocMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 9358 |
|
| 9359 |
CIndividualProcessNode* newLocIndiNode = getLocalizedIndividual(processIndi,false,newCalcAlgContext); |
| 9360 |
prepareBranchedTaskProcessing(newLocIndiNode,newSatCalcTask,newCalcAlgContext); |
| 9361 |
|
| 9362 |
} |
| 9363 |
|
| 9364 |
// set new task priority |
| 9365 |
double newTaskPriority = calcAlgContext->getUsedTaskPriorityStrategy()->getPriorityForTaskReusing(newSatCalcTask,calcAlgContext->getUsedSatisfiableCalculationTask(),reusingAlternative); |
| 9366 |
newSatCalcTask->setTaskPriority(newTaskPriority); |
| 9367 |
|
| 9368 |
newTaskIt = (CSatisfiableCalculationTask*)newTaskIt->getNext(); |
| 9369 |
|
| 9370 |
} |
| 9371 |
|
| 9372 |
|
| 9373 |
processorContext->getTaskProcessorCommunicator()->communicateTaskCreation(newTaskList); |
| 9374 |
|
| 9375 |
throw CCalculationStopProcessingException(true); |
| 9376 |
} |
| 9377 |
} else { |
| 9378 |
STATINC(COMPLETIONGRAPHREUSECACHERETRIEVALFAILEDCOUNT,calcAlgContext); |
| 9379 |
} |
| 9380 |
} |
| 9381 |
} |
| 9382 |
|
| 9383 |
|
| 9384 |
void CCalculationTableauCompletionTaskHandleAlgorithm::eliminiateBlockedIndividuals(CIndividualProcessNode*& indiProcNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9385 |
//if (indiProcNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDATEBLOCKERFLAGSCOMPINATION)) { |
| 9386 |
if (indiProcNode->hasBlockedIndividualsLinker()) { |
| 9387 |
// reactivate all blocked individuals |
| 9388 |
reactivateBlockedIndividuals(indiProcNode,calcAlgContext); |
| 9389 |
} |
| 9390 |
if (indiProcNode->hasBlockingFollower()) { |
| 9391 |
CBlockingFollowSet* followerSet = indiProcNode->getBlockingFollowSet(false); |
| 9392 |
for (CPROCESSSET<cint64>::const_iterator it = followerSet->constBegin(), itEnd = followerSet->constEnd(); it != itEnd; ++it) { |
| 9393 |
cint64 blockingIndiNodeID = *it; |
| 9394 |
CIndividualProcessNode* blockingIndiNode = getUpToDateIndividual(blockingIndiNodeID,calcAlgContext); |
| 9395 |
addIndividualToBlockingUpdateReviewProcessingQueue(blockingIndiNode,calcAlgContext); |
| 9396 |
} |
| 9397 |
} |
| 9398 |
CXLinker<CIndividualProcessNode*>* processingBlockedNodeLinker = indiProcNode->getProcessingBlockedIndividualsLinker(); |
| 9399 |
while (processingBlockedNodeLinker) { |
| 9400 |
CIndividualProcessNode* blockedNode = processingBlockedNodeLinker->getData(); |
| 9401 |
CIndividualProcessNode* locBlockedNode = getLocalizedIndividual(blockedNode,true,calcAlgContext); |
| 9402 |
locBlockedNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEPROCESSINGCOMPLETED); |
| 9403 |
addIndividualToProcessingQueue(locBlockedNode,calcAlgContext); |
| 9404 |
processingBlockedNodeLinker = processingBlockedNodeLinker->getNext(); |
| 9405 |
} |
| 9406 |
indiProcNode->clearBlockedIndividualsLinker(); |
| 9407 |
//} |
| 9408 |
} |
| 9409 |
|
| 9410 |
|
| 9411 |
|
| 9412 |
|
| 9413 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getDelayProcessingBlockingNominalNode(CIndividualProcessNode* testIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9414 |
CIndividualProcessNode* nominalBlockerIndividual = nullptr; |
| 9415 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 9416 |
CSignatureBlockingCandidateHash* sigNomDelCandHash = processingDataBox->getSignatureNominalDelayingCandidateHash(false); |
| 9417 |
|
| 9418 |
CReapplyConceptLabelSet* conSet = testIndi->getReapplyConceptLabelSet(false); |
| 9419 |
if (conSet && sigNomDelCandHash) { |
| 9420 |
cint64 assConSig = testIndi->getAssertionInitialisationSignatureValue(); |
| 9421 |
CSignatureBlockingCandidateIterator candIt(sigNomDelCandHash->getBlockingCandidatesIterator(assConSig)); |
| 9422 |
while (!nominalBlockerIndividual && candIt.hasNext()) { |
| 9423 |
cint64 candIndiID = candIt.next(true); |
| 9424 |
if (candIndiID != testIndi->getIndividualNodeID()) { |
| 9425 |
CIndividualProcessNode* candIndiNode = getUpToDateIndividual(candIndiID,calcAlgContext); |
| 9426 |
if (candIndiNode->isNominalIndividualNode() && candIndiNode->getNominalIndividual() && !candIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 9427 |
CReapplyConceptLabelSet* blockerConSet = candIndiNode->getReapplyConceptLabelSet(false); |
| 9428 |
if (isLabelConceptSubSetIgnoreNominals(conSet,blockerConSet, nullptr,calcAlgContext)) { |
| 9429 |
nominalBlockerIndividual = candIndiNode; |
| 9430 |
} |
| 9431 |
} |
| 9432 |
} |
| 9433 |
} |
| 9434 |
} |
| 9435 |
return nominalBlockerIndividual; |
| 9436 |
} |
| 9437 |
|
| 9438 |
|
| 9439 |
|
| 9440 |
|
| 9441 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::tryDelayNominalProcessing(CConceptProcessDescriptor* conProDes, CIndividualProcessNode* testIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9442 |
if (canDelayNominalProcessing(conProDes,testIndi,calcAlgContext)) { |
| 9443 |
testIndi->setNominalProcessingDelayingChecked(true); |
| 9444 |
|
| 9445 |
bool notConnectedNominal = false; |
| 9446 |
CSuccessorIterator succIt(testIndi->getSuccessorIterator()); |
| 9447 |
if (!succIt.hasNext()) { |
| 9448 |
notConnectedNominal = true; |
| 9449 |
} |
| 9450 |
|
| 9451 |
if (notConnectedNominal) { |
| 9452 |
CIndividualProcessNode* blockerNominalIndiNode = getDelayProcessingBlockingNominalNode(testIndi,calcAlgContext); |
| 9453 |
if (blockerNominalIndiNode) { |
| 9454 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 9455 |
CIndividualUnsortedProcessingQueue* delayingNominalProcessingQueu = processingDataBox->getDelayingNominalProcessingQueue(true); |
| 9456 |
delayingNominalProcessingQueu->insertIndiviudalProcessNode(testIndi); |
| 9457 |
testIndi->setDelayedNominalProcessingQueued(true); |
| 9458 |
return true; |
| 9459 |
} |
| 9460 |
} |
| 9461 |
} |
| 9462 |
return false; |
| 9463 |
} |
| 9464 |
|
| 9465 |
|
| 9466 |
|
| 9467 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::canDelayNominalProcessing(CConceptProcessDescriptor* conProDes, CIndividualProcessNode* testIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9468 |
if (testIndi->isNominalIndividualNode() && testIndi->getNominalIndividual()) { |
| 9469 |
if (conProDes->getProcessPriority() < mImmediatelyProcessPriority) { |
| 9470 |
if (!testIndi->hasNominalProcessingDelayingChecked()) { |
| 9471 |
return true; |
| 9472 |
} |
| 9473 |
} |
| 9474 |
} |
| 9475 |
return false; |
| 9476 |
} |
| 9477 |
|
| 9478 |
|
| 9479 |
|
| 9480 |
void CCalculationTableauCompletionTaskHandleAlgorithm::individualNodeConclusion(CIndividualProcessNode*& indiProcNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9481 |
if (mIndiNodeConcludeUnsatCaching) { |
| 9482 |
testIndividualNodeUnsatisfiableCached(indiProcNode,calcAlgContext); |
| 9483 |
} |
| 9484 |
|
| 9485 |
calcAlgContext->setCurrentIndividualNode(nullptr); |
| 9486 |
addIndividualToProcessingQueue(indiProcNode,calcAlgContext); |
| 9487 |
|
| 9488 |
//CConceptProcessingQueue* conProQue = indiProcNode->getConceptProcessingQueue(false); |
| 9489 |
//if (nodeProcessingBreaked && conProQue && !conProQue->isEmpty()) { |
| 9490 |
// addIndividualToProcessingQueue(indiProcNode,false,calcAlgContext); |
| 9491 |
//} else if (!conProQue || conProQue->isEmpty()) { |
| 9492 |
// propagateIndividualProcessedAndReactivate(indiProcNode,calcAlgContext); |
| 9493 |
//} |
| 9494 |
} |
| 9495 |
|
| 9496 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::tableauRuleProcessing(CIndividualProcessNode*& indiProcNode,CConceptProcessDescriptor*& conProcDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9497 |
CConceptDescriptor* conDes = conProcDes->getConceptDescriptor(); |
| 9498 |
bool conNeg = conDes->getNegation(); |
| 9499 |
CConcept* concept = conDes->getConcept(); |
| 9500 |
cint64 conOpCode = concept->getOperatorCode(); |
| 9501 |
|
| 9502 |
if (tryDelayNominalProcessing(conProcDes,indiProcNode,calcAlgContext)) { |
| 9503 |
return false; |
| 9504 |
} |
| 9505 |
|
| 9506 |
if (needsIndividualNodeExpansionBlockingTest(conProcDes,indiProcNode,calcAlgContext)) { |
| 9507 |
if (isIndividualNodeBackendCacheSynchronizationProcessingBlocked(indiProcNode,calcAlgContext)) { |
| 9508 |
return false; |
| 9509 |
} |
| 9510 |
if (isIndividualNodeExpansionBlocked(indiProcNode,calcAlgContext)) { |
| 9511 |
return false; |
| 9512 |
} |
| 9513 |
} |
| 9514 |
|
| 9515 |
|
| 9516 |
tableauRuleChoice(indiProcNode,conProcDes,calcAlgContext); |
| 9517 |
|
| 9518 |
return true; |
| 9519 |
} |
| 9520 |
|
| 9521 |
|
| 9522 |
void CCalculationTableauCompletionTaskHandleAlgorithm::tableauRuleChoice(CIndividualProcessNode*& indiProcNode,CConceptProcessDescriptor*& conProcDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9523 |
CConceptDescriptor* conDes = conProcDes->getConceptDescriptor(); |
| 9524 |
bool conNeg = conDes->getNegation(); |
| 9525 |
CConcept* concept = conDes->getConcept(); |
| 9526 |
cint64 conOpCode = concept->getOperatorCode(); |
| 9527 |
|
| 9528 |
++mCurrentRecProcDepth; |
| 9529 |
|
| 9530 |
|
| 9531 |
TableauRuleFunction func = nullptr; |
| 9532 |
if (!conNeg) { |
| 9533 |
func = mPosJumpFuncVec[conOpCode]; |
| 9534 |
if (func) { |
| 9535 |
(this->*func)(indiProcNode,conProcDes,false,calcAlgContext); |
| 9536 |
} |
| 9537 |
mLastJumpFunc = func; |
| 9538 |
} else { |
| 9539 |
func = mNegJumpFuncVec[conOpCode]; |
| 9540 |
if (func) { |
| 9541 |
(this->*func)(indiProcNode,conProcDes,true,calcAlgContext); |
| 9542 |
} |
| 9543 |
mLastJumpFunc = func; |
| 9544 |
} |
| 9545 |
|
| 9546 |
|
| 9547 |
--mCurrentRecProcDepth; |
| 9548 |
|
| 9549 |
} |
| 9550 |
|
| 9551 |
|
| 9552 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyNegAutomatChooseRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9553 |
applyAutomatChooseRule(processIndi,conProDes,!negate,calcAlgContext); |
| 9554 |
} |
| 9555 |
|
| 9556 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyNegANDRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9557 |
applyANDRule(processIndi,conProDes,!negate,calcAlgContext); |
| 9558 |
} |
| 9559 |
|
| 9560 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyNegSOMERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9561 |
applySOMERule(processIndi,conProDes,!negate,calcAlgContext); |
| 9562 |
} |
| 9563 |
|
| 9564 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyNegALLRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9565 |
applyALLRule(processIndi,conProDes,!negate,calcAlgContext); |
| 9566 |
} |
| 9567 |
|
| 9568 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyNegORRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9569 |
applyORRule(processIndi,conProDes,!negate,calcAlgContext); |
| 9570 |
} |
| 9571 |
|
| 9572 |
|
| 9573 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyNegATMOSTRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9574 |
applyATLEASTRule(processIndi,conProDes,negate,calcAlgContext); |
| 9575 |
} |
| 9576 |
|
| 9577 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyNegATLEASTRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9578 |
applyATMOSTRule(processIndi,conProDes,negate,calcAlgContext); |
| 9579 |
} |
| 9580 |
|
| 9581 |
|
| 9582 |
|
| 9583 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyAutomatChooseRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9584 |
STATINC(AUTOMATEINITCOUNT,calcAlgContext); |
| 9585 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 9586 |
CConcept* concept = conDes->getConcept(); |
| 9587 |
bool conceptNegation = negate; |
| 9588 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 9589 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 9590 |
|
| 9591 |
// create dependency |
| 9592 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 9593 |
CAUTOMATCHOOSEDependencyNode* andDepNode = createAUTOMATCHOOSEDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 9594 |
|
| 9595 |
while (conceptOpLinkerIt) { |
| 9596 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 9597 |
bool opNegation = conceptOpLinkerIt->isNegated(); |
| 9598 |
if (opNegation == negate) { |
| 9599 |
addConceptToIndividual(opConcept,false,processIndi,nextDepTrackPoint,true,false,calcAlgContext); |
| 9600 |
} |
| 9601 |
conceptOpLinkerIt = conceptOpLinkerIt->getNext(); |
| 9602 |
} |
| 9603 |
} |
| 9604 |
|
| 9605 |
|
| 9606 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyAutomatANDRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9607 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 9608 |
CConcept* concept = conDes->getConcept(); |
| 9609 |
bool conceptNegation = negate; |
| 9610 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 9611 |
|
| 9612 |
applyAutomatTransactions(processIndi,conProDes,concept,negate,calcAlgContext); |
| 9613 |
} |
| 9614 |
|
| 9615 |
|
| 9616 |
|
| 9617 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isRestrictedTopObjectPropertyPropagation(CIndividualProcessNode*& processIndi, CIndividualProcessNode*& destIndi, CConcept* concept, bool negated, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9618 |
CSatisfiableTaskAnswererBindingPropagationAdapter* answererMessageAdapter = calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableAnswererBindingPropagationAdapter(); |
| 9619 |
if (answererMessageAdapter) { |
| 9620 |
CAnsweringPropagationSteeringController* propagationSteeringController = answererMessageAdapter->getAnswererPropagationSteeringController(); |
| 9621 |
if (propagationSteeringController) { |
| 9622 |
if (propagationSteeringController->isRestrictedTopPropagation(concept)) { |
| 9623 |
cint64 univConnIndiId = calcAlgContext->getProcessingDataBox()->getOntology()->getABox()->getUniversalConnectionIndividualID(); |
| 9624 |
if (processIndi->getIndividualNodeID() == -univConnIndiId || destIndi->getIndividualNodeID() == -univConnIndiId || processIndi->getNominalIndividual() && destIndi->getNominalIndividual() || destIndi->getNominalIndividual()) { |
| 9625 |
return true; |
| 9626 |
} |
| 9627 |
} |
| 9628 |
} |
| 9629 |
} |
| 9630 |
return false; |
| 9631 |
} |
| 9632 |
|
| 9633 |
|
| 9634 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyAutomatTransactions(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, CConcept* concept, bool negated, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9635 |
STATINC(AUTOMATERULEAPPLICATIONCOUNT,calcAlgContext); |
| 9636 |
|
| 9637 |
CConceptDescriptor* baseConDes = conProDes->getConceptDescriptor(); |
| 9638 |
bool reapplied = conProDes->isConceptReapplied(); |
| 9639 |
CIndividualLinkEdge* restLink = getLinkProcessingRestriction(conProDes); |
| 9640 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 9641 |
|
| 9642 |
|
| 9643 |
cint64 opCode = concept->getOperatorCode(); |
| 9644 |
CSortedNegLinker<CConcept*>* opConcepts = concept->getOperandList(); |
| 9645 |
if (opCode == CCAQAND || opCode == CCIMPLAQAND || opCode == CCBRANCHAQAND) { |
| 9646 |
while (opConcepts) { |
| 9647 |
++mAppliedALLRuleCount; |
| 9648 |
STATINC(AUTOMATESTATECOUNT,calcAlgContext); |
| 9649 |
CConcept* opCon = opConcepts->getData(); |
| 9650 |
bool opConNeg = opConcepts->isNegated(); |
| 9651 |
applyAutomatTransactions(processIndi,conProDes,opCon,opConNeg,calcAlgContext); |
| 9652 |
opConcepts = opConcepts->getNext(); |
| 9653 |
} |
| 9654 |
} else if (opCode == CCAQALL || opCode == CCIMPLAQALL || opCode == CCBRANCHAQALL) { |
| 9655 |
CRole* role = concept->getRole(); |
| 9656 |
|
| 9657 |
|
| 9658 |
if (restLink) { |
| 9659 |
if (restLink->getLinkRole() == role) { |
| 9660 |
++mAppliedALLRuleCount; |
| 9661 |
STATINC(AUTOMATETRANSACTIONCOUNT,calcAlgContext); |
| 9662 |
|
| 9663 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 9664 |
CAUTOMATTRANSACTIONDependencyNode* allDepNode = nullptr; |
| 9665 |
bool allDepNodeCreated = false; |
| 9666 |
|
| 9667 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,restLink,calcAlgContext); |
| 9668 |
if (!isRestrictedTopObjectPropertyPropagation(processIndi, succIndi, concept, negated, calcAlgContext)) { |
| 9669 |
CIndividualProcessNode* locSuccIndi = nullptr; |
| 9670 |
CReapplyConceptLabelSet* conLabelSet = succIndi->getReapplyConceptLabelSet(false); |
| 9671 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = opConcepts; |
| 9672 |
while (conceptOpLinkerIt) { |
| 9673 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 9674 |
bool opConNeg = conceptOpLinkerIt->isNegated() ^ negated; |
| 9675 |
if (!conLabelSet->containsConcept(opConcept, opConNeg)) { |
| 9676 |
|
| 9677 |
// create dependency |
| 9678 |
if (!allDepNodeCreated) { |
| 9679 |
allDepNodeCreated = true; |
| 9680 |
allDepNode = createAUTOMATTRANSACTIONDependency(nextDepTrackPoint, processIndi, baseConDes, depTrackPoint, restLink->getDependencyTrackPoint(), calcAlgContext); |
| 9681 |
} |
| 9682 |
|
| 9683 |
// add concept |
| 9684 |
if (!locSuccIndi) { |
| 9685 |
locSuccIndi = getLocalizedIndividual(succIndi, false, calcAlgContext); |
| 9686 |
conLabelSet = locSuccIndi->getReapplyConceptLabelSet(true); |
| 9687 |
} |
| 9688 |
addConceptToIndividual(opConcept, opConNeg, locSuccIndi, nextDepTrackPoint, true, true, calcAlgContext); |
| 9689 |
} |
| 9690 |
conceptOpLinkerIt = conceptOpLinkerIt->getNext(); |
| 9691 |
} |
| 9692 |
if (locSuccIndi) { |
| 9693 |
addIndividualToProcessingQueue(locSuccIndi, calcAlgContext); |
| 9694 |
} |
| 9695 |
} |
| 9696 |
} |
| 9697 |
} else { |
| 9698 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 9699 |
if (roleSuccHash) { |
| 9700 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role); |
| 9701 |
while (roleSuccIt.hasNext()) { |
| 9702 |
++mAppliedALLRuleCount; |
| 9703 |
STATINC(AUTOMATETRANSACTIONCOUNT,calcAlgContext); |
| 9704 |
|
| 9705 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 9706 |
CAUTOMATTRANSACTIONDependencyNode* allDepNode = nullptr; |
| 9707 |
bool allDepNodeCreated = false; |
| 9708 |
|
| 9709 |
CIndividualLinkEdge* link = roleSuccIt.next(true); |
| 9710 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 9711 |
if (!isRestrictedTopObjectPropertyPropagation(processIndi, succIndi, concept, negated, calcAlgContext)) { |
| 9712 |
CIndividualProcessNode* locSuccIndi = nullptr; |
| 9713 |
CReapplyConceptLabelSet* conLabelSet = succIndi->getReapplyConceptLabelSet(false); |
| 9714 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = opConcepts; |
| 9715 |
while (conceptOpLinkerIt) { |
| 9716 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 9717 |
bool opConNeg = conceptOpLinkerIt->isNegated() ^ negated; |
| 9718 |
if (!conLabelSet->containsConcept(opConcept, opConNeg)) { |
| 9719 |
|
| 9720 |
// create dependency |
| 9721 |
if (!allDepNodeCreated) { |
| 9722 |
allDepNodeCreated = true; |
| 9723 |
allDepNode = createAUTOMATTRANSACTIONDependency(nextDepTrackPoint, processIndi, baseConDes, depTrackPoint, link->getDependencyTrackPoint(), calcAlgContext); |
| 9724 |
} |
| 9725 |
|
| 9726 |
// add concept |
| 9727 |
if (!locSuccIndi) { |
| 9728 |
locSuccIndi = getLocalizedIndividual(succIndi, false, calcAlgContext); |
| 9729 |
conLabelSet = locSuccIndi->getReapplyConceptLabelSet(true); |
| 9730 |
} |
| 9731 |
addConceptToIndividual(opConcept, opConNeg, locSuccIndi, nextDepTrackPoint, true, true, calcAlgContext); |
| 9732 |
} |
| 9733 |
conceptOpLinkerIt = conceptOpLinkerIt->getNext(); |
| 9734 |
} |
| 9735 |
if (locSuccIndi) { |
| 9736 |
addIndividualToProcessingQueue(locSuccIndi, calcAlgContext); |
| 9737 |
} |
| 9738 |
} |
| 9739 |
} |
| 9740 |
} |
| 9741 |
} |
| 9742 |
if (!reapplied) { |
| 9743 |
// add to reapply queue |
| 9744 |
addConceptToReapplyQueue(baseConDes,role,processIndi,true,depTrackPoint,calcAlgContext); |
| 9745 |
} |
| 9746 |
} else if (!reapplied) { |
| 9747 |
addConceptToIndividual(concept,negated,processIndi,depTrackPoint,true,true,calcAlgContext); |
| 9748 |
} |
| 9749 |
|
| 9750 |
} |
| 9751 |
|
| 9752 |
|
| 9753 |
CREPRESENTATIVEGROUNDINGDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREPRESENTATIVEGROUNDINGDependency(CDependencyTrackPoint*& implContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CVariableBindingPath* selectVarBindPath, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9754 |
CREPRESENTATIVEGROUNDINGDependencyNode* depNode = nullptr; |
| 9755 |
if (mConfBuildDependencies) { |
| 9756 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREPRESENTATIVEGROUNDINGDependency(implContinueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,selectVarBindPath,calcAlgContext); |
| 9757 |
} |
| 9758 |
return depNode; |
| 9759 |
} |
| 9760 |
|
| 9761 |
CREPRESENTATIVEJOINDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREPRESENTATIVEJOINDependency(CDependencyTrackPoint*& joinContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* otherDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9762 |
CREPRESENTATIVEJOINDependencyNode* depNode = nullptr; |
| 9763 |
if (mConfBuildDependencies) { |
| 9764 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREPRESENTATIVEJOINDependency(joinContinueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,otherDepTrackPoint,calcAlgContext); |
| 9765 |
} |
| 9766 |
return depNode; |
| 9767 |
} |
| 9768 |
|
| 9769 |
CREPRESENTATIVEBINDVARIABLEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREPRESENTATIVEBINDVARIABLEDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9770 |
CREPRESENTATIVEBINDVARIABLEDependencyNode* depNode = nullptr; |
| 9771 |
if (mConfBuildDependencies) { |
| 9772 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREPRESENTATIVEBINDVARIABLEDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9773 |
} |
| 9774 |
return depNode; |
| 9775 |
} |
| 9776 |
|
| 9777 |
CREPRESENTATIVEIMPLICATIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREPRESENTATIVEIMPLICATIONDependency(CDependencyTrackPoint*& implContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9778 |
CREPRESENTATIVEIMPLICATIONDependencyNode* depNode = nullptr; |
| 9779 |
if (mConfBuildDependencies) { |
| 9780 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREPRESENTATIVEIMPLICATIONDependency(implContinueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,prevOtherDependencies,calcAlgContext); |
| 9781 |
} |
| 9782 |
return depNode; |
| 9783 |
} |
| 9784 |
|
| 9785 |
CREPRESENTATIVEALLDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREPRESENTATIVEALLDependency(CDependencyTrackPoint*& allDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* linkDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9786 |
CREPRESENTATIVEALLDependencyNode* depNode = nullptr; |
| 9787 |
if (mConfBuildDependencies) { |
| 9788 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREPRESENTATIVEALLDependency(allDepTrackPoint,processIndi,conDes,prevDepTrackPoint,linkDepTrackPoint,calcAlgContext); |
| 9789 |
} |
| 9790 |
return depNode; |
| 9791 |
} |
| 9792 |
|
| 9793 |
CREPRESENTATIVEANDDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREPRESENTATIVEANDDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9794 |
CREPRESENTATIVEANDDependencyNode* depNode = nullptr; |
| 9795 |
if (mConfBuildDependencies) { |
| 9796 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREPRESENTATIVEANDDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9797 |
} |
| 9798 |
return depNode; |
| 9799 |
} |
| 9800 |
|
| 9801 |
CRESOLVEREPRESENTATIVEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createRESOLVEREPRESENTATIVEDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CRepresentativeVariableBindingPathMap* resolveVarBindPathMap, CRepresentativePropagationMap* resolveRepPropMap, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* additionalDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9802 |
CRESOLVEREPRESENTATIVEDependencyNode* depNode = nullptr; |
| 9803 |
if (mConfBuildDependencies) { |
| 9804 |
depNode = calcAlgContext->getUsedDependencyFactory()->createRESOLVEREPRESENTATIVEDependency(andDepTrackPoint,processIndi,conDes,resolveVarBindPathMap,resolveRepPropMap,prevDepTrackPoint,additionalDepTrackPoint,calcAlgContext); |
| 9805 |
} |
| 9806 |
return depNode; |
| 9807 |
} |
| 9808 |
|
| 9809 |
|
| 9810 |
|
| 9811 |
|
| 9812 |
|
| 9813 |
|
| 9814 |
|
| 9815 |
|
| 9816 |
|
| 9817 |
|
| 9818 |
CPROPAGATEVARIABLECONNECTIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createPROPAGATEVARIABLECONNECTIONDependency(CIndividualProcessNode* processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9819 |
CPROPAGATEVARIABLECONNECTIONDependencyNode* depNode = nullptr; |
| 9820 |
if (mConfBuildDependencies) { |
| 9821 |
depNode = calcAlgContext->getUsedDependencyFactory()->createPROPAGATEVARIABLECONNECTIONDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9822 |
} |
| 9823 |
return depNode; |
| 9824 |
} |
| 9825 |
|
| 9826 |
CVARBINDPROPAGATEIMPLICATIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createVARBINDPROPAGATEIMPLICATIONDependency(CDependencyTrackPoint*& implContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9827 |
CVARBINDPROPAGATEIMPLICATIONDependencyNode* depNode = nullptr; |
| 9828 |
if (mConfBuildDependencies) { |
| 9829 |
depNode = calcAlgContext->getUsedDependencyFactory()->createVARBINDPROPAGATEIMPLICATIONDependency(implContinueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,prevOtherDependencies,calcAlgContext); |
| 9830 |
} |
| 9831 |
return depNode; |
| 9832 |
} |
| 9833 |
|
| 9834 |
CVARBINDPROPAGATEGROUNDINGDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createVARBINDPROPAGATEGROUNDINGDependency(CDependencyTrackPoint*& implContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9835 |
CVARBINDPROPAGATEGROUNDINGDependencyNode* depNode = nullptr; |
| 9836 |
if (mConfBuildDependencies) { |
| 9837 |
depNode = calcAlgContext->getUsedDependencyFactory()->createVARBINDPROPAGATEGROUNDINGDependency(implContinueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,prevOtherDependencies,calcAlgContext); |
| 9838 |
} |
| 9839 |
return depNode; |
| 9840 |
} |
| 9841 |
|
| 9842 |
CVARBINDPROPAGATEALLDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createVARBINDPROPAGATEALLDependency(CDependencyTrackPoint*& allDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* linkDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9843 |
CVARBINDPROPAGATEALLDependencyNode* depNode = nullptr; |
| 9844 |
if (mConfBuildDependencies) { |
| 9845 |
depNode = calcAlgContext->getUsedDependencyFactory()->createVARBINDPROPAGATEALLDependency(allDepTrackPoint,processIndi,conDes,prevDepTrackPoint,linkDepTrackPoint,calcAlgContext); |
| 9846 |
} |
| 9847 |
return depNode; |
| 9848 |
} |
| 9849 |
|
| 9850 |
CVARBINDPROPAGATEANDDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createVARBINDPROPAGATEANDDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9851 |
CVARBINDPROPAGATEANDDependencyNode* depNode = nullptr; |
| 9852 |
if (mConfBuildDependencies) { |
| 9853 |
depNode = calcAlgContext->getUsedDependencyFactory()->createVARBINDPROPAGATEANDDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9854 |
} |
| 9855 |
return depNode; |
| 9856 |
} |
| 9857 |
|
| 9858 |
CPROPAGATEVARIABLEBINDINGDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createPROPAGATEVARIABLEBINDINGDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9859 |
CPROPAGATEVARIABLEBINDINGDependencyNode* depNode = nullptr; |
| 9860 |
if (mConfBuildDependencies) { |
| 9861 |
depNode = calcAlgContext->getUsedDependencyFactory()->createPROPAGATEVARIABLEBINDINGDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,prevOtherDependencies,calcAlgContext); |
| 9862 |
} |
| 9863 |
return depNode; |
| 9864 |
} |
| 9865 |
|
| 9866 |
CPROPAGATEVARIABLEBINDINGSSUCCESSORDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createPROPAGATEVARIABLEBINDINGSSUCCESSORDependency(CDependencyTrackPoint*& allDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* linkDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9867 |
CPROPAGATEVARIABLEBINDINGSSUCCESSORDependencyNode* depNode = nullptr; |
| 9868 |
if (mConfBuildDependencies) { |
| 9869 |
depNode = calcAlgContext->getUsedDependencyFactory()->createPROPAGATEVARIABLEBINDINGSSUCCESSORDependency(allDepTrackPoint,processIndi,conDes,prevDepTrackPoint,linkDepTrackPoint,calcAlgContext); |
| 9870 |
} |
| 9871 |
return depNode; |
| 9872 |
} |
| 9873 |
|
| 9874 |
CVARBINDVARIABLEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createVARBINDVARIABLEDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9875 |
CVARBINDVARIABLEDependencyNode* depNode = nullptr; |
| 9876 |
if (mConfBuildDependencies) { |
| 9877 |
depNode = calcAlgContext->getUsedDependencyFactory()->createVARBINDVARIABLEDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9878 |
} |
| 9879 |
return depNode; |
| 9880 |
} |
| 9881 |
|
| 9882 |
CVARBINDPROPAGATEJOINDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createVARBINDPROPAGATEJOINDependency(CDependencyTrackPoint*& continueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* otherDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9883 |
CVARBINDPROPAGATEJOINDependencyNode* depNode = nullptr; |
| 9884 |
if (mConfBuildDependencies) { |
| 9885 |
depNode = calcAlgContext->getUsedDependencyFactory()->createVARBINDPROPAGATEJOINDependency(continueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,otherDepTrackPoint,calcAlgContext); |
| 9886 |
} |
| 9887 |
return depNode; |
| 9888 |
} |
| 9889 |
|
| 9890 |
|
| 9891 |
|
| 9892 |
|
| 9893 |
|
| 9894 |
|
| 9895 |
CBINDPROPAGATEGROUNDINGDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createBINDPROPAGATEGROUNDINGDependency(CDependencyTrackPoint*& implContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9896 |
CBINDPROPAGATEGROUNDINGDependencyNode* depNode = nullptr; |
| 9897 |
if (mConfBuildDependencies) { |
| 9898 |
depNode = calcAlgContext->getUsedDependencyFactory()->createBINDPROPAGATEGROUNDINGDependency(implContinueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,prevOtherDependencies,calcAlgContext); |
| 9899 |
} |
| 9900 |
return depNode; |
| 9901 |
} |
| 9902 |
|
| 9903 |
CPROPAGATECONNECTIONAWAYDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createPROPAGATECONNECTIONAWAYDependency(CIndividualProcessNode* processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9904 |
CPROPAGATECONNECTIONAWAYDependencyNode* depNode = nullptr; |
| 9905 |
if (mConfBuildDependencies) { |
| 9906 |
depNode = calcAlgContext->getUsedDependencyFactory()->createPROPAGATECONNECTIONAWAYDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9907 |
} |
| 9908 |
return depNode; |
| 9909 |
} |
| 9910 |
|
| 9911 |
CPROPAGATECONNECTIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createPROPAGATECONNECTIONDependency(CIndividualProcessNode* processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9912 |
CPROPAGATECONNECTIONDependencyNode* depNode = nullptr; |
| 9913 |
if (mConfBuildDependencies) { |
| 9914 |
depNode = calcAlgContext->getUsedDependencyFactory()->createPROPAGATECONNECTIONDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9915 |
} |
| 9916 |
return depNode; |
| 9917 |
} |
| 9918 |
|
| 9919 |
CBINDPROPAGATECYCLEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createBINDPROPAGATECYCLEDependency(CDependencyTrackPoint*& continueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* triggDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9920 |
CBINDPROPAGATECYCLEDependencyNode* depNode = nullptr; |
| 9921 |
if (mConfBuildDependencies) { |
| 9922 |
depNode = calcAlgContext->getUsedDependencyFactory()->createBINDPROPAGATECYCLEDependency(continueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,triggDepTrackPoint,calcAlgContext); |
| 9923 |
} |
| 9924 |
return depNode; |
| 9925 |
} |
| 9926 |
|
| 9927 |
CBINDPROPAGATEALLDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createBINDPROPAGATEALLDependency(CDependencyTrackPoint*& allDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* linkDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9928 |
CBINDPROPAGATEALLDependencyNode* depNode = nullptr; |
| 9929 |
if (mConfBuildDependencies) { |
| 9930 |
depNode = calcAlgContext->getUsedDependencyFactory()->createBINDPROPAGATEALLDependency(allDepTrackPoint,processIndi,conDes,prevDepTrackPoint,linkDepTrackPoint,calcAlgContext); |
| 9931 |
} |
| 9932 |
return depNode; |
| 9933 |
} |
| 9934 |
|
| 9935 |
CPROPAGATEBINDINGSSUCCESSORDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createPROPAGATEBINDINGSSUCCESSORDependency(CDependencyTrackPoint*& allDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* linkDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9936 |
CPROPAGATEBINDINGSSUCCESSORDependencyNode* depNode = nullptr; |
| 9937 |
if (mConfBuildDependencies) { |
| 9938 |
depNode = calcAlgContext->getUsedDependencyFactory()->createPROPAGATEBINDINGSSUCCESSORDependency(allDepTrackPoint,processIndi,conDes,prevDepTrackPoint,linkDepTrackPoint,calcAlgContext); |
| 9939 |
} |
| 9940 |
return depNode; |
| 9941 |
} |
| 9942 |
|
| 9943 |
CBINDPROPAGATEIMPLICATIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createBINDPROPAGATEIMPLICATIONDependency(CDependencyTrackPoint*& implContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9944 |
CBINDPROPAGATEIMPLICATIONDependencyNode* depNode = nullptr; |
| 9945 |
if (mConfBuildDependencies) { |
| 9946 |
depNode = calcAlgContext->getUsedDependencyFactory()->createBINDPROPAGATEIMPLICATIONDependency(implContinueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,prevOtherDependencies,calcAlgContext); |
| 9947 |
} |
| 9948 |
return depNode; |
| 9949 |
} |
| 9950 |
|
| 9951 |
CANDDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createANDDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9952 |
CANDDependencyNode* depNode = nullptr; |
| 9953 |
if (mConfBuildDependencies) { |
| 9954 |
depNode = calcAlgContext->getUsedDependencyFactory()->createANDDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9955 |
} |
| 9956 |
return depNode; |
| 9957 |
} |
| 9958 |
|
| 9959 |
CBINDPROPAGATEANDDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createBINDPROPAGATEANDDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9960 |
CBINDPROPAGATEANDDependencyNode* depNode = nullptr; |
| 9961 |
if (mConfBuildDependencies) { |
| 9962 |
depNode = calcAlgContext->getUsedDependencyFactory()->createBINDPROPAGATEANDDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9963 |
} |
| 9964 |
return depNode; |
| 9965 |
} |
| 9966 |
|
| 9967 |
CPROPAGATEBINDINGDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createPROPAGATEBINDINGDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9968 |
CPROPAGATEBINDINGDependencyNode* depNode = nullptr; |
| 9969 |
if (mConfBuildDependencies) { |
| 9970 |
depNode = calcAlgContext->getUsedDependencyFactory()->createPROPAGATEBINDINGDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,prevOtherDependencies,calcAlgContext); |
| 9971 |
} |
| 9972 |
return depNode; |
| 9973 |
} |
| 9974 |
|
| 9975 |
CBINDVARIABLEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createBINDVARIABLEDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9976 |
CBINDVARIABLEDependencyNode* depNode = nullptr; |
| 9977 |
if (mConfBuildDependencies) { |
| 9978 |
depNode = calcAlgContext->getUsedDependencyFactory()->createBINDVARIABLEDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9979 |
} |
| 9980 |
return depNode; |
| 9981 |
} |
| 9982 |
|
| 9983 |
CNOMINALDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createNOMINALDependency(CDependencyTrackPoint*& nominalContDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* nominalDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9984 |
CNOMINALDependencyNode* depNode = nullptr; |
| 9985 |
if (mConfBuildDependencies) { |
| 9986 |
depNode = calcAlgContext->getUsedDependencyFactory()->createNOMINALDependency(nominalContDepTrackPoint,processIndi,conDes,prevDepTrackPoint,nominalDepTrackPoint,calcAlgContext); |
| 9987 |
} |
| 9988 |
return depNode; |
| 9989 |
} |
| 9990 |
|
| 9991 |
CAUTOMATCHOOSEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createAUTOMATCHOOSEDependency(CDependencyTrackPoint*& andDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 9992 |
CAUTOMATCHOOSEDependencyNode* depNode = nullptr; |
| 9993 |
if (mConfBuildDependencies) { |
| 9994 |
depNode = calcAlgContext->getUsedDependencyFactory()->createAUTOMATCHOOSEDependency(andDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 9995 |
} |
| 9996 |
return depNode; |
| 9997 |
} |
| 9998 |
|
| 9999 |
CSOMEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createSOMEDependency(CDependencyTrackPoint*& someDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10000 |
CSOMEDependencyNode* depNode = nullptr; |
| 10001 |
if (mConfBuildDependencies) { |
| 10002 |
depNode = calcAlgContext->getUsedDependencyFactory()->createSOMEDependency(someDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10003 |
} |
| 10004 |
return depNode; |
| 10005 |
} |
| 10006 |
|
| 10007 |
CSELFDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createSELFDependency(CDependencyTrackPoint*& someDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10008 |
CSELFDependencyNode* depNode = nullptr; |
| 10009 |
if (mConfBuildDependencies) { |
| 10010 |
depNode = calcAlgContext->getUsedDependencyFactory()->createSELFDependency(someDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10011 |
} |
| 10012 |
return depNode; |
| 10013 |
} |
| 10014 |
|
| 10015 |
CVALUEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createVALUEDependency(CDependencyTrackPoint*& valueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* nominalDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10016 |
CVALUEDependencyNode* depNode = nullptr; |
| 10017 |
if (mConfBuildDependencies) { |
| 10018 |
depNode = calcAlgContext->getUsedDependencyFactory()->createVALUEDependency(valueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,nominalDepTrackPoint,calcAlgContext); |
| 10019 |
} |
| 10020 |
return depNode; |
| 10021 |
} |
| 10022 |
|
| 10023 |
CROLEASSERTIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createROLEASSERTIONDependency(CDependencyTrackPoint*& valueDepTrackPoint, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* nominalDepTrackPoint, CRole* baseAssertionRole, CIndividual* baseAssertionIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10024 |
CROLEASSERTIONDependencyNode* depNode = nullptr; |
| 10025 |
if (mConfBuildDependencies) { |
| 10026 |
depNode = calcAlgContext->getUsedDependencyFactory()->createROLEASSERTIONDependency(valueDepTrackPoint,processIndi,prevDepTrackPoint,nominalDepTrackPoint, baseAssertionRole, baseAssertionIndi ,calcAlgContext); |
| 10027 |
} |
| 10028 |
return depNode; |
| 10029 |
} |
| 10030 |
|
| 10031 |
CDATAASSERTIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createDATAASSERTIONDependency(CDependencyTrackPoint*& valueDepTrackPoint, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10032 |
CDATAASSERTIONDependencyNode* depNode = nullptr; |
| 10033 |
if (mConfBuildDependencies) { |
| 10034 |
depNode = calcAlgContext->getUsedDependencyFactory()->createDATAASSERTIONDependency(valueDepTrackPoint, processIndi, prevDepTrackPoint, calcAlgContext); |
| 10035 |
} |
| 10036 |
return depNode; |
| 10037 |
} |
| 10038 |
|
| 10039 |
CNEGVALUEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createNEGVALUEDependency(CDependencyTrackPoint*& negValueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* nominalDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10040 |
CNEGVALUEDependencyNode* depNode = nullptr; |
| 10041 |
if (mConfBuildDependencies) { |
| 10042 |
depNode = calcAlgContext->getUsedDependencyFactory()->createNEGVALUEDependency(negValueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,nominalDepTrackPoint,calcAlgContext); |
| 10043 |
} |
| 10044 |
return depNode; |
| 10045 |
} |
| 10046 |
|
| 10047 |
CALLDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createALLDependency(CDependencyTrackPoint*& allDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* linkDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10048 |
CALLDependencyNode* depNode = nullptr; |
| 10049 |
if (mConfBuildDependencies) { |
| 10050 |
depNode = calcAlgContext->getUsedDependencyFactory()->createALLDependency(allDepTrackPoint,processIndi,conDes,prevDepTrackPoint,linkDepTrackPoint,calcAlgContext); |
| 10051 |
} |
| 10052 |
return depNode; |
| 10053 |
} |
| 10054 |
|
| 10055 |
CMERGEDCONCEPTDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createMERGEDCONCEPTDependency(CDependencyTrackPoint*& mergedConceptContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* mergePrevDepTrackPoint, CDependencyTrackPoint* conceptPrevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10056 |
CMERGEDCONCEPTDependencyNode* depNode = nullptr; |
| 10057 |
if (mConfBuildDependencies) { |
| 10058 |
depNode = calcAlgContext->getUsedDependencyFactory()->createMERGEDCONCEPTDependency(mergedConceptContinueDepTrackPoint,processIndi,conDes,mergePrevDepTrackPoint,conceptPrevDepTrackPoint,calcAlgContext); |
| 10059 |
} |
| 10060 |
return depNode; |
| 10061 |
} |
| 10062 |
|
| 10063 |
CMERGEDLINKDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createMERGEDLINKDependency(CDependencyTrackPoint*& mergedLinkContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* mergePrevDepTrackPoint, CDependencyTrackPoint* linkPrevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10064 |
CMERGEDLINKDependencyNode* depNode = nullptr; |
| 10065 |
if (mConfBuildDependencies) { |
| 10066 |
depNode = calcAlgContext->getUsedDependencyFactory()->createMERGEDLINKDependency(mergedLinkContinueDepTrackPoint,processIndi,mergePrevDepTrackPoint,linkPrevDepTrackPoint,calcAlgContext); |
| 10067 |
} |
| 10068 |
return depNode; |
| 10069 |
} |
| 10070 |
|
| 10071 |
|
| 10072 |
CMERGEDIndividualDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createMERGEDINDIVIDUALDependency(CDependencyTrackPoint*& mergedIndividualContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* mergePrevDepTrackPoint, CDependencyTrackPoint* individualPrevDepTrackPoint, CCalculationAlgorithmContext* calcAlgContext) { |
| 10073 |
CMERGEDIndividualDependencyNode* depNode = nullptr; |
| 10074 |
if (mConfBuildDependencies) { |
| 10075 |
depNode = calcAlgContext->getUsedDependencyFactory()->createMERGEDINDIVIDUALDependency(mergedIndividualContinueDepTrackPoint,processIndi,mergePrevDepTrackPoint,individualPrevDepTrackPoint,calcAlgContext); |
| 10076 |
} |
| 10077 |
return depNode; |
| 10078 |
} |
| 10079 |
|
| 10080 |
|
| 10081 |
CFUNCTIONALDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createFUNCTIONALDependency(CDependencyTrackPoint*& functionalContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* prevLink1DependencyTrackPoint, CDependencyTrackPoint* prevLink2DependencyTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10082 |
CFUNCTIONALDependencyNode* depNode = nullptr; |
| 10083 |
if (mConfBuildDependencies) { |
| 10084 |
depNode = calcAlgContext->getUsedDependencyFactory()->createFUNCTIONALDependency(functionalContinueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,prevLink1DependencyTrackPoint,prevLink2DependencyTrackPoint,calcAlgContext); |
| 10085 |
} |
| 10086 |
return depNode; |
| 10087 |
} |
| 10088 |
|
| 10089 |
CDISTINCTDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createDISTINCTDependency(CDependencyTrackPoint*& distinctDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10090 |
CDISTINCTDependencyNode* depNode = nullptr; |
| 10091 |
if (mConfBuildDependencies) { |
| 10092 |
depNode = calcAlgContext->getUsedDependencyFactory()->createDISTINCTDependency(distinctDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10093 |
} |
| 10094 |
return depNode; |
| 10095 |
} |
| 10096 |
|
| 10097 |
CAUTOMATTRANSACTIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createAUTOMATTRANSACTIONDependency(CDependencyTrackPoint*& allDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* linkDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10098 |
CAUTOMATTRANSACTIONDependencyNode* depNode = nullptr; |
| 10099 |
if (mConfBuildDependencies) { |
| 10100 |
depNode = calcAlgContext->getUsedDependencyFactory()->createAUTOMATTRANSACTIONDependency(allDepTrackPoint,processIndi,conDes,prevDepTrackPoint,linkDepTrackPoint,calcAlgContext); |
| 10101 |
} |
| 10102 |
return depNode; |
| 10103 |
} |
| 10104 |
|
| 10105 |
CATLEASTDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createATLEASTDependency(CDependencyTrackPoint*& atleastDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10106 |
CATLEASTDependencyNode* depNode = nullptr; |
| 10107 |
if (mConfBuildDependencies) { |
| 10108 |
depNode = calcAlgContext->getUsedDependencyFactory()->createATLEASTDependency(atleastDepTrackPoint,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10109 |
} |
| 10110 |
return depNode; |
| 10111 |
} |
| 10112 |
|
| 10113 |
CORDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createORDependency(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10114 |
CORDependencyNode* depNode = nullptr; |
| 10115 |
if (mConfBuildDependencies) { |
| 10116 |
depNode = calcAlgContext->getUsedDependencyFactory()->createORDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10117 |
} |
| 10118 |
return depNode; |
| 10119 |
} |
| 10120 |
|
| 10121 |
CATMOSTDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createATMOSTDependency(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10122 |
CATMOSTDependencyNode* depNode = nullptr; |
| 10123 |
if (mConfBuildDependencies) { |
| 10124 |
depNode = calcAlgContext->getUsedDependencyFactory()->createATMOSTDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10125 |
} |
| 10126 |
return depNode; |
| 10127 |
} |
| 10128 |
|
| 10129 |
CMERGEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createMERGEDependency(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10130 |
CMERGEDependencyNode* depNode = nullptr; |
| 10131 |
if (mConfBuildDependencies) { |
| 10132 |
depNode = calcAlgContext->getUsedDependencyFactory()->createMERGEDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10133 |
} |
| 10134 |
return depNode; |
| 10135 |
} |
| 10136 |
|
| 10137 |
CREUSEINDIVIDUALDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREUSEINDIVIDUALDependency(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10138 |
CREUSEINDIVIDUALDependencyNode* depNode = nullptr; |
| 10139 |
if (mConfBuildDependencies) { |
| 10140 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREUSEINDIVIDUALDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10141 |
} |
| 10142 |
return depNode; |
| 10143 |
} |
| 10144 |
|
| 10145 |
CREUSECOMPLETIONGRAPHDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREUSECOMPLETIONGRAPHDependency(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10146 |
CREUSECOMPLETIONGRAPHDependencyNode* depNode = nullptr; |
| 10147 |
if (mConfBuildDependencies) { |
| 10148 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREUSECOMPLETIONGRAPHDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10149 |
} |
| 10150 |
return depNode; |
| 10151 |
} |
| 10152 |
|
| 10153 |
|
| 10154 |
|
| 10155 |
CMERGEPOSSIBLEINSTANCEINDIVIDUALDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createMERGEPOSSIBLEINSTANCEINDIVIDUALDependencyNode(CIndividualProcessNode*& processIndi, CDependencyTrackPoint* prevDepTrackPoint, CIndividualProcessNode* mergingIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10156 |
CMERGEPOSSIBLEINSTANCEINDIVIDUALDependencyNode* depNode = nullptr; |
| 10157 |
if (mConfBuildDependencies) { |
| 10158 |
depNode = calcAlgContext->getUsedDependencyFactory()->createMERGEPOSSIBLEINSTANCEINDIVIDUALDependencyNode(processIndi, prevDepTrackPoint, mergingIndi, calcAlgContext); |
| 10159 |
} |
| 10160 |
return depNode; |
| 10161 |
} |
| 10162 |
|
| 10163 |
CREUSECONCEPTSDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREUSECONCEPTSDependency(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10164 |
CREUSECONCEPTSDependencyNode* depNode = nullptr; |
| 10165 |
if (mConfBuildDependencies) { |
| 10166 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREUSECONCEPTSDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10167 |
} |
| 10168 |
return depNode; |
| 10169 |
} |
| 10170 |
|
| 10171 |
CQUALIFYDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createQUALIFYDependency(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10172 |
CQUALIFYDependencyNode* depNode = nullptr; |
| 10173 |
if (mConfBuildDependencies) { |
| 10174 |
depNode = calcAlgContext->getUsedDependencyFactory()->createQUALIFYDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10175 |
} |
| 10176 |
return depNode; |
| 10177 |
} |
| 10178 |
|
| 10179 |
|
| 10180 |
|
| 10181 |
CORONLYOPTIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createORONLYOPTIONDependency(CDependencyTrackPoint*& orContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10182 |
CORONLYOPTIONDependencyNode* depNode = nullptr; |
| 10183 |
if (mConfBuildDependencies) { |
| 10184 |
depNode = calcAlgContext->getUsedDependencyFactory()->createORONLYOPTIONDependency(orContinueDepTrackPoint, processIndi, conDes, prevDepTrackPoint, prevOtherDependencies, calcAlgContext); |
| 10185 |
} |
| 10186 |
return depNode; |
| 10187 |
} |
| 10188 |
|
| 10189 |
|
| 10190 |
CIMPLICATIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createIMPLICATIONDependency(CDependencyTrackPoint*& implContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10191 |
CIMPLICATIONDependencyNode* depNode = nullptr; |
| 10192 |
if (mConfBuildDependencies) { |
| 10193 |
depNode = calcAlgContext->getUsedDependencyFactory()->createIMPLICATIONDependency(implContinueDepTrackPoint,processIndi,conDes,prevDepTrackPoint,prevOtherDependencies,calcAlgContext); |
| 10194 |
} |
| 10195 |
return depNode; |
| 10196 |
} |
| 10197 |
|
| 10198 |
|
| 10199 |
CEXPANDEDDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createEXPANDEDDependency(CDependencyTrackPoint*& expContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* prevDepTrackPoint, CDependency* prevOtherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10200 |
CEXPANDEDDependencyNode* depNode = nullptr; |
| 10201 |
if (mConfBuildDependencies) { |
| 10202 |
depNode = calcAlgContext->getUsedDependencyFactory()->createEXPANDEDDependency(expContinueDepTrackPoint,processIndi,prevDepTrackPoint,prevOtherDependencies,calcAlgContext); |
| 10203 |
} |
| 10204 |
return depNode; |
| 10205 |
} |
| 10206 |
|
| 10207 |
|
| 10208 |
CCONNECTIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createCONNECTIONDependency(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10209 |
CCONNECTIONDependencyNode* depNode = nullptr; |
| 10210 |
if (mConfBuildDependencies) { |
| 10211 |
depNode = calcAlgContext->getUsedDependencyFactory()->createCONNECTIONDependency(processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 10212 |
} |
| 10213 |
return depNode; |
| 10214 |
} |
| 10215 |
|
| 10216 |
|
| 10217 |
CSAMEINDIVIDUALSMERGEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createSAMEINDIVIDUALMERGEDependency(CDependencyTrackPoint*& expContinueDepTrackPoint, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* prevOtherDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10218 |
CSAMEINDIVIDUALSMERGEDependencyNode* depNode = nullptr; |
| 10219 |
if (mConfBuildDependencies) { |
| 10220 |
depNode = calcAlgContext->getUsedDependencyFactory()->createSAMEINDIVIDUALMERGEDependency(expContinueDepTrackPoint, processIndi, prevDepTrackPoint, prevOtherDepTrackPoint, calcAlgContext); |
| 10221 |
} |
| 10222 |
return depNode; |
| 10223 |
} |
| 10224 |
|
| 10225 |
|
| 10226 |
|
| 10227 |
|
| 10228 |
CREUSEBACKENDEXPANSIONMODESDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREUSEBACKENDEXPANSIONMODESDependency(CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10229 |
CREUSEBACKENDEXPANSIONMODESDependencyNode* depNode = nullptr; |
| 10230 |
if (mConfBuildDependencies) { |
| 10231 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREUSEBACKENDEXPANSIONMODESDependency(prevDepTrackPoint, calcAlgContext); |
| 10232 |
} |
| 10233 |
return depNode; |
| 10234 |
} |
| 10235 |
|
| 10236 |
|
| 10237 |
CREUSEBACKENDFIXEDINDIVIDUALEXPANSIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREUSEBACKENDFIXEDINDIVIDUALEXPANSIONDependency(CIndividualProcessNode*& processIndi, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10238 |
CREUSEBACKENDFIXEDINDIVIDUALEXPANSIONDependencyNode* depNode = nullptr; |
| 10239 |
if (mConfBuildDependencies) { |
| 10240 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREUSEBACKENDFIXEDINDIVIDUALEXPANSIONDependency(processIndi, prevDepTrackPoint, calcAlgContext); |
| 10241 |
} |
| 10242 |
return depNode; |
| 10243 |
} |
| 10244 |
|
| 10245 |
|
| 10246 |
CREUSEBACKENDPRIORITIZEDINDIVIDUALEXPANSIONDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREUSEBACKENDPRIORITIZEDINDIVIDUALEXPANSIONDependency(CIndividualProcessNode*& processIndi, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10247 |
CREUSEBACKENDPRIORITIZEDINDIVIDUALEXPANSIONDependencyNode* depNode = nullptr; |
| 10248 |
if (mConfBuildDependencies) { |
| 10249 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREUSEBACKENDPRIORITIZEDINDIVIDUALEXPANSIONDependency(processIndi, prevDepTrackPoint, calcAlgContext); |
| 10250 |
} |
| 10251 |
return depNode; |
| 10252 |
} |
| 10253 |
|
| 10254 |
|
| 10255 |
|
| 10256 |
|
| 10257 |
CREUSEBACKENDVALUEDependencyNode* CCalculationTableauCompletionTaskHandleAlgorithm::createREUSEBACKENDVALUEDependency(CDependencyTrackPoint*& valueDepTrackPoint, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CDependencyTrackPoint* nominalDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10258 |
CREUSEBACKENDVALUEDependencyNode* depNode = nullptr; |
| 10259 |
if (mConfBuildDependencies) { |
| 10260 |
depNode = calcAlgContext->getUsedDependencyFactory()->createREUSEBACKENDVALUEDependency(valueDepTrackPoint, processIndi, conDes, prevDepTrackPoint, nominalDepTrackPoint, calcAlgContext); |
| 10261 |
} |
| 10262 |
return depNode; |
| 10263 |
} |
| 10264 |
|
| 10265 |
|
| 10266 |
|
| 10267 |
|
| 10268 |
|
| 10269 |
|
| 10270 |
|
| 10271 |
|
| 10272 |
|
| 10273 |
|
| 10274 |
|
| 10275 |
|
| 10276 |
|
| 10277 |
|
| 10278 |
|
| 10279 |
|
| 10280 |
|
| 10281 |
|
| 10282 |
|
| 10283 |
|
| 10284 |
|
| 10285 |
|
| 10286 |
|
| 10287 |
|
| 10288 |
|
| 10289 |
|
| 10290 |
|
| 10291 |
|
| 10292 |
|
| 10293 |
|
| 10294 |
|
| 10295 |
|
| 10296 |
|
| 10297 |
|
| 10298 |
|
| 10299 |
|
| 10300 |
|
| 10301 |
|
| 10302 |
|
| 10303 |
|
| 10304 |
|
| 10305 |
|
| 10306 |
|
| 10307 |
|
| 10308 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEGROUNDINGRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10309 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 10310 |
|
| 10311 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 10312 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 10313 |
CConcept* concept = conDes->getConcept(); |
| 10314 |
bool negated = conDes->isNegated(); |
| 10315 |
cint64 opCount = concept->getOperandCount(); |
| 10316 |
|
| 10317 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 10318 |
|
| 10319 |
CConceptRepresentativePropagationSetHash* repPropSetHash = processIndi->getConceptRepresentativePropagationSetHash(false); |
| 10320 |
CRepresentativePropagationSet* repPropSet = repPropSetHash->getRepresentativePropagationSet(concept,false); |
| 10321 |
|
| 10322 |
STATINC(VARBINDRULEGROUNDINGAPPLICATIONCOUNT,calcAlgContext); |
| 10323 |
|
| 10324 |
if (repPropSet) { |
| 10325 |
|
| 10326 |
CRepresentativePropagationDescriptor* outRepPropDes = repPropSet->getOutgoingRepresentativePropagationDescriptorLinker(); |
| 10327 |
if (outRepPropDes) { |
| 10328 |
CRepresentativeVariableBindingPathSetData* repVarBindPathSetData = outRepPropDes->getRepresentativeVariableBindingPathSetData(); |
| 10329 |
if (repVarBindPathSetData) { |
| 10330 |
CRepresentativeVariableBindingPathSetMigrateData* repVarBindPathSetMigData = repVarBindPathSetData->getMigrateData(false); |
| 10331 |
if (repVarBindPathSetMigData) { |
| 10332 |
CRepresentativeVariableBindingPathMap* repVarBindPathSetMap = repVarBindPathSetMigData->getRepresentativeVariableBindingPathMap(); |
| 10333 |
|
| 10334 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mBeforeGroundingDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 10335 |
|
| 10336 |
CPROCESSINGHASH<CConcept*,CVariableBindingPath*>* groundedConVarBindPathHash = nullptr; |
| 10337 |
CSortedNegLinker<CConcept*>* newGroundedLinker = mGroundingHandler->getGroundingConceptLinker(processIndi,repVarBindPathSetMap,concept,negated,groundedConVarBindPathHash,calcAlgContext); |
| 10338 |
|
| 10339 |
if (newGroundedLinker) { |
| 10340 |
for (CSortedNegLinker<CConcept*>* newGroundedLinkerIt = newGroundedLinker; newGroundedLinkerIt; newGroundedLinkerIt = newGroundedLinkerIt->getNext()) { |
| 10341 |
STATINC(VARBINDGROUNDINGCOUNT,calcAlgContext); |
| 10342 |
++mStatRepresentativeGroundingCount; |
| 10343 |
CConcept* newGroundedCocnept = newGroundedLinkerIt->getData(); |
| 10344 |
bool newGroundedConceptNegation = newGroundedLinkerIt->isNegated(); |
| 10345 |
|
| 10346 |
CVariableBindingPath* selectedVarBindPath = groundedConVarBindPathHash->value(newGroundedCocnept); |
| 10347 |
|
| 10348 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 10349 |
CREPRESENTATIVEGROUNDINGDependencyNode* groundingDepNode = createREPRESENTATIVEGROUNDINGDependency(nextDepTrackPoint,processIndi,conDes,outRepPropDes->getDependencyTrackPoint(),selectedVarBindPath,calcAlgContext); |
| 10350 |
|
| 10351 |
addConceptToIndividual(newGroundedCocnept,newGroundedConceptNegation,processIndi,nextDepTrackPoint,true,false,calcAlgContext); |
| 10352 |
|
| 10353 |
} |
| 10354 |
} |
| 10355 |
|
| 10356 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mAfterGroundingDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 10357 |
|
| 10358 |
} |
| 10359 |
} |
| 10360 |
} |
| 10361 |
} |
| 10362 |
} |
| 10363 |
|
| 10364 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEJOINRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10365 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 10366 |
CConcept* concept = conDes->getConcept(); |
| 10367 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 10368 |
cint64 opCount = concept->getOperandCount(); |
| 10369 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 10370 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 10371 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 10372 |
|
| 10373 |
|
| 10374 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 10375 |
CConceptDescriptor* joinConDes = nullptr; |
| 10376 |
CDependencyTrackPoint* joinDepTrackPoint = nullptr; |
| 10377 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 10378 |
|
| 10379 |
CConcept* joinConcept = opLinker->getData(); |
| 10380 |
bool joinConceptNegation = opLinker->isNegated(); |
| 10381 |
CSortedNegLinker<CConcept*>* triggerLinker = opLinker->getNext(); |
| 10382 |
|
| 10383 |
CSortedLinker<CVariable*>* varLinker = concept->getVariableLinker(); |
| 10384 |
|
| 10385 |
STATINC(VARBINDRULEJOINAPPLICATIONCOUNT,calcAlgContext); |
| 10386 |
|
| 10387 |
bool propagateJoins = false; |
| 10388 |
bool createJoinConcept = false; |
| 10389 |
if (!conSet->getConceptDescriptorAndReapplyQueue(joinConcept,joinConDes,joinDepTrackPoint,reapplyQueue)) { |
| 10390 |
// search next not existing trigger |
| 10391 |
bool allTriggersAvailable = true; |
| 10392 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 10393 |
CSortedNegLinker<CConcept*>* triggerLinkerIt = nullptr; |
| 10394 |
for (triggerLinkerIt = triggerLinker; triggerLinkerIt && allTriggersAvailable; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 10395 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 10396 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 10397 |
CConceptDescriptor* triggerConDes = nullptr; |
| 10398 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 10399 |
if (conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint)) { |
| 10400 |
if (triggerConDes->isNegated() == nextTrigger->isNegated()) { |
| 10401 |
return; |
| 10402 |
} |
| 10403 |
} else { |
| 10404 |
allTriggersAvailable = false; |
| 10405 |
break; |
| 10406 |
} |
| 10407 |
} |
| 10408 |
|
| 10409 |
if (!allTriggersAvailable) { |
| 10410 |
// install to trigger |
| 10411 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 10412 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 10413 |
bool triggerNegation = !nextTrigger->isNegated(); |
| 10414 |
if (!isConceptInReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,calcAlgContext)) { |
| 10415 |
addConceptToReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,(CProcessingRestrictionSpecification*)nullptr,depTrackPoint,calcAlgContext); |
| 10416 |
} |
| 10417 |
} else { |
| 10418 |
propagateJoins = true; |
| 10419 |
createJoinConcept = true; |
| 10420 |
} |
| 10421 |
} else { |
| 10422 |
propagateJoins = true; |
| 10423 |
} |
| 10424 |
|
| 10425 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 10426 |
|
| 10427 |
bool propagationsDone = false; |
| 10428 |
if (propagateJoins) { |
| 10429 |
|
| 10430 |
for (CSortedNegLinker<CConcept*>* triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 10431 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 10432 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 10433 |
if (!isConceptInReapplyQueue(conDes,triggerConcept,false,processIndi,calcAlgContext)) { |
| 10434 |
addConceptToReapplyQueue(conDes,triggerConcept,false,processIndi,(CProcessingRestrictionSpecification*)nullptr,depTrackPoint,calcAlgContext); |
| 10435 |
} |
| 10436 |
} |
| 10437 |
|
| 10438 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(false); |
| 10439 |
CConceptRepresentativePropagationSetHash* repPropSetHash = processIndi->getConceptRepresentativePropagationSetHash(false); |
| 10440 |
CPropagationBindingSet* propBindingSet = nullptr; |
| 10441 |
if (conPropBindingSetHash && repPropSetHash) { |
| 10442 |
propBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 10443 |
if (propBindingSet) { |
| 10444 |
|
| 10445 |
CPropagationRepresentativeTransitionExtension* propRepTransExt = propBindingSet->getPropagationRepresentativeTransitionExtension(false); |
| 10446 |
|
| 10447 |
CSortedNegLinker<CConcept*>* leftTriggerLinker = triggerLinker; |
| 10448 |
CSortedNegLinker<CConcept*>* rightTriggerLinker = triggerLinker->getNext(); |
| 10449 |
|
| 10450 |
CConcept* leftConcept = leftTriggerLinker->getData(); |
| 10451 |
CConcept* rightConcept = rightTriggerLinker->getData(); |
| 10452 |
|
| 10453 |
CRepresentativePropagationSet* leftRepPropSet = repPropSetHash->getRepresentativePropagationSet(leftConcept,false); |
| 10454 |
CRepresentativePropagationSet* rightRepPropSet = repPropSetHash->getRepresentativePropagationSet(rightConcept,false); |
| 10455 |
|
| 10456 |
bool examineTransExt = false; |
| 10457 |
|
| 10458 |
|
| 10459 |
CRepresentativePropagationDescriptor* leftRepPropDes = leftRepPropSet->getOutgoingRepresentativePropagationDescriptorLinker(); |
| 10460 |
CRepresentativePropagationDescriptor* rightRepPropDes = rightRepPropSet->getOutgoingRepresentativePropagationDescriptorLinker(); |
| 10461 |
|
| 10462 |
if (leftRepPropSet && rightRepPropSet && leftRepPropDes && rightRepPropDes) { |
| 10463 |
|
| 10464 |
if (!propRepTransExt) { |
| 10465 |
examineTransExt = true; |
| 10466 |
} else { |
| 10467 |
if (propRepTransExt->getLastAnalysedPropagateAllFlag() != propBindingSet->getPropagateAllFlag() || |
| 10468 |
propRepTransExt->getLastAnalysedPropagationBindingDescriptor() != propBindingSet->getPropagationBindingDescriptorLinker() || |
| 10469 |
propRepTransExt->getLeftLastRepresentativeJoiningDescriptor() != leftRepPropDes || |
| 10470 |
propRepTransExt->getRightLastRepresentativeJoiningDescriptor() != rightRepPropDes) { |
| 10471 |
|
| 10472 |
examineTransExt = true; |
| 10473 |
} |
| 10474 |
} |
| 10475 |
} |
| 10476 |
|
| 10477 |
if (examineTransExt) { |
| 10478 |
++mStatRepresentativeJoinCount; |
| 10479 |
|
| 10480 |
conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 10481 |
repPropSetHash = processIndi->getConceptRepresentativePropagationSetHash(true); |
| 10482 |
propBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,true); |
| 10483 |
propRepTransExt = propBindingSet->getPropagationRepresentativeTransitionExtension(true); |
| 10484 |
|
| 10485 |
CRepresentativePropagationSet* joinRepPropSet = repPropSetHash->getRepresentativePropagationSet(joinConcept,true); |
| 10486 |
|
| 10487 |
CPropagationBindingDescriptor* lastAnalyPropBindDes = propRepTransExt->getLastAnalysedPropagationBindingDescriptor(); |
| 10488 |
CPropagationBindingDescriptor* propBindDes = propBindingSet->getPropagationBindingDescriptorLinker(); |
| 10489 |
|
| 10490 |
bool propAllFlag = propBindingSet->hasPropagateAllFlag(); |
| 10491 |
|
| 10492 |
CRepresentativeVariableBindingPathSetData* leftRepData = leftRepPropDes->getRepresentativeVariableBindingPathSetData(); |
| 10493 |
CRepresentativeVariableBindingPathSetData* rightRepData = rightRepPropDes->getRepresentativeVariableBindingPathSetData(); |
| 10494 |
|
| 10495 |
|
| 10496 |
if (areRepresentativesJoinable(processIndi,leftRepData,rightRepData,varLinker,calcAlgContext)) { |
| 10497 |
|
| 10498 |
CRepresentativeJoiningData* joinData = nullptr; |
| 10499 |
CRepresentativeJoiningData* locJoinData = nullptr; |
| 10500 |
CRepresentativeJoiningHash* repJoiningHash = procDataBox->getRepresentativeJoiningHash(false); |
| 10501 |
if (repJoiningHash) { |
| 10502 |
joinData = repJoiningHash->getRepresentativeJoiningData(leftRepData,rightRepData,false); |
| 10503 |
} |
| 10504 |
|
| 10505 |
if (!joinData) { |
| 10506 |
|
| 10507 |
CRepresentativeVariableBindingPathSetHash* repVarBindPathSetHash = nullptr; |
| 10508 |
if (!leftRepData->hasJoiningData(concept)) { |
| 10509 |
if (!repVarBindPathSetHash) { |
| 10510 |
repVarBindPathSetHash = procDataBox->getRepresentativeVariableBindingPathSetHash(true); |
| 10511 |
} |
| 10512 |
leftRepData = repVarBindPathSetHash->getRepresentativeVariableBindingPathSetData(leftRepData,true); |
| 10513 |
} |
| 10514 |
if (!rightRepData->hasJoiningData(concept)) { |
| 10515 |
if (!repVarBindPathSetHash) { |
| 10516 |
repVarBindPathSetHash = procDataBox->getRepresentativeVariableBindingPathSetHash(true); |
| 10517 |
} |
| 10518 |
rightRepData = repVarBindPathSetHash->getRepresentativeVariableBindingPathSetData(rightRepData,true); |
| 10519 |
} |
| 10520 |
|
| 10521 |
if (!locJoinData) { |
| 10522 |
repJoiningHash = procDataBox->getRepresentativeJoiningHash(true); |
| 10523 |
locJoinData = repJoiningHash->getRepresentativeJoiningData(leftRepData,rightRepData,true); |
| 10524 |
joinData = locJoinData; |
| 10525 |
} |
| 10526 |
|
| 10527 |
CRepresentativeVariableBindingPathSetJoiningKeyMap* leftJoiningKeyMap = getRepresentativeJoiningKeyData(leftRepData,concept,calcAlgContext); |
| 10528 |
CRepresentativeVariableBindingPathSetJoiningKeyMap* rightJoiningKeyMap = getRepresentativeJoiningKeyData(rightRepData,concept,calcAlgContext); |
| 10529 |
|
| 10530 |
CRepresentativeJoiningCommonKeyMap* repJoinCommonKeyMap = joinData->getRepresentativeJoiningCommonKeyMap(); |
| 10531 |
|
| 10532 |
createCommonJoiningKeyMap(repJoinCommonKeyMap,leftJoiningKeyMap,leftRepData,rightJoiningKeyMap,rightRepData,true,calcAlgContext); |
| 10533 |
} |
| 10534 |
|
| 10535 |
CRepresentativeJoiningCommonKeyMap* repJoinCommonKeyMap = joinData->getRepresentativeJoiningCommonKeyMap(); |
| 10536 |
if (!repJoinCommonKeyMap->isEmpty()) { |
| 10537 |
++mStatRepresentativeJoinedCount; |
| 10538 |
|
| 10539 |
if (propAllFlag) { |
| 10540 |
CRepresentativeJoiningAllDataExtension* joinAllExtData = joinData->getJoiningAllExtension(false); |
| 10541 |
if (!joinAllExtData) { |
| 10542 |
if (!locJoinData) { |
| 10543 |
repJoiningHash = procDataBox->getRepresentativeJoiningHash(true); |
| 10544 |
locJoinData = repJoiningHash->getRepresentativeJoiningData(leftRepData,rightRepData,true); |
| 10545 |
joinData = locJoinData; |
| 10546 |
} |
| 10547 |
|
| 10548 |
joinAllExtData = joinData->getJoiningAllExtension(true); |
| 10549 |
|
| 10550 |
createCommonJoiningAll(joinData->getRepresentativeJoiningCommonKeyMap(),joinAllExtData,leftRepData,rightRepData,calcAlgContext); |
| 10551 |
} |
| 10552 |
|
| 10553 |
CRepresentativeVariableBindingPathSetData* joinedRepData = joinAllExtData->getRepresentativeVariableBindingPathSetData(); |
| 10554 |
|
| 10555 |
CRepresentativePropagationMap* leftRepPropMap = propRepTransExt->getLeftRepresentativePropagationMap(); |
| 10556 |
CRepresentativePropagationMap* rightRepPropMap = propRepTransExt->getRightRepresentativePropagationMap(); |
| 10557 |
if (!leftRepPropMap->contains(leftRepData->getRepresentativeID())) { |
| 10558 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 10559 |
CREPRESENTATIVEANDDependencyNode* repPropDepNode = createREPRESENTATIVEANDDependency(nextDepTrackPoint,processIndi,conDes,leftRepPropDes->getDependencyTrackPoint(),calcAlgContext); |
| 10560 |
CRepresentativePropagationDescriptor* propagateRepDes = CObjectAllocator<CRepresentativePropagationDescriptor>::allocateAndConstruct(taskMemMan); |
| 10561 |
propagateRepDes->initRepresentativeDescriptor(leftRepData,nextDepTrackPoint); |
| 10562 |
leftRepPropMap->insert(leftRepData->getRepresentativeID(),CRepresentativePropagationMapData(propagateRepDes)); |
| 10563 |
} |
| 10564 |
if (!rightRepPropMap->contains(rightRepData->getRepresentativeID())) { |
| 10565 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 10566 |
CREPRESENTATIVEANDDependencyNode* repPropDepNode = createREPRESENTATIVEANDDependency(nextDepTrackPoint,processIndi,conDes,rightRepPropDes->getDependencyTrackPoint(),calcAlgContext); |
| 10567 |
CRepresentativePropagationDescriptor* propagateRepDes = CObjectAllocator<CRepresentativePropagationDescriptor>::allocateAndConstruct(taskMemMan); |
| 10568 |
propagateRepDes->initRepresentativeDescriptor(rightRepData,nextDepTrackPoint); |
| 10569 |
rightRepPropMap->insert(rightRepData->getRepresentativeID(),CRepresentativePropagationMapData(propagateRepDes)); |
| 10570 |
} |
| 10571 |
|
| 10572 |
CDependencyTrackPoint* leftNextResolveDepTrackPoint = nullptr; |
| 10573 |
CRESOLVEREPRESENTATIVEDependencyNode* leftResolveRepNode = createRESOLVEREPRESENTATIVEDependency(leftNextResolveDepTrackPoint,processIndi,nullptr,joinAllExtData->getLeftResolveVariableBindingPathMap(false),leftRepPropMap,leftRepPropDes->getDependencyTrackPoint(),nullptr,calcAlgContext); |
| 10574 |
|
| 10575 |
CDependencyTrackPoint* rightNextResolveDepTrackPoint = nullptr; |
| 10576 |
CRESOLVEREPRESENTATIVEDependencyNode* rightResolveRepNode = createRESOLVEREPRESENTATIVEDependency(rightNextResolveDepTrackPoint,processIndi,nullptr,joinAllExtData->getRightResolveVariableBindingPathMap(false),rightRepPropMap,rightRepPropDes->getDependencyTrackPoint(),nullptr,calcAlgContext); |
| 10577 |
|
| 10578 |
CDependencyTrackPoint* joinNextDepTrackPoint = nullptr; |
| 10579 |
CREPRESENTATIVEJOINDependencyNode* joinResolveRepNode = createREPRESENTATIVEJOINDependency(joinNextDepTrackPoint,processIndi,conDes,leftNextResolveDepTrackPoint,rightNextResolveDepTrackPoint,calcAlgContext); |
| 10580 |
|
| 10581 |
CRepresentativePropagationDescriptor* propagateRepDes = CObjectAllocator<CRepresentativePropagationDescriptor>::allocateAndConstruct(taskMemMan); |
| 10582 |
propagateRepDes->initRepresentativeDescriptor(joinedRepData,joinNextDepTrackPoint); |
| 10583 |
joinRepPropSet->addIncomingRepresentativePropagation(propagateRepDes); |
| 10584 |
updateRepresentativePropagationSet(processIndi,joinRepPropSet,calcAlgContext); |
| 10585 |
|
| 10586 |
if (!joinConDes) { |
| 10587 |
joinDepTrackPoint = joinNextDepTrackPoint; |
| 10588 |
joinConDes = addConceptToIndividualReturnConceptDescriptor(joinConcept,false,processIndi,joinNextDepTrackPoint,false,false,calcAlgContext); |
| 10589 |
} |
| 10590 |
} else { |
| 10591 |
// ToDo! |
| 10592 |
} |
| 10593 |
|
| 10594 |
propagationsDone = true; |
| 10595 |
} |
| 10596 |
} |
| 10597 |
|
| 10598 |
propRepTransExt->setLeftLastRepresentativeJoiningDescriptor(leftRepPropDes); |
| 10599 |
propRepTransExt->setRightLastRepresentativeJoiningDescriptor(rightRepPropDes); |
| 10600 |
propRepTransExt->setLastAnalysedPropagationBindingDescriptor(propBindDes); |
| 10601 |
propRepTransExt->setLastAnalysedPropagateAllFlag(propBindingSet->hasPropagateAllFlag()); |
| 10602 |
} |
| 10603 |
} |
| 10604 |
} |
| 10605 |
} |
| 10606 |
|
| 10607 |
if (propagationsDone) { |
| 10608 |
if (!createJoinConcept) { |
| 10609 |
reapplyConceptUpdatedRepresentative(processIndi,joinConDes,joinDepTrackPoint,conSet,reapplyQueue,calcAlgContext); |
| 10610 |
} |
| 10611 |
} |
| 10612 |
} |
| 10613 |
|
| 10614 |
|
| 10615 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasCommonVariableBindings(CIndividualProcessNode*& processIndi, CRepresentativeVariableBindingPathMap* leftRepVarBindMap, CRepresentativeVariableBindingPathMap* rightRepVarBindMap, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10616 |
if (rightRepVarBindMap->count() < leftRepVarBindMap->count()) { |
| 10617 |
return hasCommonVariableBindings(processIndi,rightRepVarBindMap,leftRepVarBindMap,calcAlgContext); |
| 10618 |
} |
| 10619 |
|
| 10620 |
if (leftRepVarBindMap->count()*mMapComparisonDirectLookupFactor < rightRepVarBindMap->count()) { |
| 10621 |
for (CRepresentativeVariableBindingPathMap::const_iterator it1 = leftRepVarBindMap->constBegin(), it1End = leftRepVarBindMap->constEnd(); it1 != it1End; ++it1) { |
| 10622 |
if (rightRepVarBindMap->contains(it1.key())) { |
| 10623 |
return true; |
| 10624 |
} |
| 10625 |
} |
| 10626 |
return false; |
| 10627 |
} else { |
| 10628 |
CRepresentativeVariableBindingPathMap::const_iterator it1 = leftRepVarBindMap->constBegin(), it1End = leftRepVarBindMap->constEnd(); |
| 10629 |
CRepresentativeVariableBindingPathMap::const_iterator it2 = rightRepVarBindMap->constBegin(), it2End = rightRepVarBindMap->constEnd(); |
| 10630 |
|
| 10631 |
while (it1 != it1End && it2 != it2End) { |
| 10632 |
cint64 key1 = it1.key(); |
| 10633 |
cint64 key2 = it2.key(); |
| 10634 |
if (key1 == key2) { |
| 10635 |
return true; |
| 10636 |
} |
| 10637 |
if (key1 < key2) { |
| 10638 |
++it1; |
| 10639 |
} else if (key2 < key1) { |
| 10640 |
++it2; |
| 10641 |
} |
| 10642 |
} |
| 10643 |
return false; |
| 10644 |
} |
| 10645 |
} |
| 10646 |
|
| 10647 |
|
| 10648 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::areRepresentativesJoinable(CIndividualProcessNode*& processIndi, CRepresentativeVariableBindingPathSetData* leftRepData, CRepresentativeVariableBindingPathSetData* rightRepData, CSortedLinker<CVariable*>* varLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10649 |
CRepresentativeVariableBindingPathSetMigrateData* leftRepMigData = leftRepData->getMigrateData(); |
| 10650 |
CRepresentativeVariableBindingPathSetMigrateData* rightRepMigData = rightRepData->getMigrateData(); |
| 10651 |
if (varLinker && leftRepMigData && rightRepMigData) { |
| 10652 |
CRepresentativeVariableBindingPathMap* leftRepVarBindMap = leftRepMigData->getRepresentativeVariableBindingPathMap(); |
| 10653 |
CRepresentativeVariableBindingPathMap* rightRepVarBindMap = rightRepMigData->getRepresentativeVariableBindingPathMap(); |
| 10654 |
|
| 10655 |
const CRepresentativeVariableBindingPathMapData& leftRepVarBindData = leftRepVarBindMap->constBegin().value(); |
| 10656 |
const CRepresentativeVariableBindingPathMapData& rightRepVarBindData = rightRepVarBindMap->constBegin().value(); |
| 10657 |
CVariableBindingPath* leftVarBindPath = leftRepVarBindData.getVariableBindingPath(); |
| 10658 |
CVariableBindingPath* rightVarBindPath = rightRepVarBindData.getVariableBindingPath(); |
| 10659 |
if (leftVarBindPath->getVariableBindingCount() == 1 && rightVarBindPath->getVariableBindingCount() == 1) { |
| 10660 |
if (!hasCommonVariableBindings(processIndi,leftRepVarBindMap,rightRepVarBindMap,calcAlgContext)) { |
| 10661 |
++mStatRepresentativeJoinQuickFailCount; |
| 10662 |
return false; |
| 10663 |
} |
| 10664 |
} |
| 10665 |
} |
| 10666 |
return true; |
| 10667 |
} |
| 10668 |
|
| 10669 |
|
| 10670 |
void CCalculationTableauCompletionTaskHandleAlgorithm::createCommonJoiningAll(CRepresentativeJoiningCommonKeyMap* repJoinCommonKeyMap, CRepresentativeJoiningAllDataExtension* joinAllExtData, CRepresentativeVariableBindingPathSetData* leftRepData, CRepresentativeVariableBindingPathSetData* rightRepData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10671 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 10672 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 10673 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 10674 |
CRepresentativeVariableBindingPathSetData* repData = CObjectParameterizingAllocator< CRepresentativeVariableBindingPathSetData,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,processContext); |
| 10675 |
repData->initRepresentativeVariableBindingPathData(nullptr); |
| 10676 |
repData->setRepresentativeID(procDataBox->getNextRepresentativeVariableBindingPathID(true)); |
| 10677 |
repData->setMigratable(false); |
| 10678 |
repData->incUseCount(); |
| 10679 |
repData->incShareCount(); |
| 10680 |
CRepresentativeVariableBindingPathSetMigrateData* repMigData = repData->getMigrateData(true); |
| 10681 |
CRepresentativeVariableBindingPathMap* varBindPathResolveMap = repMigData->getRepresentativeVariableBindingPathMap(); |
| 10682 |
|
| 10683 |
CRepresentativeVariableBindingPathMap* leftRepVarBindPathResolveMap = joinAllExtData->getLeftResolveVariableBindingPathMap(true); |
| 10684 |
CRepresentativeVariableBindingPathMap* rightRepVarBindPathResolveMap = joinAllExtData->getRightResolveVariableBindingPathMap(true); |
| 10685 |
|
| 10686 |
for (CRepresentativeJoiningCommonKeyMap::const_iterator it = repJoinCommonKeyMap->constBegin(), itEnd = repJoinCommonKeyMap->constEnd(); it != itEnd; ++it) { |
| 10687 |
cint64 joiningKey = it.key(); |
| 10688 |
const CRepresentativeJoiningCommonKeyData& commonKeyData = it.value(); |
| 10689 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* leftKeyDataMap = commonKeyData.getLeftJoiningDataMap(); |
| 10690 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* rightKeyDataMap = commonKeyData.getRightJoiningDataMap(); |
| 10691 |
|
| 10692 |
for (CRepresentativeVariableBindingPathSetJoiningKeyDataMap::const_iterator it1 = leftKeyDataMap->constBegin(), it1End = leftKeyDataMap->constEnd(); it1 != it1End; ++it1) { |
| 10693 |
for (CRepresentativeVariableBindingPathSetJoiningKeyDataMap::const_iterator it2 = rightKeyDataMap->constBegin(), it2End = rightKeyDataMap->constEnd(); it2 != it2End; ++it2) { |
| 10694 |
CVariableBindingPath* varBindPath1 = it1.value(); |
| 10695 |
CVariableBindingPath* varBindPath2 = it2.value(); |
| 10696 |
|
| 10697 |
CVariableBindingPath* mergedVarBindPath = getJoinedVariableBindingPath(varBindPath1,varBindPath2,calcAlgContext); |
| 10698 |
|
| 10699 |
leftRepVarBindPathResolveMap->insert(mergedVarBindPath->getPropagationID(),CRepresentativeVariableBindingPathMapData(mergedVarBindPath,varBindPath1,leftRepData)); |
| 10700 |
rightRepVarBindPathResolveMap->insert(mergedVarBindPath->getPropagationID(),CRepresentativeVariableBindingPathMapData(mergedVarBindPath,varBindPath2,rightRepData)); |
| 10701 |
|
| 10702 |
varBindPathResolveMap->insert(mergedVarBindPath->getPropagationID(),CRepresentativeVariableBindingPathMapData(mergedVarBindPath,repData)); |
| 10703 |
} |
| 10704 |
} |
| 10705 |
} |
| 10706 |
|
| 10707 |
++mStatRepresentativeJoinCombinesCount; |
| 10708 |
repMigData->getRepresentativeContainingMap()->insertContainedRepresentative(repData,false); |
| 10709 |
repData->addKeySignatureValue(repData->getRepresentativeID()); |
| 10710 |
CRepresentativeVariableBindingPathSetHash* repVarBindPathSetHash = procDataBox->getRepresentativeVariableBindingPathSetHash(true); |
| 10711 |
repVarBindPathSetHash->insertRepresentativeVariableBindingPathSetData(repData); |
| 10712 |
joinAllExtData->setRepresentativeVariableBindingPathSetData(repData); |
| 10713 |
} |
| 10714 |
|
| 10715 |
|
| 10716 |
|
| 10717 |
void CCalculationTableauCompletionTaskHandleAlgorithm::createCommonJoiningKeyMap(CRepresentativeJoiningCommonKeyMap* repJoinCommonKeyMap, CRepresentativeVariableBindingPathSetJoiningKeyMap* firstJoiningKeyMap, CRepresentativeVariableBindingPathSetData* firstRepData, |
| 10718 |
CRepresentativeVariableBindingPathSetJoiningKeyMap* secJoiningKeyMap, CRepresentativeVariableBindingPathSetData* secRepData, bool firstLeft, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10719 |
|
| 10720 |
if (secJoiningKeyMap->count() < firstJoiningKeyMap->count()) { |
| 10721 |
createCommonJoiningKeyMap(repJoinCommonKeyMap,secJoiningKeyMap,secRepData,firstJoiningKeyMap,firstRepData,!firstLeft,calcAlgContext); |
| 10722 |
} |
| 10723 |
if (firstJoiningKeyMap->count()*mMapComparisonDirectLookupFactor < secJoiningKeyMap->count()) { |
| 10724 |
for (CRepresentativeVariableBindingPathSetJoiningKeyMap::const_iterator it = firstJoiningKeyMap->constBegin(), itEnd = firstJoiningKeyMap->constEnd(); it != itEnd; ++it) { |
| 10725 |
cint64 joiningKey = it.key(); |
| 10726 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* firstJoiningDataMap = it.value().getRepresentativeVariableBindingPathSetJoiningKeyDataMap(); |
| 10727 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* secJoiningDataMap = secJoiningKeyMap->value(joiningKey).getRepresentativeVariableBindingPathSetJoiningKeyDataMap(); |
| 10728 |
if (secJoiningDataMap) { |
| 10729 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* leftJoiningDataMap = firstJoiningDataMap; |
| 10730 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* rightJoiningDataMap = secJoiningDataMap; |
| 10731 |
if (!firstLeft) { |
| 10732 |
leftJoiningDataMap = secJoiningDataMap; |
| 10733 |
rightJoiningDataMap = firstJoiningDataMap; |
| 10734 |
} |
| 10735 |
repJoinCommonKeyMap->insert(joiningKey,CRepresentativeJoiningCommonKeyData(leftJoiningDataMap,rightJoiningDataMap)); |
| 10736 |
} |
| 10737 |
} |
| 10738 |
} else { |
| 10739 |
CRepresentativeVariableBindingPathSetJoiningKeyMap::const_iterator it1 = firstJoiningKeyMap->constBegin(), it1End = firstJoiningKeyMap->constEnd(); |
| 10740 |
CRepresentativeVariableBindingPathSetJoiningKeyMap::const_iterator it2 = secJoiningKeyMap->constBegin(), it2End = secJoiningKeyMap->constEnd(); |
| 10741 |
while (it1 != it1End && it2 != it2End) { |
| 10742 |
cint64 joiningKey1 = it1.key(); |
| 10743 |
cint64 joiningKey2 = it2.key(); |
| 10744 |
if (joiningKey1 == joiningKey2) { |
| 10745 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* firstJoiningDataMap = it1.value().getRepresentativeVariableBindingPathSetJoiningKeyDataMap(); |
| 10746 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* secJoiningDataMap = it2.value().getRepresentativeVariableBindingPathSetJoiningKeyDataMap(); |
| 10747 |
if (firstJoiningDataMap && secJoiningDataMap) { |
| 10748 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* leftJoiningDataMap = firstJoiningDataMap; |
| 10749 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* rightJoiningDataMap = secJoiningDataMap; |
| 10750 |
if (!firstLeft) { |
| 10751 |
leftJoiningDataMap = secJoiningDataMap; |
| 10752 |
rightJoiningDataMap = firstJoiningDataMap; |
| 10753 |
} |
| 10754 |
repJoinCommonKeyMap->insert(joiningKey1,CRepresentativeJoiningCommonKeyData(leftJoiningDataMap,rightJoiningDataMap)); |
| 10755 |
} |
| 10756 |
++it1; |
| 10757 |
++it2; |
| 10758 |
} else if (joiningKey1 < joiningKey2) { |
| 10759 |
++it1; |
| 10760 |
} else if (joiningKey2 < joiningKey1) { |
| 10761 |
++it2; |
| 10762 |
} |
| 10763 |
} |
| 10764 |
} |
| 10765 |
} |
| 10766 |
|
| 10767 |
|
| 10768 |
|
| 10769 |
CRepresentativeVariableBindingPathSetJoiningKeyMap* CCalculationTableauCompletionTaskHandleAlgorithm::getRepresentativeJoiningKeyData(CRepresentativeVariableBindingPathSetData* repVarBindPathSetData, CConcept* joinConcept, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10770 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 10771 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 10772 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 10773 |
CSortedLinker<CVariable*>* keyVarLinker = joinConcept->getVariableLinker(); |
| 10774 |
|
| 10775 |
CRepresentativeVariableBindingPathSetJoiningData* joiningData = nullptr; |
| 10776 |
|
| 10777 |
CRepresentativeVariableBindingPathSetJoiningHash* joiningHash = repVarBindPathSetData->getJoiningHash(false); |
| 10778 |
if (joiningHash) { |
| 10779 |
joiningData = joiningHash->getRepresentativeVariableBindingPathSetJoiningData(joinConcept,false); |
| 10780 |
} |
| 10781 |
if (!joiningData) { |
| 10782 |
joiningHash = repVarBindPathSetData->getJoiningHash(true); |
| 10783 |
joiningData = joiningHash->getRepresentativeVariableBindingPathSetJoiningData(joinConcept,true); |
| 10784 |
|
| 10785 |
CRepresentativeVariableBindingPathJoiningKeyHash* varBindPathJoiningKeyHash = procDataBox->getRepresentativeVariableBindingPathJoiningKeyHash(true); |
| 10786 |
|
| 10787 |
CRepresentativeVariableBindingPathSetJoiningKeyMap* joiningKeyMap = joiningData->getJoiningKeyMap(); |
| 10788 |
CRepresentativeVariableBindingPathMap* varBindPathMap = repVarBindPathSetData->getMigrateData(false)->getRepresentativeVariableBindingPathMap(); |
| 10789 |
for (CRepresentativeVariableBindingPathMap::const_iterator it = varBindPathMap->constBegin(), itEnd = varBindPathMap->constEnd(); it != itEnd; ++it) { |
| 10790 |
CVariableBindingPath* varBindPath = it.value().getVariableBindingPath(); |
| 10791 |
cint64 joinKey = varBindPathJoiningKeyHash->getRepresentativeVariableBindingPathJoiningKey(varBindPath,keyVarLinker,true); |
| 10792 |
CRepresentativeVariableBindingPathSetJoiningKeyDataMap* joiningKeyDataMap = joiningKeyMap->getJoiningKeyDataMap(joinKey,true); |
| 10793 |
joiningKeyDataMap->insert(varBindPath->getPropagationID(),varBindPath); |
| 10794 |
} |
| 10795 |
} |
| 10796 |
return joiningData->getJoiningKeyMap(); |
| 10797 |
} |
| 10798 |
|
| 10799 |
|
| 10800 |
|
| 10801 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEBINDVARIABLERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10802 |
|
| 10803 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 10804 |
CConcept* concept = conDes->getConcept(); |
| 10805 |
CVariable* variable = concept->getVariable(); |
| 10806 |
bool conceptNegation = negate; |
| 10807 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 10808 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 10809 |
|
| 10810 |
CConcept* bindingTriggerConcept = opConLinker->getData(); |
| 10811 |
bool bindingTriggerConceptNegation = opConLinker->isNegated(); |
| 10812 |
|
| 10813 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 10814 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 10815 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 10816 |
|
| 10817 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 10818 |
CConceptDescriptor* bindingConDes = nullptr; |
| 10819 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 10820 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 10821 |
|
| 10822 |
STATINC(VARBINDRULEBINDAPPLICATIONCOUNT,calcAlgContext); |
| 10823 |
|
| 10824 |
bool updateExt = false; |
| 10825 |
|
| 10826 |
|
| 10827 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(false); |
| 10828 |
if (conPropBindingSetHash) { |
| 10829 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 10830 |
|
| 10831 |
if (propBindingSet) { |
| 10832 |
CPropagationVariableBindingTransitionExtension* propVarBindTransExt = propBindingSet->getPropagationVariableBindingTransitionExtension(false); |
| 10833 |
if (!propVarBindTransExt || !propVarBindTransExt->isProcessingCompleted()) { |
| 10834 |
if (!propVarBindTransExt || propBindingSet->hasPropagateAllFlag()) { |
| 10835 |
updateExt = true; |
| 10836 |
} else { |
| 10837 |
CPropagationBindingDescriptor* lastAnalyPropBindDes = propVarBindTransExt->getLastAnalysedPropagationBindingDescriptor(); |
| 10838 |
CPropagationBindingDescriptor* propBindDes = propBindingSet->getPropagationBindingDescriptorLinker(); |
| 10839 |
if (lastAnalyPropBindDes != propBindDes) { |
| 10840 |
updateExt = true; |
| 10841 |
} |
| 10842 |
} |
| 10843 |
} |
| 10844 |
} |
| 10845 |
} |
| 10846 |
|
| 10847 |
|
| 10848 |
|
| 10849 |
if (updateExt) { |
| 10850 |
|
| 10851 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 10852 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,true); |
| 10853 |
CPropagationVariableBindingTransitionExtension* propVarBindTransExt = propBindingSet->getPropagationVariableBindingTransitionExtension(true); |
| 10854 |
|
| 10855 |
CPropagationBindingDescriptor* lastAnalyPropBindDes = propVarBindTransExt->getLastAnalysedPropagationBindingDescriptor(); |
| 10856 |
CPropagationBindingDescriptor* propBindDes = propBindingSet->getPropagationBindingDescriptorLinker(); |
| 10857 |
|
| 10858 |
propVarBindTransExt->setTriggeredVariableIndividualPair(variable,processIndi); |
| 10859 |
bool createVarBinding = false; |
| 10860 |
createVarBinding = propBindingSet->hasPropagateAllFlag(); |
| 10861 |
for (CPropagationBindingDescriptor* propBindDesIt = propBindDes; propBindDesIt != lastAnalyPropBindDes; propBindDesIt = propBindDesIt->getNext()) { |
| 10862 |
if (propVarBindTransExt->addAnalysedPropagationBindingDescriptorReturnMatched(propBindDesIt)) { |
| 10863 |
createVarBinding = true; |
| 10864 |
} |
| 10865 |
} |
| 10866 |
propVarBindTransExt->setLastAnalysedPropagationBindingDescriptor(propBindDes); |
| 10867 |
propVarBindTransExt->setLastAnalysedPropagateAllFlag(propBindingSet->hasPropagateAllFlag()); |
| 10868 |
|
| 10869 |
if (createVarBinding) { |
| 10870 |
++mStatRepresentativeCreatedCount; |
| 10871 |
STATINC(VARBINDVARIABLEBINDCOUNT,calcAlgContext); |
| 10872 |
propVarBindTransExt->setProcessingCompleted(true); |
| 10873 |
|
| 10874 |
CConceptRepresentativePropagationSetHash* conRepPropSetHash = processIndi->getConceptRepresentativePropagationSetHash(true); |
| 10875 |
CRepresentativePropagationSet* repPropSet = conRepPropSetHash->getRepresentativePropagationSet(bindingTriggerConcept,true); |
| 10876 |
|
| 10877 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 10878 |
cint64 nextPathPropID = processingDataBox->getNextVariableBindingPathID(true); |
| 10879 |
|
| 10880 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 10881 |
CREPRESENTATIVEBINDVARIABLEDependencyNode* bindDepNode = createREPRESENTATIVEBINDVARIABLEDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 10882 |
|
| 10883 |
|
| 10884 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 10885 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 10886 |
} else { |
| 10887 |
reapplyConceptUpdatedRepresentative(processIndi,bindingConDes,bindingDepTrackPoint,conSet,reapplyQueue,calcAlgContext); |
| 10888 |
} |
| 10889 |
|
| 10890 |
repPropSet->setConceptDescriptor(bindingConDes); |
| 10891 |
CVariableBinding* varBinding = CObjectAllocator<CVariableBinding>::allocateAndConstruct(taskMemMan); |
| 10892 |
varBinding->initVariableBinding(nextDepTrackPoint,processIndi,variable); |
| 10893 |
CVariableBindingDescriptor* varBindingDes = CObjectAllocator<CVariableBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 10894 |
varBindingDes->initVariableBindingDescriptor(varBinding); |
| 10895 |
CVariableBindingPath* varBindingPath = CObjectAllocator<CVariableBindingPath>::allocateAndConstruct(taskMemMan); |
| 10896 |
varBindingPath->initVariableBindingPath(nextPathPropID,varBindingDes); |
| 10897 |
|
| 10898 |
CRepresentativeVariableBindingPathHash* repVarBindPathHash = procDataBox->getRepresentativeVariableBindingPathHash(true); |
| 10899 |
CRepresentativeVariableBindingPathSetData* repData = repVarBindPathHash->getRepresentativeVariableBindingPathSetData(varBindingPath,true); |
| 10900 |
repData->setRepresentativeID(procDataBox->getNextRepresentativeVariableBindingPathID(true)); |
| 10901 |
repData->setMigratable(false); |
| 10902 |
repData->incUseCount(); |
| 10903 |
repData->incShareCount(); |
| 10904 |
CRepresentativeVariableBindingPathSetMigrateData* repMigData = repData->getMigrateData(true); |
| 10905 |
repMigData->getRepresentativeVariableBindingPathMap()->insert(varBindingPath->getPropagationID(),CRepresentativeVariableBindingPathMapData(varBindingPath,repData)); |
| 10906 |
repMigData->getRepresentativeContainingMap()->insertContainedRepresentative(repData,false); |
| 10907 |
repData->addKeySignatureValue(repData->getRepresentativeID()); |
| 10908 |
|
| 10909 |
CRepresentativeVariableBindingPathSetHash* repVarBindPathSetHash = procDataBox->getRepresentativeVariableBindingPathSetHash(true); |
| 10910 |
repVarBindPathSetHash->insertRepresentativeVariableBindingPathSetData(repData); |
| 10911 |
|
| 10912 |
|
| 10913 |
CRepresentativePropagationDescriptor* repPropDes = CObjectAllocator<CRepresentativePropagationDescriptor>::allocateAndConstruct(taskMemMan); |
| 10914 |
repPropDes->initRepresentativeDescriptor(repData,nextDepTrackPoint); |
| 10915 |
|
| 10916 |
repPropSet->addIncomingRepresentativePropagationDescriptorLinker(repPropDes); |
| 10917 |
updateRepresentativePropagationSet(processIndi,repPropSet,calcAlgContext); |
| 10918 |
|
| 10919 |
} |
| 10920 |
} |
| 10921 |
} |
| 10922 |
|
| 10923 |
|
| 10924 |
|
| 10925 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEIMPLICATIONRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 10926 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 10927 |
CConcept* concept = conDes->getConcept(); |
| 10928 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 10929 |
cint64 opCount = concept->getOperandCount(); |
| 10930 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 10931 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 10932 |
|
| 10933 |
|
| 10934 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 10935 |
CConceptDescriptor* bindingConDes = nullptr; |
| 10936 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 10937 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 10938 |
|
| 10939 |
CConcept* bindingTriggerConcept = opLinker->getData(); |
| 10940 |
bool bindingTriggerConceptNegation = opLinker->isNegated(); |
| 10941 |
CSortedNegLinker<CConcept*>* triggerLinker = opLinker->getNext(); |
| 10942 |
|
| 10943 |
STATINC(VARBINDRULEIMPLICATIONAPPLICATIONCOUNT,calcAlgContext); |
| 10944 |
|
| 10945 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 10946 |
|
| 10947 |
// search next not existing trigger |
| 10948 |
bool allTriggersAvailable = true; |
| 10949 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 10950 |
CSortedNegLinker<CConcept*>* triggerLinkerIt = nullptr; |
| 10951 |
for (triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 10952 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 10953 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 10954 |
CConceptDescriptor* triggerConDes = nullptr; |
| 10955 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 10956 |
if (conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint)) { |
| 10957 |
if (triggerConDes->isNegated() == nextTrigger->isNegated()) { |
| 10958 |
return; |
| 10959 |
} |
| 10960 |
} else { |
| 10961 |
allTriggersAvailable = false; |
| 10962 |
break; |
| 10963 |
} |
| 10964 |
} |
| 10965 |
|
| 10966 |
if (!allTriggersAvailable) { |
| 10967 |
// install to trigger |
| 10968 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 10969 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 10970 |
bool triggerNegation = !nextTrigger->isNegated(); |
| 10971 |
if (!isConceptInReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,calcAlgContext)) { |
| 10972 |
addConceptToReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,(CProcessingRestrictionSpecification*)nullptr,depTrackPoint,calcAlgContext); |
| 10973 |
} |
| 10974 |
} else { |
| 10975 |
CDependency* triggerDeps = nullptr; |
| 10976 |
for (CSortedNegLinker<CConcept*>* triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 10977 |
CConcept* triggerConcept = triggerLinkerIt->getData(); |
| 10978 |
CConceptDescriptor* triggerConDes = nullptr; |
| 10979 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 10980 |
conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint); |
| 10981 |
CCONNECTIONDependencyNode* connDep = createCONNECTIONDependency(processIndi,triggerConDes,triggerDepTrackPoint,calcAlgContext); |
| 10982 |
connDep->setNext(triggerDeps); |
| 10983 |
triggerDeps = connDep; |
| 10984 |
} |
| 10985 |
|
| 10986 |
++mStatRepresentativeImplicationCount; |
| 10987 |
|
| 10988 |
CConceptRepresentativePropagationSetHash* conRepPropSetHash = processIndi->getConceptRepresentativePropagationSetHash(true); |
| 10989 |
CRepresentativePropagationSet* prevRepPropSet = conRepPropSetHash->getRepresentativePropagationSet(concept,false); |
| 10990 |
CRepresentativePropagationSet* repPropSet = conRepPropSetHash->getRepresentativePropagationSet(bindingTriggerConcept,true); |
| 10991 |
CRepresentativePropagationDescriptor* procRepPropDes = nullptr; |
| 10992 |
CDependencyTrackPoint* propDepTrackPoint = nullptr; |
| 10993 |
if (prevRepPropSet) { |
| 10994 |
procRepPropDes = prevRepPropSet->getOutgoingRepresentativePropagationDescriptorLinker(); |
| 10995 |
} |
| 10996 |
if (procRepPropDes) { |
| 10997 |
propDepTrackPoint = procRepPropDes->getDependencyTrackPoint(); |
| 10998 |
|
| 10999 |
repPropSet->setConceptDescriptor(bindingConDes); |
| 11000 |
|
| 11001 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 11002 |
CREPRESENTATIVEIMPLICATIONDependencyNode* implDepNode = createREPRESENTATIVEIMPLICATIONDependency(nextDepTrackPoint,processIndi,conDes,propDepTrackPoint,triggerDeps,calcAlgContext); |
| 11003 |
|
| 11004 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,true,false,calcAlgContext); |
| 11005 |
|
| 11006 |
|
| 11007 |
propagateRepresentative(processIndi,procRepPropDes,repPropSet,nextDepTrackPoint,calcAlgContext); |
| 11008 |
} |
| 11009 |
|
| 11010 |
} |
| 11011 |
} else { |
| 11012 |
|
| 11013 |
CConceptRepresentativePropagationSetHash* conRepPropSetHash = processIndi->getConceptRepresentativePropagationSetHash(true); |
| 11014 |
CRepresentativePropagationSet* prevRepPropSet = conRepPropSetHash->getRepresentativePropagationSet(concept,false); |
| 11015 |
CRepresentativePropagationSet* repPropSet = conRepPropSetHash->getRepresentativePropagationSet(bindingTriggerConcept,true); |
| 11016 |
CRepresentativePropagationDescriptor* procRepPropDes = nullptr; |
| 11017 |
CDependencyTrackPoint* propDepTrackPoint = nullptr; |
| 11018 |
if (prevRepPropSet) { |
| 11019 |
procRepPropDes = prevRepPropSet->getOutgoingRepresentativePropagationDescriptorLinker(); |
| 11020 |
} |
| 11021 |
if (procRepPropDes) { |
| 11022 |
propDepTrackPoint = procRepPropDes->getDependencyTrackPoint(); |
| 11023 |
|
| 11024 |
if (requiresRepresentativePropagation(processIndi,procRepPropDes,repPropSet,calcAlgContext)) { |
| 11025 |
CDependency* triggerDeps = nullptr; |
| 11026 |
for (CSortedNegLinker<CConcept*>* triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 11027 |
CConcept* triggerConcept = triggerLinkerIt->getData(); |
| 11028 |
CConceptDescriptor* triggerConDes = nullptr; |
| 11029 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 11030 |
conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint); |
| 11031 |
CCONNECTIONDependencyNode* connDep = createCONNECTIONDependency(processIndi,triggerConDes,triggerDepTrackPoint,calcAlgContext); |
| 11032 |
connDep->setNext(triggerDeps); |
| 11033 |
triggerDeps = connDep; |
| 11034 |
} |
| 11035 |
|
| 11036 |
++mStatRepresentativeImplicationCount; |
| 11037 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 11038 |
CREPRESENTATIVEIMPLICATIONDependencyNode* implDepNode = createREPRESENTATIVEIMPLICATIONDependency(nextDepTrackPoint,processIndi,conDes,propDepTrackPoint,triggerDeps,calcAlgContext); |
| 11039 |
|
| 11040 |
propagateRepresentative(processIndi,procRepPropDes,repPropSet,nextDepTrackPoint,calcAlgContext); |
| 11041 |
reapplyConceptUpdatedRepresentative(processIndi,bindingConDes,bindingDepTrackPoint,conSet,reapplyQueue,calcAlgContext); |
| 11042 |
} |
| 11043 |
} |
| 11044 |
} |
| 11045 |
} |
| 11046 |
|
| 11047 |
|
| 11048 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateRepresentativeToSuccessor(CIndividualProcessNode* processIndi, CIndividualProcessNode*& succIndi, CSortedNegLinker<CConcept*>* conceptOpLinker, bool negate, CConceptDescriptor* conDes, CIndividualLinkEdge* restLink, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11049 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11050 |
CDependencyTrackPoint* depTrackPoint = conDes->getDependencyTrackPoint(); |
| 11051 |
CConcept* concept = conDes->getConcept(); |
| 11052 |
|
| 11053 |
|
| 11054 |
succIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 11055 |
CReapplyConceptLabelSet* conSet = succIndi->getReapplyConceptLabelSet(false); |
| 11056 |
|
| 11057 |
// create dependency |
| 11058 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 11059 |
bool continuePropagation = false; |
| 11060 |
|
| 11061 |
for (CSortedNegLinker<CConcept*>* conceptOpLinkerIt = conceptOpLinker; conceptOpLinkerIt; conceptOpLinkerIt = conceptOpLinkerIt->getNext()) { |
| 11062 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 11063 |
bool opConNeg = conceptOpLinkerIt->isNegated() ^ negate; |
| 11064 |
|
| 11065 |
CConceptDescriptor* bindingConDes = nullptr; |
| 11066 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 11067 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 11068 |
|
| 11069 |
CConceptRepresentativePropagationSetHash* conRepPropSetHash = processIndi->getConceptRepresentativePropagationSetHash(true); |
| 11070 |
CRepresentativePropagationSet* prevRepPropSet = conRepPropSetHash->getRepresentativePropagationSet(concept,false); |
| 11071 |
CConceptRepresentativePropagationSetHash* succConRepPropSetHash = succIndi->getConceptRepresentativePropagationSetHash(true); |
| 11072 |
CRepresentativePropagationSet* succRepPropSet = succConRepPropSetHash->getRepresentativePropagationSet(opConcept,true); |
| 11073 |
CRepresentativePropagationDescriptor* procRepPropDes = nullptr; |
| 11074 |
CDependencyTrackPoint* propDepTrackPoint = nullptr; |
| 11075 |
if (prevRepPropSet) { |
| 11076 |
procRepPropDes = prevRepPropSet->getOutgoingRepresentativePropagationDescriptorLinker(); |
| 11077 |
} |
| 11078 |
if (procRepPropDes) { |
| 11079 |
propDepTrackPoint = procRepPropDes->getDependencyTrackPoint(); |
| 11080 |
|
| 11081 |
if (!conSet->getConceptDescriptorAndReapplyQueue(opConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 11082 |
|
| 11083 |
++mStatRepresentativePropagateSuccCount; |
| 11084 |
if (!nextDepTrackPoint) { |
| 11085 |
conSet = succIndi->getReapplyConceptLabelSet(true); |
| 11086 |
CREPRESENTATIVEALLDependencyNode* repAllDepNode = createREPRESENTATIVEALLDependency(nextDepTrackPoint,processIndi,conDes,propDepTrackPoint,restLink->getDependencyTrackPoint(),calcAlgContext); |
| 11087 |
} |
| 11088 |
|
| 11089 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(opConcept,opConNeg,succIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 11090 |
succRepPropSet->setConceptDescriptor(bindingConDes); |
| 11091 |
|
| 11092 |
propagateRepresentative(succIndi,procRepPropDes,succRepPropSet,nextDepTrackPoint,calcAlgContext); |
| 11093 |
continuePropagation = true; |
| 11094 |
} else { |
| 11095 |
|
| 11096 |
if (requiresRepresentativePropagation(succIndi,procRepPropDes,succRepPropSet,calcAlgContext)) { |
| 11097 |
++mStatRepresentativePropagateSuccCount; |
| 11098 |
if (!nextDepTrackPoint) { |
| 11099 |
conSet = succIndi->getReapplyConceptLabelSet(true); |
| 11100 |
CREPRESENTATIVEALLDependencyNode* repAllDepNode = createREPRESENTATIVEALLDependency(nextDepTrackPoint,processIndi,conDes,propDepTrackPoint,restLink->getDependencyTrackPoint(),calcAlgContext); |
| 11101 |
} |
| 11102 |
|
| 11103 |
propagateRepresentative(succIndi,procRepPropDes,succRepPropSet,nextDepTrackPoint,calcAlgContext); |
| 11104 |
cint64 varCount = succRepPropSet->getOutgoingRepresentativePropagationDescriptorLinker()->getRepresentativeVariableBindingPathSetData()->getRepresentatedVariableCount(); |
| 11105 |
reapplyConceptUpdatedRepresentative(succIndi,bindingConDes,bindingDepTrackPoint,varCount,conSet,reapplyQueue,calcAlgContext); |
| 11106 |
continuePropagation = true; |
| 11107 |
} |
| 11108 |
} |
| 11109 |
} |
| 11110 |
} |
| 11111 |
|
| 11112 |
if (continuePropagation) { |
| 11113 |
addIndividualToProcessingQueue(succIndi,calcAlgContext); |
| 11114 |
} |
| 11115 |
} |
| 11116 |
|
| 11117 |
|
| 11118 |
|
| 11119 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEALLRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11120 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 11121 |
CConcept* concept = conDes->getConcept(); |
| 11122 |
CRole* role = concept->getRole(); |
| 11123 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 11124 |
cint64 opCount = concept->getOperandCount(); |
| 11125 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 11126 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11127 |
|
| 11128 |
CSortedNegLinker<CConcept*>* conceptOpLinker = concept->getOperandList(); |
| 11129 |
|
| 11130 |
STATINC(VARBINDRULEALLAPPLICATIONCOUNT,calcAlgContext); |
| 11131 |
|
| 11132 |
CIndividualLinkEdge* restLink = getLinkProcessingRestriction(conProDes); |
| 11133 |
if (restLink) { |
| 11134 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,restLink,calcAlgContext); |
| 11135 |
|
| 11136 |
propagateRepresentativeToSuccessor(processIndi,succIndi,opLinker,negate,conDes,restLink,calcAlgContext); |
| 11137 |
|
| 11138 |
} else { |
| 11139 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 11140 |
if (roleSuccHash) { |
| 11141 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role); |
| 11142 |
while (roleSuccIt.hasNext()) { |
| 11143 |
CIndividualLinkEdge* link = roleSuccIt.next(true); |
| 11144 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 11145 |
|
| 11146 |
propagateRepresentativeToSuccessor(processIndi,succIndi,opLinker,negate,conDes,link,calcAlgContext); |
| 11147 |
} |
| 11148 |
} |
| 11149 |
} |
| 11150 |
if (!conProDes->isConceptReapplied()) { |
| 11151 |
if (!isConceptInReapplyQueue(conDes,role,processIndi,calcAlgContext)) { |
| 11152 |
addConceptToReapplyQueue(conDes,role,processIndi,true,depTrackPoint,calcAlgContext); |
| 11153 |
} |
| 11154 |
} |
| 11155 |
} |
| 11156 |
|
| 11157 |
|
| 11158 |
|
| 11159 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyREPRESENTATIVEANDRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11160 |
|
| 11161 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 11162 |
CConcept* concept = conDes->getConcept(); |
| 11163 |
bool conceptNegation = negate; |
| 11164 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 11165 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 11166 |
|
| 11167 |
|
| 11168 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 11169 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11170 |
|
| 11171 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 11172 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 11173 |
|
| 11174 |
CConceptRepresentativePropagationSetHash* conRepPropHash = nullptr; |
| 11175 |
CRepresentativePropagationSet* prevRepPropSet = nullptr; |
| 11176 |
CRepresentativePropagationDescriptor* procRepPropDes = nullptr; |
| 11177 |
CDependencyTrackPoint* propDepTrackPoint = nullptr; |
| 11178 |
|
| 11179 |
STATINC(VARBINDRULEANDAPPLICATIONCOUNT,calcAlgContext); |
| 11180 |
|
| 11181 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = opConLinker; opConLinkerIt; opConLinkerIt = opConLinkerIt->getNext()) { |
| 11182 |
CConcept* bindingTriggerConcept = opConLinkerIt->getData(); |
| 11183 |
bool bindingTriggerConceptNegation = opConLinkerIt->isNegated()^conceptNegation; |
| 11184 |
|
| 11185 |
if (!conRepPropHash) { |
| 11186 |
conRepPropHash = processIndi->getConceptRepresentativePropagationSetHash(true); |
| 11187 |
} |
| 11188 |
if (!prevRepPropSet) { |
| 11189 |
prevRepPropSet = conRepPropHash->getRepresentativePropagationSet(concept,false); |
| 11190 |
} |
| 11191 |
if (prevRepPropSet) { |
| 11192 |
procRepPropDes = prevRepPropSet->getOutgoingRepresentativePropagationDescriptorLinker(); |
| 11193 |
} |
| 11194 |
if (procRepPropDes) { |
| 11195 |
propDepTrackPoint = procRepPropDes->getDependencyTrackPoint(); |
| 11196 |
CRepresentativePropagationSet* repPropSet = conRepPropHash->getRepresentativePropagationSet(bindingTriggerConcept,true); |
| 11197 |
|
| 11198 |
CConceptDescriptor* bindingConDes = nullptr; |
| 11199 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 11200 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 11201 |
|
| 11202 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 11203 |
|
| 11204 |
++mStatRepresentativePropagateCount; |
| 11205 |
if (!nextDepTrackPoint) { |
| 11206 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 11207 |
CREPRESENTATIVEANDDependencyNode* repPropDepNode = createREPRESENTATIVEANDDependency(nextDepTrackPoint,processIndi,conDes,propDepTrackPoint,calcAlgContext); |
| 11208 |
} |
| 11209 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 11210 |
repPropSet->setConceptDescriptor(bindingConDes); |
| 11211 |
|
| 11212 |
propagateRepresentative(processIndi,procRepPropDes,repPropSet,nextDepTrackPoint,calcAlgContext); |
| 11213 |
|
| 11214 |
} else { |
| 11215 |
|
| 11216 |
if (requiresRepresentativePropagation(processIndi,procRepPropDes,repPropSet,calcAlgContext)) { |
| 11217 |
++mStatRepresentativePropagateCount; |
| 11218 |
if (!nextDepTrackPoint) { |
| 11219 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 11220 |
CREPRESENTATIVEANDDependencyNode* repPropDepNode = createREPRESENTATIVEANDDependency(nextDepTrackPoint,processIndi,conDes,propDepTrackPoint,calcAlgContext); |
| 11221 |
} |
| 11222 |
|
| 11223 |
propagateRepresentative(processIndi,procRepPropDes,repPropSet,nextDepTrackPoint,calcAlgContext); |
| 11224 |
cint64 varCount = repPropSet->getOutgoingRepresentativePropagationDescriptorLinker()->getRepresentativeVariableBindingPathSetData()->getRepresentatedVariableCount(); |
| 11225 |
reapplyConceptUpdatedRepresentative(processIndi,bindingConDes,bindingDepTrackPoint,varCount,conSet,reapplyQueue,calcAlgContext); |
| 11226 |
} |
| 11227 |
} |
| 11228 |
} |
| 11229 |
} |
| 11230 |
} |
| 11231 |
|
| 11232 |
|
| 11233 |
|
| 11234 |
void CCalculationTableauCompletionTaskHandleAlgorithm::reapplyConceptUpdatedRepresentative(CIndividualProcessNode*& processIndi, CConceptDescriptor* bindingConDes, CDependencyTrackPoint* bindingDepTrackPoint, CReapplyConceptLabelSet* conSet, CCondensedReapplyQueue* reapplyQueue, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11235 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 11236 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 11237 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,true,calcAlgContext); |
| 11238 |
if (!reapplyQueue->isEmpty()) { |
| 11239 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 11240 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 11241 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 11242 |
} |
| 11243 |
} |
| 11244 |
|
| 11245 |
|
| 11246 |
void CCalculationTableauCompletionTaskHandleAlgorithm::reapplyConceptUpdatedRepresentative(CIndividualProcessNode*& processIndi, CConceptDescriptor* bindingConDes, CDependencyTrackPoint* bindingDepTrackPoint, cint64 bindingCount, CReapplyConceptLabelSet* conSet, CCondensedReapplyQueue* reapplyQueue, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11247 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 11248 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 11249 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,bindingCount,calcAlgContext); |
| 11250 |
if (!reapplyQueue->isEmpty()) { |
| 11251 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 11252 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 11253 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 11254 |
} |
| 11255 |
} |
| 11256 |
|
| 11257 |
|
| 11258 |
void CCalculationTableauCompletionTaskHandleAlgorithm::updateRepresentativePropagationSet(CIndividualProcessNode*& processIndi, CRepresentativePropagationSet* repPropSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11259 |
if (repPropSet->getLastProcessedIncomingRepresentativePropagationDescriptorLinker() != repPropSet->getIncomingRepresentativePropagationDescriptorLinker()) { |
| 11260 |
CRepresentativePropagationDescriptor* lastRepPropDes = repPropSet->getLastProcessedIncomingRepresentativePropagationDescriptorLinker(); |
| 11261 |
CRepresentativePropagationDescriptor* lastIncRepPropDes = repPropSet->getIncomingRepresentativePropagationDescriptorLinker(); |
| 11262 |
CRepresentativePropagationDescriptor* lastOutRepPropDes = repPropSet->getOutgoingRepresentativePropagationDescriptorLinker(); |
| 11263 |
repPropSet->setLastProcessedIncomingRepresentativePropagationDescriptorLinker(lastIncRepPropDes); |
| 11264 |
|
| 11265 |
|
| 11266 |
if (!repPropSet->getOutgoingRepresentativePropagationDescriptorLinker() && !lastIncRepPropDes->hasNext()) { |
| 11267 |
repPropSet->setOutgoingRepresentativePropagationDescriptorLinker(lastIncRepPropDes); |
| 11268 |
if (lastIncRepPropDes->getRepresentativeVariableBindingPathSetData()->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger())) { |
| 11269 |
lastIncRepPropDes->getRepresentativeVariableBindingPathSetData()->incShareCount(); |
| 11270 |
} |
| 11271 |
} else { |
| 11272 |
++mStatRepresentativePropagateUseRepresentativeCount; |
| 11273 |
|
| 11274 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 11275 |
CRepresentativeVariableBindingPathSetHash* repVarBindPathSetHash = procDataBox->getRepresentativeVariableBindingPathSetHash(true); |
| 11276 |
|
| 11277 |
CRepresentativeVariableBindingPathSetData* lastRepVarBindPathSetData = nullptr; |
| 11278 |
bool migrateable = false; |
| 11279 |
if (lastOutRepPropDes) { |
| 11280 |
lastRepVarBindPathSetData = lastOutRepPropDes->getRepresentativeVariableBindingPathSetData(); |
| 11281 |
} |
| 11282 |
if (lastRepVarBindPathSetData) { |
| 11283 |
if (lastRepVarBindPathSetData->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger())) { |
| 11284 |
lastRepVarBindPathSetData->decShareCount(); |
| 11285 |
if (lastRepVarBindPathSetData->isMigratable() && lastRepVarBindPathSetData->getShareCount() <= 0 && lastRepVarBindPathSetData->getUseCount() <= 20) { |
| 11286 |
migrateable = true; |
| 11287 |
} |
| 11288 |
} |
| 11289 |
} |
| 11290 |
|
| 11291 |
CRepresentativeVariableBindingPathSetData* repVarBindPathSetData = repVarBindPathSetHash->getRepresentativeVariableBindingPathSetData(repPropSet,true); |
| 11292 |
repVarBindPathSetData->incShareCount(); |
| 11293 |
repVarBindPathSetData->incUseCount(); |
| 11294 |
if (!repVarBindPathSetData->hasMigrateData()) { |
| 11295 |
++mStatRepresentativePropagateNewRepresentativeCount; |
| 11296 |
repVarBindPathSetData->setRepresentativeID(procDataBox->getNextRepresentativeVariableBindingPathID(true)); |
| 11297 |
bool updateNewOnly = false; |
| 11298 |
if (migrateable) { |
| 11299 |
updateNewOnly = true; |
| 11300 |
repVarBindPathSetData->takeMigrateDataFrom(lastRepVarBindPathSetData); |
| 11301 |
} else if (lastRepVarBindPathSetData) { |
| 11302 |
updateNewOnly = true; |
| 11303 |
repVarBindPathSetData->copyMigrateDataFrom(lastRepVarBindPathSetData); |
| 11304 |
} |
| 11305 |
|
| 11306 |
CRepresentativeVariableBindingPathSetMigrateData* repMigrateData = repVarBindPathSetData->getMigrateData(true); |
| 11307 |
CRepresentativeVariableBindingPathMap* repVarBindPathMap = repMigrateData->getRepresentativeVariableBindingPathMap(); |
| 11308 |
CRepresentativePropagationDescriptor* untilUpdateRepPropDes = nullptr; |
| 11309 |
if (updateNewOnly) { |
| 11310 |
untilUpdateRepPropDes = lastRepPropDes; |
| 11311 |
} |
| 11312 |
for (CRepresentativePropagationDescriptor* newRepPropDesIt = lastIncRepPropDes; newRepPropDesIt != untilUpdateRepPropDes; newRepPropDesIt = newRepPropDesIt->getNext()) { |
| 11313 |
CRepresentativeVariableBindingPathSetData* newRepVarBindPathSetData = newRepPropDesIt->getRepresentativeVariableBindingPathSetData(); |
| 11314 |
CRepresentativeVariableBindingPathSetMigrateData* newRepMigrateData = newRepVarBindPathSetData->getMigrateData(true); |
| 11315 |
repMigrateData->getRepresentativeContainingMap()->insertContainedRepresentative(newRepVarBindPathSetData,true); |
| 11316 |
repVarBindPathSetData->addKeySignatureValue(newRepVarBindPathSetData->getRepresentativeKey()); |
| 11317 |
|
| 11318 |
CRepresentativeVariableBindingPathMap* newRepVarBindPathMap = newRepMigrateData->getRepresentativeVariableBindingPathMap(); |
| 11319 |
|
| 11320 |
if (newRepVarBindPathMap->count()*mMapComparisonDirectLookupFactor <= repVarBindPathMap->count()) { |
| 11321 |
for (CRepresentativeVariableBindingPathMap::const_iterator propIt = newRepVarBindPathMap->constBegin(), propItEnd = newRepVarBindPathMap->constEnd(); propIt != propItEnd; ++propIt) { |
| 11322 |
cint64 propVarBindPathID = propIt.key(); |
| 11323 |
if (!repVarBindPathMap->contains(propVarBindPathID)) { |
| 11324 |
repVarBindPathMap->insert(propVarBindPathID,CRepresentativeVariableBindingPathMapData(propIt.value().getVariableBindingPath(),newRepVarBindPathSetData)); |
| 11325 |
} |
| 11326 |
} |
| 11327 |
} else { |
| 11328 |
|
| 11329 |
CRepresentativeVariableBindingPathMap::const_iterator availIt = repVarBindPathMap->begin(), availItEnd = repVarBindPathMap->end(); |
| 11330 |
CRepresentativeVariableBindingPathMap::const_iterator propIt = newRepVarBindPathMap->constBegin(), propItEnd = newRepVarBindPathMap->constEnd(); |
| 11331 |
|
| 11332 |
while (propIt != propItEnd) { |
| 11333 |
cint64 propID = propIt.key(); |
| 11334 |
if (availIt == availItEnd) { |
| 11335 |
availIt = repVarBindPathMap->insert(propID,CRepresentativeVariableBindingPathMapData(propIt.value().getVariableBindingPath(),newRepVarBindPathSetData)); |
| 11336 |
++propIt; |
| 11337 |
++availIt; |
| 11338 |
} else { |
| 11339 |
cint64 availID = availIt.key(); |
| 11340 |
if (availID < propID) { |
| 11341 |
++availIt; |
| 11342 |
} else if (availID > propID) { |
| 11343 |
availIt = repVarBindPathMap->insert(propID,CRepresentativeVariableBindingPathMapData(propIt.value().getVariableBindingPath(),newRepVarBindPathSetData)); |
| 11344 |
++propIt; |
| 11345 |
++availIt; |
| 11346 |
} else { |
| 11347 |
++propIt; |
| 11348 |
++availIt; |
| 11349 |
} |
| 11350 |
} |
| 11351 |
} |
| 11352 |
} |
| 11353 |
} |
| 11354 |
|
| 11355 |
} else { |
| 11356 |
++mStatRepresentativePropagateReusedRepresentativeCount; |
| 11357 |
} |
| 11358 |
|
| 11359 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11360 |
CRepresentativePropagationDescriptor* outPropRepDes = CObjectAllocator<CRepresentativePropagationDescriptor>::allocateAndConstruct(taskMemMan); |
| 11361 |
|
| 11362 |
|
| 11363 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 11364 |
CRepresentativeVariableBindingPathMap* repVarBindPathMap = repVarBindPathSetData->getMigrateData(false)->getRepresentativeVariableBindingPathMap(); |
| 11365 |
CRepresentativeContainingMap* repConMap = repVarBindPathSetData->getMigrateData(false)->getRepresentativeContainingMap(); |
| 11366 |
CRESOLVEREPRESENTATIVEDependencyNode* resolveRepNode = createRESOLVEREPRESENTATIVEDependency(nextDepTrackPoint,processIndi,repPropSet->getConceptDescriptor(),repVarBindPathMap,repPropSet->getRepresentativePropagationMap(),lastIncRepPropDes->getDependencyTrackPoint(),lastOutRepPropDes->getDependencyTrackPoint(),calcAlgContext); |
| 11367 |
|
| 11368 |
outPropRepDes->initRepresentativeDescriptor(repVarBindPathSetData,nextDepTrackPoint); |
| 11369 |
repPropSet->addOutgoingRepresentativePropagationDescriptorLinker(outPropRepDes); |
| 11370 |
|
| 11371 |
} |
| 11372 |
} |
| 11373 |
} |
| 11374 |
|
| 11375 |
|
| 11376 |
|
| 11377 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateRepresentative(CIndividualProcessNode*& processIndi, CRepresentativePropagationDescriptor* repPropDes, CRepresentativePropagationSet* repPropSet, CDependencyTrackPoint* nextDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11378 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11379 |
CRepresentativePropagationDescriptor* propagateRepDes = CObjectAllocator<CRepresentativePropagationDescriptor>::allocateAndConstruct(taskMemMan); |
| 11380 |
|
| 11381 |
propagateRepDes->initRepresentativeDescriptor(repPropDes->getRepresentativeVariableBindingPathSetData(),nextDepTrackPoint); |
| 11382 |
repPropSet->addIncomingRepresentativePropagation(propagateRepDes); |
| 11383 |
|
| 11384 |
updateRepresentativePropagationSet(processIndi,repPropSet,calcAlgContext); |
| 11385 |
} |
| 11386 |
|
| 11387 |
|
| 11388 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::requiresRepresentativePropagation(CIndividualProcessNode*& processIndi, CRepresentativePropagationDescriptor* repPropDes, CRepresentativePropagationSet* testRepPropSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11389 |
cint64 propRepID = repPropDes->getRepresentativeVariableBindingPathSetData()->getRepresentativeID(); |
| 11390 |
if (testRepPropSet->containsRepresentativePropagation(propRepID)) { |
| 11391 |
return false; |
| 11392 |
} |
| 11393 |
|
| 11394 |
CRepresentativePropagationDescriptor* lastRepPropDes = testRepPropSet->getOutgoingRepresentativePropagationDescriptorLinker(); |
| 11395 |
if (lastRepPropDes) { |
| 11396 |
CRepresentativeVariableBindingPathSetData* availRepData = lastRepPropDes->getRepresentativeVariableBindingPathSetData(); |
| 11397 |
CRepresentativeVariableBindingPathSetMigrateData* availMigData = availRepData->getMigrateData(false); |
| 11398 |
if (availMigData) { |
| 11399 |
CRepresentativeContainingMap* repContMap = availMigData->getRepresentativeContainingMap(); |
| 11400 |
if (repContMap->contains(propRepID)) { |
| 11401 |
return false; |
| 11402 |
} |
| 11403 |
CRepresentativeVariableBindingPathMap* availVarBindPathMap = availMigData->getRepresentativeVariableBindingPathMap(); |
| 11404 |
CRepresentativeVariableBindingPathSetMigrateData* propMigData = repPropDes->getRepresentativeVariableBindingPathSetData()->getMigrateData(false); |
| 11405 |
CRepresentativeVariableBindingPathMap* propVarBindPathMap = propMigData->getRepresentativeVariableBindingPathMap(); |
| 11406 |
|
| 11407 |
|
| 11408 |
if (propVarBindPathMap->count()*mMapComparisonDirectLookupFactor <= availVarBindPathMap->count()) { |
| 11409 |
for (CRepresentativeVariableBindingPathMap::const_iterator propIt = propVarBindPathMap->constBegin(), propItEnd = propVarBindPathMap->constEnd(); propIt != propItEnd; ++propIt) { |
| 11410 |
cint64 propVarBindPathID = propIt.key(); |
| 11411 |
if (!availVarBindPathMap->contains(propVarBindPathID)) { |
| 11412 |
return true; |
| 11413 |
} |
| 11414 |
} |
| 11415 |
return false; |
| 11416 |
} else { |
| 11417 |
CRepresentativeVariableBindingPathMap::const_iterator availIt = availVarBindPathMap->constBegin(), availItEnd = availVarBindPathMap->constEnd(); |
| 11418 |
CRepresentativeVariableBindingPathMap::const_iterator propIt = propVarBindPathMap->constBegin(), propItEnd = propVarBindPathMap->constEnd(); |
| 11419 |
|
| 11420 |
while (propIt != propItEnd) { |
| 11421 |
cint64 propID = propIt.key(); |
| 11422 |
if (availIt == availItEnd) { |
| 11423 |
return true; |
| 11424 |
} |
| 11425 |
cint64 availID = availIt.key(); |
| 11426 |
if (availID < propID) { |
| 11427 |
++availIt; |
| 11428 |
} else if (propID < availID) { |
| 11429 |
return true; |
| 11430 |
} else { |
| 11431 |
++availIt; |
| 11432 |
++propIt; |
| 11433 |
} |
| 11434 |
} |
| 11435 |
return false; |
| 11436 |
|
| 11437 |
} |
| 11438 |
} |
| 11439 |
|
| 11440 |
} |
| 11441 |
return true; |
| 11442 |
} |
| 11443 |
|
| 11444 |
|
| 11445 |
|
| 11446 |
|
| 11447 |
|
| 11448 |
|
| 11449 |
|
| 11450 |
|
| 11451 |
|
| 11452 |
|
| 11453 |
|
| 11454 |
|
| 11455 |
|
| 11456 |
|
| 11457 |
|
| 11458 |
|
| 11459 |
|
| 11460 |
|
| 11461 |
|
| 11462 |
|
| 11463 |
|
| 11464 |
|
| 11465 |
|
| 11466 |
|
| 11467 |
|
| 11468 |
|
| 11469 |
|
| 11470 |
|
| 11471 |
|
| 11472 |
|
| 11473 |
|
| 11474 |
|
| 11475 |
|
| 11476 |
|
| 11477 |
|
| 11478 |
|
| 11479 |
|
| 11480 |
|
| 11481 |
|
| 11482 |
|
| 11483 |
|
| 11484 |
|
| 11485 |
|
| 11486 |
|
| 11487 |
|
| 11488 |
|
| 11489 |
|
| 11490 |
|
| 11491 |
|
| 11492 |
|
| 11493 |
|
| 11494 |
|
| 11495 |
|
| 11496 |
|
| 11497 |
|
| 11498 |
|
| 11499 |
|
| 11500 |
|
| 11501 |
|
| 11502 |
|
| 11503 |
|
| 11504 |
|
| 11505 |
|
| 11506 |
|
| 11507 |
|
| 11508 |
|
| 11509 |
|
| 11510 |
|
| 11511 |
|
| 11512 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyVARIABLEBINDINGANDRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11513 |
|
| 11514 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 11515 |
CConcept* concept = conDes->getConcept(); |
| 11516 |
bool conceptNegation = negate; |
| 11517 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 11518 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 11519 |
|
| 11520 |
|
| 11521 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 11522 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11523 |
|
| 11524 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 11525 |
|
| 11526 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 11527 |
|
| 11528 |
STATINC(VARBINDRULEANDAPPLICATIONCOUNT,calcAlgContext); |
| 11529 |
|
| 11530 |
|
| 11531 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = opConLinker; opConLinkerIt; opConLinkerIt = opConLinkerIt->getNext()) { |
| 11532 |
CConcept* bindingTriggerConcept = opConLinkerIt->getData(); |
| 11533 |
bool bindingTriggerConceptNegation = opConLinkerIt->isNegated()^conceptNegation; |
| 11534 |
|
| 11535 |
CConceptDescriptor* bindingConDes = nullptr; |
| 11536 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 11537 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 11538 |
|
| 11539 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 11540 |
if (!nextDepTrackPoint) { |
| 11541 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 11542 |
CVARBINDPROPAGATEANDDependencyNode* bindDepNode = createVARBINDPROPAGATEANDDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 11543 |
} |
| 11544 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 11545 |
|
| 11546 |
CConceptVariableBindingPathSetHash* conVarBindingSetHash = processIndi->getConceptVariableBindingPathSetHash(true); |
| 11547 |
CVariableBindingPathSet* prevVarBindingPathSet = conVarBindingSetHash->getVariableBindingPathSet(concept,false); |
| 11548 |
CVariableBindingPathSet* varBindingPathSet = conVarBindingSetHash->getVariableBindingPathSet(bindingTriggerConcept,true); |
| 11549 |
varBindingPathSet->setConceptDescriptor(bindingConDes); |
| 11550 |
|
| 11551 |
propagateInitialVariableBindings(processIndi,bindingConDes,varBindingPathSet,prevVarBindingPathSet,nullptr, conVarBindingSetHash,calcAlgContext); |
| 11552 |
|
| 11553 |
|
| 11554 |
|
| 11555 |
} else { |
| 11556 |
|
| 11557 |
CConceptVariableBindingPathSetHash* conVarBindingSetHash = processIndi->getConceptVariableBindingPathSetHash(true); |
| 11558 |
CVariableBindingPathSet* prevVarBindingPathSet = conVarBindingSetHash->getVariableBindingPathSet(concept,false); |
| 11559 |
CVariableBindingPathSet* varBindingPathSet = conVarBindingSetHash->getVariableBindingPathSet(bindingTriggerConcept,true); |
| 11560 |
|
| 11561 |
|
| 11562 |
|
| 11563 |
if (propagateFreshVariableBindings(processIndi,conDes,varBindingPathSet,prevVarBindingPathSet,nullptr, conVarBindingSetHash, calcAlgContext)) { |
| 11564 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 11565 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true);; |
| 11566 |
cint64 bindingCount = varBindingPathSet->getVariableBindingPathMap()->count(); |
| 11567 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,true,calcAlgContext); |
| 11568 |
if (!reapplyQueue->isEmpty()) { |
| 11569 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 11570 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 11571 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 11572 |
} |
| 11573 |
} |
| 11574 |
} |
| 11575 |
} |
| 11576 |
} |
| 11577 |
|
| 11578 |
|
| 11579 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateInitialVariableBindings(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CVariableBindingPathSet* newVarBindingSet, CVariableBindingPathSet* prevVarBindingSet, CDependency* otherDependencies, CConceptVariableBindingPathSetHash* conVarBindingSetHash, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11580 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11581 |
bool propagations = false; |
| 11582 |
CVariableBindingPathDescriptor* newVarBindPathDesLinker = nullptr; |
| 11583 |
if (prevVarBindingSet) { |
| 11584 |
newVarBindingSet->copyVariableBindingPaths(prevVarBindingSet->getVariableBindingPathMap()); |
| 11585 |
CVariableBindingPathMap* varBindMap = newVarBindingSet->getVariableBindingPathMap(); |
| 11586 |
for (CVariableBindingPathMap::iterator it = varBindMap->begin(), itEnd = varBindMap->end(); it != itEnd; ++it) { |
| 11587 |
++mStatVarBindingPropagateCount; |
| 11588 |
++mStatVarBindingPropagateInitialCount; |
| 11589 |
STATINC(VARBINDPROPAGATEDCOUNT,calcAlgContext); |
| 11590 |
STATINC(VARBINDPROPAGATEDINITIALCOUNT,calcAlgContext); |
| 11591 |
CVariableBindingPathMapData& varBindPathMapData = it.value(); |
| 11592 |
CVariableBindingPathDescriptor* prevVarBindPathDes = varBindPathMapData.getVariableBindingPathDescriptor(); |
| 11593 |
CVariableBindingPathDescriptor* newVarBindPathDes = CObjectAllocator<CVariableBindingPathDescriptor>::allocateAndConstruct(taskMemMan); |
| 11594 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 11595 |
CPROPAGATEVARIABLEBINDINGDependencyNode* bindDepNode = createPROPAGATEVARIABLEBINDINGDependency(newDepTrackPoint,processIndi,conDes,prevVarBindPathDes->getDependencyTrackPoint(),otherDependencies,calcAlgContext); |
| 11596 |
newVarBindPathDes->initVariableBindingPathDescriptor(prevVarBindPathDes->getVariableBindingPath(),newDepTrackPoint); |
| 11597 |
varBindPathMapData.setVariableBindingPathDescriptor(newVarBindPathDes); |
| 11598 |
newVarBindPathDesLinker = newVarBindPathDes->append(newVarBindPathDesLinker); |
| 11599 |
propagations = true; |
| 11600 |
} |
| 11601 |
if (newVarBindPathDesLinker) { |
| 11602 |
newVarBindingSet->addVariableBindingPathDescriptorLinker(newVarBindPathDesLinker); |
| 11603 |
conVarBindingSetHash->setLastVariableBindingDescriptionLinker(newVarBindPathDesLinker); |
| 11604 |
} |
| 11605 |
} |
| 11606 |
return propagations; |
| 11607 |
} |
| 11608 |
|
| 11609 |
|
| 11610 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateFreshVariableBindings(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CVariableBindingPathSet* newVarBindingSet, CVariableBindingPathSet* prevVarBindingSet, CDependency* otherDependencies, CConceptVariableBindingPathSetHash* conVarBindingSetHash, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11611 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11612 |
bool propagations = false; |
| 11613 |
if (prevVarBindingSet) { |
| 11614 |
CVariableBindingPathMap* prevVarBindPathMap = prevVarBindingSet->getVariableBindingPathMap(); |
| 11615 |
CVariableBindingPathMap* newVarBindPathMap = newVarBindingSet->getVariableBindingPathMap(); |
| 11616 |
|
| 11617 |
CVariableBindingPathMap::iterator itNew = newVarBindPathMap->begin(); |
| 11618 |
CVariableBindingPathMap::const_iterator itPrev = prevVarBindPathMap->constBegin(), itPrevEnd = prevVarBindPathMap->constEnd(); |
| 11619 |
|
| 11620 |
CVariableBindingPathDescriptor* newVarBindPathDesLinker = nullptr; |
| 11621 |
|
| 11622 |
while (itPrev != itPrevEnd) { |
| 11623 |
cint64 prevPropID = itPrev.key(); |
| 11624 |
bool doPropagation = false; |
| 11625 |
if (itNew == newVarBindPathMap->end()) { |
| 11626 |
doPropagation = true; |
| 11627 |
} else { |
| 11628 |
cint64 newPropID = itNew.key(); |
| 11629 |
if (newPropID < prevPropID) { |
| 11630 |
++itNew; |
| 11631 |
} else if (newPropID == prevPropID) { |
| 11632 |
++itNew; |
| 11633 |
++itPrev; |
| 11634 |
} else { |
| 11635 |
doPropagation = true; |
| 11636 |
} |
| 11637 |
} |
| 11638 |
if (doPropagation) { |
| 11639 |
++mStatVarBindingPropagateCount; |
| 11640 |
++mStatVarBindingPropagateFreshCount; |
| 11641 |
STATINC(VARBINDPROPAGATEDCOUNT,calcAlgContext); |
| 11642 |
STATINC(VARBINDPROPAGATEDFRESHCOUNT,calcAlgContext); |
| 11643 |
const CVariableBindingPathMapData& prevVarBindPathMapData = itPrev.value(); |
| 11644 |
CVariableBindingPathDescriptor* prevVarBindPathDes = prevVarBindPathMapData.getVariableBindingPathDescriptor(); |
| 11645 |
|
| 11646 |
CVariableBindingPathDescriptor* newVarBindPathDes = CObjectAllocator<CVariableBindingPathDescriptor>::allocateAndConstruct(taskMemMan); |
| 11647 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 11648 |
CPROPAGATEVARIABLEBINDINGDependencyNode* bindDepNode = createPROPAGATEVARIABLEBINDINGDependency(newDepTrackPoint,processIndi,conDes,prevVarBindPathDes->getDependencyTrackPoint(),otherDependencies,calcAlgContext); |
| 11649 |
CVariableBindingPath* varBindingPath = prevVarBindPathDes->getVariableBindingPath(); |
| 11650 |
newVarBindPathDes->initVariableBindingPathDescriptor(varBindingPath,newDepTrackPoint); |
| 11651 |
|
| 11652 |
itNew = newVarBindPathMap->insert(varBindingPath->getPropagationID(),CVariableBindingPathMapData(newVarBindPathDes)); |
| 11653 |
|
| 11654 |
newVarBindPathDesLinker = newVarBindPathDes->append(newVarBindPathDesLinker); |
| 11655 |
propagations = true; |
| 11656 |
} |
| 11657 |
} |
| 11658 |
if (newVarBindPathDesLinker) { |
| 11659 |
newVarBindingSet->addVariableBindingPathDescriptorLinker(newVarBindPathDesLinker); |
| 11660 |
conVarBindingSetHash->setLastVariableBindingDescriptionLinker(newVarBindPathDesLinker); |
| 11661 |
} |
| 11662 |
} |
| 11663 |
return propagations; |
| 11664 |
} |
| 11665 |
|
| 11666 |
|
| 11667 |
|
| 11668 |
|
| 11669 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateVariableBindingsToSuccessor(CIndividualProcessNode* processIndi, CIndividualProcessNode*& succIndi, CSortedNegLinker<CConcept*>* conceptOpLinker, bool negate, CConceptDescriptor* conDes, CIndividualLinkEdge* restLink, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11670 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11671 |
CDependencyTrackPoint* depTrackPoint = conDes->getDependencyTrackPoint(); |
| 11672 |
CConcept* concept = conDes->getConcept(); |
| 11673 |
|
| 11674 |
|
| 11675 |
succIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 11676 |
CReapplyConceptLabelSet* conSet = succIndi->getReapplyConceptLabelSet(false); |
| 11677 |
|
| 11678 |
// create dependency |
| 11679 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 11680 |
bool continuePropagation = false; |
| 11681 |
|
| 11682 |
for (CSortedNegLinker<CConcept*>* conceptOpLinkerIt = conceptOpLinker; conceptOpLinkerIt; conceptOpLinkerIt = conceptOpLinkerIt->getNext()) { |
| 11683 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 11684 |
bool opConNeg = conceptOpLinkerIt->isNegated() ^ negate; |
| 11685 |
|
| 11686 |
CConceptDescriptor* bindingConDes = nullptr; |
| 11687 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 11688 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 11689 |
if (!conSet->getConceptDescriptorAndReapplyQueue(opConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 11690 |
|
| 11691 |
|
| 11692 |
if (!nextDepTrackPoint) { |
| 11693 |
conSet = succIndi->getReapplyConceptLabelSet(true); |
| 11694 |
CVARBINDPROPAGATEALLDependencyNode* bindDepNode = createVARBINDPROPAGATEALLDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,restLink->getDependencyTrackPoint(),calcAlgContext); |
| 11695 |
} |
| 11696 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(opConcept,opConNeg,succIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 11697 |
|
| 11698 |
CConceptVariableBindingPathSetHash* conVarBindingPathSetHash = processIndi->getConceptVariableBindingPathSetHash(true); |
| 11699 |
CVariableBindingPathSet* prevVarBindingPathSet = conVarBindingPathSetHash->getVariableBindingPathSet(concept,false); |
| 11700 |
CConceptVariableBindingPathSetHash* succConVarBindingPathSetHash = succIndi->getConceptVariableBindingPathSetHash(true); |
| 11701 |
CVariableBindingPathSet* succVarBindingPathSet = succConVarBindingPathSetHash->getVariableBindingPathSet(opConcept,true); |
| 11702 |
succVarBindingPathSet->setConceptDescriptor(bindingConDes); |
| 11703 |
|
| 11704 |
propagateInitialVariableBindingsToSuccessor(processIndi,succIndi,bindingConDes,succVarBindingPathSet,prevVarBindingPathSet,restLink, succConVarBindingPathSetHash,calcAlgContext); |
| 11705 |
continuePropagation = true; |
| 11706 |
} else { |
| 11707 |
|
| 11708 |
CConceptVariableBindingPathSetHash* conVarBindingPathSetHash = processIndi->getConceptVariableBindingPathSetHash(true); |
| 11709 |
CVariableBindingPathSet* prevVarBindingPathSet = conVarBindingPathSetHash->getVariableBindingPathSet(concept,false); |
| 11710 |
CConceptVariableBindingPathSetHash* succConVarBindingPathSetHash = succIndi->getConceptVariableBindingPathSetHash(true); |
| 11711 |
CVariableBindingPathSet* succVarBindingPathSet = succConVarBindingPathSetHash->getVariableBindingPathSet(opConcept,true); |
| 11712 |
|
| 11713 |
if (propagateFreshVariableBindingsToSuccessor(processIndi,succIndi,conDes,succVarBindingPathSet,prevVarBindingPathSet,restLink, succConVarBindingPathSetHash,calcAlgContext)) { |
| 11714 |
setIndividualNodeConceptLabelSetModified(succIndi,calcAlgContext); |
| 11715 |
CConceptProcessingQueue* conProQueue = succIndi->getConceptProcessingQueue(true);; |
| 11716 |
cint64 bindingCount = succVarBindingPathSet->getVariableBindingPathMap()->count(); |
| 11717 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,succIndi,true,calcAlgContext); |
| 11718 |
if (!reapplyQueue->isEmpty()) { |
| 11719 |
conSet = succIndi->getReapplyConceptLabelSet(true); |
| 11720 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 11721 |
applyReapplyQueueConcepts(succIndi,&reapplyQueueIt,calcAlgContext); |
| 11722 |
} |
| 11723 |
continuePropagation = true; |
| 11724 |
} |
| 11725 |
} |
| 11726 |
} |
| 11727 |
|
| 11728 |
if (continuePropagation) { |
| 11729 |
addIndividualToProcessingQueue(succIndi,calcAlgContext); |
| 11730 |
} |
| 11731 |
|
| 11732 |
} |
| 11733 |
|
| 11734 |
|
| 11735 |
|
| 11736 |
|
| 11737 |
|
| 11738 |
|
| 11739 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateInitialVariableBindingsToSuccessor(CIndividualProcessNode*& processIndi, CIndividualProcessNode* succIndi, CConceptDescriptor* conDes, CVariableBindingPathSet* newVarBindingPathSet, CVariableBindingPathSet* prevVarBindingPathSet, CIndividualLinkEdge* restLink, CConceptVariableBindingPathSetHash* conVarBindingSetHash, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11740 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11741 |
bool propagations = false; |
| 11742 |
CVariableBindingPathDescriptor* newVarBindPathDesLinker = nullptr; |
| 11743 |
if (prevVarBindingPathSet) { |
| 11744 |
newVarBindingPathSet->copyVariableBindingPaths(prevVarBindingPathSet->getVariableBindingPathMap()); |
| 11745 |
CVariableBindingPathMap* varBindPathMap = newVarBindingPathSet->getVariableBindingPathMap(); |
| 11746 |
for (CVariableBindingPathMap::iterator it = varBindPathMap->begin(), itEnd = varBindPathMap->end(); it != itEnd; ++it) { |
| 11747 |
STATINC(VARBINDPROPAGATEDCOUNT,calcAlgContext); |
| 11748 |
STATINC(VARBINDPROPAGATEDINITIALCOUNT,calcAlgContext); |
| 11749 |
++mStatVarBindingPropagateSuccCount; |
| 11750 |
++mStatVarBindingPropagateSuccInitialCount; |
| 11751 |
CVariableBindingPathMapData& varBindPathMapData = it.value(); |
| 11752 |
CVariableBindingPathDescriptor* prevVarBindPathDes = varBindPathMapData.getVariableBindingPathDescriptor(); |
| 11753 |
CVariableBindingPathDescriptor* newVarBindPathDes = CObjectAllocator<CVariableBindingPathDescriptor>::allocateAndConstruct(taskMemMan); |
| 11754 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 11755 |
CPROPAGATEVARIABLEBINDINGSSUCCESSORDependencyNode* bindDepNode = createPROPAGATEVARIABLEBINDINGSSUCCESSORDependency(newDepTrackPoint,processIndi,conDes,prevVarBindPathDes->getDependencyTrackPoint(),restLink->getDependencyTrackPoint(),calcAlgContext); |
| 11756 |
newVarBindPathDes->initVariableBindingPathDescriptor(prevVarBindPathDes->getVariableBindingPath(),newDepTrackPoint); |
| 11757 |
varBindPathMapData.setVariableBindingPathDescriptor(newVarBindPathDes); |
| 11758 |
newVarBindPathDesLinker = newVarBindPathDes->append(newVarBindPathDesLinker); |
| 11759 |
propagations = true; |
| 11760 |
} |
| 11761 |
if (newVarBindPathDesLinker) { |
| 11762 |
newVarBindingPathSet->addVariableBindingPathDescriptorLinker(newVarBindPathDesLinker); |
| 11763 |
conVarBindingSetHash->setLastVariableBindingDescriptionLinker(newVarBindPathDesLinker); |
| 11764 |
} |
| 11765 |
} |
| 11766 |
return propagations; |
| 11767 |
} |
| 11768 |
|
| 11769 |
|
| 11770 |
|
| 11771 |
|
| 11772 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateFreshVariableBindingsToSuccessor(CIndividualProcessNode*& processIndi, CIndividualProcessNode* succIndi, CConceptDescriptor* conDes, CVariableBindingPathSet* newVarBindingPathSet, CVariableBindingPathSet* prevVarBindingPathSet, CIndividualLinkEdge* restLink, CConceptVariableBindingPathSetHash* conVarBindingSetHash, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11773 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11774 |
bool propagations = false; |
| 11775 |
if (prevVarBindingPathSet) { |
| 11776 |
|
| 11777 |
CVariableBindingPathMap* prevVarBindPathMap = prevVarBindingPathSet->getVariableBindingPathMap(); |
| 11778 |
CVariableBindingPathMap* newVarBindPathMap = newVarBindingPathSet->getVariableBindingPathMap(); |
| 11779 |
|
| 11780 |
CVariableBindingPathMap::iterator itNew = newVarBindPathMap->begin(); |
| 11781 |
CVariableBindingPathMap::const_iterator itPrev = prevVarBindPathMap->constBegin(), itPrevEnd = prevVarBindPathMap->constEnd(); |
| 11782 |
|
| 11783 |
CVariableBindingPathDescriptor* newVarBindPathDesLinker = nullptr; |
| 11784 |
|
| 11785 |
while (itPrev != itPrevEnd) { |
| 11786 |
cint64 prevPropID = itPrev.key(); |
| 11787 |
bool doPropagation = false; |
| 11788 |
if (itNew == newVarBindPathMap->end()) { |
| 11789 |
doPropagation = true; |
| 11790 |
} else { |
| 11791 |
cint64 newPropID = itNew.key(); |
| 11792 |
if (newPropID < prevPropID) { |
| 11793 |
++itNew; |
| 11794 |
} else if (newPropID == prevPropID) { |
| 11795 |
++itNew; |
| 11796 |
++itPrev; |
| 11797 |
} else { |
| 11798 |
doPropagation = true; |
| 11799 |
} |
| 11800 |
} |
| 11801 |
if (doPropagation) { |
| 11802 |
STATINC(VARBINDPROPAGATEDCOUNT,calcAlgContext); |
| 11803 |
STATINC(VARBINDPROPAGATEDFRESHCOUNT,calcAlgContext); |
| 11804 |
++mStatVarBindingPropagateSuccCount; |
| 11805 |
++mStatVarBindingPropagateSuccFreshCount; |
| 11806 |
const CVariableBindingPathMapData& prevVarBindPathMapData = itPrev.value(); |
| 11807 |
CVariableBindingPathDescriptor* prevVarBindPathDes = prevVarBindPathMapData.getVariableBindingPathDescriptor(); |
| 11808 |
|
| 11809 |
CVariableBindingPathDescriptor* newVarBindPathDes = CObjectAllocator<CVariableBindingPathDescriptor>::allocateAndConstruct(taskMemMan); |
| 11810 |
|
| 11811 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 11812 |
CPROPAGATEVARIABLEBINDINGSSUCCESSORDependencyNode* bindDepNode = createPROPAGATEVARIABLEBINDINGSSUCCESSORDependency(newDepTrackPoint,processIndi,conDes,prevVarBindPathDes->getDependencyTrackPoint(),restLink->getDependencyTrackPoint(),calcAlgContext); |
| 11813 |
CVariableBindingPath* varBindingPath = prevVarBindPathDes->getVariableBindingPath(); |
| 11814 |
newVarBindPathDes->initVariableBindingPathDescriptor(varBindingPath,newDepTrackPoint); |
| 11815 |
|
| 11816 |
itNew = newVarBindPathMap->insert(varBindingPath->getPropagationID(),CVariableBindingPathMapData(newVarBindPathDes)); |
| 11817 |
|
| 11818 |
newVarBindPathDesLinker = newVarBindPathDes->append(newVarBindPathDesLinker); |
| 11819 |
propagations = true; |
| 11820 |
} |
| 11821 |
} |
| 11822 |
if (newVarBindPathDesLinker) { |
| 11823 |
newVarBindingPathSet->addVariableBindingPathDescriptorLinker(newVarBindPathDesLinker); |
| 11824 |
conVarBindingSetHash->setLastVariableBindingDescriptionLinker(newVarBindPathDesLinker); |
| 11825 |
} |
| 11826 |
} |
| 11827 |
return propagations; |
| 11828 |
} |
| 11829 |
|
| 11830 |
|
| 11831 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEALLRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11832 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 11833 |
CConcept* concept = conDes->getConcept(); |
| 11834 |
CRole* role = concept->getRole(); |
| 11835 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 11836 |
cint64 opCount = concept->getOperandCount(); |
| 11837 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 11838 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11839 |
|
| 11840 |
CSortedNegLinker<CConcept*>* conceptOpLinker = concept->getOperandList(); |
| 11841 |
|
| 11842 |
STATINC(VARBINDRULEALLAPPLICATIONCOUNT,calcAlgContext); |
| 11843 |
|
| 11844 |
CIndividualLinkEdge* restLink = getLinkProcessingRestriction(conProDes); |
| 11845 |
if (restLink) { |
| 11846 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,restLink,calcAlgContext); |
| 11847 |
|
| 11848 |
propagateVariableBindingsToSuccessor(processIndi,succIndi,opLinker,negate,conDes,restLink,calcAlgContext); |
| 11849 |
|
| 11850 |
} else { |
| 11851 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 11852 |
if (roleSuccHash) { |
| 11853 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role); |
| 11854 |
while (roleSuccIt.hasNext()) { |
| 11855 |
CIndividualLinkEdge* link = roleSuccIt.next(true); |
| 11856 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 11857 |
|
| 11858 |
propagateVariableBindingsToSuccessor(processIndi,succIndi,opLinker,negate,conDes,link,calcAlgContext); |
| 11859 |
} |
| 11860 |
} |
| 11861 |
} |
| 11862 |
if (!conProDes->isConceptReapplied()) { |
| 11863 |
if (!isConceptInReapplyQueue(conDes,role,processIndi,calcAlgContext)) { |
| 11864 |
addConceptToReapplyQueue(conDes,role,processIndi,true,depTrackPoint,calcAlgContext); |
| 11865 |
} |
| 11866 |
} |
| 11867 |
} |
| 11868 |
|
| 11869 |
|
| 11870 |
|
| 11871 |
|
| 11872 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDVARIABLERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 11873 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 11874 |
CConcept* concept = conDes->getConcept(); |
| 11875 |
CVariable* variable = concept->getVariable(); |
| 11876 |
bool conceptNegation = negate; |
| 11877 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 11878 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 11879 |
|
| 11880 |
CConcept* bindingTriggerConcept = opConLinker->getData(); |
| 11881 |
bool bindingTriggerConceptNegation = opConLinker->isNegated(); |
| 11882 |
|
| 11883 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 11884 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 11885 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 11886 |
|
| 11887 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 11888 |
CConceptDescriptor* bindingConDes = nullptr; |
| 11889 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 11890 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 11891 |
|
| 11892 |
STATINC(VARBINDRULEBINDAPPLICATIONCOUNT,calcAlgContext); |
| 11893 |
|
| 11894 |
bool updateExt = false; |
| 11895 |
|
| 11896 |
|
| 11897 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(false); |
| 11898 |
if (conPropBindingSetHash) { |
| 11899 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 11900 |
|
| 11901 |
if (propBindingSet) { |
| 11902 |
CPropagationVariableBindingTransitionExtension* propVarBindTransExt = propBindingSet->getPropagationVariableBindingTransitionExtension(false); |
| 11903 |
if (!propVarBindTransExt || !propVarBindTransExt->isProcessingCompleted()) { |
| 11904 |
if (!propVarBindTransExt || propBindingSet->hasPropagateAllFlag()) { |
| 11905 |
updateExt = true; |
| 11906 |
} else { |
| 11907 |
CPropagationBindingDescriptor* lastAnalyPropBindDes = propVarBindTransExt->getLastAnalysedPropagationBindingDescriptor(); |
| 11908 |
CPropagationBindingDescriptor* propBindDes = propBindingSet->getPropagationBindingDescriptorLinker(); |
| 11909 |
if (lastAnalyPropBindDes != propBindDes) { |
| 11910 |
updateExt = true; |
| 11911 |
} |
| 11912 |
} |
| 11913 |
} |
| 11914 |
} |
| 11915 |
} |
| 11916 |
|
| 11917 |
|
| 11918 |
|
| 11919 |
if (updateExt) { |
| 11920 |
|
| 11921 |
|
| 11922 |
if (!mFirstBindingCreationDebugWritten) { |
| 11923 |
mFirstBindingCreationDebugWritten = true; |
| 11924 |
if (mConfDebuggingWriteData) { |
| 11925 |
QString writingFolder = "./Debugging/CompletionTasks/"; |
| 11926 |
QFile file(QString("%1%2-task.txt").arg(writingFolder, "first-binding-creation")); |
| 11927 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 11928 |
if (file.open(QIODevice::WriteOnly)) { |
| 11929 |
file.write(mEndTaskDebugIndiModelString.replace("<br>", "\r\n").toLocal8Bit()); |
| 11930 |
file.close(); |
| 11931 |
} |
| 11932 |
} |
| 11933 |
} |
| 11934 |
|
| 11935 |
|
| 11936 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 11937 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,true); |
| 11938 |
CPropagationVariableBindingTransitionExtension* propVarBindTransExt = propBindingSet->getPropagationVariableBindingTransitionExtension(true); |
| 11939 |
|
| 11940 |
CPropagationBindingDescriptor* lastAnalyPropBindDes = propVarBindTransExt->getLastAnalysedPropagationBindingDescriptor(); |
| 11941 |
CPropagationBindingDescriptor* propBindDes = propBindingSet->getPropagationBindingDescriptorLinker(); |
| 11942 |
|
| 11943 |
propVarBindTransExt->setTriggeredVariableIndividualPair(variable,processIndi); |
| 11944 |
bool createVarBinding = false; |
| 11945 |
createVarBinding = propBindingSet->hasPropagateAllFlag(); |
| 11946 |
for (CPropagationBindingDescriptor* propBindDesIt = propBindDes; propBindDesIt != lastAnalyPropBindDes; propBindDesIt = propBindDesIt->getNext()) { |
| 11947 |
if (propVarBindTransExt->addAnalysedPropagationBindingDescriptorReturnMatched(propBindDesIt)) { |
| 11948 |
createVarBinding = true; |
| 11949 |
} |
| 11950 |
} |
| 11951 |
propVarBindTransExt->setLastAnalysedPropagationBindingDescriptor(propBindDes); |
| 11952 |
propVarBindTransExt->setLastAnalysedPropagateAllFlag(propBindingSet->hasPropagateAllFlag()); |
| 11953 |
|
| 11954 |
if (createVarBinding) { |
| 11955 |
++mStatVarBindingCreatedCount; |
| 11956 |
STATINC(VARBINDVARIABLEBINDCOUNT,calcAlgContext); |
| 11957 |
propVarBindTransExt->setProcessingCompleted(true); |
| 11958 |
|
| 11959 |
CConceptVariableBindingPathSetHash* conVarBindingPathSetHash = processIndi->getConceptVariableBindingPathSetHash(true); |
| 11960 |
CVariableBindingPathSet* varBindPathSet = conVarBindingPathSetHash->getVariableBindingPathSet(bindingTriggerConcept,true); |
| 11961 |
|
| 11962 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 11963 |
cint64 nextPathPropID = processingDataBox->getNextVariableBindingPathID(true); |
| 11964 |
|
| 11965 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 11966 |
CVARBINDVARIABLEDependencyNode* bindDepNode = createVARBINDVARIABLEDependency(nextDepTrackPoint,processIndi,conDes, depTrackPoint,calcAlgContext); |
| 11967 |
|
| 11968 |
|
| 11969 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 11970 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 11971 |
} else { |
| 11972 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 11973 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 11974 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,true,calcAlgContext); |
| 11975 |
if (!reapplyQueue->isEmpty()) { |
| 11976 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 11977 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 11978 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 11979 |
} |
| 11980 |
} |
| 11981 |
|
| 11982 |
varBindPathSet->setConceptDescriptor(bindingConDes); |
| 11983 |
CVariableBinding* varBinding = CObjectAllocator<CVariableBinding>::allocateAndConstruct(taskMemMan); |
| 11984 |
varBinding->initVariableBinding(nextDepTrackPoint,processIndi,variable); |
| 11985 |
CVariableBindingDescriptor* varBindingDes = CObjectAllocator<CVariableBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 11986 |
varBindingDes->initVariableBindingDescriptor(varBinding); |
| 11987 |
CVariableBindingPath* varBindingPath = CObjectAllocator<CVariableBindingPath>::allocateAndConstruct(taskMemMan); |
| 11988 |
varBindingPath->initVariableBindingPath(nextPathPropID,varBindingDes); |
| 11989 |
CVariableBindingPathDescriptor* varBindingPathDes = CObjectAllocator<CVariableBindingPathDescriptor>::allocateAndConstruct(taskMemMan); |
| 11990 |
varBindingPathDes->initVariableBindingPathDescriptor(varBindingPath,nextDepTrackPoint); |
| 11991 |
varBindPathSet->addVariableBindingPath(varBindingPathDes); |
| 11992 |
conVarBindingPathSetHash->setLastVariableBindingDescriptionLinker(varBindingPathDes); |
| 11993 |
|
| 11994 |
} |
| 11995 |
} |
| 11996 |
} |
| 11997 |
|
| 11998 |
|
| 11999 |
|
| 12000 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEJOINRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12001 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 12002 |
CConcept* concept = conDes->getConcept(); |
| 12003 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 12004 |
cint64 opCount = concept->getOperandCount(); |
| 12005 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 12006 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 12007 |
|
| 12008 |
|
| 12009 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 12010 |
CConceptDescriptor* joinConDes = nullptr; |
| 12011 |
CDependencyTrackPoint* joinDepTrackPoint = nullptr; |
| 12012 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 12013 |
|
| 12014 |
CConcept* joinConcept = opLinker->getData(); |
| 12015 |
bool joinConceptNegation = opLinker->isNegated(); |
| 12016 |
CSortedNegLinker<CConcept*>* triggerLinker = opLinker->getNext(); |
| 12017 |
|
| 12018 |
CSortedLinker<CVariable*>* varLinker = concept->getVariableLinker(); |
| 12019 |
|
| 12020 |
STATINC(VARBINDRULEJOINAPPLICATIONCOUNT,calcAlgContext); |
| 12021 |
|
| 12022 |
bool propagateJoins = false; |
| 12023 |
bool createJoinConcept = false; |
| 12024 |
if (!conSet->getConceptDescriptorAndReapplyQueue(joinConcept,joinConDes,joinDepTrackPoint,reapplyQueue)) { |
| 12025 |
// search next not existing trigger |
| 12026 |
bool allTriggersAvailable = true; |
| 12027 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 12028 |
CSortedNegLinker<CConcept*>* triggerLinkerIt = nullptr; |
| 12029 |
for (triggerLinkerIt = triggerLinker; triggerLinkerIt && allTriggersAvailable; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 12030 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 12031 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 12032 |
CConceptDescriptor* triggerConDes = nullptr; |
| 12033 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 12034 |
if (conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint)) { |
| 12035 |
if (triggerConDes->isNegated() == nextTrigger->isNegated()) { |
| 12036 |
return; |
| 12037 |
} |
| 12038 |
} else { |
| 12039 |
allTriggersAvailable = false; |
| 12040 |
break; |
| 12041 |
} |
| 12042 |
} |
| 12043 |
|
| 12044 |
if (!allTriggersAvailable) { |
| 12045 |
// install to trigger |
| 12046 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 12047 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 12048 |
bool triggerNegation = !nextTrigger->isNegated(); |
| 12049 |
if (!isConceptInReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,calcAlgContext)) { |
| 12050 |
addConceptToReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,(CProcessingRestrictionSpecification*)nullptr,depTrackPoint,calcAlgContext); |
| 12051 |
} |
| 12052 |
} else { |
| 12053 |
propagateJoins = true; |
| 12054 |
createJoinConcept = true; |
| 12055 |
} |
| 12056 |
} else { |
| 12057 |
propagateJoins = true; |
| 12058 |
} |
| 12059 |
|
| 12060 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 12061 |
|
| 12062 |
bool propagationsDone = false; |
| 12063 |
if (propagateJoins) { |
| 12064 |
|
| 12065 |
for (CSortedNegLinker<CConcept*>* triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 12066 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 12067 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 12068 |
if (!isConceptInReapplyQueue(conDes,triggerConcept,false,processIndi,calcAlgContext)) { |
| 12069 |
addConceptToReapplyQueue(conDes,triggerConcept,false,processIndi,(CProcessingRestrictionSpecification*)nullptr,depTrackPoint,calcAlgContext); |
| 12070 |
} |
| 12071 |
} |
| 12072 |
|
| 12073 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(false); |
| 12074 |
CConceptVariableBindingPathSetHash* varBindingPathSetHash = processIndi->getConceptVariableBindingPathSetHash(false); |
| 12075 |
CPropagationBindingSet* propBindingSet = nullptr; |
| 12076 |
if (conPropBindingSetHash && varBindingPathSetHash) { |
| 12077 |
propBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 12078 |
if (propBindingSet) { |
| 12079 |
|
| 12080 |
CPropagationVariableBindingTransitionExtension* propVarBindTransExt = propBindingSet->getPropagationVariableBindingTransitionExtension(false); |
| 12081 |
|
| 12082 |
CSortedNegLinker<CConcept*>* leftTriggerLinker = triggerLinker; |
| 12083 |
CSortedNegLinker<CConcept*>* rightTriggerLinker = triggerLinker->getNext(); |
| 12084 |
|
| 12085 |
CConcept* leftConcept = leftTriggerLinker->getData(); |
| 12086 |
CConcept* rightConcept = rightTriggerLinker->getData(); |
| 12087 |
|
| 12088 |
CVariableBindingPathSet* leftVarBindPathSet = varBindingPathSetHash->getVariableBindingPathSet(leftConcept,false); |
| 12089 |
CVariableBindingPathSet* rightVarBindPathSet = varBindingPathSetHash->getVariableBindingPathSet(rightConcept,false); |
| 12090 |
|
| 12091 |
bool examineTransExt = false; |
| 12092 |
|
| 12093 |
if (leftVarBindPathSet && rightVarBindPathSet) { |
| 12094 |
|
| 12095 |
if (!propVarBindTransExt) { |
| 12096 |
examineTransExt = true; |
| 12097 |
} else { |
| 12098 |
if (propVarBindTransExt->getLastAnalysedPropagateAllFlag() != propBindingSet->getPropagateAllFlag() || |
| 12099 |
propVarBindTransExt->getLastAnalysedPropagationBindingDescriptor() != propBindingSet->getPropagationBindingDescriptorLinker() || |
| 12100 |
propVarBindTransExt->getLeftLastVariableBindingPathJoiningDescriptor() != leftVarBindPathSet->getVariableBindingPathDescriptorLinker() || |
| 12101 |
propVarBindTransExt->getRightLastVariableBindingPathJoiningDescriptor() != rightVarBindPathSet->getVariableBindingPathDescriptorLinker()) { |
| 12102 |
|
| 12103 |
examineTransExt = true; |
| 12104 |
} |
| 12105 |
} |
| 12106 |
} |
| 12107 |
|
| 12108 |
if (examineTransExt) { |
| 12109 |
conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 12110 |
varBindingPathSetHash = processIndi->getConceptVariableBindingPathSetHash(true); |
| 12111 |
propBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,true); |
| 12112 |
propVarBindTransExt = propBindingSet->getPropagationVariableBindingTransitionExtension(true); |
| 12113 |
|
| 12114 |
|
| 12115 |
CVariableBindingPathSet* joinVarBindingPathSet = nullptr; |
| 12116 |
|
| 12117 |
CVariableBindingTriggerHash* varBindTriggerHash = propVarBindTransExt->getVariableBindingTriggerHash(true); |
| 12118 |
CVariableBindingPathJoiningHash* varBindPathJoinHash = propVarBindTransExt->getVariableBindingPathJoiningHash(true); |
| 12119 |
|
| 12120 |
CPropagationBindingDescriptor* lastAnalyPropBindDes = propVarBindTransExt->getLastAnalysedPropagationBindingDescriptor(); |
| 12121 |
CPropagationBindingDescriptor* propBindDes = propBindingSet->getPropagationBindingDescriptorLinker(); |
| 12122 |
|
| 12123 |
bool propAllFlag = propBindingSet->hasPropagateAllFlag(); |
| 12124 |
|
| 12125 |
if (propAllFlag) { |
| 12126 |
|
| 12127 |
for (CVariableBindingTriggerHash::iterator it = varBindTriggerHash->begin(), itEnd = varBindTriggerHash->end(); it != itEnd; ++it) { |
| 12128 |
CVariableBindingTriggerData& data = it.value(); |
| 12129 |
CVariableBindingTriggerLinker* varBindTriggerLinker = data.getVariableBindingTriggerLinker(); |
| 12130 |
data.setTriggered(true); |
| 12131 |
data.clearVariableBindingTriggerLinker(); |
| 12132 |
for (CVariableBindingTriggerLinker* varBindTriggerIt = varBindTriggerLinker; varBindTriggerIt; varBindTriggerIt = varBindTriggerIt->getNext()) { |
| 12133 |
STATINC(VARBINDJOINTRIGGEREXECUTECOUNT,calcAlgContext); |
| 12134 |
|
| 12135 |
CVariableBindingPathDescriptor* varBindPathDes = varBindTriggerIt->getVariableBindingPathDescriptor(); |
| 12136 |
CVariableBindingDescriptor* varBindTriggerDes = varBindTriggerIt->getNextTriggerVariableBindingDescriptor(); |
| 12137 |
bool leftTriggered = varBindTriggerIt->isLeftTriggered(); |
| 12138 |
|
| 12139 |
propagationsDone |= propagateVariableBindingsJoins(processIndi,conDes,joinConcept,varBindPathDes,leftTriggered,varBindPathJoinHash,varBindingPathSetHash,joinConDes,joinVarBindingPathSet,calcAlgContext); |
| 12140 |
} |
| 12141 |
} |
| 12142 |
|
| 12143 |
} else { |
| 12144 |
|
| 12145 |
for (CPropagationBindingDescriptor* propBindDesIt = propBindDes; propBindDesIt != lastAnalyPropBindDes; propBindDesIt = propBindDesIt->getNext()) { |
| 12146 |
CVariableBindingTriggerLinker* varBindTriggerLinker = nullptr; |
| 12147 |
if (propVarBindTransExt->addAnalysedPropagationBindingDescriptorReturnMatched(propBindDesIt,&varBindTriggerLinker)) { |
| 12148 |
for (CVariableBindingTriggerLinker* varBindTriggerIt = varBindTriggerLinker; varBindTriggerIt; varBindTriggerIt = varBindTriggerIt->getNext()) { |
| 12149 |
STATINC(VARBINDJOINTRIGGEREXECUTECOUNT,calcAlgContext); |
| 12150 |
|
| 12151 |
CVariableBindingPathDescriptor* varBindPathDes = varBindTriggerIt->getVariableBindingPathDescriptor(); |
| 12152 |
CVariableBindingDescriptor* varBindTriggerDes = varBindTriggerIt->getNextTriggerVariableBindingDescriptor(); |
| 12153 |
bool leftTriggered = varBindTriggerIt->isLeftTriggered(); |
| 12154 |
|
| 12155 |
if (!triggerVariableBindingPathJoining(processIndi,varBindPathDes,varBindTriggerDes,leftTriggered,varBindTriggerHash,calcAlgContext)) { |
| 12156 |
propagationsDone |= propagateVariableBindingsJoins(processIndi,conDes,joinConcept,varBindPathDes,leftTriggered,varBindPathJoinHash,varBindingPathSetHash,joinConDes,joinVarBindingPathSet,calcAlgContext); |
| 12157 |
} |
| 12158 |
} |
| 12159 |
} |
| 12160 |
} |
| 12161 |
|
| 12162 |
} |
| 12163 |
propVarBindTransExt->setLastAnalysedPropagationBindingDescriptor(propBindDes); |
| 12164 |
propVarBindTransExt->setLastAnalysedPropagateAllFlag(propBindingSet->hasPropagateAllFlag()); |
| 12165 |
|
| 12166 |
|
| 12167 |
|
| 12168 |
if (propVarBindTransExt->getLeftLastVariableBindingPathJoiningDescriptor() != leftVarBindPathSet->getVariableBindingPathDescriptorLinker()) { |
| 12169 |
for (CVariableBindingPathDescriptor* varBindPathDes = leftVarBindPathSet->getVariableBindingPathDescriptorLinker(); varBindPathDes != propVarBindTransExt->getLeftLastVariableBindingPathJoiningDescriptor(); varBindPathDes = varBindPathDes->getNext()) { |
| 12170 |
CVariableBindingPath* varBindPath = varBindPathDes->getVariableBindingPath(); |
| 12171 |
|
| 12172 |
CVariableBindingDescriptor* varBindTriggerDes = varBindPath->getVariableBindingDescriptorLinker(); |
| 12173 |
bool leftTriggered = true; |
| 12174 |
|
| 12175 |
if (propAllFlag || !triggerVariableBindingPathJoining(processIndi,varBindPathDes,varBindTriggerDes,leftTriggered,varBindTriggerHash,calcAlgContext)) { |
| 12176 |
propagationsDone |= propagateVariableBindingsJoins(processIndi,conDes,joinConcept,varBindPathDes,leftTriggered,varBindPathJoinHash,varBindingPathSetHash,joinConDes,joinVarBindingPathSet,calcAlgContext); |
| 12177 |
} |
| 12178 |
} |
| 12179 |
propVarBindTransExt->setLeftLastVariableBindingPathJoiningDescriptor(leftVarBindPathSet->getVariableBindingPathDescriptorLinker()); |
| 12180 |
} |
| 12181 |
|
| 12182 |
|
| 12183 |
|
| 12184 |
if (propVarBindTransExt->getRightLastVariableBindingPathJoiningDescriptor() != rightVarBindPathSet->getVariableBindingPathDescriptorLinker()) { |
| 12185 |
for (CVariableBindingPathDescriptor* varBindPathDes = rightVarBindPathSet->getVariableBindingPathDescriptorLinker(); varBindPathDes != propVarBindTransExt->getRightLastVariableBindingPathJoiningDescriptor(); varBindPathDes = varBindPathDes->getNext()) { |
| 12186 |
CVariableBindingPath* varBindPath = varBindPathDes->getVariableBindingPath(); |
| 12187 |
|
| 12188 |
CVariableBindingDescriptor* varBindTriggerDes = varBindPath->getVariableBindingDescriptorLinker(); |
| 12189 |
bool leftTriggered = false; |
| 12190 |
|
| 12191 |
if (propAllFlag || !triggerVariableBindingPathJoining(processIndi,varBindPathDes,varBindTriggerDes,leftTriggered,varBindTriggerHash,calcAlgContext)) { |
| 12192 |
propagationsDone |= propagateVariableBindingsJoins(processIndi,conDes,joinConcept,varBindPathDes,leftTriggered,varBindPathJoinHash,varBindingPathSetHash,joinConDes,joinVarBindingPathSet,calcAlgContext); |
| 12193 |
} |
| 12194 |
} |
| 12195 |
propVarBindTransExt->setRightLastVariableBindingPathJoiningDescriptor(rightVarBindPathSet->getVariableBindingPathDescriptorLinker()); |
| 12196 |
} |
| 12197 |
|
| 12198 |
|
| 12199 |
} |
| 12200 |
} |
| 12201 |
} |
| 12202 |
|
| 12203 |
|
| 12204 |
} |
| 12205 |
|
| 12206 |
if (propagationsDone) { |
| 12207 |
if (!createJoinConcept) { |
| 12208 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 12209 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 12210 |
addConceptPreprocessedToProcessingQueue(joinConDes,joinDepTrackPoint,conProQueue,processIndi,true,calcAlgContext); |
| 12211 |
if (!reapplyQueue->isEmpty()) { |
| 12212 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 12213 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(joinConDes)); |
| 12214 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 12215 |
} |
| 12216 |
} |
| 12217 |
} |
| 12218 |
} |
| 12219 |
|
| 12220 |
|
| 12221 |
|
| 12222 |
|
| 12223 |
|
| 12224 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateVariableBindingsJoins(CIndividualProcessNode* processIndi, CConceptDescriptor* joiningConDes, CConcept* joinConcept, CVariableBindingPathDescriptor* varBindPathDes, bool leftTriggerPath, |
| 12225 |
CVariableBindingPathJoiningHash* varBindPathJoinHash, CConceptVariableBindingPathSetHash* varBindingPathSetHash, CConceptDescriptor*& joinConDes, CVariableBindingPathSet*& varBindingPathSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12226 |
|
| 12227 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 12228 |
CConcept* joiningConcept = joiningConDes->getConcept(); |
| 12229 |
CSortedLinker<CVariable*>* varLinker = joiningConcept->getVariableLinker(); |
| 12230 |
|
| 12231 |
CVariableBindingPath* varBindPath = varBindPathDes->getVariableBindingPath(); |
| 12232 |
CVariableBindingPathJoiningData* varBindPathJoinData = varBindPathJoinHash->getVariableBindingPathJoiningData(CVariableBindingPathJoiningHasher(varBindPath,varLinker),true); |
| 12233 |
CVariableBindingDescriptor* varBindDes = varBindPath->getVariableBindingDescriptorLinker(); |
| 12234 |
|
| 12235 |
if (!varBindPathJoinData) { |
| 12236 |
varBindPathJoinData = CObjectAllocator< CVariableBindingPathJoiningData >::allocateAndConstruct(taskMemMan); |
| 12237 |
CVariableBindingDescriptor* keyVarBindDesLinker = createVariableBindingPathKey(processIndi,varLinker,varBindDes,calcAlgContext); |
| 12238 |
varBindPathJoinData->initVariableBindingPathJoiningData(keyVarBindDesLinker,nullptr,nullptr); |
| 12239 |
varBindPathJoinHash->insertVariableBindingPathJoiningData(CVariableBindingPathJoiningHasher(varBindPathJoinData),varBindPathJoinData); |
| 12240 |
} |
| 12241 |
|
| 12242 |
|
| 12243 |
CVariableBindingPathDescriptor* otherVarBindPathDes = nullptr; |
| 12244 |
if (leftTriggerPath) { |
| 12245 |
otherVarBindPathDes = varBindPathJoinData->getRightVariableBindingPathDescriptorLinker(); |
| 12246 |
} else { |
| 12247 |
otherVarBindPathDes = varBindPathJoinData->getLeftVariableBindingPathDescriptorLinker(); |
| 12248 |
} |
| 12249 |
|
| 12250 |
|
| 12251 |
bool addedVarBindPath = false; |
| 12252 |
for (CVariableBindingPathDescriptor* otherVarBindPathDesIt = otherVarBindPathDes; otherVarBindPathDesIt; otherVarBindPathDesIt = otherVarBindPathDesIt->getNext()) { |
| 12253 |
STATINC(VARBINDJOINCOMBINECOUNT,calcAlgContext); |
| 12254 |
++mStatVarBindingJoinCombinesCount; |
| 12255 |
|
| 12256 |
CVariableBindingPath* mergedVarBindPath = getJoinedVariableBindingPath(varBindPathDes->getVariableBindingPath(),otherVarBindPathDesIt->getVariableBindingPath(),calcAlgContext); |
| 12257 |
CVariableBindingPathDescriptor* mergedVarBindPathDes = CObjectAllocator< CVariableBindingPathDescriptor >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 12258 |
|
| 12259 |
CDependencyTrackPoint* mergedDependencyTrackPoint = nullptr; |
| 12260 |
CVARBINDPROPAGATEJOINDependencyNode* bindJoinDepNode = createVARBINDPROPAGATEJOINDependency(mergedDependencyTrackPoint,processIndi,joiningConDes,varBindPathDes->getDependencyTrackPoint(),otherVarBindPathDesIt->getDependencyTrackPoint(),calcAlgContext); |
| 12261 |
|
| 12262 |
forceVariableBindingJoinCreated(processIndi,joiningConDes,joinConcept,joinConDes,mergedDependencyTrackPoint,varBindingPathSet,varBindingPathSetHash,calcAlgContext); |
| 12263 |
|
| 12264 |
mergedVarBindPathDes->initVariableBindingPathDescriptor(mergedVarBindPath,mergedDependencyTrackPoint); |
| 12265 |
varBindingPathSet->addVariableBindingPath(mergedVarBindPathDes); |
| 12266 |
|
| 12267 |
addedVarBindPath = true; |
| 12268 |
} |
| 12269 |
|
| 12270 |
CVariableBindingPathDescriptor* newVarBindPathDes = CObjectAllocator< CVariableBindingPathDescriptor >::allocateAndConstruct(taskMemMan); |
| 12271 |
newVarBindPathDes->initVariableBindingPathDescriptor(varBindPath,varBindPathDes->getDependencyTrackPoint()); |
| 12272 |
|
| 12273 |
|
| 12274 |
if (leftTriggerPath) { |
| 12275 |
varBindingPathSetHash->setLastVariableBindingDescriptionLinker(newVarBindPathDes); |
| 12276 |
varBindPathJoinData->addLeftVariableBindingPathDescriptorLinker(newVarBindPathDes); |
| 12277 |
} else { |
| 12278 |
varBindingPathSetHash->setLastVariableBindingDescriptionLinker(newVarBindPathDes); |
| 12279 |
varBindPathJoinData->addRightVariableBindingPathDescriptorLinker(newVarBindPathDes); |
| 12280 |
} |
| 12281 |
|
| 12282 |
return addedVarBindPath; |
| 12283 |
} |
| 12284 |
|
| 12285 |
|
| 12286 |
|
| 12287 |
|
| 12288 |
|
| 12289 |
CVariableBindingDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createVariableBindingPathKey(CIndividualProcessNode* processIndi, CSortedLinker<CVariable*>* varLinker, CVariableBindingDescriptor* varBindDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12290 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 12291 |
|
| 12292 |
CVariableBindingDescriptor* keyVarBindDesLinker = nullptr; |
| 12293 |
CVariableBindingDescriptor* lastKeyVarBindDesLinker = nullptr; |
| 12294 |
CSortedLinker<CVariable*>* varLinkerIt = varLinker; |
| 12295 |
CVariableBindingDescriptor* varBindDesIt = varBindDes; |
| 12296 |
while (varLinkerIt) { |
| 12297 |
CVariableBinding* varBind = varBindDesIt->getVariableBinding(); |
| 12298 |
if (varBind->getBindedVariable() == varLinkerIt->getData()) { |
| 12299 |
CVariableBindingDescriptor* nextKeyVarBindDesLinker = CObjectAllocator< CVariableBindingDescriptor >::allocateAndConstruct(taskMemMan); |
| 12300 |
nextKeyVarBindDesLinker->initVariableBindingDescriptor(varBind); |
| 12301 |
|
| 12302 |
if (lastKeyVarBindDesLinker) { |
| 12303 |
lastKeyVarBindDesLinker->setNext(nextKeyVarBindDesLinker); |
| 12304 |
lastKeyVarBindDesLinker = nextKeyVarBindDesLinker; |
| 12305 |
} else { |
| 12306 |
keyVarBindDesLinker = lastKeyVarBindDesLinker = nextKeyVarBindDesLinker; |
| 12307 |
} |
| 12308 |
varLinkerIt = varLinkerIt->getNext(); |
| 12309 |
varBindDesIt = varBindDesIt->getNext(); |
| 12310 |
} else { |
| 12311 |
varBindDesIt = varBindDesIt->getNext(); |
| 12312 |
} |
| 12313 |
} |
| 12314 |
return keyVarBindDesLinker; |
| 12315 |
} |
| 12316 |
|
| 12317 |
|
| 12318 |
|
| 12319 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::triggerVariableBindingPathJoining(CIndividualProcessNode* processIndi, CVariableBindingPathDescriptor* varBindPathDes, CVariableBindingDescriptor* varBindDes, bool leftTriggered, CVariableBindingTriggerHash* varBindTriggerHash, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12320 |
|
| 12321 |
CVariableBindingDescriptor* nextVarBindDesTrigger = varBindDes; |
| 12322 |
if (nextVarBindDesTrigger) { |
| 12323 |
while (nextVarBindDesTrigger) { |
| 12324 |
CVariableBinding* varBind = nextVarBindDesTrigger->getVariableBinding(); |
| 12325 |
nextVarBindDesTrigger = nextVarBindDesTrigger->getNext(); |
| 12326 |
if (!varBindTriggerHash->tryInsertVariableBindingTrigger(varBind->getBindedVariable(),varBind->getBindedIndividual(),varBindPathDes,nextVarBindDesTrigger,leftTriggered)) { |
| 12327 |
} else { |
| 12328 |
STATINC(VARBINDJOINTRIGGERINSTALLCOUNT,calcAlgContext); |
| 12329 |
return true; |
| 12330 |
} |
| 12331 |
} |
| 12332 |
} |
| 12333 |
return false; |
| 12334 |
} |
| 12335 |
|
| 12336 |
|
| 12337 |
|
| 12338 |
|
| 12339 |
void CCalculationTableauCompletionTaskHandleAlgorithm::forceVariableBindingJoinCreated(CIndividualProcessNode* processIndi, CConceptDescriptor* joiningConDes, CConcept* joinConcept, CConceptDescriptor*& joinConDes, CDependencyTrackPoint* mergedDependencyTrackPoint, CVariableBindingPathSet*& varBindingPathSet, CConceptVariableBindingPathSetHash* varBindingPathSetHash, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12340 |
if (!joinConDes) { |
| 12341 |
joinConDes = addConceptToIndividualReturnConceptDescriptor(joinConcept,false,processIndi,mergedDependencyTrackPoint,false,false,calcAlgContext); |
| 12342 |
} |
| 12343 |
if (!varBindingPathSet) { |
| 12344 |
varBindingPathSet = varBindingPathSetHash->getVariableBindingPathSet(joinConcept,true); |
| 12345 |
varBindingPathSet->setConceptDescriptor(joinConDes); |
| 12346 |
} |
| 12347 |
} |
| 12348 |
|
| 12349 |
|
| 12350 |
|
| 12351 |
CVariableBindingPath* CCalculationTableauCompletionTaskHandleAlgorithm::getJoinedVariableBindingPath(CVariableBindingPath* leftVarBindPath, CVariableBindingPath* rightVarBindPath, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12352 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 12353 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 12354 |
CVariableBindingPathMergingHash* varBindPathMergingHash = processingDataBox->getVariableBindingPathMergingHash(true); |
| 12355 |
|
| 12356 |
CVariableBindingPathMergingHashData* mergeHashData = varBindPathMergingHash->getMergedVariableBindingPathData(leftVarBindPath,rightVarBindPath); |
| 12357 |
CVariableBindingPath* mergedVarBindPath = mergeHashData->getVariableBindingPath(); |
| 12358 |
if (!mergedVarBindPath) { |
| 12359 |
STATINC(VARBINDJOINCREATENEWCOUNT,calcAlgContext); |
| 12360 |
|
| 12361 |
CVariableBindingDescriptor* leftVarBindDesIt = leftVarBindPath->getVariableBindingDescriptorLinker(); |
| 12362 |
CVariableBindingDescriptor* rightVarBindDesIt = rightVarBindPath->getVariableBindingDescriptorLinker(); |
| 12363 |
|
| 12364 |
CVariableBindingDescriptor* mergedVarBindDes = nullptr; |
| 12365 |
CVariableBindingDescriptor* lastMergedVarBindDes = nullptr; |
| 12366 |
|
| 12367 |
while (leftVarBindDesIt || rightVarBindDesIt) { |
| 12368 |
CVariableBindingDescriptor* nextMergedVarBindDes = nullptr; |
| 12369 |
if (leftVarBindDesIt && rightVarBindDesIt) { |
| 12370 |
bool leftLE = *leftVarBindDesIt->getVariableBinding() <= *rightVarBindDesIt->getVariableBinding(); |
| 12371 |
bool rightLE = *rightVarBindDesIt->getVariableBinding() <= *leftVarBindDesIt->getVariableBinding(); |
| 12372 |
if (leftLE && rightLE) { |
| 12373 |
nextMergedVarBindDes = CObjectAllocator< CVariableBindingDescriptor >::allocateAndConstruct(taskMemMan); |
| 12374 |
nextMergedVarBindDes->initVariableBindingDescriptor(leftVarBindDesIt->getVariableBinding()); |
| 12375 |
leftVarBindDesIt = leftVarBindDesIt->getNext(); |
| 12376 |
rightVarBindDesIt = rightVarBindDesIt->getNext(); |
| 12377 |
} else if (rightLE) { |
| 12378 |
nextMergedVarBindDes = CObjectAllocator< CVariableBindingDescriptor >::allocateAndConstruct(taskMemMan); |
| 12379 |
nextMergedVarBindDes->initVariableBindingDescriptor(rightVarBindDesIt->getVariableBinding()); |
| 12380 |
rightVarBindDesIt = rightVarBindDesIt->getNext(); |
| 12381 |
} else if (leftLE) { |
| 12382 |
nextMergedVarBindDes = CObjectAllocator< CVariableBindingDescriptor >::allocateAndConstruct(taskMemMan); |
| 12383 |
nextMergedVarBindDes->initVariableBindingDescriptor(leftVarBindDesIt->getVariableBinding()); |
| 12384 |
leftVarBindDesIt = leftVarBindDesIt->getNext(); |
| 12385 |
} |
| 12386 |
} else if (leftVarBindDesIt) { |
| 12387 |
nextMergedVarBindDes = CObjectAllocator< CVariableBindingDescriptor >::allocateAndConstruct(taskMemMan); |
| 12388 |
nextMergedVarBindDes->initVariableBindingDescriptor(leftVarBindDesIt->getVariableBinding()); |
| 12389 |
leftVarBindDesIt = leftVarBindDesIt->getNext(); |
| 12390 |
} else if (rightVarBindDesIt) { |
| 12391 |
nextMergedVarBindDes = CObjectAllocator< CVariableBindingDescriptor >::allocateAndConstruct(taskMemMan); |
| 12392 |
nextMergedVarBindDes->initVariableBindingDescriptor(rightVarBindDesIt->getVariableBinding()); |
| 12393 |
rightVarBindDesIt = rightVarBindDesIt->getNext(); |
| 12394 |
} |
| 12395 |
|
| 12396 |
if (nextMergedVarBindDes) { |
| 12397 |
if (lastMergedVarBindDes) { |
| 12398 |
lastMergedVarBindDes->setNext(nextMergedVarBindDes); |
| 12399 |
lastMergedVarBindDes = nextMergedVarBindDes; |
| 12400 |
} else { |
| 12401 |
mergedVarBindDes = lastMergedVarBindDes = nextMergedVarBindDes; |
| 12402 |
} |
| 12403 |
} |
| 12404 |
} |
| 12405 |
|
| 12406 |
mergedVarBindPath = CObjectAllocator< CVariableBindingPath >::allocateAndConstruct(taskMemMan); |
| 12407 |
mergedVarBindPath->initVariableBindingPath(processingDataBox->getNextVariableBindingPathID(true),mergedVarBindDes); |
| 12408 |
mergeHashData->setVariableBindingPath(mergedVarBindPath); |
| 12409 |
} |
| 12410 |
return mergedVarBindPath; |
| 12411 |
} |
| 12412 |
|
| 12413 |
|
| 12414 |
|
| 12415 |
|
| 12416 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEGROUNDINGRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12417 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 12418 |
|
| 12419 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 12420 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 12421 |
CConcept* concept = conDes->getConcept(); |
| 12422 |
bool negated = conDes->isNegated(); |
| 12423 |
cint64 opCount = concept->getOperandCount(); |
| 12424 |
|
| 12425 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 12426 |
|
| 12427 |
CConceptVariableBindingPathSetHash* conVarBindPathSetHash = processIndi->getConceptVariableBindingPathSetHash(false); |
| 12428 |
CVariableBindingPathSet* varBindPathSet = conVarBindPathSetHash->getVariableBindingPathSet(concept,false); |
| 12429 |
|
| 12430 |
STATINC(VARBINDRULEGROUNDINGAPPLICATIONCOUNT,calcAlgContext); |
| 12431 |
|
| 12432 |
if (varBindPathSet) { |
| 12433 |
|
| 12434 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mBeforeGroundingDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 12435 |
|
| 12436 |
CPROCESSINGHASH<CConcept*,CVariableBindingPathDescriptor*>* groundedConVarBindPathDesHash = nullptr; |
| 12437 |
CSortedNegLinker<CConcept*>* newGroundedLinker = mGroundingHandler->getGroundingConceptLinker(processIndi,varBindPathSet,concept,negated,groundedConVarBindPathDesHash,calcAlgContext); |
| 12438 |
|
| 12439 |
if (newGroundedLinker) { |
| 12440 |
for (CSortedNegLinker<CConcept*>* newGroundedLinkerIt = newGroundedLinker; newGroundedLinkerIt; newGroundedLinkerIt = newGroundedLinkerIt->getNext()) { |
| 12441 |
STATINC(VARBINDGROUNDINGCOUNT,calcAlgContext); |
| 12442 |
++mStatVarBindingGroundingCount; |
| 12443 |
CConcept* newGroundedCocnept = newGroundedLinkerIt->getData(); |
| 12444 |
bool newGroundedConceptNegation = newGroundedLinkerIt->isNegated(); |
| 12445 |
|
| 12446 |
CDependencyTrackPoint* baseDependencyTrackPoint = nullptr; |
| 12447 |
CDependency* additionalsDependencies = nullptr; |
| 12448 |
// collect dependencies |
| 12449 |
|
| 12450 |
CPROCESSINGHASH<CConcept*,CVariableBindingPathDescriptor*>::const_iterator it = groundedConVarBindPathDesHash->constFind(newGroundedCocnept), itEnd = groundedConVarBindPathDesHash->constEnd(); |
| 12451 |
while (it != itEnd && it.key() == newGroundedCocnept) { |
| 12452 |
CVariableBindingPathDescriptor* varBindPathDes = it.value(); |
| 12453 |
CDependencyTrackPoint* propVarDepTrackPoint = varBindPathDes->getDependencyTrackPoint(); |
| 12454 |
if (propVarDepTrackPoint) { |
| 12455 |
if (!baseDependencyTrackPoint) { |
| 12456 |
baseDependencyTrackPoint = propVarDepTrackPoint; |
| 12457 |
} |
| 12458 |
} |
| 12459 |
++it; |
| 12460 |
} |
| 12461 |
|
| 12462 |
if (!baseDependencyTrackPoint) { |
| 12463 |
baseDependencyTrackPoint = depTrackPoint; |
| 12464 |
} |
| 12465 |
|
| 12466 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 12467 |
CVARBINDPROPAGATEGROUNDINGDependencyNode* groundingDepNode = createVARBINDPROPAGATEGROUNDINGDependency(nextDepTrackPoint,processIndi,conDes,baseDependencyTrackPoint,additionalsDependencies,calcAlgContext); |
| 12468 |
|
| 12469 |
addConceptToIndividual(newGroundedCocnept,newGroundedConceptNegation,processIndi,nextDepTrackPoint,true,false,calcAlgContext); |
| 12470 |
|
| 12471 |
} |
| 12472 |
} |
| 12473 |
|
| 12474 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mAfterGroundingDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 12475 |
} |
| 12476 |
} |
| 12477 |
|
| 12478 |
|
| 12479 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPROPAGATEIMPLICATIONRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12480 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 12481 |
CConcept* concept = conDes->getConcept(); |
| 12482 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 12483 |
cint64 opCount = concept->getOperandCount(); |
| 12484 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 12485 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 12486 |
|
| 12487 |
|
| 12488 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 12489 |
CConceptDescriptor* bindingConDes = nullptr; |
| 12490 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 12491 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 12492 |
|
| 12493 |
CConcept* bindingTriggerConcept = opLinker->getData(); |
| 12494 |
bool bindingTriggerConceptNegation = opLinker->isNegated(); |
| 12495 |
CSortedNegLinker<CConcept*>* triggerLinker = opLinker->getNext(); |
| 12496 |
|
| 12497 |
STATINC(VARBINDRULEIMPLICATIONAPPLICATIONCOUNT,calcAlgContext); |
| 12498 |
|
| 12499 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 12500 |
|
| 12501 |
// search next not existing trigger |
| 12502 |
bool allTriggersAvailable = true; |
| 12503 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 12504 |
CSortedNegLinker<CConcept*>* triggerLinkerIt = nullptr; |
| 12505 |
for (triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 12506 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 12507 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 12508 |
CConceptDescriptor* triggerConDes = nullptr; |
| 12509 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 12510 |
if (conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint)) { |
| 12511 |
if (triggerConDes->isNegated() == nextTrigger->isNegated()) { |
| 12512 |
return; |
| 12513 |
} |
| 12514 |
} else { |
| 12515 |
allTriggersAvailable = false; |
| 12516 |
break; |
| 12517 |
} |
| 12518 |
} |
| 12519 |
|
| 12520 |
if (!allTriggersAvailable) { |
| 12521 |
// install to trigger |
| 12522 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 12523 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 12524 |
bool triggerNegation = !nextTrigger->isNegated(); |
| 12525 |
if (!isConceptInReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,calcAlgContext)) { |
| 12526 |
addConceptToReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,(CProcessingRestrictionSpecification*)nullptr,depTrackPoint,calcAlgContext); |
| 12527 |
} |
| 12528 |
} else { |
| 12529 |
CDependency* triggerDeps = nullptr; |
| 12530 |
for (CSortedNegLinker<CConcept*>* triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 12531 |
CConcept* triggerConcept = triggerLinkerIt->getData(); |
| 12532 |
CConceptDescriptor* triggerConDes = nullptr; |
| 12533 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 12534 |
conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint); |
| 12535 |
CCONNECTIONDependencyNode* connDep = createCONNECTIONDependency(processIndi,triggerConDes,triggerDepTrackPoint,calcAlgContext); |
| 12536 |
connDep->setNext(triggerDeps); |
| 12537 |
triggerDeps = connDep; |
| 12538 |
} |
| 12539 |
|
| 12540 |
++mStatVarBindingImplicationCount; |
| 12541 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 12542 |
CVARBINDPROPAGATEIMPLICATIONDependencyNode* implDepNode = createVARBINDPROPAGATEIMPLICATIONDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,triggerDeps,calcAlgContext); |
| 12543 |
|
| 12544 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,true,false,calcAlgContext); |
| 12545 |
|
| 12546 |
CConceptVariableBindingPathSetHash* conVarBindingSetHash = processIndi->getConceptVariableBindingPathSetHash(true); |
| 12547 |
CVariableBindingPathSet* prevVarBindingPathSet = conVarBindingSetHash->getVariableBindingPathSet(concept,false); |
| 12548 |
CVariableBindingPathSet* varBindingPathSet = conVarBindingSetHash->getVariableBindingPathSet(bindingTriggerConcept,true); |
| 12549 |
varBindingPathSet->setConceptDescriptor(bindingConDes); |
| 12550 |
|
| 12551 |
propagateInitialVariableBindings(processIndi,bindingConDes,varBindingPathSet,prevVarBindingPathSet,triggerDeps, conVarBindingSetHash, calcAlgContext); |
| 12552 |
|
| 12553 |
|
| 12554 |
} |
| 12555 |
} else { |
| 12556 |
CDependency* triggerDeps = nullptr; |
| 12557 |
for (CSortedNegLinker<CConcept*>* triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 12558 |
CConcept* triggerConcept = triggerLinkerIt->getData(); |
| 12559 |
CConceptDescriptor* triggerConDes = nullptr; |
| 12560 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 12561 |
conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint); |
| 12562 |
CCONNECTIONDependencyNode* connDep = createCONNECTIONDependency(processIndi,triggerConDes,triggerDepTrackPoint,calcAlgContext); |
| 12563 |
connDep->setNext(triggerDeps); |
| 12564 |
triggerDeps = connDep; |
| 12565 |
} |
| 12566 |
++mStatVarBindingImplicationCount; |
| 12567 |
|
| 12568 |
CConceptVariableBindingPathSetHash* conVarBindingSetHash = processIndi->getConceptVariableBindingPathSetHash(true); |
| 12569 |
CVariableBindingPathSet* prevVarBindingPathSet = conVarBindingSetHash->getVariableBindingPathSet(concept,false); |
| 12570 |
CVariableBindingPathSet* varBindingPathSet = conVarBindingSetHash->getVariableBindingPathSet(bindingTriggerConcept,true); |
| 12571 |
|
| 12572 |
if (propagateFreshVariableBindings(processIndi,conDes,varBindingPathSet,prevVarBindingPathSet,triggerDeps, conVarBindingSetHash, calcAlgContext)) { |
| 12573 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 12574 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 12575 |
cint64 bindingCount = varBindingPathSet->getVariableBindingPathMap()->count(); |
| 12576 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,bindingCount,calcAlgContext); |
| 12577 |
if (!reapplyQueue->isEmpty()) { |
| 12578 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 12579 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 12580 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 12581 |
} |
| 12582 |
} |
| 12583 |
} |
| 12584 |
} |
| 12585 |
|
| 12586 |
|
| 12587 |
|
| 12588 |
|
| 12589 |
|
| 12590 |
|
| 12591 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDPREPARERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12592 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 12593 |
CConcept* concept = conDes->getConcept(); |
| 12594 |
bool conceptNegation = negate; |
| 12595 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 12596 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 12597 |
|
| 12598 |
|
| 12599 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 12600 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 12601 |
|
| 12602 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 12603 |
|
| 12604 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 12605 |
|
| 12606 |
STATINC(VARBINDRULEANDAPPLICATIONCOUNT, calcAlgContext); |
| 12607 |
|
| 12608 |
CSatisfiableTaskAnswererBindingPropagationAdapter* answererMessageAdapter = calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableAnswererBindingPropagationAdapter(); |
| 12609 |
if (answererMessageAdapter) { |
| 12610 |
CAnsweringPropagationSteeringController* propagationSteeringController = answererMessageAdapter->getAnswererPropagationSteeringController(); |
| 12611 |
if (propagationSteeringController) { |
| 12612 |
|
| 12613 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = opConLinker; opConLinkerIt; opConLinkerIt = opConLinkerIt->getNext()) { |
| 12614 |
CConcept* bindingTriggerConcept = opConLinkerIt->getData(); |
| 12615 |
bool bindingTriggerConceptNegation = opConLinkerIt->isNegated() ^ conceptNegation; |
| 12616 |
|
| 12617 |
CConceptDescriptor* bindingConDes = nullptr; |
| 12618 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 12619 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 12620 |
|
| 12621 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept, bindingConDes, bindingDepTrackPoint, reapplyQueue)) { |
| 12622 |
|
| 12623 |
bool propagateAll = false; |
| 12624 |
bool propagateNominal = false; |
| 12625 |
bool propagateBindings = false; |
| 12626 |
CVariable* variable = nullptr; |
| 12627 |
CIndividual* nominalIndi = processIndi->getNominalIndividual(); |
| 12628 |
if (bindingTriggerConcept->getOperatorCode() == CCVARBINDJOIN) { |
| 12629 |
propagateAll = true; |
| 12630 |
propagateBindings = true; |
| 12631 |
} else { |
| 12632 |
variable = bindingTriggerConcept->getVariable(); |
| 12633 |
if (bindingTriggerConcept->getOperatorCode() == CCVARBINDVARIABLE) { |
| 12634 |
propagateBindings = true; |
| 12635 |
} else { |
| 12636 |
variable = concept->getVariable(); |
| 12637 |
} |
| 12638 |
if (variable) { |
| 12639 |
propagateAll = propagationSteeringController->isPreparationBindingAllIndividuals(variable); |
| 12640 |
if (nominalIndi) { |
| 12641 |
propagateNominal = propagationSteeringController->isPreparationBindingNominalIndividual(variable, nominalIndi); |
| 12642 |
} |
| 12643 |
} |
| 12644 |
} |
| 12645 |
|
| 12646 |
if (!nextDepTrackPoint) { |
| 12647 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 12648 |
if (propagateBindings) { |
| 12649 |
CVARBINDPROPAGATEANDDependencyNode* bindDepNode = createVARBINDPROPAGATEANDDependency(nextDepTrackPoint, processIndi, conDes, depTrackPoint, calcAlgContext); |
| 12650 |
} else { |
| 12651 |
CANDDependencyNode* andDepNode = createANDDependency(nextDepTrackPoint, processIndi, conDes, depTrackPoint, calcAlgContext); |
| 12652 |
} |
| 12653 |
} |
| 12654 |
|
| 12655 |
CPropagationBindingSet* propBindingSet = nullptr; |
| 12656 |
if (propagateBindings) { |
| 12657 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 12658 |
propBindingSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept, true); |
| 12659 |
if (propagateAll | propagateNominal) { |
| 12660 |
propBindingSet->setPropagateAllFlag(true); |
| 12661 |
} |
| 12662 |
} |
| 12663 |
|
| 12664 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept, bindingTriggerConceptNegation, processIndi, nextDepTrackPoint, false, false, calcAlgContext); |
| 12665 |
if (propBindingSet) { |
| 12666 |
propBindingSet->setConceptDescriptor(bindingConDes); |
| 12667 |
} |
| 12668 |
|
| 12669 |
} |
| 12670 |
} |
| 12671 |
} |
| 12672 |
} |
| 12673 |
} |
| 12674 |
|
| 12675 |
|
| 12676 |
|
| 12677 |
|
| 12678 |
|
| 12679 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyVARBINDFINALIZERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12680 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 12681 |
CConcept* concept = conDes->getConcept(); |
| 12682 |
bool conceptNegation = negate; |
| 12683 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 12684 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 12685 |
|
| 12686 |
|
| 12687 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 12688 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 12689 |
|
| 12690 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 12691 |
|
| 12692 |
|
| 12693 |
STATINC(VARBINDRULEANDAPPLICATIONCOUNT, calcAlgContext); |
| 12694 |
|
| 12695 |
CConcept* topConcept = procDataBox->getOntologyTopConcept(); |
| 12696 |
|
| 12697 |
CSatisfiableTaskAnswererBindingPropagationAdapter* answererMessageAdapter = calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableAnswererBindingPropagationAdapter(); |
| 12698 |
if (answererMessageAdapter) { |
| 12699 |
CAnsweringPropagationSteeringController* propagationSteeringController = answererMessageAdapter->getAnswererPropagationSteeringController(); |
| 12700 |
if (propagationSteeringController) { |
| 12701 |
if (propagationSteeringController->finalizeWithClashing()) { |
| 12702 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 12703 |
if (!nextDepTrackPoint) { |
| 12704 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 12705 |
CVARBINDPROPAGATEANDDependencyNode* bindDepNode = createVARBINDPROPAGATEANDDependency(nextDepTrackPoint, processIndi, conDes, depTrackPoint, calcAlgContext); |
| 12706 |
} |
| 12707 |
addConceptToIndividualReturnConceptDescriptor(topConcept, true, processIndi, nextDepTrackPoint, false, false, calcAlgContext); |
| 12708 |
} |
| 12709 |
if (propagationSteeringController->finalizeWithBindingExtraction()) { |
| 12710 |
bool nondeterministically = true; |
| 12711 |
if (depTrackPoint && depTrackPoint->getBranchingTag() <= 0) { |
| 12712 |
nondeterministically = false; |
| 12713 |
} |
| 12714 |
|
| 12715 |
calcAlgContext->getProcessingDataBox()->getMarkerIndividualNodeHash(true)->addMarkerIndividualNode(concept, processIndi, nondeterministically); |
| 12716 |
} |
| 12717 |
} |
| 12718 |
} |
| 12719 |
|
| 12720 |
|
| 12721 |
|
| 12722 |
|
| 12723 |
} |
| 12724 |
|
| 12725 |
|
| 12726 |
|
| 12727 |
|
| 12728 |
|
| 12729 |
|
| 12730 |
|
| 12731 |
|
| 12732 |
|
| 12733 |
|
| 12734 |
|
| 12735 |
|
| 12736 |
|
| 12737 |
|
| 12738 |
|
| 12739 |
|
| 12740 |
|
| 12741 |
|
| 12742 |
|
| 12743 |
|
| 12744 |
|
| 12745 |
|
| 12746 |
|
| 12747 |
|
| 12748 |
|
| 12749 |
|
| 12750 |
|
| 12751 |
|
| 12752 |
|
| 12753 |
|
| 12754 |
|
| 12755 |
|
| 12756 |
|
| 12757 |
|
| 12758 |
|
| 12759 |
|
| 12760 |
|
| 12761 |
|
| 12762 |
|
| 12763 |
|
| 12764 |
|
| 12765 |
|
| 12766 |
|
| 12767 |
|
| 12768 |
|
| 12769 |
|
| 12770 |
|
| 12771 |
|
| 12772 |
|
| 12773 |
|
| 12774 |
|
| 12775 |
|
| 12776 |
|
| 12777 |
|
| 12778 |
|
| 12779 |
|
| 12780 |
|
| 12781 |
|
| 12782 |
|
| 12783 |
|
| 12784 |
|
| 12785 |
|
| 12786 |
|
| 12787 |
|
| 12788 |
|
| 12789 |
|
| 12790 |
|
| 12791 |
|
| 12792 |
|
| 12793 |
|
| 12794 |
|
| 12795 |
|
| 12796 |
|
| 12797 |
|
| 12798 |
|
| 12799 |
|
| 12800 |
|
| 12801 |
|
| 12802 |
|
| 12803 |
|
| 12804 |
|
| 12805 |
|
| 12806 |
|
| 12807 |
|
| 12808 |
|
| 12809 |
|
| 12810 |
|
| 12811 |
|
| 12812 |
|
| 12813 |
|
| 12814 |
|
| 12815 |
|
| 12816 |
|
| 12817 |
|
| 12818 |
|
| 12819 |
|
| 12820 |
|
| 12821 |
|
| 12822 |
|
| 12823 |
|
| 12824 |
// back propagation (propagation of candidates) |
| 12825 |
|
| 12826 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEGROUNDINGRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 12827 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 12828 |
|
| 12829 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 12830 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 12831 |
CConcept* concept = conDes->getConcept(); |
| 12832 |
bool negated = conDes->isNegated(); |
| 12833 |
cint64 opCount = concept->getOperandCount(); |
| 12834 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 12835 |
|
| 12836 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 12837 |
|
| 12838 |
CConceptPropagationBindingSetHash* conPropBindSetHash = processIndi->getConceptPropagationBindingSetHash(false); |
| 12839 |
CPropagationBindingSet* propBindSet = conPropBindSetHash->getPropagationBindingSet(concept,false); |
| 12840 |
|
| 12841 |
if (propBindSet) { |
| 12842 |
STATINC(PBINDRULEGROUNDINGAPPLICATIONCOUNT,calcAlgContext); |
| 12843 |
|
| 12844 |
if (!opConLinker) { |
| 12845 |
|
| 12846 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mBeforeGroundingDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 12847 |
|
| 12848 |
CPROCESSINGHASH<CConcept*,CPropagationBindingDescriptor*>* groundedConPropBindDesHash = nullptr; |
| 12849 |
CPROCESSINGHASH<CVariable*,CPropagationBindingDescriptor*>* additionalPropBindDesHash = nullptr; |
| 12850 |
CSortedNegLinker<CConcept*>* newGroundedLinker = mGroundingHandler->getGroundingConceptLinker(processIndi,propBindSet,concept,negated,groundedConPropBindDesHash,additionalPropBindDesHash,calcAlgContext); |
| 12851 |
|
| 12852 |
if (newGroundedLinker) { |
| 12853 |
for (CSortedNegLinker<CConcept*>* newGroundedLinkerIt = newGroundedLinker; newGroundedLinkerIt; newGroundedLinkerIt = newGroundedLinkerIt->getNext()) { |
| 12854 |
CConcept* newGroundedCocnept = newGroundedLinkerIt->getData(); |
| 12855 |
bool newGroundedConceptNegation = newGroundedLinkerIt->isNegated(); |
| 12856 |
|
| 12857 |
STATINC(PBINDGROUNDINGCOUNT,calcAlgContext); |
| 12858 |
|
| 12859 |
CDependencyTrackPoint* baseDependencyTrackPoint = nullptr; |
| 12860 |
CDependency* additionalsDependencies = nullptr; |
| 12861 |
// collect dependencies |
| 12862 |
|
| 12863 |
|
| 12864 |
CPROCESSINGHASH<CConcept*,CPropagationBindingDescriptor*>::const_iterator it = groundedConPropBindDesHash->constFind(newGroundedCocnept), itEnd = groundedConPropBindDesHash->constEnd(); |
| 12865 |
while (it != itEnd && it.key() == newGroundedCocnept) { |
| 12866 |
CPropagationBindingDescriptor* propBindDes = it.value(); |
| 12867 |
CDependencyTrackPoint* propBindDepTrackPoint = propBindDes->getDependencyTrackPoint(); |
| 12868 |
if (propBindDepTrackPoint) { |
| 12869 |
if (!baseDependencyTrackPoint) { |
| 12870 |
baseDependencyTrackPoint = propBindDepTrackPoint; |
| 12871 |
} else { |
| 12872 |
CPROPAGATECONNECTIONDependencyNode* connDep = createPROPAGATECONNECTIONDependency(nullptr,conDes,propBindDepTrackPoint,calcAlgContext); |
| 12873 |
additionalsDependencies = connDep->append(additionalsDependencies); |
| 12874 |
} |
| 12875 |
} |
| 12876 |
++it; |
| 12877 |
} |
| 12878 |
|
| 12879 |
for (CPROCESSINGHASH<CVariable*,CPropagationBindingDescriptor*>::const_iterator it = additionalPropBindDesHash->constBegin(), itEnd = additionalPropBindDesHash->constEnd(); it != itEnd; ++it) { |
| 12880 |
CPropagationBindingDescriptor* propBindDes = *it; |
| 12881 |
CDependencyTrackPoint* propBindDepTrackPoint = propBindDes->getDependencyTrackPoint(); |
| 12882 |
if (propBindDepTrackPoint) { |
| 12883 |
if (!baseDependencyTrackPoint) { |
| 12884 |
baseDependencyTrackPoint = propBindDepTrackPoint; |
| 12885 |
} else { |
| 12886 |
CPROPAGATECONNECTIONDependencyNode* connDep = createPROPAGATECONNECTIONDependency(nullptr,conDes,propBindDepTrackPoint,calcAlgContext); |
| 12887 |
additionalsDependencies = connDep->append(additionalsDependencies); |
| 12888 |
} |
| 12889 |
} |
| 12890 |
} |
| 12891 |
|
| 12892 |
if (!baseDependencyTrackPoint) { |
| 12893 |
baseDependencyTrackPoint = depTrackPoint; |
| 12894 |
} |
| 12895 |
|
| 12896 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 12897 |
CBINDPROPAGATEGROUNDINGDependencyNode* groundingDepNode = createBINDPROPAGATEGROUNDINGDependency(nextDepTrackPoint,processIndi,conDes,baseDependencyTrackPoint,additionalsDependencies,calcAlgContext); |
| 12898 |
addConceptToIndividual(newGroundedCocnept,newGroundedConceptNegation,processIndi,nextDepTrackPoint,true,false,calcAlgContext); |
| 12899 |
} |
| 12900 |
} |
| 12901 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mAfterGroundingDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 12902 |
} else { |
| 12903 |
|
| 12904 |
|
| 12905 |
CPROCESSINGHASH<CConcept*,CPropagationBindingDescriptor*>* groundedConPropBindDesHash = nullptr; |
| 12906 |
CPROCESSINGHASH<CVariable*,CPropagationBindingDescriptor*>* additionalPropBindDesHash = nullptr; |
| 12907 |
CSortedNegLinker<CConcept*>* newGroundedLinker = mGroundingHandler->getGroundingConceptLinker(processIndi,propBindSet,concept,negated,groundedConPropBindDesHash,additionalPropBindDesHash,calcAlgContext); |
| 12908 |
|
| 12909 |
if (newGroundedLinker) { |
| 12910 |
|
| 12911 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = opConLinker; opConLinkerIt; opConLinkerIt = opConLinkerIt->getNext()) { |
| 12912 |
CConcept* bindingTriggerConcept = opConLinkerIt->getData(); |
| 12913 |
bool bindingTriggerConceptNegation = opConLinkerIt->isNegated(); |
| 12914 |
|
| 12915 |
CConceptDescriptor* bindingConDes = nullptr; |
| 12916 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 12917 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 12918 |
|
| 12919 |
CPropagationBindingSet* prevPropBindingSet = propBindSet; |
| 12920 |
CPropagationBindingSet* newPropBindingSet = conPropBindSetHash->getPropagationBindingSet(bindingTriggerConcept,true); |
| 12921 |
|
| 12922 |
bool createdBindConcept = false; |
| 12923 |
bool doneBindPropagations = false; |
| 12924 |
|
| 12925 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 12926 |
CConcept* newGroundedCocnept = newGroundedLinker->getData(); |
| 12927 |
bool newGroundedConceptNegation = newGroundedLinker->isNegated(); |
| 12928 |
|
| 12929 |
CDependencyTrackPoint* baseDependencyTrackPoint = nullptr; |
| 12930 |
CDependency* additionalsDependencies = nullptr; |
| 12931 |
CPROCESSINGHASH<CConcept*,CPropagationBindingDescriptor*>::const_iterator it = groundedConPropBindDesHash->constFind(newGroundedCocnept), itEnd = groundedConPropBindDesHash->constEnd(); |
| 12932 |
while (it != itEnd && it.key() == newGroundedCocnept) { |
| 12933 |
CPropagationBindingDescriptor* propBindDes = it.value(); |
| 12934 |
CDependencyTrackPoint* propBindDepTrackPoint = propBindDes->getDependencyTrackPoint(); |
| 12935 |
if (propBindDepTrackPoint) { |
| 12936 |
if (!baseDependencyTrackPoint) { |
| 12937 |
baseDependencyTrackPoint = propBindDepTrackPoint; |
| 12938 |
} else { |
| 12939 |
CPROPAGATECONNECTIONDependencyNode* connDep = createPROPAGATECONNECTIONDependency(nullptr,conDes,propBindDepTrackPoint,calcAlgContext); |
| 12940 |
additionalsDependencies = connDep->append(additionalsDependencies); |
| 12941 |
} |
| 12942 |
} |
| 12943 |
++it; |
| 12944 |
} |
| 12945 |
|
| 12946 |
for (CPROCESSINGHASH<CVariable*,CPropagationBindingDescriptor*>::const_iterator it = additionalPropBindDesHash->constBegin(), itEnd = additionalPropBindDesHash->constEnd(); it != itEnd; ++it) { |
| 12947 |
CPropagationBindingDescriptor* propBindDes = *it; |
| 12948 |
CDependencyTrackPoint* propBindDepTrackPoint = propBindDes->getDependencyTrackPoint(); |
| 12949 |
if (propBindDepTrackPoint) { |
| 12950 |
if (!baseDependencyTrackPoint) { |
| 12951 |
baseDependencyTrackPoint = propBindDepTrackPoint; |
| 12952 |
} else { |
| 12953 |
CPROPAGATECONNECTIONDependencyNode* connDep = createPROPAGATECONNECTIONDependency(nullptr,conDes,propBindDepTrackPoint,calcAlgContext); |
| 12954 |
additionalsDependencies = connDep->append(additionalsDependencies); |
| 12955 |
} |
| 12956 |
} |
| 12957 |
} |
| 12958 |
|
| 12959 |
if (!baseDependencyTrackPoint) { |
| 12960 |
baseDependencyTrackPoint = depTrackPoint; |
| 12961 |
} |
| 12962 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 12963 |
CBINDPROPAGATEGROUNDINGDependencyNode* groundingDepNode = createBINDPROPAGATEGROUNDINGDependency(nextDepTrackPoint,processIndi,conDes,baseDependencyTrackPoint,additionalsDependencies,calcAlgContext); |
| 12964 |
|
| 12965 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 12966 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 12967 |
|
| 12968 |
createdBindConcept = true; |
| 12969 |
} |
| 12970 |
|
| 12971 |
|
| 12972 |
|
| 12973 |
for (CSortedNegLinker<CConcept*>* newGroundedLinkerIt = newGroundedLinker; newGroundedLinkerIt; newGroundedLinkerIt = newGroundedLinkerIt->getNext()) { |
| 12974 |
CConcept* newGroundedCocnept = newGroundedLinkerIt->getData(); |
| 12975 |
bool newGroundedConceptNegation = newGroundedLinkerIt->isNegated(); |
| 12976 |
|
| 12977 |
CPROCESSINGHASH<CConcept*,CPropagationBindingDescriptor*>::const_iterator it = groundedConPropBindDesHash->constFind(newGroundedCocnept), itEnd = groundedConPropBindDesHash->constEnd(); |
| 12978 |
while (it != itEnd && it.key() == newGroundedCocnept) { |
| 12979 |
CPropagationBindingDescriptor* propBindDes = it.value(); |
| 12980 |
CPropagationBinding* propBinding = propBindDes->getPropagationBinding(); |
| 12981 |
if (!newPropBindingSet->containsPropagationBinding(propBinding)) { |
| 12982 |
STATINC(PBINDGROUNDINGCOUNT,calcAlgContext); |
| 12983 |
CDependencyTrackPoint* propBindDepTrackPoint = propBindDes->getDependencyTrackPoint(); |
| 12984 |
|
| 12985 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 12986 |
CPROPAGATEBINDINGDependencyNode* bindDepNode = createPROPAGATEBINDINGDependency(newDepTrackPoint,processIndi,conDes,propBindDepTrackPoint,nullptr,calcAlgContext); |
| 12987 |
CPropagationBindingDescriptor* newPropBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 12988 |
newPropBindDes->initPropagationBindingDescriptor(propBinding,newDepTrackPoint); |
| 12989 |
newPropBindingSet->addPropagationBinding(newPropBindDes,false); |
| 12990 |
|
| 12991 |
doneBindPropagations = true; |
| 12992 |
} |
| 12993 |
++it; |
| 12994 |
} |
| 12995 |
for (CPROCESSINGHASH<CVariable*,CPropagationBindingDescriptor*>::const_iterator it = additionalPropBindDesHash->constBegin(), itEnd = additionalPropBindDesHash->constEnd(); it != itEnd; ++it) { |
| 12996 |
CPropagationBindingDescriptor* propBindDes = *it; |
| 12997 |
CDependencyTrackPoint* propBindDepTrackPoint = propBindDes->getDependencyTrackPoint(); |
| 12998 |
CPropagationBinding* propBinding = propBindDes->getPropagationBinding(); |
| 12999 |
if (!newPropBindingSet->containsPropagationBinding(propBinding)) { |
| 13000 |
STATINC(PBINDGROUNDINGCOUNT,calcAlgContext); |
| 13001 |
CDependencyTrackPoint* propBindDepTrackPoint = propBindDes->getDependencyTrackPoint(); |
| 13002 |
|
| 13003 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 13004 |
CPROPAGATEBINDINGDependencyNode* bindDepNode = createPROPAGATEBINDINGDependency(newDepTrackPoint,processIndi,conDes,propBindDepTrackPoint,nullptr,calcAlgContext); |
| 13005 |
CPropagationBindingDescriptor* newPropBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 13006 |
newPropBindDes->initPropagationBindingDescriptor(propBinding,newDepTrackPoint); |
| 13007 |
newPropBindingSet->addPropagationBinding(newPropBindDes,false); |
| 13008 |
|
| 13009 |
doneBindPropagations = true; |
| 13010 |
} |
| 13011 |
} |
| 13012 |
|
| 13013 |
|
| 13014 |
} |
| 13015 |
|
| 13016 |
|
| 13017 |
if (doneBindPropagations) { |
| 13018 |
if (!createdBindConcept) { |
| 13019 |
if (propagateFreshPropagationBindings(processIndi,conDes,newPropBindingSet,prevPropBindingSet,nullptr,calcAlgContext)) { |
| 13020 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 13021 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true);; |
| 13022 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,true,calcAlgContext); |
| 13023 |
if (!reapplyQueue->isEmpty()) { |
| 13024 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13025 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 13026 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 13027 |
} |
| 13028 |
} |
| 13029 |
} |
| 13030 |
} |
| 13031 |
|
| 13032 |
|
| 13033 |
} |
| 13034 |
} |
| 13035 |
} |
| 13036 |
|
| 13037 |
} |
| 13038 |
} |
| 13039 |
|
| 13040 |
|
| 13041 |
|
| 13042 |
|
| 13043 |
|
| 13044 |
|
| 13045 |
|
| 13046 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATECYCLERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13047 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 13048 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 13049 |
CConcept* concept = conDes->getConcept(); |
| 13050 |
cint64 opCount = concept->getOperandCount(); |
| 13051 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 13052 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13053 |
|
| 13054 |
|
| 13055 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 13056 |
CConceptDescriptor* bindingConDes = nullptr; |
| 13057 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 13058 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 13059 |
|
| 13060 |
CConcept* bindingTriggerConcept = opLinker->getData(); |
| 13061 |
bool bindingTriggerConceptNegation = opLinker->isNegated(); |
| 13062 |
CSortedNegLinker<CConcept*>* triggerLinker = opLinker->getNext(); |
| 13063 |
CConcept* cycleTriggerConcept = triggerLinker->getData(); |
| 13064 |
bool cycleTriggerConceptNegation = triggerLinker->isNegated(); |
| 13065 |
CConceptDescriptor* cycleTriggerConDes = nullptr; |
| 13066 |
CDependencyTrackPoint* cycleTriggerDepTrackPoint = nullptr; |
| 13067 |
|
| 13068 |
|
| 13069 |
|
| 13070 |
bool testCycleBindingClosed = false; |
| 13071 |
bool addCycleCloseConcept = false; |
| 13072 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 13073 |
bool cycleTriggersAvailable = true; |
| 13074 |
if (conSet->getConceptDescriptor(cycleTriggerConcept,cycleTriggerConDes,cycleTriggerDepTrackPoint)) { |
| 13075 |
if (cycleTriggerConDes->isNegated() == cycleTriggerConceptNegation) { |
| 13076 |
return; |
| 13077 |
} |
| 13078 |
} else { |
| 13079 |
cycleTriggersAvailable = false; |
| 13080 |
} |
| 13081 |
|
| 13082 |
if (cycleTriggersAvailable) { |
| 13083 |
addCycleCloseConcept = true; |
| 13084 |
testCycleBindingClosed = true; |
| 13085 |
} |
| 13086 |
} else { |
| 13087 |
testCycleBindingClosed = true; |
| 13088 |
} |
| 13089 |
|
| 13090 |
|
| 13091 |
CPropagationBindingDescriptor* cycleTriggerConceptNewBindingDescriptor = nullptr; |
| 13092 |
CPropagationBindingDescriptor* cyclePropagationConceptDescriptor = nullptr; |
| 13093 |
CPropagationBindingSet* cycleTriggerConceptBindingSet = nullptr; |
| 13094 |
CPropagationBindingSet* cyclePropConceptBindingSet = nullptr; |
| 13095 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = nullptr; |
| 13096 |
CPropagationBinding* cycleTriggerConceptNewBinding = nullptr; |
| 13097 |
bool cycleBindingPropagation = false; |
| 13098 |
if (testCycleBindingClosed) { |
| 13099 |
conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(false); |
| 13100 |
if (conPropBindingSetHash) { |
| 13101 |
cycleTriggerConceptBindingSet = conPropBindingSetHash->getPropagationBindingSet(cycleTriggerConcept,false); |
| 13102 |
if (cycleTriggerConceptBindingSet) { |
| 13103 |
cycleTriggerConceptNewBindingDescriptor = cycleTriggerConceptBindingSet->getNewSepcialPropagationBindingDescriptor(); |
| 13104 |
cycleTriggerConceptNewBinding = cycleTriggerConceptNewBindingDescriptor->getPropagationBinding(); |
| 13105 |
cint64 bindingID = cycleTriggerConceptNewBinding->getPropagationID(); |
| 13106 |
|
| 13107 |
cyclePropConceptBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 13108 |
if (cyclePropConceptBindingSet) { |
| 13109 |
cyclePropagationConceptDescriptor = cyclePropConceptBindingSet->getPropagationBindingDescriptor(cycleTriggerConceptNewBinding); |
| 13110 |
if (cyclePropagationConceptDescriptor) { |
| 13111 |
cycleBindingPropagation = true; |
| 13112 |
} |
| 13113 |
} |
| 13114 |
} |
| 13115 |
} |
| 13116 |
} |
| 13117 |
|
| 13118 |
|
| 13119 |
bool propagations = false; |
| 13120 |
if (cycleBindingPropagation) { |
| 13121 |
STATINC(PBINDRULECYCLEAPPLICATIONCOUNT,calcAlgContext); |
| 13122 |
|
| 13123 |
if (addCycleCloseConcept) { |
| 13124 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13125 |
CBINDPROPAGATECYCLEDependencyNode* cycleDepNode = createBINDPROPAGATECYCLEDependency(bindingDepTrackPoint,processIndi,conDes,cyclePropagationConceptDescriptor->getDependencyTrackPoint(),cycleTriggerConceptNewBindingDescriptor->getDependencyTrackPoint(),calcAlgContext); |
| 13126 |
|
| 13127 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,bindingDepTrackPoint,true,false,calcAlgContext); |
| 13128 |
} |
| 13129 |
|
| 13130 |
// propagate bindings |
| 13131 |
CPropagationBindingMap* cyclePropConceptBindingMap = cyclePropConceptBindingSet->getPropagationBindingMap(); |
| 13132 |
CPropagationBindingMap* cycleTriggerConceptBindingMap = cycleTriggerConceptBindingSet->getPropagationBindingMap(); |
| 13133 |
|
| 13134 |
CPropagationBindingMap::iterator itCycle = cyclePropConceptBindingMap->begin(), itCycleEnd = cyclePropConceptBindingMap->end(); |
| 13135 |
CPropagationBindingMap::iterator itTrigger = cycleTriggerConceptBindingMap->begin(), itTriggerEnd = cycleTriggerConceptBindingMap->end(); |
| 13136 |
|
| 13137 |
CPropagationBindingSet* newPropBindSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept,false); |
| 13138 |
CPropagationBindingMap* newPropBindMap = nullptr; |
| 13139 |
CPropagationBindingDescriptor* newPropBindDesLinker = nullptr; |
| 13140 |
if (newPropBindSet) { |
| 13141 |
newPropBindMap = newPropBindSet->getPropagationBindingMap(); |
| 13142 |
} |
| 13143 |
|
| 13144 |
while (itCycle != itCycleEnd) { |
| 13145 |
cint64 cycleID = itCycle.key(); |
| 13146 |
cint64 triggerID = -1; |
| 13147 |
if (itTrigger != itTriggerEnd) { |
| 13148 |
triggerID = itTrigger.key(); |
| 13149 |
} |
| 13150 |
if (triggerID != -1 && triggerID < cycleID) { |
| 13151 |
++itTrigger; |
| 13152 |
} else if (triggerID == cycleID) { |
| 13153 |
|
| 13154 |
if (!newPropBindSet || !newPropBindSet->containsPropagationBinding(cycleID)) { |
| 13155 |
STATINC(PBINDCYCLEPROPAGATECOUNT,calcAlgContext); |
| 13156 |
if (!newPropBindSet) { |
| 13157 |
newPropBindSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept,true); |
| 13158 |
newPropBindMap = newPropBindSet->getPropagationBindingMap(); |
| 13159 |
newPropBindSet->setConceptDescriptor(bindingConDes); |
| 13160 |
} |
| 13161 |
|
| 13162 |
CPropagationBindingMapData& cyclePropBindMapData = itCycle.value(); |
| 13163 |
CPropagationBindingDescriptor* cyclePropBindDes = cyclePropBindMapData.getPropagationBindingDescriptor(); |
| 13164 |
|
| 13165 |
CPropagationBindingMapData& triggerPropBindMapData = itTrigger.value(); |
| 13166 |
CPropagationBindingDescriptor* triggerPropBindDes = triggerPropBindMapData.getPropagationBindingDescriptor(); |
| 13167 |
|
| 13168 |
CPROPAGATECONNECTIONDependencyNode* connDep1 = createPROPAGATECONNECTIONDependency(nullptr,cycleTriggerConceptBindingSet->getConceptDescriptor(),triggerPropBindDes->getDependencyTrackPoint(),calcAlgContext); |
| 13169 |
CPROPAGATECONNECTIONDependencyNode* connDep2 = createPROPAGATECONNECTIONDependency(nullptr,conDes,cyclePropagationConceptDescriptor->getDependencyTrackPoint(),calcAlgContext); |
| 13170 |
CDependency* connDep = connDep1->setNext(connDep2); |
| 13171 |
|
| 13172 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 13173 |
CPROPAGATEBINDINGDependencyNode* bindDepNode = createPROPAGATEBINDINGDependency(newDepTrackPoint,processIndi,conDes,cyclePropBindDes->getDependencyTrackPoint(),connDep,calcAlgContext); |
| 13174 |
CPropagationBinding* propBinding = cyclePropBindDes->getPropagationBinding(); |
| 13175 |
CPropagationBindingDescriptor* newPropBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 13176 |
newPropBindDes->initPropagationBindingDescriptor(propBinding,newDepTrackPoint); |
| 13177 |
|
| 13178 |
CPropagationBindingMapData& data = (*newPropBindMap)[propBinding->getPropagationID()]; |
| 13179 |
data.setPropagationBindingDescriptor(newPropBindDes); |
| 13180 |
CPropagationBindingReapplyConceptDescriptor* reapplyDes = data.getReapplyConceptDescriptor(); |
| 13181 |
if (reapplyDes) { |
| 13182 |
applyReapplyQueueConcepts(processIndi,reapplyDes,calcAlgContext); |
| 13183 |
} |
| 13184 |
newPropBindDesLinker = newPropBindDes->append(newPropBindDesLinker); |
| 13185 |
|
| 13186 |
propagations = true; |
| 13187 |
} |
| 13188 |
|
| 13189 |
++itCycle; |
| 13190 |
++itTrigger; |
| 13191 |
|
| 13192 |
} else { |
| 13193 |
|
| 13194 |
if (!newPropBindSet || !newPropBindSet->containsPropagationBinding(cycleID)) { |
| 13195 |
|
| 13196 |
CPropagationBindingMapData& cyclePropBindMapData = itCycle.value(); |
| 13197 |
CPropagationBindingDescriptor* cyclePropBindDes = cyclePropBindMapData.getPropagationBindingDescriptor(); |
| 13198 |
CPropagationBinding* propBinding = cyclePropBindDes->getPropagationBinding(); |
| 13199 |
CIndividualProcessNode* bindedIndiNode = propBinding->getBindedIndividual(); |
| 13200 |
CConceptDescriptor* bindedConDes = propBinding->getBindedConceptDescriptor(); |
| 13201 |
|
| 13202 |
bindedIndiNode = getUpToDateIndividual(bindedIndiNode,calcAlgContext); |
| 13203 |
bindedIndiNode = getCorrectedMergedIntoIndividualNode(bindedIndiNode,calcAlgContext); |
| 13204 |
|
| 13205 |
CConceptPropagationBindingSetHash* bindedIndiConPropBindingSetHash = bindedIndiNode->getConceptPropagationBindingSetHash(false); |
| 13206 |
if (bindedIndiConPropBindingSetHash) { |
| 13207 |
CPropagationBindingSet* bindedIndiConPropBindingSet = bindedIndiConPropBindingSetHash->getPropagationBindingSet(bindedConDes->getConcept(),false); |
| 13208 |
if (bindedIndiConPropBindingSet) { |
| 13209 |
|
| 13210 |
CPropagationBindingDescriptor* triggerPropBindDes = bindedIndiConPropBindingSet->getPropagationBindingDescriptor(cycleTriggerConceptNewBinding); |
| 13211 |
if (triggerPropBindDes) { |
| 13212 |
STATINC(PBINDCYCLEPROPAGATECOUNT,calcAlgContext); |
| 13213 |
if (!newPropBindSet) { |
| 13214 |
newPropBindSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept,true); |
| 13215 |
newPropBindMap = newPropBindSet->getPropagationBindingMap(); |
| 13216 |
} |
| 13217 |
|
| 13218 |
// do propagation |
| 13219 |
CPROPAGATECONNECTIONDependencyNode* connDep1 = createPROPAGATECONNECTIONDependency(bindedIndiNode,cycleTriggerConceptBindingSet->getConceptDescriptor(),triggerPropBindDes->getDependencyTrackPoint(),calcAlgContext); |
| 13220 |
CPROPAGATECONNECTIONDependencyNode* connDep2 = createPROPAGATECONNECTIONDependency(nullptr,conDes,cyclePropagationConceptDescriptor->getDependencyTrackPoint(),calcAlgContext); |
| 13221 |
CDependency* connDep = connDep1->setNext(connDep2); |
| 13222 |
|
| 13223 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 13224 |
CPROPAGATEBINDINGDependencyNode* bindDepNode = createPROPAGATEBINDINGDependency(newDepTrackPoint,processIndi,conDes,cyclePropBindDes->getDependencyTrackPoint(),connDep,calcAlgContext); |
| 13225 |
CPropagationBindingDescriptor* newPropBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 13226 |
newPropBindDes->initPropagationBindingDescriptor(propBinding,newDepTrackPoint); |
| 13227 |
|
| 13228 |
CPropagationBindingMapData& data = (*newPropBindMap)[propBinding->getPropagationID()]; |
| 13229 |
data.setPropagationBindingDescriptor(newPropBindDes); |
| 13230 |
CPropagationBindingReapplyConceptDescriptor* reapplyDes = data.getReapplyConceptDescriptor(); |
| 13231 |
if (reapplyDes) { |
| 13232 |
applyReapplyQueueConcepts(processIndi,reapplyDes,calcAlgContext); |
| 13233 |
} |
| 13234 |
newPropBindDesLinker = newPropBindDes->append(newPropBindDesLinker); |
| 13235 |
propagations = true; |
| 13236 |
} else { |
| 13237 |
// install rule reapplication if variable bindings will change |
| 13238 |
TIndividualConceptPair indiConPair(bindedIndiNode->getIndividualNodeID(),concept); |
| 13239 |
CPropagationBindingReapplyConceptHash* reapplyHash = bindedIndiConPropBindingSet->getPropagationBindingReapplyConceptHash(false); |
| 13240 |
if (reapplyHash) { |
| 13241 |
if (!reapplyHash->hasPropagationBindingReapplyConceptDescriptor(indiConPair)) { |
| 13242 |
STATINC(PBINDCYCLEREAPPLYINSTALLCOUNT,calcAlgContext); |
| 13243 |
bindedIndiNode = getLocalizedIndividual(bindedIndiNode,false,calcAlgContext); |
| 13244 |
bindedIndiConPropBindingSetHash = bindedIndiNode->getConceptPropagationBindingSetHash(true); |
| 13245 |
bindedIndiConPropBindingSet = bindedIndiConPropBindingSetHash->getPropagationBindingSet(bindedConDes->getConcept(),true); |
| 13246 |
|
| 13247 |
CPropagationBindingReapplyConceptDescriptor* propBindReapplyConDes = CObjectAllocator<CPropagationBindingReapplyConceptDescriptor>::allocateAndConstruct(taskMemMan); |
| 13248 |
propBindReapplyConDes->initReapllyDescriptor(processIndi,cycleTriggerConceptNewBinding,conDes,depTrackPoint); |
| 13249 |
|
| 13250 |
bindedIndiConPropBindingSet->addPropagationBindingReapplyConceptDescriptor(propBindReapplyConDes); |
| 13251 |
} |
| 13252 |
} |
| 13253 |
} |
| 13254 |
} |
| 13255 |
} |
| 13256 |
} |
| 13257 |
++itCycle; |
| 13258 |
|
| 13259 |
} |
| 13260 |
} |
| 13261 |
if (newPropBindSet && newPropBindDesLinker) { |
| 13262 |
newPropBindSet->addPropagationBindingDescriptorLinker(newPropBindDesLinker); |
| 13263 |
} |
| 13264 |
|
| 13265 |
|
| 13266 |
} |
| 13267 |
|
| 13268 |
|
| 13269 |
if (propagations && !addCycleCloseConcept) { |
| 13270 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 13271 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true);; |
| 13272 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,true,calcAlgContext); |
| 13273 |
if (!reapplyQueue->isEmpty()) { |
| 13274 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13275 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 13276 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 13277 |
} |
| 13278 |
} |
| 13279 |
|
| 13280 |
|
| 13281 |
|
| 13282 |
if (!isConceptInReapplyQueue(conDes,cycleTriggerConcept,!cycleTriggerConceptNegation,processIndi,calcAlgContext)) { |
| 13283 |
addConceptToReapplyQueue(conDes,cycleTriggerConcept,!cycleTriggerConceptNegation,processIndi,(CProcessingRestrictionSpecification*)nullptr,depTrackPoint,calcAlgContext); |
| 13284 |
} |
| 13285 |
|
| 13286 |
} |
| 13287 |
|
| 13288 |
|
| 13289 |
|
| 13290 |
|
| 13291 |
|
| 13292 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagatePropagationBindingsToSuccessor(CIndividualProcessNode* processIndi, CIndividualProcessNode*& succIndi, CSortedNegLinker<CConcept*>* conceptOpLinker, bool negate, CConceptDescriptor* conDes, CIndividualLinkEdge* restLink, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13293 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13294 |
CDependencyTrackPoint* depTrackPoint = conDes->getDependencyTrackPoint(); |
| 13295 |
CConcept* concept = conDes->getConcept(); |
| 13296 |
|
| 13297 |
|
| 13298 |
succIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 13299 |
CReapplyConceptLabelSet* conSet = succIndi->getReapplyConceptLabelSet(false); |
| 13300 |
|
| 13301 |
// create dependency |
| 13302 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 13303 |
bool continuePropagation = false; |
| 13304 |
|
| 13305 |
for (CSortedNegLinker<CConcept*>* conceptOpLinkerIt = conceptOpLinker; conceptOpLinkerIt; conceptOpLinkerIt = conceptOpLinkerIt->getNext()) { |
| 13306 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 13307 |
bool opConNeg = conceptOpLinkerIt->isNegated() ^ negate; |
| 13308 |
|
| 13309 |
CConceptDescriptor* bindingConDes = nullptr; |
| 13310 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 13311 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 13312 |
if (!conSet->getConceptDescriptorAndReapplyQueue(opConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 13313 |
|
| 13314 |
|
| 13315 |
if (!nextDepTrackPoint) { |
| 13316 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13317 |
CBINDPROPAGATEALLDependencyNode* bindDepNode = createBINDPROPAGATEALLDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,restLink->getDependencyTrackPoint(),calcAlgContext); |
| 13318 |
} |
| 13319 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(opConcept,opConNeg,succIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 13320 |
|
| 13321 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 13322 |
CPropagationBindingSet* prevPropBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 13323 |
CConceptPropagationBindingSetHash* succConPropBindingSetHash = succIndi->getConceptPropagationBindingSetHash(true); |
| 13324 |
CPropagationBindingSet* propBindingSet = succConPropBindingSetHash->getPropagationBindingSet(opConcept,true); |
| 13325 |
propBindingSet->setConceptDescriptor(bindingConDes); |
| 13326 |
|
| 13327 |
propagateInitialPropagationBindingsToSuccessor(processIndi,succIndi,bindingConDes,propBindingSet,prevPropBindingSet,restLink,calcAlgContext); |
| 13328 |
continuePropagation = true; |
| 13329 |
} else { |
| 13330 |
|
| 13331 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 13332 |
CPropagationBindingSet* prevPropBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 13333 |
CConceptPropagationBindingSetHash* succConPropBindingSetHash = succIndi->getConceptPropagationBindingSetHash(true); |
| 13334 |
CPropagationBindingSet* propBindingSet = succConPropBindingSetHash->getPropagationBindingSet(opConcept,true); |
| 13335 |
|
| 13336 |
if (propagateFreshPropagationBindingsToSuccessor(processIndi,succIndi,conDes,propBindingSet,prevPropBindingSet,restLink,calcAlgContext)) { |
| 13337 |
setIndividualNodeConceptLabelSetModified(succIndi,calcAlgContext); |
| 13338 |
CConceptProcessingQueue* conProQueue = succIndi->getConceptProcessingQueue(true);; |
| 13339 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,succIndi,true,calcAlgContext); |
| 13340 |
if (!reapplyQueue->isEmpty()) { |
| 13341 |
conSet = succIndi->getReapplyConceptLabelSet(true); |
| 13342 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 13343 |
applyReapplyQueueConcepts(succIndi,&reapplyQueueIt,calcAlgContext); |
| 13344 |
} |
| 13345 |
continuePropagation = true; |
| 13346 |
} |
| 13347 |
} |
| 13348 |
} |
| 13349 |
|
| 13350 |
if (continuePropagation) { |
| 13351 |
addIndividualToProcessingQueue(succIndi,calcAlgContext); |
| 13352 |
} |
| 13353 |
} |
| 13354 |
|
| 13355 |
|
| 13356 |
|
| 13357 |
|
| 13358 |
|
| 13359 |
|
| 13360 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateInitialPropagationBindingsToSuccessor(CIndividualProcessNode*& processIndi, CIndividualProcessNode* succIndi, CConceptDescriptor* conDes, CPropagationBindingSet* newPropBindingSet, CPropagationBindingSet* prevPropBindingSet, CIndividualLinkEdge* restLink, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13361 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13362 |
bool propagations = false; |
| 13363 |
CPropagationBindingDescriptor* newPropBindDesLinker = nullptr; |
| 13364 |
if (prevPropBindingSet) { |
| 13365 |
propagations |= newPropBindingSet->adoptPropagateAllFlag(prevPropBindingSet); |
| 13366 |
|
| 13367 |
newPropBindingSet->copyPropagationBindings(prevPropBindingSet->getPropagationBindingMap()); |
| 13368 |
CPropagationBindingMap* propBindMap = newPropBindingSet->getPropagationBindingMap(); |
| 13369 |
for (CPropagationBindingMap::iterator it = propBindMap->begin(), itEnd = propBindMap->end(); it != itEnd; ++it) { |
| 13370 |
STATINC(PBINDPROPAGATEDCOUNT,calcAlgContext); |
| 13371 |
STATINC(PBINDPROPAGATEDINITIALCOUNT,calcAlgContext); |
| 13372 |
CPropagationBindingMapData& propBindMapData = it.value(); |
| 13373 |
propBindMapData.clearReapplyConceptDescriptor(); |
| 13374 |
CPropagationBindingDescriptor* prevPropBindDes = propBindMapData.getPropagationBindingDescriptor(); |
| 13375 |
CPropagationBindingDescriptor* newPropBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 13376 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 13377 |
CPROPAGATEBINDINGSSUCCESSORDependencyNode* bindDepNode = createPROPAGATEBINDINGSSUCCESSORDependency(newDepTrackPoint,processIndi,conDes,prevPropBindDes->getDependencyTrackPoint(),restLink->getDependencyTrackPoint(),calcAlgContext); |
| 13378 |
newPropBindDes->initPropagationBindingDescriptor(prevPropBindDes->getPropagationBinding(),newDepTrackPoint); |
| 13379 |
propBindMapData.setPropagationBindingDescriptor(newPropBindDes); |
| 13380 |
newPropBindDesLinker = newPropBindDes->append(newPropBindDesLinker); |
| 13381 |
propagations = true; |
| 13382 |
} |
| 13383 |
if (newPropBindDesLinker) { |
| 13384 |
newPropBindingSet->addPropagationBindingDescriptorLinker(newPropBindDesLinker); |
| 13385 |
} |
| 13386 |
} |
| 13387 |
return propagations; |
| 13388 |
} |
| 13389 |
|
| 13390 |
|
| 13391 |
|
| 13392 |
|
| 13393 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateFreshPropagationBindingsToSuccessor(CIndividualProcessNode*& processIndi, CIndividualProcessNode* succIndi, CConceptDescriptor* conDes, CPropagationBindingSet* newPropBindingSet, CPropagationBindingSet* prevPropBindingSet, CIndividualLinkEdge* restLink, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13394 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13395 |
bool propagations = false; |
| 13396 |
if (prevPropBindingSet) { |
| 13397 |
propagations |= newPropBindingSet->adoptPropagateAllFlag(prevPropBindingSet); |
| 13398 |
|
| 13399 |
CPropagationBindingMap* prevPropBindMap = prevPropBindingSet->getPropagationBindingMap(); |
| 13400 |
CPropagationBindingMap* newPropBindMap = newPropBindingSet->getPropagationBindingMap(); |
| 13401 |
|
| 13402 |
CPropagationBindingMap::iterator itNew = newPropBindMap->begin(); |
| 13403 |
CPropagationBindingMap::const_iterator itPrev = prevPropBindMap->constBegin(), itPrevEnd = prevPropBindMap->constEnd(); |
| 13404 |
|
| 13405 |
CPropagationBindingDescriptor* newPropBindDesLinker = nullptr; |
| 13406 |
|
| 13407 |
while (itPrev != itPrevEnd) { |
| 13408 |
cint64 prevPropID = itPrev.key(); |
| 13409 |
bool doPropagation = false; |
| 13410 |
bool updateExisting = false; |
| 13411 |
if (itNew == newPropBindMap->end()) { |
| 13412 |
doPropagation = true; |
| 13413 |
} else { |
| 13414 |
cint64 newPropID = itNew.key(); |
| 13415 |
if (newPropID < prevPropID) { |
| 13416 |
++itNew; |
| 13417 |
} else if (newPropID == prevPropID) { |
| 13418 |
if (!itNew.value().hasPropagationBindingDescriptor()) { |
| 13419 |
doPropagation = true; |
| 13420 |
updateExisting = true; |
| 13421 |
} else { |
| 13422 |
++itNew; |
| 13423 |
++itPrev; |
| 13424 |
} |
| 13425 |
} else { |
| 13426 |
doPropagation = true; |
| 13427 |
} |
| 13428 |
} |
| 13429 |
if (doPropagation) { |
| 13430 |
STATINC(PBINDPROPAGATEDCOUNT,calcAlgContext); |
| 13431 |
STATINC(PBINDPROPAGATEDFRESHCOUNT,calcAlgContext); |
| 13432 |
const CPropagationBindingMapData& prevPropBindMapData = itPrev.value(); |
| 13433 |
CPropagationBindingDescriptor* prevPropBindDes = prevPropBindMapData.getPropagationBindingDescriptor(); |
| 13434 |
|
| 13435 |
CPropagationBindingDescriptor* newPropBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 13436 |
|
| 13437 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 13438 |
CPROPAGATEBINDINGSSUCCESSORDependencyNode* bindDepNode = createPROPAGATEBINDINGSSUCCESSORDependency(newDepTrackPoint,processIndi,conDes,prevPropBindDes->getDependencyTrackPoint(),restLink->getDependencyTrackPoint(),calcAlgContext); |
| 13439 |
CPropagationBinding* propBinding = prevPropBindDes->getPropagationBinding(); |
| 13440 |
newPropBindDes->initPropagationBindingDescriptor(propBinding,newDepTrackPoint); |
| 13441 |
|
| 13442 |
if (updateExisting) { |
| 13443 |
CPropagationBindingMapData& data = (*newPropBindMap)[propBinding->getPropagationID()]; |
| 13444 |
data.setPropagationBindingDescriptor(newPropBindDes); |
| 13445 |
CPropagationBindingReapplyConceptDescriptor* reapplyDes = data.getReapplyConceptDescriptor(); |
| 13446 |
if (reapplyDes) { |
| 13447 |
applyReapplyQueueConcepts(succIndi,reapplyDes,calcAlgContext); |
| 13448 |
} |
| 13449 |
} else { |
| 13450 |
itNew = newPropBindMap->insert(propBinding->getPropagationID(),CPropagationBindingMapData(newPropBindDes)); |
| 13451 |
} |
| 13452 |
newPropBindDesLinker = newPropBindDes->append(newPropBindDesLinker); |
| 13453 |
propagations = true; |
| 13454 |
} |
| 13455 |
} |
| 13456 |
if (newPropBindDesLinker) { |
| 13457 |
newPropBindingSet->addPropagationBindingDescriptorLinker(newPropBindDesLinker); |
| 13458 |
} |
| 13459 |
} |
| 13460 |
return propagations; |
| 13461 |
} |
| 13462 |
|
| 13463 |
|
| 13464 |
|
| 13465 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEALLRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13466 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 13467 |
CConcept* concept = conDes->getConcept(); |
| 13468 |
CRole* role = concept->getRole(); |
| 13469 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 13470 |
cint64 opCount = concept->getOperandCount(); |
| 13471 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 13472 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13473 |
|
| 13474 |
CSortedNegLinker<CConcept*>* conceptOpLinker = concept->getOperandList(); |
| 13475 |
|
| 13476 |
STATINC(PBINDRULEALLAPPLICATIONCOUNT,calcAlgContext); |
| 13477 |
|
| 13478 |
CIndividualLinkEdge* restLink = getLinkProcessingRestriction(conProDes); |
| 13479 |
if (restLink) { |
| 13480 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,restLink,calcAlgContext); |
| 13481 |
|
| 13482 |
propagatePropagationBindingsToSuccessor(processIndi,succIndi,opLinker,negate,conDes,restLink,calcAlgContext); |
| 13483 |
|
| 13484 |
} else { |
| 13485 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 13486 |
if (roleSuccHash) { |
| 13487 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role); |
| 13488 |
while (roleSuccIt.hasNext()) { |
| 13489 |
CIndividualLinkEdge* link = roleSuccIt.next(true); |
| 13490 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 13491 |
|
| 13492 |
propagatePropagationBindingsToSuccessor(processIndi,succIndi,opLinker,negate,conDes,link,calcAlgContext); |
| 13493 |
} |
| 13494 |
} |
| 13495 |
} |
| 13496 |
if (!conProDes->isConceptReapplied()) { |
| 13497 |
if (!isConceptInReapplyQueue(conDes,role,processIndi,calcAlgContext)) { |
| 13498 |
addConceptToReapplyQueue(conDes,role,processIndi,true,depTrackPoint,calcAlgContext); |
| 13499 |
} |
| 13500 |
} |
| 13501 |
} |
| 13502 |
|
| 13503 |
|
| 13504 |
|
| 13505 |
|
| 13506 |
|
| 13507 |
|
| 13508 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEIMPLICATIONRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13509 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 13510 |
CConcept* concept = conDes->getConcept(); |
| 13511 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 13512 |
cint64 opCount = concept->getOperandCount(); |
| 13513 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 13514 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13515 |
|
| 13516 |
STATINC(PBINDRULEIMPLICATIONAPPLICATIONCOUNT,calcAlgContext); |
| 13517 |
|
| 13518 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 13519 |
CConceptDescriptor* bindingConDes = nullptr; |
| 13520 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 13521 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 13522 |
|
| 13523 |
CConcept* bindingTriggerConcept = opLinker->getData(); |
| 13524 |
bool bindingTriggerConceptNegation = opLinker->isNegated(); |
| 13525 |
CSortedNegLinker<CConcept*>* triggerLinker = opLinker->getNext(); |
| 13526 |
|
| 13527 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 13528 |
|
| 13529 |
// search next not existing trigger |
| 13530 |
bool allTriggersAvailable = true; |
| 13531 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13532 |
CSortedNegLinker<CConcept*>* triggerLinkerIt = nullptr; |
| 13533 |
for (triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 13534 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 13535 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 13536 |
CConceptDescriptor* triggerConDes = nullptr; |
| 13537 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 13538 |
if (conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint)) { |
| 13539 |
if (triggerConDes->isNegated() == nextTrigger->isNegated()) { |
| 13540 |
return; |
| 13541 |
} |
| 13542 |
} else { |
| 13543 |
allTriggersAvailable = false; |
| 13544 |
break; |
| 13545 |
} |
| 13546 |
} |
| 13547 |
|
| 13548 |
if (!allTriggersAvailable) { |
| 13549 |
// install to trigger |
| 13550 |
CSortedNegLinker<CConcept*>* nextTrigger = triggerLinkerIt; |
| 13551 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 13552 |
bool triggerNegation = !nextTrigger->isNegated(); |
| 13553 |
if (!isConceptInReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,calcAlgContext)) { |
| 13554 |
addConceptToReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,(CProcessingRestrictionSpecification*)nullptr,depTrackPoint,calcAlgContext); |
| 13555 |
} |
| 13556 |
} else { |
| 13557 |
CDependency* triggerDeps = nullptr; |
| 13558 |
for (CSortedNegLinker<CConcept*>* triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 13559 |
CConcept* triggerConcept = triggerLinkerIt->getData(); |
| 13560 |
CConceptDescriptor* triggerConDes = nullptr; |
| 13561 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 13562 |
conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint); |
| 13563 |
CCONNECTIONDependencyNode* connDep = createCONNECTIONDependency(processIndi,triggerConDes,triggerDepTrackPoint,calcAlgContext); |
| 13564 |
connDep->setNext(triggerDeps); |
| 13565 |
triggerDeps = connDep; |
| 13566 |
} |
| 13567 |
|
| 13568 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 13569 |
CBINDPROPAGATEIMPLICATIONDependencyNode* implDepNode = createBINDPROPAGATEIMPLICATIONDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,triggerDeps,calcAlgContext); |
| 13570 |
|
| 13571 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,true,false,calcAlgContext); |
| 13572 |
|
| 13573 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 13574 |
CPropagationBindingSet* prevPropBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 13575 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept,true); |
| 13576 |
propBindingSet->setConceptDescriptor(bindingConDes); |
| 13577 |
|
| 13578 |
propagateInitialPropagationBindings(processIndi,bindingConDes,propBindingSet,prevPropBindingSet,triggerDeps,calcAlgContext); |
| 13579 |
|
| 13580 |
} |
| 13581 |
} else { |
| 13582 |
CDependency* triggerDeps = nullptr; |
| 13583 |
for (CSortedNegLinker<CConcept*>* triggerLinkerIt = triggerLinker; triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 13584 |
CConcept* triggerConcept = triggerLinkerIt->getData(); |
| 13585 |
CConceptDescriptor* triggerConDes = nullptr; |
| 13586 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 13587 |
conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint); |
| 13588 |
CCONNECTIONDependencyNode* connDep = createCONNECTIONDependency(processIndi,triggerConDes,triggerDepTrackPoint,calcAlgContext); |
| 13589 |
connDep->setNext(triggerDeps); |
| 13590 |
triggerDeps = connDep; |
| 13591 |
} |
| 13592 |
|
| 13593 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 13594 |
CPropagationBindingSet* prevPropBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 13595 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept,true); |
| 13596 |
|
| 13597 |
if (propagateFreshPropagationBindings(processIndi,conDes,propBindingSet,prevPropBindingSet,triggerDeps,calcAlgContext)) { |
| 13598 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 13599 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true);; |
| 13600 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,true,calcAlgContext); |
| 13601 |
if (!reapplyQueue->isEmpty()) { |
| 13602 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13603 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 13604 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 13605 |
} |
| 13606 |
} |
| 13607 |
} |
| 13608 |
} |
| 13609 |
|
| 13610 |
|
| 13611 |
|
| 13612 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEANDRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13613 |
propagatePropagationBindings(processIndi,conProDes,negate,false,calcAlgContext); |
| 13614 |
} |
| 13615 |
|
| 13616 |
|
| 13617 |
|
| 13618 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDPROPAGATEANDFLAGALLRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13619 |
++mStatBackPropActivationCount; |
| 13620 |
propagatePropagationBindings(processIndi,conProDes,negate,true,calcAlgContext); |
| 13621 |
} |
| 13622 |
|
| 13623 |
|
| 13624 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagatePropagationBindings(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, bool propagateAllFlag, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13625 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 13626 |
CConcept* concept = conDes->getConcept(); |
| 13627 |
bool conceptNegation = negate; |
| 13628 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 13629 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 13630 |
|
| 13631 |
STATINC(PBINDRULEANDAPPLICATIONCOUNT,calcAlgContext); |
| 13632 |
|
| 13633 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 13634 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13635 |
|
| 13636 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 13637 |
|
| 13638 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 13639 |
|
| 13640 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = opConLinker; opConLinkerIt; opConLinkerIt = opConLinkerIt->getNext()) { |
| 13641 |
CConcept* bindingTriggerConcept = opConLinkerIt->getData(); |
| 13642 |
bool bindingTriggerConceptNegation = opConLinkerIt->isNegated()^conceptNegation; |
| 13643 |
|
| 13644 |
CConceptDescriptor* bindingConDes = nullptr; |
| 13645 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 13646 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 13647 |
|
| 13648 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 13649 |
if (!nextDepTrackPoint) { |
| 13650 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13651 |
CBINDPROPAGATEANDDependencyNode* bindDepNode = createBINDPROPAGATEANDDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 13652 |
} |
| 13653 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 13654 |
|
| 13655 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 13656 |
CPropagationBindingSet* prevPropBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 13657 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept,true); |
| 13658 |
propBindingSet->setConceptDescriptor(bindingConDes); |
| 13659 |
|
| 13660 |
if (propagateAllFlag) { |
| 13661 |
propBindingSet->setPropagateAllFlag(true); |
| 13662 |
} |
| 13663 |
|
| 13664 |
propagateInitialPropagationBindings(processIndi,bindingConDes,propBindingSet,prevPropBindingSet,nullptr,calcAlgContext); |
| 13665 |
} else { |
| 13666 |
|
| 13667 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 13668 |
CPropagationBindingSet* prevPropBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 13669 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept,true); |
| 13670 |
|
| 13671 |
if (propagateFreshPropagationBindings(processIndi,conDes,propBindingSet,prevPropBindingSet,nullptr,calcAlgContext) || propagateAllFlag && !propBindingSet->hasPropagateAllFlag()) { |
| 13672 |
if (propagateAllFlag) { |
| 13673 |
propBindingSet->setPropagateAllFlag(true); |
| 13674 |
} |
| 13675 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 13676 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true);; |
| 13677 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,true,calcAlgContext); |
| 13678 |
if (!reapplyQueue->isEmpty()) { |
| 13679 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13680 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 13681 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 13682 |
} |
| 13683 |
} |
| 13684 |
} |
| 13685 |
} |
| 13686 |
} |
| 13687 |
|
| 13688 |
|
| 13689 |
|
| 13690 |
|
| 13691 |
|
| 13692 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyBINDVARIABLERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13693 |
|
| 13694 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 13695 |
CConcept* concept = conDes->getConcept(); |
| 13696 |
CVariable* variable = concept->getVariable(); |
| 13697 |
bool conceptNegation = negate; |
| 13698 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 13699 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 13700 |
|
| 13701 |
CConcept* bindingTriggerConcept = opConLinker->getData(); |
| 13702 |
bool bindingTriggerConceptNegation = opConLinker->isNegated(); |
| 13703 |
|
| 13704 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 13705 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 13706 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13707 |
|
| 13708 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 13709 |
CConceptDescriptor* bindingConDes = nullptr; |
| 13710 |
CDependencyTrackPoint* bindingDepTrackPoint = nullptr; |
| 13711 |
CCondensedReapplyQueue* reapplyQueue = nullptr; |
| 13712 |
|
| 13713 |
STATINC(PBINDRULEBINDNAPPLICATIONCOUNT,calcAlgContext); |
| 13714 |
|
| 13715 |
if (!conSet->getConceptDescriptorAndReapplyQueue(bindingTriggerConcept,bindingConDes,bindingDepTrackPoint,reapplyQueue)) { |
| 13716 |
STATINC(PBINDVARIABLEBINDCOUNT,calcAlgContext); |
| 13717 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 13718 |
CBINDVARIABLEDependencyNode* bindDepNode = createBINDVARIABLEDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 13719 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13720 |
|
| 13721 |
bindingConDes = addConceptToIndividualReturnConceptDescriptor(bindingTriggerConcept,bindingTriggerConceptNegation,processIndi,nextDepTrackPoint,false,false,calcAlgContext); |
| 13722 |
|
| 13723 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 13724 |
CPropagationBindingSet* prevPropBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 13725 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept,true); |
| 13726 |
propBindingSet->setConceptDescriptor(bindingConDes); |
| 13727 |
propagateInitialPropagationBindings(processIndi,bindingConDes,propBindingSet,prevPropBindingSet,nullptr,calcAlgContext); |
| 13728 |
|
| 13729 |
|
| 13730 |
CPropagationBinding* propVarBinding = CObjectAllocator<CPropagationBinding>::allocateAndConstruct(taskMemMan); |
| 13731 |
cint64 nextPropBindingID = procDataBox->getNextBindingPropagationID(true); |
| 13732 |
propVarBinding->initPropagationBinding(nextPropBindingID,nextDepTrackPoint,processIndi,bindingConDes,variable); |
| 13733 |
CPropagationBindingDescriptor* propBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 13734 |
propBindDes->initPropagationBindingDescriptor(propVarBinding,nextDepTrackPoint); |
| 13735 |
propBindingSet->addPropagationBinding(propBindDes,true); |
| 13736 |
|
| 13737 |
} else { |
| 13738 |
CConceptPropagationBindingSetHash* conPropBindingSetHash = processIndi->getConceptPropagationBindingSetHash(true); |
| 13739 |
CPropagationBindingSet* prevPropBindingSet = conPropBindingSetHash->getPropagationBindingSet(concept,false); |
| 13740 |
CPropagationBindingSet* propBindingSet = conPropBindingSetHash->getPropagationBindingSet(bindingTriggerConcept,true); |
| 13741 |
|
| 13742 |
bool newVarBindCreated = false; |
| 13743 |
if (!propBindingSet->getNewSepcialPropagationBindingDescriptor()) { |
| 13744 |
STATINC(PBINDVARIABLEBINDCOUNT,calcAlgContext); |
| 13745 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 13746 |
CBINDVARIABLEDependencyNode* bindDepNode = createBINDVARIABLEDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 13747 |
CPropagationBinding* propVarBinding = CObjectAllocator<CPropagationBinding>::allocateAndConstruct(taskMemMan); |
| 13748 |
cint64 nextPropBindingID = procDataBox->getNextBindingPropagationID(true); |
| 13749 |
propVarBinding->initPropagationBinding(nextPropBindingID,nextDepTrackPoint,processIndi,bindingConDes,variable); |
| 13750 |
CPropagationBindingDescriptor* propBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 13751 |
propBindDes->initPropagationBindingDescriptor(propVarBinding,nextDepTrackPoint); |
| 13752 |
propBindingSet->addPropagationBinding(propBindDes,true); |
| 13753 |
newVarBindCreated = true; |
| 13754 |
} |
| 13755 |
|
| 13756 |
if (propagateFreshPropagationBindings(processIndi,conDes,propBindingSet,prevPropBindingSet,nullptr,calcAlgContext) || newVarBindCreated) { |
| 13757 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 13758 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true);; |
| 13759 |
addConceptPreprocessedToProcessingQueue(bindingConDes,bindingDepTrackPoint,conProQueue,processIndi,true,calcAlgContext); |
| 13760 |
if (!reapplyQueue->isEmpty()) { |
| 13761 |
conSet = processIndi->getReapplyConceptLabelSet(true); |
| 13762 |
CCondensedReapplyQueueIterator reapplyQueueIt(conSet->getConceptReapplyIterator(bindingConDes)); |
| 13763 |
applyReapplyQueueConcepts(processIndi,&reapplyQueueIt,calcAlgContext); |
| 13764 |
} |
| 13765 |
} |
| 13766 |
} |
| 13767 |
} |
| 13768 |
|
| 13769 |
|
| 13770 |
|
| 13771 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateInitialPropagationBindings(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CPropagationBindingSet* newPropBindingSet, CPropagationBindingSet* prevPropBindingSet, CDependency* otherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13772 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13773 |
bool propagations = false; |
| 13774 |
CPropagationBindingDescriptor* newPropBindDesLinker = nullptr; |
| 13775 |
if (prevPropBindingSet) { |
| 13776 |
propagations |= newPropBindingSet->adoptPropagateAllFlag(prevPropBindingSet); |
| 13777 |
|
| 13778 |
newPropBindingSet->copyPropagationBindings(prevPropBindingSet->getPropagationBindingMap()); |
| 13779 |
CPropagationBindingMap* propBindMap = newPropBindingSet->getPropagationBindingMap(); |
| 13780 |
for (CPropagationBindingMap::iterator it = propBindMap->begin(), itEnd = propBindMap->end(); it != itEnd; ++it) { |
| 13781 |
STATINC(PBINDPROPAGATEDCOUNT,calcAlgContext); |
| 13782 |
STATINC(PBINDPROPAGATEDINITIALCOUNT,calcAlgContext); |
| 13783 |
CPropagationBindingMapData& propBindMapData = it.value(); |
| 13784 |
propBindMapData.clearReapplyConceptDescriptor(); |
| 13785 |
CPropagationBindingDescriptor* prevPropBindDes = propBindMapData.getPropagationBindingDescriptor(); |
| 13786 |
CPropagationBindingDescriptor* newPropBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 13787 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 13788 |
CPROPAGATEBINDINGDependencyNode* bindDepNode = createPROPAGATEBINDINGDependency(newDepTrackPoint,processIndi,conDes,prevPropBindDes->getDependencyTrackPoint(),otherDependencies,calcAlgContext); |
| 13789 |
newPropBindDes->initPropagationBindingDescriptor(prevPropBindDes->getPropagationBinding(),newDepTrackPoint); |
| 13790 |
propBindMapData.setPropagationBindingDescriptor(newPropBindDes); |
| 13791 |
newPropBindDesLinker = newPropBindDes->append(newPropBindDesLinker); |
| 13792 |
propagations = true; |
| 13793 |
} |
| 13794 |
if (newPropBindDesLinker) { |
| 13795 |
newPropBindingSet->addPropagationBindingDescriptorLinker(newPropBindDesLinker); |
| 13796 |
} |
| 13797 |
} |
| 13798 |
return propagations; |
| 13799 |
} |
| 13800 |
|
| 13801 |
|
| 13802 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::propagateFreshPropagationBindings(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CPropagationBindingSet* newPropBindingSet, CPropagationBindingSet* prevPropBindingSet, CDependency* otherDependencies, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13803 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 13804 |
bool propagations = false; |
| 13805 |
if (prevPropBindingSet) { |
| 13806 |
propagations |= newPropBindingSet->adoptPropagateAllFlag(prevPropBindingSet); |
| 13807 |
CPropagationBindingMap* prevPropBindMap = prevPropBindingSet->getPropagationBindingMap(); |
| 13808 |
CPropagationBindingMap* newPropBindMap = newPropBindingSet->getPropagationBindingMap(); |
| 13809 |
|
| 13810 |
CPropagationBindingMap::iterator itNew = newPropBindMap->begin(); |
| 13811 |
CPropagationBindingMap::const_iterator itPrev = prevPropBindMap->constBegin(), itPrevEnd = prevPropBindMap->constEnd(); |
| 13812 |
|
| 13813 |
CPropagationBindingDescriptor* newPropBindDesLinker = nullptr; |
| 13814 |
|
| 13815 |
while (itPrev != itPrevEnd) { |
| 13816 |
cint64 prevPropID = itPrev.key(); |
| 13817 |
bool doPropagation = false; |
| 13818 |
bool updateExisting = false; |
| 13819 |
if (itNew == newPropBindMap->end()) { |
| 13820 |
doPropagation = true; |
| 13821 |
} else { |
| 13822 |
cint64 newPropID = itNew.key(); |
| 13823 |
if (newPropID < prevPropID) { |
| 13824 |
++itNew; |
| 13825 |
} else if (newPropID == prevPropID) { |
| 13826 |
if (!itNew.value().hasPropagationBindingDescriptor()) { |
| 13827 |
doPropagation = true; |
| 13828 |
updateExisting = true; |
| 13829 |
} else { |
| 13830 |
++itNew; |
| 13831 |
++itPrev; |
| 13832 |
} |
| 13833 |
} else { |
| 13834 |
doPropagation = true; |
| 13835 |
} |
| 13836 |
} |
| 13837 |
if (doPropagation) { |
| 13838 |
STATINC(PBINDPROPAGATEDCOUNT,calcAlgContext); |
| 13839 |
STATINC(PBINDPROPAGATEDFRESHCOUNT,calcAlgContext); |
| 13840 |
const CPropagationBindingMapData& prevPropBindMapData = itPrev.value(); |
| 13841 |
CPropagationBindingDescriptor* prevPropBindDes = prevPropBindMapData.getPropagationBindingDescriptor(); |
| 13842 |
|
| 13843 |
CPropagationBindingDescriptor* newPropBindDes = CObjectAllocator<CPropagationBindingDescriptor>::allocateAndConstruct(taskMemMan); |
| 13844 |
|
| 13845 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 13846 |
CPROPAGATEBINDINGDependencyNode* bindDepNode = createPROPAGATEBINDINGDependency(newDepTrackPoint,processIndi,conDes,prevPropBindDes->getDependencyTrackPoint(),otherDependencies,calcAlgContext); |
| 13847 |
CPropagationBinding* propBinding = prevPropBindDes->getPropagationBinding(); |
| 13848 |
newPropBindDes->initPropagationBindingDescriptor(propBinding,newDepTrackPoint); |
| 13849 |
|
| 13850 |
if (updateExisting) { |
| 13851 |
CPropagationBindingMapData& data = (*newPropBindMap)[propBinding->getPropagationID()]; |
| 13852 |
data.setPropagationBindingDescriptor(newPropBindDes); |
| 13853 |
CPropagationBindingReapplyConceptDescriptor* reapplyDes = data.getReapplyConceptDescriptor(); |
| 13854 |
if (reapplyDes) { |
| 13855 |
applyReapplyQueueConcepts(processIndi,reapplyDes,calcAlgContext); |
| 13856 |
} |
| 13857 |
} else { |
| 13858 |
itNew = newPropBindMap->insert(propBinding->getPropagationID(),CPropagationBindingMapData(newPropBindDes)); |
| 13859 |
} |
| 13860 |
newPropBindDesLinker = newPropBindDes->append(newPropBindDesLinker); |
| 13861 |
propagations = true; |
| 13862 |
} |
| 13863 |
} |
| 13864 |
if (newPropBindDesLinker) { |
| 13865 |
newPropBindingSet->addPropagationBindingDescriptorLinker(newPropBindDesLinker); |
| 13866 |
} |
| 13867 |
} |
| 13868 |
return propagations; |
| 13869 |
} |
| 13870 |
|
| 13871 |
|
| 13872 |
|
| 13873 |
|
| 13874 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyReapplyQueueConcepts(CIndividualProcessNode*& processIndi, CPropagationBindingReapplyConceptDescriptor* reapplyDesLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 13875 |
CProcessingRestrictionSpecification* procRest = nullptr; |
| 13876 |
for (CPropagationBindingReapplyConceptDescriptor* reapplyDesLinkerIt = reapplyDesLinker; reapplyDesLinkerIt; reapplyDesLinkerIt = reapplyDesLinkerIt->getNext()) { |
| 13877 |
STATINC(PBINDREAPPLICATIONCOUNT,calcAlgContext); |
| 13878 |
CPropagationBindingReapplyConceptDescriptor* reapplyDes = reapplyDesLinkerIt; |
| 13879 |
CConceptDescriptor* conDes = reapplyDes->getConceptDescriptor(); |
| 13880 |
CDependencyTrackPoint* depTrackPoint = conDes->getDependencyTrackPoint(); |
| 13881 |
CIndividualProcessNode* indiNode = reapplyDes->getReapllyIndividualNode(); |
| 13882 |
CIndividualProcessNode* locIndiNode = indiNode; |
| 13883 |
|
| 13884 |
if (processIndi->getIndividualNodeID() != indiNode->getIndividualNodeID()) { |
| 13885 |
locIndiNode = getLocalizedIndividual(indiNode,true,calcAlgContext); |
| 13886 |
} |
| 13887 |
|
| 13888 |
CConceptProcessingQueue* conProQueue = locIndiNode->getConceptProcessingQueue(true); |
| 13889 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,conProQueue,locIndiNode,false,nullptr,calcAlgContext); |
| 13890 |
|
| 13891 |
if (processIndi->getIndividualNodeID() != indiNode->getIndividualNodeID()) { |
| 13892 |
addIndividualToProcessingQueue(locIndiNode,calcAlgContext); |
| 13893 |
} |
| 13894 |
} |
| 13895 |
} |
| 13896 |
|
| 13897 |
|
| 13898 |
|
| 13899 |
|
| 13900 |
|
| 13901 |
|
| 13902 |
|
| 13903 |
|
| 13904 |
|
| 13905 |
|
| 13906 |
|
| 13907 |
|
| 13908 |
|
| 13909 |
|
| 13910 |
|
| 13911 |
|
| 13912 |
|
| 13913 |
|
| 13914 |
|
| 13915 |
|
| 13916 |
|
| 13917 |
|
| 13918 |
|
| 13919 |
|
| 13920 |
|
| 13921 |
|
| 13922 |
|
| 13923 |
|
| 13924 |
|
| 13925 |
|
| 13926 |
|
| 13927 |
|
| 13928 |
|
| 13929 |
|
| 13930 |
|
| 13931 |
|
| 13932 |
|
| 13933 |
|
| 13934 |
|
| 13935 |
|
| 13936 |
|
| 13937 |
|
| 13938 |
|
| 13939 |
|
| 13940 |
|
| 13941 |
|
| 13942 |
|
| 13943 |
|
| 13944 |
|
| 13945 |
|
| 13946 |
|
| 13947 |
|
| 13948 |
|
| 13949 |
|
| 13950 |
|
| 13951 |
|
| 13952 |
|
| 13953 |
|
| 13954 |
|
| 13955 |
|
| 13956 |
|
| 13957 |
|
| 13958 |
|
| 13959 |
|
| 13960 |
|
| 13961 |
|
| 13962 |
|
| 13963 |
|
| 13964 |
|
| 13965 |
|
| 13966 |
|
| 13967 |
|
| 13968 |
|
| 13969 |
|
| 13970 |
|
| 13971 |
|
| 13972 |
|
| 13973 |
|
| 13974 |
|
| 13975 |
|
| 13976 |
|
| 13977 |
|
| 13978 |
|
| 13979 |
|
| 13980 |
|
| 13981 |
|
| 13982 |
|
| 13983 |
|
| 13984 |
|
| 13985 |
|
| 13986 |
|
| 13987 |
|
| 13988 |
|
| 13989 |
|
| 13990 |
|
| 13991 |
|
| 13992 |
|
| 13993 |
|
| 13994 |
|
| 13995 |
|
| 13996 |
|
| 13997 |
|
| 13998 |
|
| 13999 |
|
| 14000 |
|
| 14001 |
|
| 14002 |
|
| 14003 |
|
| 14004 |
|
| 14005 |
|
| 14006 |
|
| 14007 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyDATATYPERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14008 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14009 |
CConcept* concept = conDes->getConcept(); |
| 14010 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14011 |
|
| 14012 |
|
| 14013 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 14014 |
//QFile file(QString("debug-model.txt")); |
| 14015 |
//if (file.open(QIODevice::WriteOnly)) { |
| 14016 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 14017 |
// file.close(); |
| 14018 |
//} |
| 14019 |
|
| 14020 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 14021 |
mDatatypeHandler->addDatatype(processIndi,concept,negate,depTrackPoint,calcAlgContext); |
| 14022 |
} |
| 14023 |
|
| 14024 |
if (!negate || concept->getOperandCount() <= 1) { |
| 14025 |
applyANDRule(processIndi,conProDes,negate,calcAlgContext); |
| 14026 |
} else { |
| 14027 |
applyORRule(processIndi,conProDes,negate,calcAlgContext); |
| 14028 |
} |
| 14029 |
} |
| 14030 |
|
| 14031 |
|
| 14032 |
|
| 14033 |
|
| 14034 |
|
| 14035 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyDATARESTRICTIONRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14036 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14037 |
CConcept* concept = conDes->getConcept(); |
| 14038 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14039 |
|
| 14040 |
|
| 14041 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 14042 |
//QFile file(QString("debug-model.txt")); |
| 14043 |
//if (file.open(QIODevice::WriteOnly)) { |
| 14044 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 14045 |
// file.close(); |
| 14046 |
//} |
| 14047 |
|
| 14048 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 14049 |
mDatatypeHandler->addDataRestriction(processIndi,concept,negate,depTrackPoint,calcAlgContext); |
| 14050 |
} |
| 14051 |
} |
| 14052 |
|
| 14053 |
|
| 14054 |
|
| 14055 |
|
| 14056 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyDATALITERALRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14057 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14058 |
CConcept* concept = conDes->getConcept(); |
| 14059 |
CDataLiteral* dataLiteral = concept->getDataLiteral(); |
| 14060 |
if (dataLiteral) { |
| 14061 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14062 |
|
| 14063 |
|
| 14064 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 14065 |
//QFile file(QString("debug-model.txt")); |
| 14066 |
//if (file.open(QIODevice::WriteOnly)) { |
| 14067 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 14068 |
// file.close(); |
| 14069 |
//} |
| 14070 |
|
| 14071 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 14072 |
mDatatypeHandler->addDataLiteral(processIndi,dataLiteral,negate,depTrackPoint,calcAlgContext); |
| 14073 |
} |
| 14074 |
} |
| 14075 |
} |
| 14076 |
|
| 14077 |
|
| 14078 |
|
| 14079 |
|
| 14080 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyDATALITERALIMPLICATIONRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14081 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14082 |
CConcept* concept = conDes->getConcept(); |
| 14083 |
CDataLiteral* dataLiteral = concept->getDataLiteral(); |
| 14084 |
if (dataLiteral) { |
| 14085 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14086 |
CConcept* triggerConcept = concept->getOperandList()->getData(); |
| 14087 |
CConceptDescriptor* triggeredConcepts = nullptr; |
| 14088 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 14089 |
mDatatypeHandler->triggerDataLiteralConcept(processIndi, dataLiteral, negate, depTrackPoint, triggerConcept, triggeredConcepts, calcAlgContext); |
| 14090 |
if (triggeredConcepts) { |
| 14091 |
addtriggeredValueSpaceConcepts(processIndi, triggeredConcepts, calcAlgContext); |
| 14092 |
} |
| 14093 |
} |
| 14094 |
} |
| 14095 |
} |
| 14096 |
|
| 14097 |
|
| 14098 |
|
| 14099 |
|
| 14100 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyDATATYPEIMPLICATIONRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14101 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14102 |
CConcept* concept = conDes->getConcept(); |
| 14103 |
CDatatype* datatype = concept->getDatatype(); |
| 14104 |
if (datatype) { |
| 14105 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14106 |
CConcept* triggerConcept = concept->getOperandList()->getData(); |
| 14107 |
CConceptDescriptor* triggeredConcepts = nullptr; |
| 14108 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 14109 |
mDatatypeHandler->triggerDatatypeConcept(processIndi, datatype, negate, depTrackPoint, triggerConcept, triggeredConcepts, calcAlgContext); |
| 14110 |
if (triggeredConcepts) { |
| 14111 |
addtriggeredValueSpaceConcepts(processIndi, triggeredConcepts, calcAlgContext); |
| 14112 |
} |
| 14113 |
} |
| 14114 |
} |
| 14115 |
} |
| 14116 |
|
| 14117 |
|
| 14118 |
|
| 14119 |
|
| 14120 |
|
| 14121 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyDATARESTRICTIONIMPLICATIONRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14122 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14123 |
CConcept* concept = conDes->getConcept(); |
| 14124 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14125 |
CConcept* triggerConcept = concept->getOperandList()->getData(); |
| 14126 |
CConceptDescriptor* triggeredConcepts = nullptr; |
| 14127 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 14128 |
mDatatypeHandler->triggerDataRestrictionConcept(processIndi, concept, negate, depTrackPoint, triggerConcept, triggeredConcepts, calcAlgContext); |
| 14129 |
if (triggeredConcepts) { |
| 14130 |
addtriggeredValueSpaceConcepts(processIndi, triggeredConcepts, calcAlgContext); |
| 14131 |
} |
| 14132 |
} |
| 14133 |
} |
| 14134 |
|
| 14135 |
|
| 14136 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyBOTTOMRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14137 |
++mAppliedANDRuleCount; |
| 14138 |
STATINC(ANDRULEAPPLICATIONCOUNT,calcAlgContext); |
| 14139 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14140 |
CConcept* concept = conDes->getConcept(); |
| 14141 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14142 |
|
| 14143 |
CConcept* topConcept = calcAlgContext->getProcessingDataBox()->getOntologyTopConcept(); |
| 14144 |
|
| 14145 |
// create dependency |
| 14146 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14147 |
CANDDependencyNode* andDepNode = createANDDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 14148 |
|
| 14149 |
addConceptToIndividual(topConcept,true,processIndi,nextDepTrackPoint,true,false,calcAlgContext); |
| 14150 |
} |
| 14151 |
|
| 14152 |
|
| 14153 |
|
| 14154 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14155 |
++mAppliedANDRuleCount; |
| 14156 |
STATINC(ANDRULEAPPLICATIONCOUNT,calcAlgContext); |
| 14157 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14158 |
CConcept* concept = conDes->getConcept(); |
| 14159 |
bool conceptNegation = negate; |
| 14160 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14161 |
|
| 14162 |
// create dependency |
| 14163 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14164 |
CANDDependencyNode* andDepNode = createANDDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 14165 |
|
| 14166 |
CSortedNegLinker<CConcept*>* opConLinkerIt = concept->getOperandList(); |
| 14167 |
|
| 14168 |
addConceptsToIndividual(opConLinkerIt,conceptNegation,processIndi,nextDepTrackPoint,true,false,nullptr,calcAlgContext); |
| 14169 |
} |
| 14170 |
|
| 14171 |
|
| 14172 |
|
| 14173 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isGeneratingConceptSatisfiableCachedAbsorpable(CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14174 |
CIndividualProcessNode* ancestorIndiNode = getAncestorIndividual(processIndi,calcAlgContext); |
| 14175 |
if (ancestorIndiNode) { |
| 14176 |
CConcept* concept = conDes->getConcept(); |
| 14177 |
CRole* role = concept->getRole(); |
| 14178 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 14179 |
while (superRoleIt) { |
| 14180 |
bool superRoleNeg = superRoleIt->isNegated(); |
| 14181 |
if (!superRoleNeg) { |
| 14182 |
CRole* superRole = superRoleIt->getData(); |
| 14183 |
if (processIndi->hasRoleSuccessorToIndividual(superRole,ancestorIndiNode,true)) { |
| 14184 |
if (superRole->isFunctional()) { |
| 14185 |
return false; |
| 14186 |
} |
| 14187 |
// check additional for ATMOST restriction |
| 14188 |
CReapplyRoleSuccessorHash* reapplyRoleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 14189 |
CReapplyQueueIterator reapplyQueueIt = reapplyRoleSuccHash->getRoleReapplyIterator(superRole,false); |
| 14190 |
while (reapplyQueueIt.hasNext()) { |
| 14191 |
CReapplyConceptDescriptor* reapplyConceptDes = reapplyQueueIt.next(); |
| 14192 |
CConceptDescriptor* reapplyConDes = reapplyConceptDes->getConceptDescriptor(); |
| 14193 |
CConcept* reapplyConcept = reapplyConDes->getConcept(); |
| 14194 |
bool reapplyConNeg = reapplyConDes->getNegation(); |
| 14195 |
cint64 opCode = reapplyConcept->getOperatorCode(); |
| 14196 |
if (opCode == CCATMOST || opCode == CCATLEAST) { |
| 14197 |
cint64 cardinality = concept->getParameter() + 1*reapplyConNeg; |
| 14198 |
if (cardinality <= 1) { |
| 14199 |
return false; |
| 14200 |
} |
| 14201 |
} |
| 14202 |
} |
| 14203 |
} |
| 14204 |
} |
| 14205 |
superRoleIt = superRoleIt->getNext(); |
| 14206 |
} |
| 14207 |
} |
| 14208 |
return true; |
| 14209 |
} |
| 14210 |
|
| 14211 |
|
| 14212 |
|
| 14213 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applySOMERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14214 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14215 |
CConcept* concept = conDes->getConcept(); |
| 14216 |
CRole* role = concept->getRole(); |
| 14217 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14218 |
CSortedNegLinker<CConcept*>* conceptOpLinker = concept->getOperandList(); |
| 14219 |
|
| 14220 |
|
| 14221 |
|
| 14222 |
CIndividualSaturationProcessNode* saturationNode = getCreationSuccessorSaturationNode(processIndi, conDes, calcAlgContext); |
| 14223 |
|
| 14224 |
// check whether there is already a suitable neighbour node in the cache |
| 14225 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)processIndi->getIndividualBackendCacheSynchronisationData(false); |
| 14226 |
if (backendSyncData && backendSyncData->getAssocitaionData()) { |
| 14227 |
cint64 neighbourVisitLimit = 1; |
| 14228 |
if (!saturationNode || saturationNode->isCompleted() && (saturationNode->hasNominalIntegrated() || saturationNode->getIndirectStatusFlags()->hasFlags(CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT, false))) { |
| 14229 |
neighbourVisitLimit = 5; |
| 14230 |
} |
| 14231 |
bool hasAppropriateNeighbourIndividual = false; |
| 14232 |
mBackendCacheHandler->visitNeighbourIndividualIdsForRole(backendSyncData->getAssocitaionData(), role, [&](cint64 neighbourIndividualId, CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel, bool nondeterministic)->bool { |
| 14233 |
|
| 14234 |
if (!nondeterministic) { |
| 14235 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourAssData = mBackendCacheHandler->getIndividualAssociationData(neighbourIndividualId, false, calcAlgContext); |
| 14236 |
if (neighbourAssData) { |
| 14237 |
bool contained = true; |
| 14238 |
for (CSortedNegLinker<CConcept*>* conceptOpLinkerIt = conceptOpLinker; conceptOpLinkerIt && contained; conceptOpLinkerIt = conceptOpLinkerIt->getNext()) { |
| 14239 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 14240 |
bool opConNegation = conceptOpLinkerIt->isNegated() ^ negate; |
| 14241 |
if (!mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(neighbourAssData, neighbourAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), opConcept, opConNegation, true, calcAlgContext)) { |
| 14242 |
contained = false; |
| 14243 |
} |
| 14244 |
} |
| 14245 |
if (contained) { |
| 14246 |
hasAppropriateNeighbourIndividual = true; |
| 14247 |
} |
| 14248 |
} |
| 14249 |
} |
| 14250 |
|
| 14251 |
return neighbourVisitLimit-- > 0 && !hasAppropriateNeighbourIndividual; |
| 14252 |
}, true, calcAlgContext); |
| 14253 |
|
| 14254 |
if (hasAppropriateNeighbourIndividual) { |
| 14255 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(processIndi, calcAlgContext); |
| 14256 |
markIndividualNodeBackendNonConceptSetNeighbourLabelRelatedProcessingForDisjointRoles(processIndi, role, calcAlgContext); |
| 14257 |
return; |
| 14258 |
} |
| 14259 |
} |
| 14260 |
|
| 14261 |
|
| 14262 |
|
| 14263 |
if (!conceptOpLinker->hasNext()) { |
| 14264 |
if (!conceptOpLinker->isNegated()^negate || (saturationNode && saturationNode->hasNominalIntegrated())) { |
| 14265 |
CConcept* nominalConcept = conceptOpLinker->getData(); |
| 14266 |
if (nominalConcept->getOperatorCode() == CCNOMINAL || (saturationNode && saturationNode->hasNominalIntegrated())) { |
| 14267 |
STATINC(VALUERULEAPPLICATIONCOUNT,calcAlgContext); |
| 14268 |
CIndividual* indi = nominalConcept->getNominalIndividual(); |
| 14269 |
bool saturationIntegrateNominal = false; |
| 14270 |
if (nominalConcept->getOperatorCode() != CCNOMINAL && saturationNode && saturationNode->hasNominalIntegrated()) { |
| 14271 |
indi = saturationNode->getIntegratedNominalIndividual(); |
| 14272 |
saturationIntegrateNominal = true; |
| 14273 |
} |
| 14274 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(processIndi, calcAlgContext); |
| 14275 |
|
| 14276 |
// force initialized |
| 14277 |
CIndividualProcessNode* locNominalIndi = getLocalizedForcedBackendInitializedNominalIndividualNode(indi->getIndividualID(), calcAlgContext); |
| 14278 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(locNominalIndi, calcAlgContext); |
| 14279 |
markIndividualNodeBackendNonConceptSetNeighbourLabelRelatedProcessingForDisjointRoles(processIndi, role, calcAlgContext); |
| 14280 |
|
| 14281 |
CReapplyConceptLabelSet* locNominalNodeConSet = locNominalIndi->getReapplyConceptLabelSet(true); |
| 14282 |
CConcept* nominalConcept = indi->getIndividualNominalConcept(); |
| 14283 |
CConceptDescriptor* nominalConDes = nullptr; |
| 14284 |
CDependencyTrackPoint* nominalConDepTrackPoint = nullptr; |
| 14285 |
if (indi->getIndividualID() != locNominalIndi->getIndividualNodeID()) { |
| 14286 |
locNominalNodeConSet->getConceptDescriptor(nominalConcept,nominalConDes,nominalConDepTrackPoint); |
| 14287 |
} |
| 14288 |
|
| 14289 |
if (!hasIndividualsLink(processIndi,locNominalIndi,role,true,calcAlgContext)) { |
| 14290 |
if (processIndi->isBlockableIndividual()) { |
| 14291 |
STATINC(INDIBLOCKABLENODEVALUECONNECTIONCOUNT, calcAlgContext); |
| 14292 |
} |
| 14293 |
|
| 14294 |
bool hasAppropriateNominalConnection = checkBackendCachedNominalConnection(processIndi, role, indi->getIndividualID(), depTrackPoint, calcAlgContext); |
| 14295 |
if (!hasAppropriateNominalConnection) { |
| 14296 |
// create dependency |
| 14297 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14298 |
CVALUEDependencyNode* valueDepNode = createVALUEDependency(nextDepTrackPoint, processIndi, conDes, depTrackPoint, nominalConDepTrackPoint, calcAlgContext); |
| 14299 |
|
| 14300 |
if (saturationIntegrateNominal) { |
| 14301 |
if (!locNominalIndi->getReapplyConceptLabelSet(false)->containsConcept(conceptOpLinker->getData(), conceptOpLinker->isNegated() ^ negate)) { |
| 14302 |
addConceptsToIndividual(conceptOpLinker, negate, locNominalIndi, nextDepTrackPoint, true, true, nullptr, calcAlgContext); |
| 14303 |
} |
| 14304 |
} |
| 14305 |
|
| 14306 |
// create link |
| 14307 |
createNewIndividualsLinksReapplyed(processIndi, locNominalIndi, role->getIndirectSuperRoleList(), role, nextDepTrackPoint, true, calcAlgContext); |
| 14308 |
|
| 14309 |
//propagateIndividualNodeNominalConnectionToAncestors(processIndi,calcAlgContext); |
| 14310 |
if (!processIndi->isNominalIndividualNode()) { |
| 14311 |
propagateIndividualNodeNominalConnectionStatusToAncestors(processIndi, locNominalIndi, calcAlgContext); |
| 14312 |
} |
| 14313 |
|
| 14314 |
propagateIndividualNodeModified(locNominalIndi, calcAlgContext); |
| 14315 |
|
| 14316 |
addIndividualToProcessingQueue(locNominalIndi, calcAlgContext); |
| 14317 |
} |
| 14318 |
|
| 14319 |
} else { |
| 14320 |
if (saturationIntegrateNominal) { |
| 14321 |
if (!locNominalIndi->getReapplyConceptLabelSet(false)->containsConcept(conceptOpLinker->getData(),conceptOpLinker->isNegated()^negate)) { |
| 14322 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14323 |
CVALUEDependencyNode* valueDepNode = createVALUEDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,nominalConDepTrackPoint,calcAlgContext); |
| 14324 |
addConceptsToIndividual(conceptOpLinker,negate,locNominalIndi,nextDepTrackPoint,true,true,nullptr,calcAlgContext); |
| 14325 |
} |
| 14326 |
} |
| 14327 |
|
| 14328 |
} |
| 14329 |
return; |
| 14330 |
} |
| 14331 |
} |
| 14332 |
} |
| 14333 |
|
| 14334 |
STATINC(SOMERULEAPPLICATIONCOUNT,calcAlgContext); |
| 14335 |
CIndividualProcessNode* alreadyExistSuitableSuccessor = getRoleSuccessorWithConcepts(processIndi,role,conceptOpLinker,negate,calcAlgContext); |
| 14336 |
|
| 14337 |
if (!alreadyExistSuitableSuccessor) { |
| 14338 |
if (mConfSatExpCachedSuccAbsorp && processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED | CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED)) { |
| 14339 |
if (isGeneratingConceptSatisfiableCachedAbsorpable(processIndi,conDes,calcAlgContext)) { |
| 14340 |
STATINC(SATCACHEDABSORBEDGENERATINGCONCEPTSCOUNT,calcAlgContext); |
| 14341 |
return addSatisfiableCachedAbsorbedGeneratingConcept(conDes,processIndi,depTrackPoint,calcAlgContext); |
| 14342 |
} |
| 14343 |
} |
| 14344 |
|
| 14345 |
++mAppliedSOMERuleCount; |
| 14346 |
STATINC(SEPARATESUCCESSORINDINODECREATIONCOUNT,calcAlgContext); |
| 14347 |
|
| 14348 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForSuccessorGeneration(conProDes,processIndi)) { |
| 14349 |
testIndividualNodeUnsatisfiableCached(processIndi,calcAlgContext); |
| 14350 |
} |
| 14351 |
|
| 14352 |
|
| 14353 |
// generate new role successor |
| 14354 |
CIndividualProcessNode* succIndi = tryExtendFunctionalSuccessorIndividual(processIndi,conDes,role->getIndirectSuperRoleList(),role,conceptOpLinker,negate,depTrackPoint,saturationNode,calcAlgContext); |
| 14355 |
if (!succIndi) { |
| 14356 |
succIndi = createSuccessorIndividual(processIndi,conDes,role->getIndirectSuperRoleList(),role,conceptOpLinker,negate,depTrackPoint,saturationNode,calcAlgContext); |
| 14357 |
if (processIndi->isNominalIndividualNode() && processIndi->getIndividualNominalLevel() <= 0) { |
| 14358 |
succIndi->setExtendedQueueProcessing(true); |
| 14359 |
} |
| 14360 |
} |
| 14361 |
// check for backward dependencies |
| 14362 |
if (processIndi->isIndividualAncestor(succIndi)) { |
| 14363 |
if (mConfSatExpCachedSuccAbsorp && processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED | CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED)) { |
| 14364 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(processIndi,calcAlgContext); |
| 14365 |
} |
| 14366 |
|
| 14367 |
CXLinker<CIndividualProcessNode*>* newBackwardDepLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 14368 |
newBackwardDepLinker->initLinker(processIndi); |
| 14369 |
succIndi->addSuccessorIndividualNodeBackwardDependencyLinker(newBackwardDepLinker); |
| 14370 |
processIndi->setBackwardDependencyToAncestorIndividualNode(true); |
| 14371 |
if (succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 14372 |
//propagateIndividualNodeNominalConnectionToAncestors(processIndi,calcAlgContext); |
| 14373 |
if (!processIndi->isNominalIndividualNode()) { |
| 14374 |
propagateIndividualNodeNominalConnectionStatusToAncestors(processIndi,succIndi,calcAlgContext); |
| 14375 |
} |
| 14376 |
} |
| 14377 |
} |
| 14378 |
|
| 14379 |
addIndividualToProcessingQueue(succIndi,calcAlgContext); |
| 14380 |
|
| 14381 |
if (mConfAnywhereBlockingSomeInitializationHashing) { |
| 14382 |
addIndividualNodeCandidateForConcept(succIndi,conceptOpLinker,negate,calcAlgContext); |
| 14383 |
} |
| 14384 |
} else { |
| 14385 |
// check for backward dependencies |
| 14386 |
if (processIndi->isIndividualAncestor(alreadyExistSuitableSuccessor)) { |
| 14387 |
CIndividualProcessNode* locAncestorIndiNode = getLocalizedIndividual(alreadyExistSuitableSuccessor,false,calcAlgContext); |
| 14388 |
CXLinker<CIndividualProcessNode*>* newBackwardDepLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 14389 |
newBackwardDepLinker->initLinker(processIndi); |
| 14390 |
locAncestorIndiNode->addSuccessorIndividualNodeBackwardDependencyLinker(newBackwardDepLinker); |
| 14391 |
processIndi->setBackwardDependencyToAncestorIndividualNode(true); |
| 14392 |
if (locAncestorIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 14393 |
//propagateIndividualNodeNominalConnectionToAncestors(processIndi,calcAlgContext); |
| 14394 |
if (!processIndi->isNominalIndividualNode()) { |
| 14395 |
propagateIndividualNodeNominalConnectionStatusToAncestors(processIndi,locAncestorIndiNode,calcAlgContext); |
| 14396 |
} |
| 14397 |
} |
| 14398 |
} |
| 14399 |
} |
| 14400 |
} |
| 14401 |
|
| 14402 |
|
| 14403 |
|
| 14404 |
|
| 14405 |
|
| 14406 |
|
| 14407 |
|
| 14408 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addReverseRoleAssertion(CIndividualProcessNode*& processIndi, CReverseRoleAssertionLinker* reverseRoleAssertionLinker, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14409 |
STATINC(REVERSEROLEASSERTIONCOUNT,calcAlgContext); |
| 14410 |
CRole* role = reverseRoleAssertionLinker->getRole(); |
| 14411 |
CIndividual* indi = reverseRoleAssertionLinker->getIndividual(); |
| 14412 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(processIndi, calcAlgContext); |
| 14413 |
|
| 14414 |
if (indi) { |
| 14415 |
if (!mOptIncrementalCompatibleExpansion || isNominalIndividualNodeAvailable(-indi->getIndividualID(),calcAlgContext)) { |
| 14416 |
CIndividualProcessNode* nominalIndi = getCorrectedNominalIndividualNode(-indi->getIndividualID(),calcAlgContext); |
| 14417 |
if (nominalIndi && (!nominalIndi->hasRoleAssertionsInitialized() || processIndi->getRoleAssertionCreationID() > nominalIndi->getRoleAssertionCreationID())) { |
| 14418 |
|
| 14419 |
CIndividualProcessNode* locNominalIndi = getLocalizedForcedBackendInitializedNominalIndividualNode(nominalIndi, calcAlgContext); |
| 14420 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(locNominalIndi, calcAlgContext); |
| 14421 |
|
| 14422 |
CDependencyTrackPoint* nominalConDepTrackPoint = nullptr; |
| 14423 |
if (-indi->getIndividualID() != locNominalIndi->getIndividualNodeID()) { |
| 14424 |
nominalConDepTrackPoint = locNominalIndi->getIndividualMergingHash(false)->value(indi->getIndividualID()).getDependencyTrackPoint(); |
| 14425 |
} |
| 14426 |
|
| 14427 |
|
| 14428 |
if (!hasIndividualsLink(locNominalIndi,processIndi,role,true,calcAlgContext)) { |
| 14429 |
// create dependency |
| 14430 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14431 |
CROLEASSERTIONDependencyNode* roleAssDepNode = createROLEASSERTIONDependency(nextDepTrackPoint, processIndi,depTrackPoint,nominalConDepTrackPoint, role, indi, calcAlgContext); |
| 14432 |
|
| 14433 |
// create link |
| 14434 |
createNewIndividualsLinksReapplyed(locNominalIndi,processIndi,role->getIndirectSuperRoleList(),role,nextDepTrackPoint,true,calcAlgContext); |
| 14435 |
|
| 14436 |
propagateIndividualNodeModified(locNominalIndi,calcAlgContext); |
| 14437 |
addIndividualToProcessingQueue(locNominalIndi,calcAlgContext); |
| 14438 |
} |
| 14439 |
} |
| 14440 |
} else if (mOptIncrementalCompatibleExpansion) { |
| 14441 |
|
| 14442 |
for (CSortedNegLinker<CRole*>* roleLinkerIt = role->getIndirectSuperRoleList(); roleLinkerIt; roleLinkerIt = roleLinkerIt->getNext()) { |
| 14443 |
CRole* role = roleLinkerIt->getData(); |
| 14444 |
bool invRole = roleLinkerIt->isNegated(); |
| 14445 |
CSortedNegLinker<CConcept*>* domainConLinkerIt = role->getDomainRangeConceptList(!invRole); |
| 14446 |
if (domainConLinkerIt) { |
| 14447 |
addConceptsToIndividual(domainConLinkerIt,false,processIndi,depTrackPoint,true,false,nullptr,calcAlgContext); |
| 14448 |
} |
| 14449 |
} |
| 14450 |
|
| 14451 |
} |
| 14452 |
} |
| 14453 |
} |
| 14454 |
|
| 14455 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addDataAssertion(CIndividualProcessNode*& processIndi, CDataAssertionLinker* dataAssertionLinker, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14456 |
CRole* role = dataAssertionLinker->getRole(); |
| 14457 |
CDataLiteral* dataLiteral = dataAssertionLinker->getDataLiteral(); |
| 14458 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14459 |
CDATAASSERTIONDependencyNode* dataAssDepNode = createDATAASSERTIONDependency(nextDepTrackPoint, processIndi, depTrackPoint, calcAlgContext); |
| 14460 |
|
| 14461 |
// generate new data role successor |
| 14462 |
CIndividualProcessNode* succIndi = createNewIndividual(nextDepTrackPoint, true, calcAlgContext); |
| 14463 |
|
| 14464 |
CIndividualLinkEdge* ancLink = createNewIndividualsLinksReapplyed(processIndi, succIndi, role->getIndirectSuperRoleList(), role, nextDepTrackPoint, false, calcAlgContext); |
| 14465 |
succIndi->setAncestorLink(ancLink); |
| 14466 |
succIndi->setIndividualAncestorDepth(processIndi->getIndividualAncestorDepth() + 1); |
| 14467 |
|
| 14468 |
CProcessAssertedDataLiteralLinker* additionalDataLitLinker = CObjectAllocator< CProcessAssertedDataLiteralLinker >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 14469 |
additionalDataLitLinker->initProcessDataLiteralLinker(dataLiteral, depTrackPoint); |
| 14470 |
succIndi->addAssertedDataLiteralLinker(additionalDataLitLinker); |
| 14471 |
succIndi->setLastAssertedDataLiteralLinker(succIndi->getAssertedDataLiteralLinker()); |
| 14472 |
|
| 14473 |
if (processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED)) { |
| 14474 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED); |
| 14475 |
} |
| 14476 |
if (processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED)) { |
| 14477 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED); |
| 14478 |
} |
| 14479 |
if (processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED | CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED)) { |
| 14480 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED); |
| 14481 |
} |
| 14482 |
|
| 14483 |
if (mDatatypeHandler && mConfDatatypeReasoning) { |
| 14484 |
mDatatypeHandler->addDataLiteral(succIndi, dataLiteral, false, nextDepTrackPoint, calcAlgContext); |
| 14485 |
CDatatype* datatype = dataLiteral->getDatatype(); |
| 14486 |
if (datatype && datatype->getDatatypeConcept()) { |
| 14487 |
addConceptToIndividual(datatype->getDatatypeConcept(), false, succIndi, nextDepTrackPoint, true, false, calcAlgContext); |
| 14488 |
} |
| 14489 |
} |
| 14490 |
} |
| 14491 |
|
| 14492 |
|
| 14493 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addRoleAssertion(CIndividualProcessNode*& processIndi, CRoleAssertionLinker* roleAssertionLinker, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14494 |
STATINC(ROLEASSERTIONCOUNT,calcAlgContext); |
| 14495 |
CRole* role = roleAssertionLinker->getRole(); |
| 14496 |
CIndividual* indi = roleAssertionLinker->getIndividual(); |
| 14497 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(processIndi, calcAlgContext); |
| 14498 |
|
| 14499 |
if (indi) { |
| 14500 |
if (!mOptIncrementalCompatibleExpansion || isNominalIndividualNodeAvailable(-indi->getIndividualID(),calcAlgContext)) { |
| 14501 |
CIndividualProcessNode* nominalIndi = getCorrectedNominalIndividualNode(-indi->getIndividualID(),calcAlgContext); |
| 14502 |
if (nominalIndi && (!nominalIndi->hasReverseRoleAssertionsInitialized() || processIndi->getRoleAssertionCreationID() > nominalIndi->getRoleAssertionCreationID())) { |
| 14503 |
|
| 14504 |
|
| 14505 |
CIndividualProcessNode* locNominalIndi = getLocalizedForcedBackendInitializedNominalIndividualNode(nominalIndi, calcAlgContext); |
| 14506 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(locNominalIndi, calcAlgContext); |
| 14507 |
|
| 14508 |
CDependencyTrackPoint* nominalConDepTrackPoint = nullptr; |
| 14509 |
if (-indi->getIndividualID() != locNominalIndi->getIndividualNodeID() && locNominalIndi->getIndividualMergingHash(false)) { |
| 14510 |
nominalConDepTrackPoint = locNominalIndi->getIndividualMergingHash(false)->value(indi->getIndividualID()).getDependencyTrackPoint(); |
| 14511 |
} |
| 14512 |
|
| 14513 |
if (!hasIndividualsLink(processIndi,locNominalIndi,role,true,calcAlgContext)) { |
| 14514 |
// create dependency |
| 14515 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14516 |
CROLEASSERTIONDependencyNode* roleAssDepNode = createROLEASSERTIONDependency(nextDepTrackPoint,processIndi,depTrackPoint,nominalConDepTrackPoint, role, processIndi->getNominalIndividual(), calcAlgContext); |
| 14517 |
|
| 14518 |
// create link |
| 14519 |
createNewIndividualsLinksReapplyed(processIndi,locNominalIndi,role->getIndirectSuperRoleList(),role,nextDepTrackPoint,true,calcAlgContext); |
| 14520 |
|
| 14521 |
propagateIndividualNodeModified(locNominalIndi,calcAlgContext); |
| 14522 |
addIndividualToProcessingQueue(locNominalIndi,calcAlgContext); |
| 14523 |
} |
| 14524 |
} |
| 14525 |
} else if (mOptIncrementalCompatibleExpansion) { |
| 14526 |
|
| 14527 |
for (CSortedNegLinker<CRole*>* roleLinkerIt = role->getIndirectSuperRoleList(); roleLinkerIt; roleLinkerIt = roleLinkerIt->getNext()) { |
| 14528 |
CRole* role = roleLinkerIt->getData(); |
| 14529 |
bool invRole = roleLinkerIt->isNegated(); |
| 14530 |
CSortedNegLinker<CConcept*>* domainConLinkerIt = role->getDomainRangeConceptList(invRole); |
| 14531 |
if (domainConLinkerIt) { |
| 14532 |
addConceptsToIndividual(domainConLinkerIt,false,processIndi,depTrackPoint,true,false,nullptr,calcAlgContext); |
| 14533 |
} |
| 14534 |
} |
| 14535 |
|
| 14536 |
} |
| 14537 |
} |
| 14538 |
} |
| 14539 |
|
| 14540 |
|
| 14541 |
|
| 14542 |
|
| 14543 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::checkBackendCachedNominalConnection(CIndividualProcessNode*& processIndi, CRole* role, cint64 nominalId, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14544 |
bool hasAppropriateNominalConnection = false; |
| 14545 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)processIndi->getIndividualBackendCacheSynchronisationData(false); |
| 14546 |
if (backendSyncData && backendSyncData->getAssocitaionData()) { |
| 14547 |
|
| 14548 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assData = backendSyncData->getAssocitaionData(); |
| 14549 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* nomAssData = nullptr; |
| 14550 |
CBackendRepresentativeMemoryLabelCacheItem* nomConLabelItem = nullptr; |
| 14551 |
if (assData) { |
| 14552 |
CBackendRepresentativeMemoryCacheIndividualNeighbourRoleSetHash* neighbourRoleSetHash = assData->getNeighbourRoleSetHash(); |
| 14553 |
if (neighbourRoleSetHash) { |
| 14554 |
CBackendRepresentativeMemoryLabelCacheItem* roleSetLabelItem = neighbourRoleSetHash->getNeighbourRoleSetLabel(nominalId); |
| 14555 |
if (roleSetLabelItem) { |
| 14556 |
|
| 14557 |
if (mBackendCacheHandler->hasRoleInAssociatedNeigbourRoleSetLabel(assData, roleSetLabelItem, role, false, false)) { |
| 14558 |
hasAppropriateNominalConnection = assData->isCompletelyHandled() && assData->isCompletelyPropagated(); |
| 14559 |
|
| 14560 |
|
| 14561 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt && hasAppropriateNominalConnection; superRoleIt = superRoleIt->getNext()) { |
| 14562 |
CRole* superRole = superRoleIt->getData(); |
| 14563 |
bool superRoleInversion = superRoleIt->isNegated(); |
| 14564 |
CSortedNegLinker<CConcept*>* rangeConLinker = superRole->getDomainRangeConceptList(!superRoleInversion); |
| 14565 |
for (CSortedNegLinker<CConcept*>* conLinkerIt = rangeConLinker; conLinkerIt && hasAppropriateNominalConnection; conLinkerIt = conLinkerIt->getNext()) { |
| 14566 |
CConcept* con = conLinkerIt->getData(); |
| 14567 |
bool conNeg = conLinkerIt->isNegated(); |
| 14568 |
if (!nomAssData) { |
| 14569 |
nomAssData = mBackendCacheHandler->getIndividualAssociationData(nominalId, false, calcAlgContext); |
| 14570 |
if (nomAssData) { |
| 14571 |
nomConLabelItem = nomAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 14572 |
} |
| 14573 |
} |
| 14574 |
if (!mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(nomAssData, nomConLabelItem, con, conNeg, true, calcAlgContext)) { |
| 14575 |
hasAppropriateNominalConnection = false; |
| 14576 |
} |
| 14577 |
} |
| 14578 |
|
| 14579 |
CSortedNegLinker<CConcept*>* domainConLinker = superRole->getDomainRangeConceptList(superRoleInversion); |
| 14580 |
for (CSortedNegLinker<CConcept*>* conLinkerIt = domainConLinker; conLinkerIt && hasAppropriateNominalConnection; conLinkerIt = conLinkerIt->getNext()) { |
| 14581 |
CConcept* con = conLinkerIt->getData(); |
| 14582 |
bool conNeg = conLinkerIt->isNegated(); |
| 14583 |
if (!processIndi->getReapplyConceptLabelSet(false)->hasConcept(con, conNeg)) { |
| 14584 |
addConceptToIndividual(con, conNeg, processIndi, depTrackPoint, false, false, calcAlgContext); |
| 14585 |
} |
| 14586 |
} |
| 14587 |
} |
| 14588 |
|
| 14589 |
if (!hasAppropriateNominalConnection) { |
| 14590 |
expandIndividualNeighbourNodeFromBackendCache(processIndi, nominalId, calcAlgContext); |
| 14591 |
} |
| 14592 |
|
| 14593 |
} else { |
| 14594 |
// build link in completion graph since it could have a clash/interaction with the new connection |
| 14595 |
// (it is also necessary for the backend handler to correctly update the instantiated roles to this individual) |
| 14596 |
expandIndividualNeighbourNodeFromBackendCache(processIndi, nominalId, calcAlgContext); |
| 14597 |
} |
| 14598 |
} |
| 14599 |
} |
| 14600 |
} |
| 14601 |
} |
| 14602 |
return hasAppropriateNominalConnection; |
| 14603 |
} |
| 14604 |
|
| 14605 |
|
| 14606 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyVALUERule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14607 |
STATINC(VALUERULEAPPLICATIONCOUNT,calcAlgContext); |
| 14608 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14609 |
CConcept* concept = conDes->getConcept(); |
| 14610 |
CRole* role = concept->getRole(); |
| 14611 |
CIndividual* indi = concept->getNominalIndividual(); |
| 14612 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14613 |
|
| 14614 |
|
| 14615 |
|
| 14616 |
if (indi) { |
| 14617 |
// check whether there is already a suitable neighbour node in the cache |
| 14618 |
bool hasAppropriateNominalConnection = checkBackendCachedNominalConnection(processIndi, role, indi->getIndividualID(), depTrackPoint, calcAlgContext); |
| 14619 |
|
| 14620 |
if (hasAppropriateNominalConnection && !negate) { |
| 14621 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(processIndi, calcAlgContext); |
| 14622 |
markIndividualNodeBackendNonConceptSetNeighbourLabelRelatedProcessingForDisjointRoles(processIndi, role, calcAlgContext); |
| 14623 |
return; |
| 14624 |
} |
| 14625 |
} |
| 14626 |
|
| 14627 |
|
| 14628 |
|
| 14629 |
|
| 14630 |
if (indi) { |
| 14631 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(processIndi, calcAlgContext); |
| 14632 |
|
| 14633 |
// force initialized |
| 14634 |
CIndividualProcessNode* locNominalIndi = getLocalizedForcedBackendInitializedNominalIndividualNode(indi->getIndividualID(), calcAlgContext); |
| 14635 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(locNominalIndi, calcAlgContext); |
| 14636 |
markIndividualNodeBackendNonConceptSetNeighbourLabelRelatedProcessingForDisjointRoles(processIndi, role, calcAlgContext); |
| 14637 |
|
| 14638 |
|
| 14639 |
CDependencyTrackPoint* nominalConDepTrackPoint = nullptr; |
| 14640 |
if (-indi->getIndividualID() != locNominalIndi->getIndividualNodeID() && locNominalIndi->getIndividualMergingHash(false)) { |
| 14641 |
nominalConDepTrackPoint = locNominalIndi->getIndividualMergingHash(false)->value(indi->getIndividualID()).getDependencyTrackPoint(); |
| 14642 |
} |
| 14643 |
|
| 14644 |
|
| 14645 |
if (!negate) { |
| 14646 |
|
| 14647 |
if (!hasIndividualsLink(processIndi,locNominalIndi,role,true,calcAlgContext)) { |
| 14648 |
if (processIndi->isBlockableIndividual()) { |
| 14649 |
STATINC(INDIBLOCKABLENODEVALUECONNECTIONCOUNT, calcAlgContext); |
| 14650 |
} |
| 14651 |
|
| 14652 |
|
| 14653 |
// create dependency |
| 14654 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14655 |
CVALUEDependencyNode* valueDepNode = createVALUEDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,nominalConDepTrackPoint,calcAlgContext); |
| 14656 |
|
| 14657 |
// create link |
| 14658 |
createNewIndividualsLinksReapplyed(processIndi,locNominalIndi,role->getIndirectSuperRoleList(),role,nextDepTrackPoint,true,calcAlgContext); |
| 14659 |
//propagateIndividualNodeNominalConnectionToAncestors(processIndi,calcAlgContext); |
| 14660 |
if (!processIndi->isNominalIndividualNode()) { |
| 14661 |
propagateIndividualNodeNominalConnectionStatusToAncestors(processIndi,locNominalIndi,calcAlgContext); |
| 14662 |
} |
| 14663 |
|
| 14664 |
propagateIndividualNodeModified(locNominalIndi,calcAlgContext); |
| 14665 |
addIndividualToProcessingQueue(locNominalIndi,calcAlgContext); |
| 14666 |
} |
| 14667 |
} else { |
| 14668 |
|
| 14669 |
// create dependency |
| 14670 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14671 |
CNEGVALUEDependencyNode* negValueDepNode = createNEGVALUEDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,nominalConDepTrackPoint,calcAlgContext); |
| 14672 |
|
| 14673 |
// create negation/disjoint link |
| 14674 |
createIndividualNodeNegationLink(processIndi,locNominalIndi,role,nextDepTrackPoint,calcAlgContext); |
| 14675 |
//propagateIndividualNodeNominalConnectionToAncestors(processIndi,calcAlgContext); |
| 14676 |
if (!processIndi->isNominalIndividualNode()) { |
| 14677 |
propagateIndividualNodeNominalConnectionStatusToAncestors(processIndi,locNominalIndi,calcAlgContext); |
| 14678 |
} |
| 14679 |
|
| 14680 |
addIndividualToProcessingQueue(locNominalIndi,calcAlgContext); |
| 14681 |
} |
| 14682 |
} |
| 14683 |
} |
| 14684 |
|
| 14685 |
|
| 14686 |
|
| 14687 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyFUNCTIONALRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14688 |
STATINC(FUNCTIONALRULEAPPLICATIONCOUNT,calcAlgContext); |
| 14689 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14690 |
CConcept* concept = conDes->getConcept(); |
| 14691 |
CRole* role = concept->getRole(); |
| 14692 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14693 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 14694 |
bool reapplied = conProDes->isConceptReapplied(); |
| 14695 |
|
| 14696 |
CRoleSuccessorLinkIterator baseRoleSuccIt(processIndi->getRoleSuccessorLinkIterator(role)); |
| 14697 |
CRoleSuccessorLinkIterator roleSuccIt(baseRoleSuccIt); |
| 14698 |
CIndividualProcessNode* firstSuccNode = nullptr; |
| 14699 |
CIndividualLinkEdge* firstLink = nullptr; |
| 14700 |
CDependencyTrackPoint* nnRequireDepTrackPoint = nullptr; |
| 14701 |
bool nominalNode = processIndi->isNominalIndividualNode(); |
| 14702 |
bool requiresNNRule = false; |
| 14703 |
bool hasAlreadyMergingNominal = false; |
| 14704 |
if (nominalNode && roleSuccIt.hasNext()) { |
| 14705 |
// has to apply NN-rule? |
| 14706 |
CRoleSuccessorLinkIterator checkNNRoleSuccIt(roleSuccIt); |
| 14707 |
while (!hasAlreadyMergingNominal && checkNNRoleSuccIt.hasNext()) { |
| 14708 |
CIndividualLinkEdge* link = checkNNRoleSuccIt.next(); |
| 14709 |
if (!requiresNNRule) { |
| 14710 |
if (link->getCreatorIndividualID() != processIndi->getIndividualNodeID()) { |
| 14711 |
requiresNNRule = true; |
| 14712 |
nnRequireDepTrackPoint = link->getDependencyTrackPoint(); |
| 14713 |
} |
| 14714 |
} |
| 14715 |
if (!hasAlreadyMergingNominal) { |
| 14716 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 14717 |
if (succIndi->isNominalIndividualNode()) { |
| 14718 |
hasAlreadyMergingNominal = true; |
| 14719 |
firstSuccNode = succIndi; |
| 14720 |
firstLink = link; |
| 14721 |
} |
| 14722 |
} |
| 14723 |
} |
| 14724 |
} |
| 14725 |
if (!hasAlreadyMergingNominal) { |
| 14726 |
if (requiresNNRule) { |
| 14727 |
|
| 14728 |
createNominalsSuccessorIndividuals(processIndi,role->getIndirectSuperRoleList(),role,conceptOpLinkerIt,false,nnRequireDepTrackPoint,1,calcAlgContext); |
| 14729 |
CRoleSuccessorLinkIterator lastRoleSuccIt = processIndi->getRoleSuccessorHistoryLinkIterator(role,nullptr); |
| 14730 |
if (lastRoleSuccIt.hasNext()) { |
| 14731 |
CIndividualLinkEdge* link = lastRoleSuccIt.next(); |
| 14732 |
CIndividualProcessNode* nominalSuccIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 14733 |
firstSuccNode = nominalSuccIndi; |
| 14734 |
firstLink = link; |
| 14735 |
} |
| 14736 |
|
| 14737 |
} else { |
| 14738 |
while (!firstSuccNode && roleSuccIt.hasNext()) { |
| 14739 |
firstLink = roleSuccIt.next(); |
| 14740 |
if (roleSuccIt.hasNext()) { |
| 14741 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,firstLink,calcAlgContext); |
| 14742 |
firstSuccNode = succIndi; |
| 14743 |
} |
| 14744 |
} |
| 14745 |
} |
| 14746 |
} |
| 14747 |
if (firstSuccNode) { |
| 14748 |
|
| 14749 |
cint64 minIndiId = firstSuccNode->getIndividualNodeID(); |
| 14750 |
cint64 prevMinIndiId = minIndiId; |
| 14751 |
CRoleSuccessorLinkIterator minSuccSearchRoleSuccIt = roleSuccIt; |
| 14752 |
while (minSuccSearchRoleSuccIt.hasNext()) { |
| 14753 |
CIndividualLinkEdge* link = minSuccSearchRoleSuccIt.next(); |
| 14754 |
CIndividualProcessNode* succIndi = link->getOppositeIndividual(processIndi); |
| 14755 |
cint64 succIndiId = succIndi->getIndividualNodeID(); |
| 14756 |
if (minIndiId < 0 && succIndiId < 0 && succIndiId > minIndiId) { |
| 14757 |
firstSuccNode = succIndi; |
| 14758 |
minIndiId = succIndiId; |
| 14759 |
firstLink = link; |
| 14760 |
} else if (minIndiId > 0 && succIndiId < minIndiId) { |
| 14761 |
firstSuccNode = succIndi; |
| 14762 |
minIndiId = succIndiId; |
| 14763 |
firstLink = link; |
| 14764 |
} |
| 14765 |
} |
| 14766 |
if (minIndiId != prevMinIndiId) { |
| 14767 |
roleSuccIt = baseRoleSuccIt; |
| 14768 |
} |
| 14769 |
|
| 14770 |
CIndividualProcessNode* locFirstSuccNode = nullptr; |
| 14771 |
while (roleSuccIt.hasNext() && !processIndi->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 14772 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 14773 |
if (link != firstLink && processIndi->hasRoleSuccessorToIndividual(role, link->getOppositeIndividual(processIndi), true)) { |
| 14774 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 14775 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 14776 |
if (isIndividualNodesMergeable(firstSuccNode,succIndi,clashDescriptors,calcAlgContext)) { |
| 14777 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 14778 |
if (!locFirstSuccNode) { |
| 14779 |
locFirstSuccNode = getLocalizedIndividual(firstSuccNode,link,calcAlgContext); |
| 14780 |
firstSuccNode = locFirstSuccNode; |
| 14781 |
} |
| 14782 |
CIndividualProcessNode* locSuccIndiNode = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 14783 |
|
| 14784 |
// create dependency |
| 14785 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 14786 |
CFUNCTIONALDependencyNode* funcDepNode = createFUNCTIONALDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,firstLink->getDependencyTrackPoint(),link->getDependencyTrackPoint(),calcAlgContext); |
| 14787 |
|
| 14788 |
// merge to first successor |
| 14789 |
locFirstSuccNode = getMergedIndividualNodes(locFirstSuccNode,locSuccIndiNode,nextDepTrackPoint,calcAlgContext); |
| 14790 |
firstSuccNode = locFirstSuccNode; |
| 14791 |
if (locFirstSuccNode == locSuccIndiNode) { |
| 14792 |
firstLink = link; |
| 14793 |
} |
| 14794 |
|
| 14795 |
roleSuccIt = processIndi->getRoleSuccessorLinkIterator(role); |
| 14796 |
|
| 14797 |
if (mConfSatExpCachedSuccAbsorp && processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED | CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED)) { |
| 14798 |
if (locFirstSuccNode == getAncestorIndividual(processIndi,calcAlgContext)) { |
| 14799 |
reapplySatisfiableCachedAbsorbedGeneratingConcepts(processIndi,calcAlgContext); |
| 14800 |
} |
| 14801 |
} |
| 14802 |
|
| 14803 |
} else { |
| 14804 |
|
| 14805 |
// clash |
| 14806 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 14807 |
clashDescriptors = createIndividualMergeCausingDescriptors(clashDescriptors,firstSuccNode,firstLink,nullptr,calcAlgContext); |
| 14808 |
clashDescriptors = createIndividualMergeCausingDescriptors(clashDescriptors,succIndi,link,nullptr,calcAlgContext); |
| 14809 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 14810 |
} |
| 14811 |
} |
| 14812 |
} |
| 14813 |
} |
| 14814 |
if (!reapplied) { |
| 14815 |
CDependencyTrackPoint* contDepTrackPoint = depTrackPoint; |
| 14816 |
addConceptToReapplyQueue(conDes,role,processIndi,true,contDepTrackPoint,calcAlgContext); |
| 14817 |
} |
| 14818 |
} |
| 14819 |
|
| 14820 |
|
| 14821 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasIdenticalConceptOperands(CSortedNegLinker<CConcept*>* opConLinker1, CSortedNegLinker<CConcept*>* opConLinker2) { |
| 14822 |
if (opConLinker1->getCount() != opConLinker2->getCount()) { |
| 14823 |
return false; |
| 14824 |
} |
| 14825 |
for (CSortedNegLinker<CConcept*>* opConLinker1It = opConLinker1; opConLinker1It; opConLinker1It = opConLinker1It->getNext()) { |
| 14826 |
CConcept* con1 = opConLinker1It->getData(); |
| 14827 |
bool neg1 = opConLinker1It->isNegated(); |
| 14828 |
bool foundOperand = false; |
| 14829 |
for (CSortedNegLinker<CConcept*>* opConLinker2It = opConLinker2; opConLinker2It && !foundOperand; opConLinker2It = opConLinker2It->getNext()) { |
| 14830 |
CConcept* con2 = opConLinker2It->getData(); |
| 14831 |
bool neg2 = opConLinker2It->isNegated(); |
| 14832 |
if (con1 == con2 && neg1 == neg2) { |
| 14833 |
foundOperand = true; |
| 14834 |
} |
| 14835 |
} |
| 14836 |
if (!foundOperand) { |
| 14837 |
return false; |
| 14838 |
} |
| 14839 |
} |
| 14840 |
for (CSortedNegLinker<CConcept*>* opConLinker2It = opConLinker2; opConLinker2It; opConLinker2It = opConLinker2It->getNext()) { |
| 14841 |
CConcept* con1 = opConLinker2It->getData(); |
| 14842 |
bool neg1 = opConLinker2It->isNegated(); |
| 14843 |
bool foundOperand = false; |
| 14844 |
for (CSortedNegLinker<CConcept*>* opConLinker1It = opConLinker1; opConLinker1It && !foundOperand; opConLinker1It = opConLinker1It->getNext()) { |
| 14845 |
CConcept* con2 = opConLinker1It->getData(); |
| 14846 |
bool neg2 = opConLinker1It->isNegated(); |
| 14847 |
if (con1 == con2 && neg1 == neg2) { |
| 14848 |
foundOperand = true; |
| 14849 |
} |
| 14850 |
} |
| 14851 |
if (!foundOperand) { |
| 14852 |
return false; |
| 14853 |
} |
| 14854 |
} |
| 14855 |
return true; |
| 14856 |
} |
| 14857 |
|
| 14858 |
|
| 14859 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyATMOSTRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 14860 |
STATINC(ATMOSTRULEAPPLICATIONCOUNT,calcAlgContext); |
| 14861 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 14862 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 14863 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 14864 |
CConcept* concept = conDes->getConcept(); |
| 14865 |
CRole* role = concept->getRole(); |
| 14866 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 14867 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 14868 |
CProcessingRestrictionSpecification* procRest = conProDes->getProcessingRestrictionSpecification(); |
| 14869 |
|
| 14870 |
cint64 cardinality = concept->getParameter() - 1*negate; |
| 14871 |
|
| 14872 |
bool installReapplication = false; |
| 14873 |
if (cardinality < 0) { |
| 14874 |
// clash |
| 14875 |
CClashedDependencyDescriptor* clashConDesLinker = nullptr; |
| 14876 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 14877 |
throw CCalculationClashProcessingException(clashConDesLinker); |
| 14878 |
} |
| 14879 |
if (cardinality == 1 && !conceptOpLinkerIt) { |
| 14880 |
return applyFUNCTIONALRule(processIndi,conProDes,negate,calcAlgContext); |
| 14881 |
} |
| 14882 |
|
| 14883 |
|
| 14884 |
if (mConfSatExpCachedMergAbsorp && processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED)) { |
| 14885 |
STATINC(SATCACHEDABSORBEDMERGINGCONCEPTSCOUNT,calcAlgContext); |
| 14886 |
return addSatisfiableCachedAbsorbedDisjunctionConcept(conDes,processIndi,procRest,depTrackPoint,calcAlgContext); |
| 14887 |
} |
| 14888 |
|
| 14889 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 14890 |
CBranchingMergingProcessingRestrictionSpecification* branchingMergingProcRest = nullptr; |
| 14891 |
CRoleSuccessorLinkIterator roleSuccIt; |
| 14892 |
CIndividualLinkEdge* usingLastLink = nullptr; |
| 14893 |
cint64 linkCount = 0; |
| 14894 |
if (!procRest) { |
| 14895 |
if (roleSuccHash) { |
| 14896 |
roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role,&linkCount,usingLastLink); |
| 14897 |
} |
| 14898 |
if (!roleSuccIt.hasNext()) { |
| 14899 |
// no need for merging |
| 14900 |
} else if (cardinality <= 0 && !conceptOpLinkerIt) { |
| 14901 |
// clash |
| 14902 |
CClashedDependencyDescriptor* clashConDesLinker = nullptr; |
| 14903 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 14904 |
CIndividualLinkEdge* link = roleSuccIt.next(false); |
| 14905 |
clashConDesLinker = createClashedIndividualLinkDescriptor(clashConDesLinker,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 14906 |
throw CCalculationClashProcessingException(clashConDesLinker); |
| 14907 |
} |
| 14908 |
|
| 14909 |
|
| 14910 |
if (mConfAtleastAtmostFastClashCheck) { |
| 14911 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 14912 |
if (conSet) { |
| 14913 |
CConceptDescriptor* conDesIt = conSet->getAddingSortedConceptDescriptionLinker(); |
| 14914 |
while (conDesIt) { |
| 14915 |
CConcept* atleastConcept = conDesIt->getData(); |
| 14916 |
bool conNegated = conDesIt->isNegated(); |
| 14917 |
cint64 opCode = atleastConcept->getOperatorCode(); |
| 14918 |
if (!conNegated && (opCode == CCATLEAST) || conNegated && (opCode == CCATMOST)) { |
| 14919 |
cint64 param = atleastConcept->getParameter(); |
| 14920 |
cint64 atleastCardinality = param + 1*conNegated; |
| 14921 |
|
| 14922 |
if (atleastCardinality > cardinality && (hasIdenticalConceptOperands(atleastConcept->getOperandList(),conceptOpLinkerIt) || !conceptOpLinkerIt)) { |
| 14923 |
CRole* atmostRole = role; |
| 14924 |
CRole* atleastRole = atleastConcept->getRole(); |
| 14925 |
|
| 14926 |
|
| 14927 |
CSortedNegLinker<CRole*>* superRoleIt = atleastRole->getIndirectSuperRoleList(); |
| 14928 |
while (superRoleIt) { |
| 14929 |
if (!superRoleIt->isNegated()) { |
| 14930 |
if (superRoleIt->getData() == atmostRole) { |
| 14931 |
CClashedDependencyDescriptor* clashConDesLinker = nullptr; |
| 14932 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 14933 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conDesIt,conDesIt->getDependencyTrackPoint(),calcAlgContext); |
| 14934 |
throw CCalculationClashProcessingException(clashConDesLinker); |
| 14935 |
} |
| 14936 |
} |
| 14937 |
superRoleIt = superRoleIt->getNext(); |
| 14938 |
} |
| 14939 |
} |
| 14940 |
} |
| 14941 |
conDesIt = conDesIt->getNext(); |
| 14942 |
} |
| 14943 |
} |
| 14944 |
} |
| 14945 |
|
| 14946 |
// create basis dependency |
| 14947 |
CATMOSTDependencyNode* atMostDepNode = createATMOSTDependency(processIndi,conDes,depTrackPoint,calcAlgContext); |
| 14948 |
CNonDeterministicDependencyTrackPoint* atMostNonDetDepTrackPoint = createNonDeterministicDependencyTrackPointBranch(atMostDepNode,true,calcAlgContext); |
| 14949 |
|
| 14950 |
// initialize qualifying and merging |
| 14951 |
branchingMergingProcRest = CObjectParameterizingAllocator< CBranchingMergingProcessingRestrictionSpecification,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,processContext); |
| 14952 |
branchingMergingProcRest->initBranchingMergingProcessingRestriction(); |
| 14953 |
branchingMergingProcRest->initDependencyTracker(atMostNonDetDepTrackPoint); |
| 14954 |
branchingMergingProcRest->initMergingDependencyNode(atMostDepNode); |
| 14955 |
|
| 14956 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForMergingInitialization(conProDes,processIndi)) { |
| 14957 |
testIndividualNodeUnsatisfiableCached(processIndi,calcAlgContext); |
| 14958 |
} |
| 14959 |
|
| 14960 |
} else { |
| 14961 |
CBranchingMergingProcessingRestrictionSpecification* prevBranchingMergingProcRest = (CBranchingMergingProcessingRestrictionSpecification*)procRest; |
| 14962 |
|
| 14963 |
roleSuccIt = roleSuccHash->getRoleSuccessorHistoryLinkIterator(role,prevBranchingMergingProcRest->getLastIndividualLink(),&linkCount); |
| 14964 |
|
| 14965 |
if (cardinality <= 0 && linkCount > 0 && !conceptOpLinkerIt) { |
| 14966 |
// clash |
| 14967 |
CClashedDependencyDescriptor* clashConDesLinker = nullptr; |
| 14968 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 14969 |
CIndividualLinkEdge* link = roleSuccIt.next(false); |
| 14970 |
clashConDesLinker = createClashedIndividualLinkDescriptor(clashConDesLinker,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 14971 |
throw CCalculationClashProcessingException(clashConDesLinker); |
| 14972 |
} |
| 14973 |
|
| 14974 |
CBranchingMergingProcessingRestrictionSpecification* newBranchingMergingProcRest = CObjectParameterizingAllocator< CBranchingMergingProcessingRestrictionSpecification,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,processContext); |
| 14975 |
newBranchingMergingProcRest->initBranchingMergingProcessingRestriction(prevBranchingMergingProcRest); |
| 14976 |
|
| 14977 |
branchingMergingProcRest = newBranchingMergingProcRest; |
| 14978 |
} |
| 14979 |
|
| 14980 |
//lastBranchingMergingProcRest = branchingMergingProcRest; |
| 14981 |
|
| 14982 |
|
| 14983 |
//CIndividual* nominalIndividual = processIndi->getNominalIndividual(); |
| 14984 |
//if (nominalIndividual && cardinality == 2) { |
| 14985 |
// if (CIRIName::getRecentIRIName(nominalIndividual->getIndividualNameLinker()) == "http://www.cs.man.ac.uk/~stevensr/ontology/fhkb.owl#richard_john_bright_1962") { |
| 14986 |
// bool bug = true; |
| 14987 |
// } |
| 14988 |
//} |
| 14989 |
|
| 14990 |
|
| 14991 |
initializeMergingIndividualNodes(processIndi,conProDes,&roleSuccIt,usingLastLink,conceptOpLinkerIt,branchingMergingProcRest,calcAlgContext); |
| 14992 |
qualifyMergingIndividualNodes(processIndi,conProDes,branchingMergingProcRest,calcAlgContext); |
| 14993 |
if (mConfPairwiseMerging) { |
| 14994 |
mergeMergingIndividualNodesPairwise(processIndi,conProDes,linkCount,cardinality,branchingMergingProcRest,calcAlgContext); |
| 14995 |
} else { |
| 14996 |
mergeMergingIndividualNodes(processIndi,conProDes,linkCount,cardinality,branchingMergingProcRest,calcAlgContext); |
| 14997 |
} |
| 14998 |
|
| 14999 |
installReapplication = true; |
| 15000 |
if (installReapplication) { |
| 15001 |
CDependencyTrackPoint* contDepTrackPoint = depTrackPoint; |
| 15002 |
addConceptToReapplyQueue(conDes,role,processIndi,branchingMergingProcRest,contDepTrackPoint,calcAlgContext); |
| 15003 |
} |
| 15004 |
} |
| 15005 |
|
| 15006 |
|
| 15007 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugMergingQueueString(CBranchingMergingProcessingRestrictionSpecification* branchingMergingProcRest, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 15008 |
QString mergingString; |
| 15009 |
CBranchingMergingIndividualNodeCandidateLinker* mergCandLinker = branchingMergingProcRest->getMergingCandidateNodeLinker(); |
| 15010 |
while (mergCandLinker) { |
| 15011 |
CIndividualProcessNode* indiNode = mergCandLinker->getMergingIndividualNodeCandidate(); |
| 15012 |
|
| 15013 |
QString indiString = QString("[ %1 ] = ").arg(indiNode->getIndividualNodeID()); |
| 15014 |
QString conSetString; |
| 15015 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 15016 |
CReapplyConceptLabelSetIterator conSetIt = conSet->getConceptLabelSetIterator(false,false,false); |
| 15017 |
while (conSetIt.hasNext()) { |
| 15018 |
CConceptDescriptor* conDes = conSetIt.next(); |
| 15019 |
CConcept* concept = conDes->getConcept(); |
| 15020 |
cint64 conTag = conDes->getConceptTag(); |
| 15021 |
if (conTag != 1) { |
| 15022 |
QString conString = QString("%1%2").arg((conDes->isNegated())?"-":"").arg(conTag); |
| 15023 |
if (concept->hasClassName()) { |
| 15024 |
conString += CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 15025 |
} |
| 15026 |
if (!conSetString.isEmpty()) { |
| 15027 |
conSetString += QString(", "); |
| 15028 |
} |
| 15029 |
conSetString += conString; |
| 15030 |
} |
| 15031 |
} |
| 15032 |
indiString += QString("{%1} \n").arg(conSetString); |
| 15033 |
mergingString += indiString; |
| 15034 |
|
| 15035 |
mergCandLinker = mergCandLinker->getNext(); |
| 15036 |
} |
| 15037 |
return mergingString; |
| 15038 |
} |
| 15039 |
|
| 15040 |
|
| 15041 |
|
| 15042 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::mergeMergingIndividualNodesPairwise(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, cint64 linkCount, cint64 cardinality, CBranchingMergingProcessingRestrictionSpecification* branchingMergingProcRest, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 15043 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 15044 |
CConcept* concept = conDes->getConcept(); |
| 15045 |
CRole* role = concept->getRole(); |
| 15046 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 15047 |
CDependencyTrackPoint* baseDepTrackPoint = branchingMergingProcRest->getDependencyTrackPoint(); |
| 15048 |
cint64 indiCount = processIndi->getRoleSuccessorCount(role); |
| 15049 |
if (indiCount > cardinality) { |
| 15050 |
CSatisfiableCalculationTask* newTaskList = nullptr; |
| 15051 |
|
| 15052 |
CMERGEDependencyNode* mergeDependencyNode = createMERGEDependency(processIndi,nullptr,baseDepTrackPoint,calcAlgContext); |
| 15053 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 15054 |
|
| 15055 |
CRoleSuccessorLinkIterator roleSuccIt1 = processIndi->getRoleSuccessorLinkIterator(role); |
| 15056 |
while (roleSuccIt1.hasNext()) { |
| 15057 |
CIndividualLinkEdge* link1 = roleSuccIt1.next(); |
| 15058 |
CIndividualProcessNode* succNode1 = getSuccessorIndividual(processIndi,link1,calcAlgContext); |
| 15059 |
|
| 15060 |
clashDescriptors = createIndividualMergeCausingDescriptors(clashDescriptors,succNode1,link1,conceptOpLinkerIt,calcAlgContext); |
| 15061 |
|
| 15062 |
CRoleSuccessorLinkIterator roleSuccIt2 = roleSuccIt1; |
| 15063 |
while (roleSuccIt2.hasNext()) { |
| 15064 |
CIndividualLinkEdge* link2 = roleSuccIt2.next(); |
| 15065 |
CIndividualProcessNode* succNode2 = getSuccessorIndividual(processIndi,link2,calcAlgContext); |
| 15066 |
|
| 15067 |
clashDescriptors = createIndividualMergeCausingDescriptors(clashDescriptors,succNode2,link2,conceptOpLinkerIt,calcAlgContext); |
| 15068 |
|
| 15069 |
if (isIndividualNodesMergeable(succNode1,succNode2,clashDescriptors,calcAlgContext)) { |
| 15070 |
CSatisfiableCalculationTask* newTask = createMergeBranchingTask(processIndi,conProDes,succNode1,succNode2,mergeDependencyNode,branchingMergingProcRest,calcAlgContext); |
| 15071 |
newTaskList = (CSatisfiableCalculationTask*)newTask->append(newTaskList); |
| 15072 |
} |
| 15073 |
} |
| 15074 |
} |
| 15075 |
|
| 15076 |
if (mergeDependencyNode) { |
| 15077 |
mergeDependencyNode->addBranchClashes(clashDescriptors); |
| 15078 |
} |
| 15079 |
|
| 15080 |
if (newTaskList) { |
| 15081 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 15082 |
processorContext->getTaskProcessorCommunicator()->communicateTaskCreation(newTaskList); |
| 15083 |
} else { |
| 15084 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors,processIndi,nullptr,baseDepTrackPoint,calcAlgContext); |
| 15085 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 15086 |
} |
| 15087 |
|
| 15088 |
throw CCalculationStopProcessingException(true); |
| 15089 |
} |
| 15090 |
return false; |
| 15091 |
} |
| 15092 |
|
| 15093 |
|
| 15094 |
|
| 15095 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::mergeMergingIndividualNodes(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, cint64 linkCount, cint64 cardinality, CBranchingMergingProcessingRestrictionSpecification* branchingMergingProcRest, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 15096 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 15097 |
CConcept* concept = conDes->getConcept(); |
| 15098 |
CRole* role = concept->getRole(); |
| 15099 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 15100 |
CPROCESSSET<cint64>* distinctMergedSet = branchingMergingProcRest->getDistinctMergedNodesSet(false); |
| 15101 |
CPROCESSSET<cint64>* locDistinctMergedSet = nullptr; |
| 15102 |
|
| 15103 |
cint64 deterministicMergingAttempt = 0; |
| 15104 |
cint64 deterministicMergingStep = 0; |
| 15105 |
|
| 15106 |
cint64 distinctCount = 0; |
| 15107 |
if (distinctMergedSet) { |
| 15108 |
distinctCount = distinctMergedSet->count(); |
| 15109 |
} |
| 15110 |
cint64 linkAndCandidateCount = branchingMergingProcRest->getRemainingLinkerMergingCandidateIndividualNodeCount() + distinctCount; |
| 15111 |
if (linkCount != linkAndCandidateCount) { |
| 15112 |
// update |
| 15113 |
branchingMergingProcRest->setRemainingValidMergingCandidateIndividualNodeCount(linkCount-distinctCount); |
| 15114 |
} |
| 15115 |
|
| 15116 |
CDependencyTrackPoint* baseDepTrackPoint = branchingMergingProcRest->getDependencyTrackPoint(); |
| 15117 |
|
| 15118 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 15119 |
|
| 15120 |
cint64 tmpCardinality = cardinality; |
| 15121 |
|
| 15122 |
|
| 15123 |
if (cardinality <= 0 && branchingMergingProcRest->getRemainingLinkerMergingCandidateIndividualNodeCount() > 0) { |
| 15124 |
// clash |
| 15125 |
CBranchingMergingIndividualNodeCandidateLinker* mergeCandLinker = branchingMergingProcRest->takeNextMergingCandidateNodeLinker(); |
| 15126 |
while (mergeCandLinker) { |
| 15127 |
CIndividualProcessNode* mergeCandIndiNode = mergeCandLinker->getMergingIndividualNodeCandidate(); |
| 15128 |
if (branchingMergingProcRest->hasValidRemainingMergingCandidates() || processIndi->hasRoleSuccessorToIndividual(role,mergeCandIndiNode,true)) { |
| 15129 |
|
| 15130 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 15131 |
|
| 15132 |
CIndividualProcessNode* mergingIndiNode = getUpToDateIndividual(mergeCandIndiNode,calcAlgContext); |
| 15133 |
clashDescriptors = createIndividualMergeCausingDescriptors(clashDescriptors,mergingIndiNode,mergeCandLinker->getMergingIndividualLink(),conceptOpLinkerIt,calcAlgContext); |
| 15134 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors,processIndi,nullptr,baseDepTrackPoint,calcAlgContext); |
| 15135 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 15136 |
|
| 15137 |
} else { |
| 15138 |
// invalid link |
| 15139 |
branchingMergingProcRest->incRemainingValidMergingCandidateIndividualNodeCount(); |
| 15140 |
} |
| 15141 |
mergeCandLinker = branchingMergingProcRest->takeNextMergingCandidateNodeLinker(); |
| 15142 |
} |
| 15143 |
} |
| 15144 |
|
| 15145 |
|
| 15146 |
|
| 15147 |
bool fixedNominalMerging = processIndi->isNominalIndividualNode() && branchingMergingProcRest->hasAddedBlockablePredecessorMergingNodeCandidate(); |
| 15148 |
bool requiresNNOperating = false; |
| 15149 |
if (fixedNominalMerging) { |
| 15150 |
cint64 fixDisCount = distinctCount + branchingMergingProcRest->getRemainingNominalCreationCount(); |
| 15151 |
if (fixDisCount > 0) { |
| 15152 |
tmpCardinality = distinctCount; |
| 15153 |
if (branchingMergingProcRest->hasRemainingMergingCandidates()) { |
| 15154 |
requiresNNOperating = true; |
| 15155 |
} |
| 15156 |
} else if (linkAndCandidateCount > 0) { |
| 15157 |
requiresNNOperating = true; |
| 15158 |
} |
| 15159 |
} |
| 15160 |
|
| 15161 |
CClashedDependencyDescriptor* initClashDescriptors = nullptr; |
| 15162 |
|
| 15163 |
if (linkAndCandidateCount > tmpCardinality || requiresNNOperating) { |
| 15164 |
// needs merging |
| 15165 |
if (fixedNominalMerging) { |
| 15166 |
bool requiresNNInitialization = fixedNominalMerging && !branchingMergingProcRest->isDistinctSetFixed(); |
| 15167 |
if (requiresNNInitialization) { |
| 15168 |
STATINC(INDINODEMERGENEWNOMINALINITCOUNT,calcAlgContext); |
| 15169 |
|
| 15170 |
if (!locDistinctMergedSet) { |
| 15171 |
locDistinctMergedSet = branchingMergingProcRest->getDistinctMergedNodesSet(true); |
| 15172 |
distinctMergedSet = locDistinctMergedSet; |
| 15173 |
locDistinctMergedSet->clear(); |
| 15174 |
distinctCount = 0; |
| 15175 |
} |
| 15176 |
|
| 15177 |
if (mConfLazyNewNominalGeneration) { |
| 15178 |
branchingMergingProcRest->setRemainingNominalCreationCount(tmpCardinality); |
| 15179 |
tmpCardinality = 0; |
| 15180 |
} else { |
| 15181 |
// generate new nominal successor nodes |
| 15182 |
createNominalsSuccessorIndividuals(processIndi,role->getIndirectSuperRoleList(),role,conceptOpLinkerIt,false,branchingMergingProcRest->getAddedBlockablePredecessorDependencyTrackPoint(),tmpCardinality,calcAlgContext); |
| 15183 |
distinctCount = tmpCardinality; |
| 15184 |
|
| 15185 |
cint64 disIndiIdx = 0; |
| 15186 |
|
| 15187 |
CIndividualLinkEdge* newLastLink = nullptr; |
| 15188 |
CRoleSuccessorLinkIterator roleSuccIt(processIndi->getRoleSuccessorHistoryLinkIterator(role,branchingMergingProcRest->getLastIndividualLink())); |
| 15189 |
while (roleSuccIt.hasNext()) { |
| 15190 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 15191 |
if (!newLastLink) { |
| 15192 |
newLastLink = link; |
| 15193 |
} |
| 15194 |
CIndividualProcessNode* nominalSuccIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 15195 |
distinctMergedSet->insert(nominalSuccIndi->getIndividualNodeID()); |
| 15196 |
++disIndiIdx; |
| 15197 |
} |
| 15198 |
branchingMergingProcRest->setLastIndividualLink(newLastLink); |
| 15199 |
} |
| 15200 |
branchingMergingProcRest->setDistinctSetFixed(true); |
| 15201 |
} |
| 15202 |
|
| 15203 |
} else { |
| 15204 |
while (distinctCount <= 0) { |
| 15205 |
if (!locDistinctMergedSet) { |
| 15206 |
locDistinctMergedSet = branchingMergingProcRest->getDistinctMergedNodesSet(true); |
| 15207 |
distinctMergedSet = locDistinctMergedSet; |
| 15208 |
} |
| 15209 |
initClashDescriptors = branchingMergingProcRest->getMultipleMergingNodesInitializationClashesDescriptors(); |
| 15210 |
CBranchingMergingIndividualNodeCandidateLinker* mergeCandLinker = branchingMergingProcRest->takeNextMergingCandidateNodeLinker(); |
| 15211 |
while (mergeCandLinker) { |
| 15212 |
CIndividualProcessNode* mergeCandIndiNode = mergeCandLinker->getMergingIndividualNodeCandidate(); |
| 15213 |
|
| 15214 |
if (!branchingMergingProcRest->hasValidRemainingMergingCandidates()) { |
| 15215 |
mergeCandIndiNode = getCorrectedNominalIndividualNode(mergeCandIndiNode->getIndividualNodeID(),calcAlgContext); |
| 15216 |
} |
| 15217 |
|
| 15218 |
CIndividualProcessNode* mergingIndiNode = getUpToDateIndividual(mergeCandIndiNode,calcAlgContext); |
| 15219 |
initClashDescriptors = createIndividualMergeCausingDescriptors(initClashDescriptors,mergingIndiNode,mergeCandLinker->getMergingIndividualLink(),conceptOpLinkerIt,calcAlgContext); |
| 15220 |
|
| 15221 |
|
| 15222 |
distinctMergedSet->insert(mergeCandIndiNode->getIndividualNodeID()); |
| 15223 |
|
| 15224 |
++distinctCount; |
| 15225 |
if (distinctCount > tmpCardinality) { |
| 15226 |
// clash, not able to merge |
| 15227 |
if (!initClashDescriptors) { |
| 15228 |
initClashDescriptors = branchingMergingProcRest->getMergingNodesInitializationClashesDescriptors(); |
| 15229 |
} |
| 15230 |
initClashDescriptors = createClashedConceptDescriptor(initClashDescriptors,processIndi,nullptr,baseDepTrackPoint,calcAlgContext); |
| 15231 |
throw CCalculationClashProcessingException(initClashDescriptors); |
| 15232 |
} |
| 15233 |
mergeCandLinker = branchingMergingProcRest->takeNextMergingInitializationCandidateNodeLinker(); |
| 15234 |
} |
| 15235 |
} |
| 15236 |
} |
| 15237 |
|
| 15238 |
|
| 15239 |
if (!branchingMergingProcRest->hasValidRemainingMergingCandidates()) { |
| 15240 |
// update distinct hash |
| 15241 |
if (!distinctMergedSet) { |
| 15242 |
locDistinctMergedSet = branchingMergingProcRest->getDistinctMergedNodesSet(true); |
| 15243 |
distinctMergedSet = locDistinctMergedSet; |
| 15244 |
} |
| 15245 |
bool relocated = false; |
| 15246 |
|
| 15247 |
for (CPROCESSSET<cint64>::const_iterator disIt = distinctMergedSet->constBegin(), disItEnd = distinctMergedSet->constEnd(); disIt != disItEnd; ++disIt) { |
| 15248 |
cint64 distinctIndiID = *disIt; |
| 15249 |
|
| 15250 |
CIndividualLinkEdge* disIndiLink = processIndi->getRoleSuccessorToIndividualLink(role,distinctIndiID,true); |
| 15251 |
if (!disIndiLink) { |
| 15252 |
CIndividualProcessNode* mergedIntoNode = getCorrectedNominalIndividualNode(distinctIndiID,calcAlgContext); |
| 15253 |
if (!locDistinctMergedSet) { |
| 15254 |
locDistinctMergedSet = branchingMergingProcRest->getDistinctMergedNodesSet(true); |
| 15255 |
distinctMergedSet = locDistinctMergedSet; |
| 15256 |
} |
| 15257 |
locDistinctMergedSet->remove(distinctIndiID); |
| 15258 |
relocated = true; |
| 15259 |
if (locDistinctMergedSet->contains(mergedIntoNode->getIndividualNodeID())) { |
| 15260 |
--distinctCount; |
| 15261 |
if (fixedNominalMerging) { |
| 15262 |
tmpCardinality = distinctCount; |
| 15263 |
} |
| 15264 |
} |
| 15265 |
locDistinctMergedSet->insert(mergedIntoNode->getIndividualNodeID()); |
| 15266 |
} else if (locDistinctMergedSet) { |
| 15267 |
locDistinctMergedSet->insert(distinctIndiID); |
| 15268 |
} |
| 15269 |
} |
| 15270 |
|
| 15271 |
if (relocated) { |
| 15272 |
branchingMergingProcRest->setDistinctSetNodeRelocated(true); |
| 15273 |
} |
| 15274 |
} |
| 15275 |
|
| 15276 |
|
| 15277 |
|
| 15278 |
while (branchingMergingProcRest->hasRemainingMergingCandidates()) { |
| 15279 |
|
| 15280 |
++deterministicMergingAttempt; |
| 15281 |
bool createNewNodesAsNominals = false; |
| 15282 |
|
| 15283 |
if (mConfLazyNewNominalGeneration) { |
| 15284 |
cint64 remainingNewNominalCreationCount = branchingMergingProcRest->getRemainingNominalCreationCount(); |
| 15285 |
if (remainingNewNominalCreationCount > 0) { |
| 15286 |
// generate new nominal |
| 15287 |
|
| 15288 |
//createNominalsSuccessorIndividuals(processIndi,role->getIndirectSuperRoleList(),role,conceptOpLinkerIt,false,branchingMergingProcRest->getAddedBlockablePredecessorDependencyTrackPoint(),1,calcAlgContext); |
| 15289 |
//if (!locDistinctMergedSet) { |
| 15290 |
// locDistinctMergedSet = branchingMergingProcRest->getDistinctMergedNodesSet(true); |
| 15291 |
// distinctMergedSet = locDistinctMergedSet; |
| 15292 |
//} |
| 15293 |
//++distinctCount; |
| 15294 |
++tmpCardinality; |
| 15295 |
createNewNodesAsNominals = true; |
| 15296 |
//CRoleSuccessorLinkIterator roleSuccIt(processIndi->getRoleSuccessorHistoryLinkIterator(role,branchingMergingProcRest->getLastIndividualLink())); |
| 15297 |
//if (roleSuccIt.hasNext()) { |
| 15298 |
// CIndividualLinkEdge* link = roleSuccIt.next(); |
| 15299 |
// branchingMergingProcRest->setLastIndividualLink(link); |
| 15300 |
// CIndividualProcessNode* nominalSuccIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 15301 |
// distinctMergedSet->insert(nominalSuccIndi->getIndividualID()); |
| 15302 |
//} |
| 15303 |
|
| 15304 |
//branchingMergingProcRest->setRemainingNominalCreationCount(remainingNewNominalCreationCount-1); |
| 15305 |
} |
| 15306 |
} |
| 15307 |
|
| 15308 |
CBranchingMergingIndividualNodeCandidateLinker* mergeCandLinker = branchingMergingProcRest->takeNextMergingCandidateNodeLinker(); |
| 15309 |
CIndividualProcessNode* mergeCandIndiNode = mergeCandLinker->getMergingIndividualNodeCandidate(); |
| 15310 |
|
| 15311 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 15312 |
|
| 15313 |
if (((branchingMergingProcRest->hasValidRemainingMergingCandidates() && branchingMergingProcRest->getRemainingValidMergingCandidateIndividualNodeCount() > 0) || processIndi->hasRoleSuccessorToIndividual(role,mergeCandIndiNode,true)) && !distinctMergedSet->contains(mergeCandIndiNode->getIndividualNodeID())) { |
| 15314 |
++deterministicMergingStep; |
| 15315 |
|
| 15316 |
CIndividualProcessNode* mergingIndiNode = getUpToDateIndividual(mergeCandIndiNode,calcAlgContext); |
| 15317 |
|
| 15318 |
// TODO: collect clashes and update distinct node set |
| 15319 |
CClashedDependencyDescriptor* clashDescriptors = initClashDescriptors; |
| 15320 |
initClashDescriptors = nullptr; |
| 15321 |
clashDescriptors = createIndividualMergeCausingDescriptors(clashDescriptors,mergingIndiNode,mergeCandLinker->getMergingIndividualLink(),conceptOpLinkerIt,calcAlgContext); |
| 15322 |
|
| 15323 |
CPROCESSSET<cint64>* itDistinctMergedSet = distinctMergedSet; |
| 15324 |
CPROCESSSET<cint64>::const_iterator disItEnd = distinctMergedSet->constEnd(); |
| 15325 |
CPROCESSSET<cint64>::const_iterator firstMergeableIt = disItEnd; |
| 15326 |
CPROCESSSET<cint64>::const_iterator secondMergeableIt = disItEnd; |
| 15327 |
|
| 15328 |
cint64 firstContIndex = 0; |
| 15329 |
cint64 secondContIndex = 0; |
| 15330 |
|
| 15331 |
|
| 15332 |
cint64 contIndex = 0; |
| 15333 |
for (CPROCESSSET<cint64>::const_iterator disIt = distinctMergedSet->constBegin(); disIt != disItEnd;) { |
| 15334 |
++contIndex; |
| 15335 |
cint64 distinctIndiID = *disIt; |
| 15336 |
|
| 15337 |
CIndividualLinkEdge* disIndiLink = processIndi->getRoleSuccessorToIndividualLink(role,distinctIndiID,true); |
| 15338 |
//if (!disIndiLink) { |
| 15339 |
// mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 15340 |
// QFile file(QString("./Debugging/CompletionTasks/task-root-clashed.txt")); |
| 15341 |
// if (file.open(QIODevice::WriteOnly)) { |
| 15342 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 15343 |
// file.close(); |
| 15344 |
// } |
| 15345 |
// bool bug = true; |
| 15346 |
|
| 15347 |
//} |
| 15348 |
KONCLUDE_ASSERT_X(disIndiLink,"merging individual nodes","individual node link for distinct hashed individual node not found"); |
| 15349 |
if (disIndiLink) { |
| 15350 |
CIndividualProcessNode* disIndiNode = getSuccessorIndividual(processIndi,disIndiLink,calcAlgContext); |
| 15351 |
|
| 15352 |
clashDescriptors = createIndividualMergeCausingDescriptors(clashDescriptors,disIndiNode,disIndiLink,conceptOpLinkerIt,calcAlgContext); |
| 15353 |
|
| 15354 |
if (isIndividualNodesMergeable(disIndiNode,mergingIndiNode,clashDescriptors,calcAlgContext)) { |
| 15355 |
if (firstMergeableIt == disItEnd) { |
| 15356 |
firstMergeableIt = disIt; |
| 15357 |
firstContIndex = contIndex; |
| 15358 |
} else { |
| 15359 |
secondMergeableIt = disIt; |
| 15360 |
secondContIndex = contIndex; |
| 15361 |
break; |
| 15362 |
} |
| 15363 |
} |
| 15364 |
++disIt; |
| 15365 |
} |
| 15366 |
} |
| 15367 |
|
| 15368 |
//KONCLUCE_TASK_ALGORITHM_CLASH_STRING_INSTRUCTION(mMergingClashString = generateDebugTrackedClashedDescriptorString(createTrackedClashesDescriptors(clashDescriptors,calcAlgContext),calcAlgContext)); |
| 15369 |
|
| 15370 |
CMERGEDependencyNode* mergeDependencyNode = createMERGEDependency(processIndi,nullptr,baseDepTrackPoint,calcAlgContext); |
| 15371 |
if (mergeDependencyNode) { |
| 15372 |
mergeDependencyNode->addBranchClashes(clashDescriptors); |
| 15373 |
} |
| 15374 |
|
| 15375 |
|
| 15376 |
//KONCLUCE_TASK_ALGORITHM_BRANCH_STRING_INSTRUCTION(mergeDependencyNode->getBranchNode()->setBranchString(new QString(QString("%1").arg(mergingIndiNode->getIndividualID())))); |
| 15377 |
|
| 15378 |
|
| 15379 |
if (firstMergeableIt == disItEnd) { |
| 15380 |
if (distinctCount < tmpCardinality) { |
| 15381 |
++mAppliedATMOSTRuleCount; |
| 15382 |
|
| 15383 |
// add individual to distinct set |
| 15384 |
if (!locDistinctMergedSet) { |
| 15385 |
locDistinctMergedSet = branchingMergingProcRest->getDistinctMergedNodesSet(true); |
| 15386 |
distinctMergedSet = locDistinctMergedSet; |
| 15387 |
} |
| 15388 |
CNonDeterministicDependencyTrackPoint* mergeNonDetDepTrackPoint = createNonDeterministicDependencyTrackPointBranch(mergeDependencyNode,true,calcAlgContext); |
| 15389 |
if ((!mConfMinimizeMerging && !createNewNodesAsNominals) || mergingIndiNode->isNominalIndividualNode()) { |
| 15390 |
distinctMergedSet->insert(mergingIndiNode->getIndividualNodeID()); |
| 15391 |
|
| 15392 |
if (createNewNodesAsNominals) { |
| 15393 |
branchingMergingProcRest->decRemainingNominalCreationCount(); |
| 15394 |
} |
| 15395 |
|
| 15396 |
branchingMergingProcRest->initMergingDependencyNode(mergeDependencyNode); |
| 15397 |
branchingMergingProcRest->initDependencyTracker(mergeNonDetDepTrackPoint); |
| 15398 |
baseDepTrackPoint = mergeNonDetDepTrackPoint; |
| 15399 |
} else { |
| 15400 |
CIndividualProcessNode* locMergingIndiNode = getLocalizedIndividual(mergingIndiNode,false,calcAlgContext); |
| 15401 |
|
| 15402 |
if (createNewNodesAsNominals) { |
| 15403 |
branchingMergingProcRest->decRemainingNominalCreationCount(); |
| 15404 |
} |
| 15405 |
|
| 15406 |
CIndividualProcessNode* mergedIntoEmptyIndiNode = getIntoEmptyMergedIndividualNode(locMergingIndiNode,createNewNodesAsNominals,processIndi,mergeNonDetDepTrackPoint,calcAlgContext); |
| 15407 |
distinctMergedSet->insert(mergedIntoEmptyIndiNode->getIndividualNodeID()); |
| 15408 |
|
| 15409 |
CRoleSuccessorLinkIterator roleSuccIt(processIndi->getRoleSuccessorHistoryLinkIterator(role,branchingMergingProcRest->getLastIndividualLink())); |
| 15410 |
if (roleSuccIt.hasNext()) { |
| 15411 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 15412 |
branchingMergingProcRest->setLastIndividualLink(link); |
| 15413 |
} |
| 15414 |
addIndividualToProcessingQueue(mergedIntoEmptyIndiNode,calcAlgContext); |
| 15415 |
|
| 15416 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 15417 |
|
| 15418 |
} |
| 15419 |
|
| 15420 |
|
| 15421 |
++distinctCount; |
| 15422 |
} else { |
| 15423 |
// clash, not able to merge |
| 15424 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors,processIndi,nullptr,baseDepTrackPoint,calcAlgContext); |
| 15425 |
|
| 15426 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 15427 |
} |
| 15428 |
} else if (secondMergeableIt == disItEnd && distinctCount >= tmpCardinality) { |
| 15429 |
++mAppliedATMOSTRuleCount; |
| 15430 |
// only one possibility to merge |
| 15431 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 15432 |
CIndividualProcessNode* locDisIndiNode = getLocalizedIndividual(*firstMergeableIt,calcAlgContext); |
| 15433 |
CIndividualProcessNode* locMergingIndiNode = getLocalizedIndividual(mergingIndiNode,false,calcAlgContext); |
| 15434 |
|
| 15435 |
CNonDeterministicDependencyTrackPoint* mergeNonDetDepTrackPoint = createNonDeterministicDependencyTrackPointBranch(mergeDependencyNode,true,calcAlgContext); |
| 15436 |
|
| 15437 |
if (branchingMergingProcRest->isDistinctSetNodeRelocated()) { |
| 15438 |
branchingMergingProcRest->setDistinctSetNodeRelocated(false); |
| 15439 |
branchingMergingProcRest->initMergingDependencyNode(mergeDependencyNode); |
| 15440 |
branchingMergingProcRest->initDependencyTracker(mergeNonDetDepTrackPoint); |
| 15441 |
} |
| 15442 |
|
| 15443 |
CIndividualProcessNode* locMergedIndiNode = getMergedIndividualNodes(locDisIndiNode,locMergingIndiNode,mergeNonDetDepTrackPoint,calcAlgContext); |
| 15444 |
if (locMergedIndiNode->getIndividualNodeID() != locDisIndiNode->getIndividualNodeID()) { |
| 15445 |
if (!locDistinctMergedSet) { |
| 15446 |
locDistinctMergedSet = branchingMergingProcRest->getDistinctMergedNodesSet(true); |
| 15447 |
distinctMergedSet = locDistinctMergedSet; |
| 15448 |
} |
| 15449 |
distinctMergedSet->remove(locDisIndiNode->getIndividualNodeID()); |
| 15450 |
distinctMergedSet->insert(locMergedIndiNode->getIndividualNodeID()); |
| 15451 |
branchingMergingProcRest->setDistinctSetNodeRelocated(true); |
| 15452 |
} |
| 15453 |
|
| 15454 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForMergedIndividualNodes(conProDes,processIndi,locMergedIndiNode)) { |
| 15455 |
testIndividualNodeUnsatisfiableCached(locMergedIndiNode,calcAlgContext); |
| 15456 |
} |
| 15457 |
|
| 15458 |
|
| 15459 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 15460 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorHistoryLinkIterator(role,branchingMergingProcRest->getLastIndividualLink(),&linkCount); |
| 15461 |
if (roleSuccIt.hasNext()) { |
| 15462 |
initializeMergingIndividualNodes(processIndi,conProDes,&roleSuccIt,nullptr,conceptOpLinkerIt,branchingMergingProcRest,calcAlgContext); |
| 15463 |
qualifyMergingIndividualNodes(processIndi,conProDes,branchingMergingProcRest,calcAlgContext); |
| 15464 |
} |
| 15465 |
|
| 15466 |
} else { |
| 15467 |
++mAppliedATMOSTRuleCount; |
| 15468 |
CSatisfiableCalculationTask* newTaskList = nullptr; |
| 15469 |
|
| 15470 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 15471 |
if (firstMergeableIt != disItEnd) { |
| 15472 |
CIndividualProcessNode* firstDistinctIndiNode = getUpToDateIndividual(*firstMergeableIt,calcAlgContext); |
| 15473 |
CSatisfiableCalculationTask* newTask = createMergeBranchingTask(processIndi,conProDes,firstDistinctIndiNode,mergingIndiNode,mergeDependencyNode,branchingMergingProcRest,calcAlgContext); |
| 15474 |
newTaskList = (CSatisfiableCalculationTask*)newTask->append(newTaskList); |
| 15475 |
} |
| 15476 |
if (secondMergeableIt != disItEnd) { |
| 15477 |
CIndividualProcessNode* secondDistinctIndiNode = getUpToDateIndividual(*secondMergeableIt,calcAlgContext); |
| 15478 |
CSatisfiableCalculationTask* newTask = createMergeBranchingTask(processIndi,conProDes,secondDistinctIndiNode,mergingIndiNode,mergeDependencyNode,branchingMergingProcRest,calcAlgContext); |
| 15479 |
newTaskList = (CSatisfiableCalculationTask*)newTask->append(newTaskList); |
| 15480 |
|
| 15481 |
CPROCESSSET<cint64>::const_iterator mergeableIt = secondMergeableIt; |
| 15482 |
while (++mergeableIt != disItEnd) { |
| 15483 |
cint64 distinctIndiID = *mergeableIt; |
| 15484 |
|
| 15485 |
CIndividualLinkEdge* disIndiLink = processIndi->getRoleSuccessorToIndividualLink(role,distinctIndiID,true); |
| 15486 |
KONCLUDE_ASSERT_X(disIndiLink,"merging individual nodes","individual node link for distinct hashed individual node not found"); |
| 15487 |
if (disIndiLink) { |
| 15488 |
CIndividualProcessNode* distinctIndiNode = getSuccessorIndividual(processIndi,disIndiLink,calcAlgContext); |
| 15489 |
|
| 15490 |
CClashedDependencyDescriptor* moreClashDescriptors = createIndividualMergeCausingDescriptors(nullptr,distinctIndiNode,disIndiLink,conceptOpLinkerIt,calcAlgContext); |
| 15491 |
|
| 15492 |
if (isIndividualNodesMergeable(distinctIndiNode,mergingIndiNode,moreClashDescriptors,calcAlgContext)) { |
| 15493 |
CSatisfiableCalculationTask* newTask = createMergeBranchingTask(processIndi,conProDes,distinctIndiNode,mergingIndiNode,mergeDependencyNode,branchingMergingProcRest,calcAlgContext); |
| 15494 |
newTaskList = (CSatisfiableCalculationTask*)newTask->append(newTaskList); |
| 15495 |
} |
| 15496 |
|
| 15497 |
if (mergeDependencyNode) { |
| 15498 |
mergeDependencyNode->addBranchClashes(moreClashDescriptors); |
| 15499 |
} |
| 15500 |
} |
| 15501 |
} |
| 15502 |
} |
| 15503 |
|
| 15504 |
if (distinctCount < tmpCardinality) { |
| 15505 |
CSatisfiableCalculationTask* newTask = createDistinctBranchingTask(processIndi,conProDes,mergingIndiNode,createNewNodesAsNominals,mergeDependencyNode,branchingMergingProcRest,calcAlgContext); |
| 15506 |
newTaskList = (CSatisfiableCalculationTask*)newTask->append(newTaskList); |
| 15507 |
} |
| 15508 |
|
| 15509 |
|
| 15510 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 15511 |
processorContext->getTaskProcessorCommunicator()->communicateTaskCreation(newTaskList); |
| 15512 |
|
| 15513 |
throw CCalculationStopProcessingException(true); |
| 15514 |
} |
| 15515 |
|
| 15516 |
} else { |
| 15517 |
// invalid link |
| 15518 |
branchingMergingProcRest->incRemainingValidMergingCandidateIndividualNodeCount(); |
| 15519 |
} |
| 15520 |
} |
| 15521 |
|
| 15522 |
} |
| 15523 |
return false; |
| 15524 |
} |
| 15525 |
|
| 15526 |
|
| 15527 |
|
| 15528 |
CSatisfiableCalculationTask* CCalculationTableauCompletionTaskHandleAlgorithm::createDistinctBranchingTask(CIndividualProcessNode*& processIndiNode, CConceptProcessDescriptor*& conProDes, CIndividualProcessNode*& distinctIndiNode, bool createAsNominal, CNonDeterministicDependencyNode* mergeDependencyNode, CBranchingMergingProcessingRestrictionSpecification* branchingMergingProcRest, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 15529 |
STATINC(TASKDISTINCTMERGEBRANCHCREATIONCOUNT,calcAlgContext); |
| 15530 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 15531 |
CRole* role = conDes->getConcept()->getRole(); |
| 15532 |
CSatisfiableCalculationTask* newSatCalcTask = createDependendBranchingTaskList(1,calcAlgContext); |
| 15533 |
|
| 15534 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 15535 |
|
| 15536 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 15537 |
|
| 15538 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext,newProcessContext,newSatCalcTask); |
| 15539 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 15540 |
|
| 15541 |
CMemoryAllocationManager* newTaskMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 15542 |
|
| 15543 |
CNonDeterministicDependencyTrackPoint* mergeNonDetDepTrackPoint = createNonDeterministicDependencyTrackPointBranch(mergeDependencyNode,false,newCalcAlgContext); |
| 15544 |
|
| 15545 |
CBranchingMergingProcessingRestrictionSpecification* newBranchingMergingProcRest = CObjectParameterizingAllocator< CBranchingMergingProcessingRestrictionSpecification,CProcessContext* >::allocateAndConstructAndParameterize(newTaskMemMan,newProcessContext); |
| 15546 |
newBranchingMergingProcRest->initBranchingMergingProcessingRestriction(branchingMergingProcRest); |
| 15547 |
|
| 15548 |
CProcessTagger* newProcessTagger = newCalcAlgContext->getUsedProcessTagger(); |
| 15549 |
newProcessTagger->incBranchingTag(); |
| 15550 |
newProcessTagger->incLocalizationTag(); |
| 15551 |
|
| 15552 |
CIndividualProcessNode* newLocDistinctIndiNode = getLocalizedIndividual(distinctIndiNode,false,newCalcAlgContext); |
| 15553 |
|
| 15554 |
CIndividualProcessNode* locProcessIndiNode = getLocalizedIndividual(processIndiNode,false,newCalcAlgContext); |
| 15555 |
|
| 15556 |
// make distinct to all other |
| 15557 |
CPROCESSSET<cint64>* locDistinctMergedSet = newBranchingMergingProcRest->getDistinctMergedNodesSet(true); |
| 15558 |
|
| 15559 |
|
| 15560 |
if ((mConfMinimizeMerging || createAsNominal) && !newLocDistinctIndiNode->isNominalIndividualNode()) { |
| 15561 |
if (createAsNominal) { |
| 15562 |
newBranchingMergingProcRest->decRemainingNominalCreationCount(); |
| 15563 |
} |
| 15564 |
|
| 15565 |
CIndividualProcessNode* mergedIntoEmptyIndiNode = getIntoEmptyMergedIndividualNode(newLocDistinctIndiNode,createAsNominal,processIndiNode,mergeNonDetDepTrackPoint,newCalcAlgContext); |
| 15566 |
locDistinctMergedSet->insert(mergedIntoEmptyIndiNode->getIndividualNodeID()); |
| 15567 |
|
| 15568 |
CRoleSuccessorLinkIterator roleSuccIt(locProcessIndiNode->getRoleSuccessorHistoryLinkIterator(role,newBranchingMergingProcRest->getLastIndividualLink())); |
| 15569 |
if (roleSuccIt.hasNext()) { |
| 15570 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 15571 |
newBranchingMergingProcRest->setLastIndividualLink(link); |
| 15572 |
} |
| 15573 |
addIndividualToProcessingQueue(mergedIntoEmptyIndiNode,newCalcAlgContext); |
| 15574 |
|
| 15575 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mDebugIndiModelString = generateDebugIndiModelStringList(newCalcAlgContext)); |
| 15576 |
|
| 15577 |
} else { |
| 15578 |
newBranchingMergingProcRest->initMergingDependencyNode(mergeDependencyNode); |
| 15579 |
newBranchingMergingProcRest->initDependencyTracker(mergeNonDetDepTrackPoint); |
| 15580 |
|
| 15581 |
locDistinctMergedSet->insert(newLocDistinctIndiNode->getIndividualNodeID()); |
| 15582 |
} |
| 15583 |
|
| 15584 |
|
| 15585 |
if (newBranchingMergingProcRest->isDistinctSetNodeRelocated()) { |
| 15586 |
newBranchingMergingProcRest->setDistinctSetNodeRelocated(false); |
| 15587 |
newBranchingMergingProcRest->initMergingDependencyNode(mergeDependencyNode); |
| 15588 |
newBranchingMergingProcRest->initDependencyTracker(mergeNonDetDepTrackPoint); |
| 15589 |
} |
| 15590 |
|
| 15591 |
|
| 15592 |
// continue merging |
| 15593 |
CConceptProcessingQueue* conProQueu = locProcessIndiNode->getConceptProcessingQueue(true); |
| 15594 |
addConceptRestrictedToProcessingQueue(conDes,mergeNonDetDepTrackPoint,conProQueu,locProcessIndiNode,true,newBranchingMergingProcRest,newCalcAlgContext); |
| 15595 |
|
| 15596 |
prepareBranchedTaskProcessing(locProcessIndiNode,newSatCalcTask,newCalcAlgContext); |
| 15597 |
|
| 15598 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mDebugIndiModelString = generateDebugIndiModelStringList(newCalcAlgContext)); |
| 15599 |
|
| 15600 |
// set new task priority |
| 15601 |
double newTaskPriority = calcAlgContext->getUsedTaskPriorityStrategy()->getPriorityForTaskMerging(newSatCalcTask,calcAlgContext->getUsedSatisfiableCalculationTask()); |
| 15602 |
newSatCalcTask->setTaskPriority(newTaskPriority); |
| 15603 |
|
| 15604 |
return newSatCalcTask; |
| 15605 |
} |
| 15606 |
|
| 15607 |
|
| 15608 |
|
| 15609 |
CSatisfiableCalculationTask* CCalculationTableauCompletionTaskHandleAlgorithm::createMergeBranchingTask(CIndividualProcessNode*& processIndiNode, CConceptProcessDescriptor*& conProDes, CIndividualProcessNode*& distinctIndiNode, CIndividualProcessNode*& mergingIndiNode, CNonDeterministicDependencyNode* mergeDependencyNode, CBranchingMergingProcessingRestrictionSpecification* branchingMergingProcRest, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 15610 |
STATINC(TASKINDINODEMERGEBRANCHCREATIONCOUNT,calcAlgContext); |
| 15611 |
|
| 15612 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 15613 |
CSatisfiableCalculationTask* newSatCalcTask = createDependendBranchingTaskList(1,calcAlgContext); |
| 15614 |
|
| 15615 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 15616 |
|
| 15617 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 15618 |
|
| 15619 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext,newProcessContext,newSatCalcTask); |
| 15620 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 15621 |
|
| 15622 |
CMemoryAllocationManager* newTaskMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 15623 |
|
| 15624 |
CNonDeterministicDependencyTrackPoint* mergeNonDetDepTrackPoint = createNonDeterministicDependencyTrackPointBranch(mergeDependencyNode,false,newCalcAlgContext); |
| 15625 |
|
| 15626 |
CBranchingMergingProcessingRestrictionSpecification* newBranchingMergingProcRest = CObjectParameterizingAllocator< CBranchingMergingProcessingRestrictionSpecification,CProcessContext* >::allocateAndConstructAndParameterize(newTaskMemMan,newProcessContext); |
| 15627 |
newBranchingMergingProcRest->initBranchingMergingProcessingRestriction(branchingMergingProcRest); |
| 15628 |
|
| 15629 |
CProcessTagger* newProcessTagger = newCalcAlgContext->getUsedProcessTagger(); |
| 15630 |
newProcessTagger->incBranchingTag(); |
| 15631 |
newProcessTagger->incLocalizationTag(); |
| 15632 |
|
| 15633 |
CIndividualProcessNode* newLocDistinctIndiNode = getLocalizedIndividual(distinctIndiNode,false,newCalcAlgContext); |
| 15634 |
CIndividualProcessNode* newLocMergingIndiNode = getLocalizedIndividual(mergingIndiNode,false,newCalcAlgContext); |
| 15635 |
|
| 15636 |
|
| 15637 |
if (newBranchingMergingProcRest->isDistinctSetNodeRelocated()) { |
| 15638 |
newBranchingMergingProcRest->setDistinctSetNodeRelocated(false); |
| 15639 |
newBranchingMergingProcRest->initMergingDependencyNode(mergeDependencyNode); |
| 15640 |
newBranchingMergingProcRest->initDependencyTracker(mergeNonDetDepTrackPoint); |
| 15641 |
} |
| 15642 |
|
| 15643 |
CIndividualProcessNode* locMergedIndiNode = getMergedIndividualNodes(newLocDistinctIndiNode,newLocMergingIndiNode,mergeNonDetDepTrackPoint,newCalcAlgContext); |
| 15644 |
if (locMergedIndiNode->getIndividualNodeID() != newLocDistinctIndiNode->getIndividualNodeID()) { |
| 15645 |
CPROCESSSET<cint64>* locDistinctMergedSet = newBranchingMergingProcRest->getDistinctMergedNodesSet(true); |
| 15646 |
locDistinctMergedSet->remove(newLocDistinctIndiNode->getIndividualNodeID()); |
| 15647 |
locDistinctMergedSet->insert(locMergedIndiNode->getIndividualNodeID()); |
| 15648 |
newBranchingMergingProcRest->setDistinctSetNodeRelocated(true); |
| 15649 |
} |
| 15650 |
|
| 15651 |
|
| 15652 |
// continue merging |
| 15653 |
CIndividualProcessNode* locProcessIndiNode = getLocalizedIndividual(processIndiNode,true,newCalcAlgContext); |
| 15654 |
CConceptProcessingQueue* conProQueu = locProcessIndiNode->getConceptProcessingQueue(true); |
| 15655 |
addConceptRestrictedToProcessingQueue(conDes,mergeNonDetDepTrackPoint,conProQueu,locProcessIndiNode,true,newBranchingMergingProcRest,newCalcAlgContext); |
| 15656 |
|
| 15657 |
|
| 15658 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForMergedIndividualNodes(conProDes,locProcessIndiNode,locMergedIndiNode)) { |
| 15659 |
addIndividualNodeForCacheUnsatisfiableRetrieval(locMergedIndiNode,newCalcAlgContext); |
| 15660 |
} |
| 15661 |
|
| 15662 |
prepareBranchedTaskProcessing(locProcessIndiNode,newSatCalcTask,newCalcAlgContext); |
| 15663 |
|
| 15664 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mDebugIndiModelString = generateDebugIndiModelStringList(newCalcAlgContext)); |
| 15665 |
|
| 15666 |
// set new task priority |
| 15667 |
double newTaskPriority = calcAlgContext->getUsedTaskPriorityStrategy()->getPriorityForTaskMerging(newSatCalcTask,calcAlgContext->getUsedSatisfiableCalculationTask()); |
| 15668 |
newSatCalcTask->setTaskPriority(newTaskPriority); |
| 15669 |
|
| 15670 |
return newSatCalcTask; |
| 15671 |
} |
| 15672 |
|
| 15673 |
|
| 15674 |
|
| 15675 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::qualifyMergingIndividualNodes(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, CBranchingMergingProcessingRestrictionSpecification* branchingMergingProcRest, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 15676 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 15677 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 15678 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 15679 |
CConcept* concept = conDes->getConcept(); |
| 15680 |
CRole* role = concept->getRole(); |
| 15681 |
cint64 cardinality = concept->getParameter() - 1*conDes->isNegated(); |
| 15682 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 15683 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 15684 |
|
| 15685 |
bool qualifing = false; |
| 15686 |
|
| 15687 |
CBranchingMergingIndividualNodeCandidateLinker* qualifyPosNegCandLinker = branchingMergingProcRest->getBothQualifyCandidateNodeLinker(); |
| 15688 |
while (qualifyPosNegCandLinker) { |
| 15689 |
|
| 15690 |
CIndividualProcessNode* qualifyIndiNode = qualifyPosNegCandLinker->getMergingIndividualNodeCandidate(); |
| 15691 |
|
| 15692 |
// check still valid |
| 15693 |
CIndividualLinkEdge* link = processIndi->getRoleSuccessorToIndividualLink(role,qualifyIndiNode,true); |
| 15694 |
if (link) { |
| 15695 |
CIndividualProcessNode* upQualifyIndiNode = getUpToDateIndividual(qualifyIndiNode,calcAlgContext); |
| 15696 |
bool negated = false; |
| 15697 |
if (containsIndividualNodeConcepts(upQualifyIndiNode,conceptOpLinkerIt,&negated,calcAlgContext)) { |
| 15698 |
if (!negated) { |
| 15699 |
if (cardinality <= 0) { |
| 15700 |
// clash |
| 15701 |
} |
| 15702 |
CBranchingMergingIndividualNodeCandidateLinker* qualifiedMovedCandLinker = CObjectParameterizingAllocator< CBranchingMergingIndividualNodeCandidateLinker,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 15703 |
qualifiedMovedCandLinker->initBranchingMergingIndividualNodeCandidate(qualifyPosNegCandLinker); |
| 15704 |
branchingMergingProcRest->addMergingCandidateNodeLinker(qualifiedMovedCandLinker); |
| 15705 |
} |
| 15706 |
|
| 15707 |
} else { |
| 15708 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 15709 |
CClashedDependencyDescriptor* clashDes = createClashedIndividualLinkDescriptor(nullptr,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 15710 |
|
| 15711 |
// create dependency |
| 15712 |
CQUALIFYDependencyNode* qualifyDepNode = createQUALIFYDependency(processIndi,nullptr,branchingMergingProcRest->getDependencyTrackPoint(),calcAlgContext); |
| 15713 |
if (qualifyDepNode) { |
| 15714 |
qualifyDepNode->addBranchClashes(clashDes); |
| 15715 |
} |
| 15716 |
branchingMergingProcRest->setBothQualifyCandidateNodeLinker(qualifyPosNegCandLinker->getNext()); |
| 15717 |
|
| 15718 |
|
| 15719 |
if (cardinality <= 0) { |
| 15720 |
++mAppliedATMOSTRuleCount; |
| 15721 |
STATINC(INDINODEQUALIFYCHOOCECOUNT,calcAlgContext); |
| 15722 |
CDependencyTrackPoint* newDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(qualifyDepNode,true,calcAlgContext); |
| 15723 |
|
| 15724 |
CIndividualProcessNode* locQualifyIndiNode = getLocalizedIndividual(upQualifyIndiNode,false,calcAlgContext); |
| 15725 |
// qualify only negated |
| 15726 |
addConceptsToIndividual(conceptOpLinkerIt,true,locQualifyIndiNode,newDependencyTrackPoint,false,true,nullptr,calcAlgContext); |
| 15727 |
addIndividualToProcessingQueue(locQualifyIndiNode,calcAlgContext); |
| 15728 |
|
| 15729 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForQualifiedIndividualNodes(conProDes,processIndi,locQualifyIndiNode)) { |
| 15730 |
addIndividualNodeForCacheUnsatisfiableRetrieval(locQualifyIndiNode,calcAlgContext); |
| 15731 |
} |
| 15732 |
|
| 15733 |
|
| 15734 |
} else { |
| 15735 |
++mAppliedATMOSTRuleCount; |
| 15736 |
STATINC(INDINODEQUALIFYCHOOCECOUNT,calcAlgContext); |
| 15737 |
|
| 15738 |
qualifing = true; |
| 15739 |
|
| 15740 |
|
| 15741 |
CSatisfiableCalculationTask* newTaskList = createDependendBranchingTaskList(2,calcAlgContext); |
| 15742 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 15743 |
|
| 15744 |
CSatisfiableCalculationTask* newTaskIt = newTaskList; |
| 15745 |
cint64 branchNumber = 1; |
| 15746 |
bool qualNeg = true; |
| 15747 |
while (newTaskIt) { |
| 15748 |
STATINC(TASKQUALIFYCHOOSEBRANCHCREATIONCOUNT,calcAlgContext); |
| 15749 |
|
| 15750 |
CSatisfiableCalculationTask* newSatCalcTask = newTaskIt; |
| 15751 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 15752 |
|
| 15753 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext,newProcessContext,newSatCalcTask); |
| 15754 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 15755 |
|
| 15756 |
CProcessTagger* newProcessTagger = newCalcAlgContext->getUsedProcessTagger(); |
| 15757 |
newProcessTagger->incBranchingTag(); |
| 15758 |
newProcessTagger->incLocalizationTag(); |
| 15759 |
|
| 15760 |
CIndividualProcessNode* newLocIndiNode = getLocalizedIndividual(processIndi,false,newCalcAlgContext); |
| 15761 |
CConceptProcessingQueue* newConProcQueue = newLocIndiNode->getConceptProcessingQueue(true); |
| 15762 |
|
| 15763 |
|
| 15764 |
CIndividualProcessNode* newLocQualifyIndiNode = getLocalizedIndividual(upQualifyIndiNode,false,newCalcAlgContext); |
| 15765 |
|
| 15766 |
|
| 15767 |
// create dependency track point |
| 15768 |
CDependencyTrackPoint* newDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(qualifyDepNode,false,newCalcAlgContext); |
| 15769 |
|
| 15770 |
if (!qualNeg) { |
| 15771 |
CMemoryAllocationManager* newTaskMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 15772 |
CBranchingMergingProcessingRestrictionSpecification* newBranchingMergingProcRest = CObjectParameterizingAllocator< CBranchingMergingProcessingRestrictionSpecification,CProcessContext* >::allocateAndConstructAndParameterize(newTaskMemMan,newProcessContext); |
| 15773 |
newBranchingMergingProcRest->initBranchingMergingProcessingRestriction(branchingMergingProcRest); |
| 15774 |
CBranchingMergingIndividualNodeCandidateLinker* qualifiedMovedCandLinker = CObjectParameterizingAllocator< CBranchingMergingIndividualNodeCandidateLinker,CProcessContext* >::allocateAndConstructAndParameterize(newTaskMemMan,newProcessContext); |
| 15775 |
qualifiedMovedCandLinker->initBranchingMergingIndividualNodeCandidate(qualifyPosNegCandLinker); |
| 15776 |
newBranchingMergingProcRest->addMergingCandidateNodeLinker(qualifiedMovedCandLinker); |
| 15777 |
|
| 15778 |
branchingMergingProcRest = newBranchingMergingProcRest; |
| 15779 |
} |
| 15780 |
|
| 15781 |
// ATMOST reapplication in new tasks |
| 15782 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,newConProcQueue,newLocIndiNode,true,branchingMergingProcRest,newCalcAlgContext); |
| 15783 |
|
| 15784 |
// qualify |
| 15785 |
addConceptsToIndividual(conceptOpLinkerIt,qualNeg,newLocQualifyIndiNode,newDependencyTrackPoint,false,true,nullptr,newCalcAlgContext); |
| 15786 |
addIndividualToProcessingQueue(newLocQualifyIndiNode,newCalcAlgContext); |
| 15787 |
|
| 15788 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForQualifiedIndividualNodes(conProDes,newLocIndiNode,newLocQualifyIndiNode)) { |
| 15789 |
addIndividualNodeForCacheUnsatisfiableRetrieval(newLocQualifyIndiNode,newCalcAlgContext); |
| 15790 |
} |
| 15791 |
|
| 15792 |
prepareBranchedTaskProcessing(newLocIndiNode,newTaskIt,newCalcAlgContext); |
| 15793 |
|
| 15794 |
// set new task priority |
| 15795 |
double newTaskPriority = calcAlgContext->getUsedTaskPriorityStrategy()->getPriorityForTaskQualifing(newSatCalcTask,calcAlgContext->getUsedSatisfiableCalculationTask(),qualNeg); |
| 15796 |
newSatCalcTask->setTaskPriority(newTaskPriority); |
| 15797 |
|
| 15798 |
++branchNumber; |
| 15799 |
qualNeg = !qualNeg; |
| 15800 |
newTaskIt = (CSatisfiableCalculationTask*)newTaskIt->getNext(); |
| 15801 |
} |
| 15802 |
|
| 15803 |
processorContext->getTaskProcessorCommunicator()->communicateTaskCreation(newTaskList); |
| 15804 |
|
| 15805 |
throw CCalculationStopProcessingException(true); |
| 15806 |
} |
| 15807 |
} |
| 15808 |
} |
| 15809 |
|
| 15810 |
qualifyPosNegCandLinker = qualifyPosNegCandLinker->getNext(); |
| 15811 |
} |
| 15812 |
branchingMergingProcRest->setBothQualifyCandidateNodeLinker(nullptr); |
| 15813 |
return qualifing; |
| 15814 |
} |
| 15815 |
|
| 15816 |
|
| 15817 |
|
| 15818 |
void CCalculationTableauCompletionTaskHandleAlgorithm::initializeMergingIndividualNodes(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, CRoleSuccessorLinkIterator* roleSuccIt, CIndividualLinkEdge* usingLastLink, CSortedNegLinker<CConcept*>* conceptOpLinkerIt, CBranchingMergingProcessingRestrictionSpecification* branchingMergingProcRest, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 15819 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 15820 |
CProcessContext* processContext = calcAlgContext->getUsedProcessContext(); |
| 15821 |
|
| 15822 |
|
| 15823 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 15824 |
bool negate = conDes->getNegation(); |
| 15825 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 15826 |
CConcept* concept = conDes->getConcept(); |
| 15827 |
|
| 15828 |
cint64 cardinality = concept->getParameter() - 1*negate; |
| 15829 |
|
| 15830 |
CConceptRoleBranchingTrigger* chooseTriggerLinker = nullptr; |
| 15831 |
CConceptProcessData* conProData = (CConceptProcessData*)concept->getConceptData(); |
| 15832 |
if (conProData) { |
| 15833 |
chooseTriggerLinker = conProData->getConceptRoleBranchTrigger(); |
| 15834 |
} |
| 15835 |
|
| 15836 |
|
| 15837 |
CIndividualLinkEdge* firstLink = usingLastLink; |
| 15838 |
CBranchingMergingIndividualNodeCandidateLinker* disIndiNodeCandLinker = nullptr; |
| 15839 |
CBranchingMergingIndividualNodeCandidateLinker* maxDisIndiNodeCandLinker = nullptr; |
| 15840 |
cint64 maxDisIndiNodeCandCount = 0; |
| 15841 |
cint64 disIndiNodeCandCount = 0; |
| 15842 |
bool collectMaxDistinctMergingNodes = true; |
| 15843 |
bool canInitMerging = !branchingMergingProcRest->hasMergingInitializationCandidates(); |
| 15844 |
|
| 15845 |
|
| 15846 |
CXLinker<CIndividualLinkEdge*>* lastCheckedTriggeredSuccLinker = nullptr; |
| 15847 |
CXLinker<CIndividualLinkEdge*>* newTriggeredSuccLinker = nullptr; |
| 15848 |
|
| 15849 |
if (branchingMergingProcRest->hasSuccessorChoiceTriggeringInstalled()) { |
| 15850 |
if (branchingMergingProcRest->getSuccessorChoiceTriggeringInstalledCount() > 0) { |
| 15851 |
CSuccessorIndividualATMOSTReactivationData* succIndiATMOSTReactivationData = processIndi->getSuccessorIndividualATMOSTReactivationData(false); |
| 15852 |
lastCheckedTriggeredSuccLinker = branchingMergingProcRest->getLastCheckedSuccessorChoiceTriggerLinker(); |
| 15853 |
newTriggeredSuccLinker = succIndiATMOSTReactivationData->getReactivationSuccessorIndividualLinkLinker(conDes); |
| 15854 |
if (lastCheckedTriggeredSuccLinker != newTriggeredSuccLinker) { |
| 15855 |
branchingMergingProcRest->setLastCheckedSuccessorChoiceTriggerLinker(newTriggeredSuccLinker); |
| 15856 |
} |
| 15857 |
} |
| 15858 |
} |
| 15859 |
|
| 15860 |
while (roleSuccIt->hasNext() || newTriggeredSuccLinker != lastCheckedTriggeredSuccLinker) { |
| 15861 |
STATINC(INDINODEMERGEINITCOUNT,calcAlgContext); |
| 15862 |
|
| 15863 |
CIndividualLinkEdge* link = nullptr; |
| 15864 |
CIndividualProcessNode* succIndi = nullptr; |
| 15865 |
|
| 15866 |
if (roleSuccIt->hasNext()) { |
| 15867 |
link = roleSuccIt->next(); |
| 15868 |
} else if (newTriggeredSuccLinker != lastCheckedTriggeredSuccLinker) { |
| 15869 |
link = newTriggeredSuccLinker->getData(); |
| 15870 |
branchingMergingProcRest->decSuccessorChoiceTriggeringInstalledCount(); |
| 15871 |
newTriggeredSuccLinker = newTriggeredSuccLinker->getNext(); |
| 15872 |
} |
| 15873 |
succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 15874 |
|
| 15875 |
|
| 15876 |
bool containsNegation = false; |
| 15877 |
if (containsIndividualNodeConcepts(succIndi,conceptOpLinkerIt,&containsNegation,calcAlgContext)) { |
| 15878 |
|
| 15879 |
|
| 15880 |
CBranchingMergingIndividualNodeCandidateLinker* mergeIndiNodeCandLinker = CObjectParameterizingAllocator< CBranchingMergingIndividualNodeCandidateLinker,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,processContext); |
| 15881 |
mergeIndiNodeCandLinker->initBranchingMergingIndividualNodeCandidate(succIndi,link); |
| 15882 |
|
| 15883 |
|
| 15884 |
if (!containsNegation) { |
| 15885 |
bool delayedCandAdded = false; |
| 15886 |
CDistinctHash* disHash = succIndi->getDistinctHash(false); |
| 15887 |
if (collectMaxDistinctMergingNodes && disHash) { |
| 15888 |
if (disIndiNodeCandLinker) { |
| 15889 |
bool distinctToAllPrev = true; |
| 15890 |
CBranchingMergingIndividualNodeCandidateLinker* disIndiNodeCandLinkerIt = disIndiNodeCandLinker; |
| 15891 |
while (disIndiNodeCandLinkerIt) { |
| 15892 |
if (!disHash->isIndividualDistinct(disIndiNodeCandLinkerIt->getMergingIndividualNodeCandidate()->getIndividualNodeID())) { |
| 15893 |
distinctToAllPrev = false; |
| 15894 |
break; |
| 15895 |
} |
| 15896 |
disIndiNodeCandLinkerIt = disIndiNodeCandLinkerIt->getNext(); |
| 15897 |
} |
| 15898 |
if (distinctToAllPrev) { |
| 15899 |
disIndiNodeCandLinker = mergeIndiNodeCandLinker->append(disIndiNodeCandLinker); |
| 15900 |
++disIndiNodeCandCount; |
| 15901 |
delayedCandAdded = true; |
| 15902 |
} else { |
| 15903 |
if (disIndiNodeCandCount > maxDisIndiNodeCandCount) { |
| 15904 |
maxDisIndiNodeCandCount = disIndiNodeCandCount; |
| 15905 |
branchingMergingProcRest->addMergingCandidateNodeLinker(maxDisIndiNodeCandLinker); |
| 15906 |
maxDisIndiNodeCandLinker = disIndiNodeCandLinker; |
| 15907 |
} else { |
| 15908 |
branchingMergingProcRest->addMergingCandidateNodeLinker(disIndiNodeCandLinker); |
| 15909 |
} |
| 15910 |
disIndiNodeCandCount = 0; |
| 15911 |
disIndiNodeCandLinker = nullptr; |
| 15912 |
} |
| 15913 |
} |
| 15914 |
|
| 15915 |
|
| 15916 |
if (!disIndiNodeCandLinker) { |
| 15917 |
if (disHash->getDistinctCount() >= maxDisIndiNodeCandCount) { |
| 15918 |
disIndiNodeCandLinker = mergeIndiNodeCandLinker; |
| 15919 |
disIndiNodeCandCount = 1; |
| 15920 |
delayedCandAdded = true; |
| 15921 |
} |
| 15922 |
} |
| 15923 |
} |
| 15924 |
if (!delayedCandAdded) { |
| 15925 |
branchingMergingProcRest->addMergingCandidateNodeLinker(mergeIndiNodeCandLinker); |
| 15926 |
} |
| 15927 |
} |
| 15928 |
|
| 15929 |
} else { |
| 15930 |
|
| 15931 |
bool installedChoiseTriggering = false; |
| 15932 |
CConcept* triggeringConcept = nullptr; |
| 15933 |
bool triggerNegation = false; |
| 15934 |
for (CConceptRoleBranchingTrigger* chooseTriggerIt = chooseTriggerLinker; !installedChoiseTriggering && chooseTriggerIt; chooseTriggerIt = chooseTriggerIt->getNext()) { |
| 15935 |
if (chooseTriggerIt->isConceptTrigger()) { |
| 15936 |
bool containedNegation = false; |
| 15937 |
if (containsIndividualNodeConcept(succIndi,chooseTriggerIt->getTriggerConcept(),&containedNegation,calcAlgContext)) { |
| 15938 |
if (chooseTriggerIt->getTriggerNegation() == containedNegation) { |
| 15939 |
installedChoiseTriggering = true; |
| 15940 |
triggeringConcept = chooseTriggerIt->getTriggerConcept(); |
| 15941 |
triggerNegation = chooseTriggerIt->getTriggerNegation(); |
| 15942 |
} |
| 15943 |
} |
| 15944 |
} |
| 15945 |
} |
| 15946 |
|
| 15947 |
if (installedChoiseTriggering) { |
| 15948 |
branchingMergingProcRest->setSuccessorChoiceTriggeringInstalled(true); |
| 15949 |
branchingMergingProcRest->incSuccessorChoiceTriggeringInstalledCount(); |
| 15950 |
|
| 15951 |
STATINC(INSERTCONCEPTREAPPLICATIONSCOUNT,calcAlgContext); |
| 15952 |
CCondensedReapplyQueue* reapplyQueue = processIndi->getConceptReapplyQueue(triggeringConcept,triggerNegation,true); |
| 15953 |
CExtendedCondensedReapplyConceptDescriptorATMOSTReactivation* reapplyATMOSTConDes = CObjectAllocator<CExtendedCondensedReapplyConceptDescriptorATMOSTReactivation>::allocateAndConstruct(taskMemMan); |
| 15954 |
reapplyATMOSTConDes->initAtmostExtendedReapllyDescriptor(conDes,depTrackPoint,!triggerNegation,branchingMergingProcRest,processIndi,link); |
| 15955 |
reapplyQueue->addReapplyConceptDescriptor(reapplyATMOSTConDes); |
| 15956 |
|
| 15957 |
} else { |
| 15958 |
|
| 15959 |
CBranchingMergingIndividualNodeCandidateLinker* mergeIndiNodeCandLinker = CObjectParameterizingAllocator< CBranchingMergingIndividualNodeCandidateLinker,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,processContext); |
| 15960 |
mergeIndiNodeCandLinker->initBranchingMergingIndividualNodeCandidate(succIndi,link); |
| 15961 |
|
| 15962 |
// TODO: check cache, add to only pos or neg qualify candidate node linker |
| 15963 |
branchingMergingProcRest->addBothQualifyCandidateNodeLinker(mergeIndiNodeCandLinker); |
| 15964 |
} |
| 15965 |
} |
| 15966 |
if (!firstLink) { |
| 15967 |
firstLink = link; |
| 15968 |
} |
| 15969 |
} |
| 15970 |
if (disIndiNodeCandLinker) { |
| 15971 |
if (disIndiNodeCandCount > maxDisIndiNodeCandCount) { |
| 15972 |
maxDisIndiNodeCandCount = disIndiNodeCandCount; |
| 15973 |
branchingMergingProcRest->addMergingCandidateNodeLinker(maxDisIndiNodeCandLinker); |
| 15974 |
maxDisIndiNodeCandLinker = disIndiNodeCandLinker; |
| 15975 |
} else { |
| 15976 |
branchingMergingProcRest->addMergingCandidateNodeLinker(disIndiNodeCandLinker); |
| 15977 |
} |
| 15978 |
} |
| 15979 |
if (maxDisIndiNodeCandLinker) { |
| 15980 |
cint64 disIndiCollCount = 0; |
| 15981 |
if (canInitMerging || maxDisIndiNodeCandCount > cardinality) { |
| 15982 |
CPROCESSINGSET<CDependencyTrackPoint*> distinctInitDepTrackPointSet(calcAlgContext->getUsedTaskProcessorContext()); |
| 15983 |
bool multipleDistinctInitClashes = false; |
| 15984 |
CClashedDependencyDescriptor* distinctInitClashes = nullptr; |
| 15985 |
CBranchingMergingIndividualNodeCandidateLinker* initMergingIndiNodeCandIt = maxDisIndiNodeCandLinker; |
| 15986 |
while (initMergingIndiNodeCandIt && disIndiCollCount <= cardinality) { |
| 15987 |
CIndividualProcessNode* indiNodeMergeCand = initMergingIndiNodeCandIt->getMergingIndividualNodeCandidate(); |
| 15988 |
|
| 15989 |
CBranchingMergingIndividualNodeCandidateLinker* initMergingIndiNodeCandIt2 = initMergingIndiNodeCandIt->getNext(); |
| 15990 |
while (initMergingIndiNodeCandIt2) { |
| 15991 |
CIndividualProcessNode* otherIndiNodeMergeCand = initMergingIndiNodeCandIt2->getMergingIndividualNodeCandidate(); |
| 15992 |
CDistinctEdge* disEdge = indiNodeMergeCand->getDistinctHash(false)->getIndividualDistinctEdge(otherIndiNodeMergeCand->getIndividualNodeID()); |
| 15993 |
CDependencyTrackPoint* disEdgeDepTrackPoint = disEdge->getDependencyTrackPoint(); |
| 15994 |
if (!distinctInitDepTrackPointSet.contains(disEdgeDepTrackPoint)) { |
| 15995 |
distinctInitDepTrackPointSet.insert(disEdgeDepTrackPoint); |
| 15996 |
if (distinctInitClashes) { |
| 15997 |
multipleDistinctInitClashes = true; |
| 15998 |
} |
| 15999 |
distinctInitClashes = createClashedIndividualDistinctDescriptor(distinctInitClashes,disEdge,disEdgeDepTrackPoint,calcAlgContext); |
| 16000 |
} |
| 16001 |
initMergingIndiNodeCandIt2 = initMergingIndiNodeCandIt2->getNext(); |
| 16002 |
} |
| 16003 |
|
| 16004 |
distinctInitClashes = createIndividualMergeCausingDescriptors(distinctInitClashes,indiNodeMergeCand,initMergingIndiNodeCandIt->getMergingIndividualLink(),conceptOpLinkerIt,calcAlgContext); |
| 16005 |
++disIndiCollCount; |
| 16006 |
|
| 16007 |
initMergingIndiNodeCandIt = initMergingIndiNodeCandIt->getNext(); |
| 16008 |
} |
| 16009 |
|
| 16010 |
if (maxDisIndiNodeCandCount > cardinality) { |
| 16011 |
distinctInitClashes = createClashedConceptDescriptor(distinctInitClashes,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 16012 |
throw CCalculationClashProcessingException(distinctInitClashes); |
| 16013 |
} |
| 16014 |
|
| 16015 |
if (multipleDistinctInitClashes) { |
| 16016 |
branchingMergingProcRest->setMultipleMergingNodesInitializationClashesDescriptors(distinctInitClashes); |
| 16017 |
} else { |
| 16018 |
branchingMergingProcRest->setMergingNodesInitializationClashesDescriptors(distinctInitClashes); |
| 16019 |
} |
| 16020 |
|
| 16021 |
branchingMergingProcRest->addMergingInitializationCandidateNodeLinker(maxDisIndiNodeCandLinker); |
| 16022 |
} else { |
| 16023 |
branchingMergingProcRest->addMergingCandidateNodeLinker(maxDisIndiNodeCandLinker); |
| 16024 |
} |
| 16025 |
} |
| 16026 |
|
| 16027 |
|
| 16028 |
|
| 16029 |
if (firstLink) { |
| 16030 |
branchingMergingProcRest->setLastIndividualLink(firstLink); |
| 16031 |
|
| 16032 |
//KONCLUCE_TASK_ALGORITHM_BRANCH_STRING_INSTRUCTION(mMergingQueueString = generateDebugMergingQueueString(branchingMergingProcRest,calcAlgContext)); |
| 16033 |
} |
| 16034 |
|
| 16035 |
for (cint64 i = 0; i < 2; ++i) { |
| 16036 |
bool qualPosNeg = false; |
| 16037 |
CBranchingMergingIndividualNodeCandidateLinker* qualifyPosNegCandLinker = nullptr; |
| 16038 |
if (i == 0) { |
| 16039 |
qualPosNeg = false; |
| 16040 |
qualifyPosNegCandLinker = branchingMergingProcRest->getOnlyPosQualifyCandidateNodeLinker(); |
| 16041 |
} else { |
| 16042 |
qualPosNeg = true; |
| 16043 |
qualifyPosNegCandLinker = branchingMergingProcRest->getOnlyNegQualifyCandidateNodeLinker(); |
| 16044 |
} |
| 16045 |
while (qualifyPosNegCandLinker) { |
| 16046 |
STATINC(INDINODEQUALIFYCHOOCECOUNT,calcAlgContext); |
| 16047 |
CIndividualProcessNode* qualifyIndiNode = qualifyPosNegCandLinker->getMergingIndividualNodeCandidate(); |
| 16048 |
CIndividualProcessNode* locQualifyIndiNode = getLocalizedIndividual(qualifyIndiNode,true,calcAlgContext); |
| 16049 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 16050 |
addConceptsToIndividual(conceptOpLinkerIt,qualPosNeg,locQualifyIndiNode,nextDepTrackPoint,true,true,nullptr,calcAlgContext); |
| 16051 |
addIndividualToProcessingQueue(locQualifyIndiNode,calcAlgContext); |
| 16052 |
if (!qualPosNeg) { |
| 16053 |
branchingMergingProcRest->addMergingCandidateNodeLinker(qualifyPosNegCandLinker); |
| 16054 |
} |
| 16055 |
qualifyPosNegCandLinker = qualifyPosNegCandLinker->getNext(); |
| 16056 |
} |
| 16057 |
} |
| 16058 |
branchingMergingProcRest->clearOnlyNegQualifyCandidateNodeLinker(); |
| 16059 |
branchingMergingProcRest->clearOnlyPosQualifyCandidateNodeLinker(); |
| 16060 |
|
| 16061 |
} |
| 16062 |
|
| 16063 |
|
| 16064 |
|
| 16065 |
|
| 16066 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyATLEASTRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16067 |
STATINC(ATLEASTRULEAPPLICATIONCOUNT,calcAlgContext); |
| 16068 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 16069 |
CConcept* concept = conDes->getConcept(); |
| 16070 |
CRole* role = concept->getRole(); |
| 16071 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 16072 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 16073 |
|
| 16074 |
cint64 cardinality = concept->getParameter() + 1*negate; |
| 16075 |
|
| 16076 |
|
| 16077 |
if (cardinality <= 0) { |
| 16078 |
return; |
| 16079 |
} else if (cardinality == 1) { |
| 16080 |
applySOMERule(processIndi,conProDes,false,calcAlgContext); |
| 16081 |
} |
| 16082 |
|
| 16083 |
|
| 16084 |
if (mConfSatExpCachedSuccAbsorp && processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED | CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED)) { |
| 16085 |
STATINC(SATCACHEDABSORBEDGENERATINGCONCEPTSCOUNT,calcAlgContext); |
| 16086 |
return addSatisfiableCachedAbsorbedGeneratingConcept(conDes,processIndi,depTrackPoint,calcAlgContext); |
| 16087 |
} |
| 16088 |
|
| 16089 |
|
| 16090 |
|
| 16091 |
bool alreadyExistSuitableSuccessors = hasDistinctRoleSuccessorConcepts(processIndi,role,conceptOpLinkerIt,false,cardinality,calcAlgContext); |
| 16092 |
if (!alreadyExistSuitableSuccessors) { |
| 16093 |
|
| 16094 |
if (mConfAtleastAtmostFastClashCheck) { |
| 16095 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 16096 |
if (conSet) { |
| 16097 |
CConceptDescriptor* conDesIt = conSet->getAddingSortedConceptDescriptionLinker(); |
| 16098 |
while (conDesIt) { |
| 16099 |
CConcept* atmostConcept = conDesIt->getData(); |
| 16100 |
bool conNegated = conDesIt->isNegated(); |
| 16101 |
cint64 opCode = atmostConcept->getOperatorCode(); |
| 16102 |
if (!conNegated && (opCode == CCATMOST) || conNegated && (opCode == CCATLEAST)) { |
| 16103 |
cint64 param = atmostConcept->getParameter(); |
| 16104 |
cint64 atmostCardinality = param - 1*conNegated; |
| 16105 |
|
| 16106 |
if (atmostCardinality < cardinality && (hasIdenticalConceptOperands(atmostConcept->getOperandList(),conceptOpLinkerIt) || !atmostConcept->getOperandList())) { |
| 16107 |
CRole* atmostRole = atmostConcept->getRole(); |
| 16108 |
|
| 16109 |
|
| 16110 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 16111 |
while (superRoleIt) { |
| 16112 |
if (!superRoleIt->isNegated()) { |
| 16113 |
if (superRoleIt->getData() == atmostRole) { |
| 16114 |
CClashedDependencyDescriptor* clashConDesLinker = nullptr; |
| 16115 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 16116 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conDesIt,conDesIt->getDependencyTrackPoint(),calcAlgContext); |
| 16117 |
throw CCalculationClashProcessingException(clashConDesLinker); |
| 16118 |
} |
| 16119 |
} |
| 16120 |
superRoleIt = superRoleIt->getNext(); |
| 16121 |
} |
| 16122 |
} |
| 16123 |
} |
| 16124 |
conDesIt = conDesIt->getNext(); |
| 16125 |
} |
| 16126 |
} |
| 16127 |
} |
| 16128 |
|
| 16129 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForSuccessorGeneration(conProDes,processIndi)) { |
| 16130 |
testIndividualNodeUnsatisfiableCached(processIndi,calcAlgContext); |
| 16131 |
} |
| 16132 |
|
| 16133 |
++mAppliedATLEASTRuleCount; |
| 16134 |
|
| 16135 |
// create dependency |
| 16136 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 16137 |
CATLEASTDependencyNode* atleastDepNode = createATLEASTDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 16138 |
|
| 16139 |
CPROCESSINGLIST<CIndividualProcessNode*> indiList(calcAlgContext->getUsedTaskProcessorContext()); |
| 16140 |
createDistinctSuccessorIndividuals(processIndi, conDes,indiList,role->getIndirectSuperRoleList(),role,conceptOpLinkerIt,false,nextDepTrackPoint,cardinality,calcAlgContext); |
| 16141 |
|
| 16142 |
for (CPROCESSINGLIST<CIndividualProcessNode*>::const_iterator it = indiList.constBegin(), itEnd = indiList.constEnd(); it != itEnd; ++it) { |
| 16143 |
STATINC(DISTINCTSUCCESSORINDINODECREATIONCOUNT,calcAlgContext); |
| 16144 |
CIndividualProcessNode* succIndi = *it; |
| 16145 |
if (processIndi->isNominalIndividualNode() && processIndi->getIndividualNominalLevel() <= 0) { |
| 16146 |
succIndi->setExtendedQueueProcessing(true); |
| 16147 |
} |
| 16148 |
addIndividualToProcessingQueue(succIndi,calcAlgContext); |
| 16149 |
} |
| 16150 |
} |
| 16151 |
} |
| 16152 |
|
| 16153 |
|
| 16154 |
|
| 16155 |
|
| 16156 |
|
| 16157 |
|
| 16158 |
|
| 16159 |
|
| 16160 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyNOMINALRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16161 |
STATINC(NOMINALRULEAPPLICATIONCOUNT,calcAlgContext); |
| 16162 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 16163 |
CConcept* concept = conDes->getConcept(); |
| 16164 |
CIndividual* indi = concept->getNominalIndividual(); |
| 16165 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 16166 |
|
| 16167 |
|
| 16168 |
CIndividualProcessNode* nominalNode = getCorrectedNominalIndividualNode(-indi->getIndividualID(),calcAlgContext); |
| 16169 |
if (!negate) { |
| 16170 |
if (nominalNode->getIndividualNodeID() != processIndi->getIndividualNodeID()) { |
| 16171 |
|
| 16172 |
// force initialized |
| 16173 |
CIndividualProcessNode* locNominalNode = getLocalizedForcedBackendInitializedNominalIndividualNode(nominalNode, calcAlgContext); |
| 16174 |
|
| 16175 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(locNominalNode, calcAlgContext); |
| 16176 |
|
| 16177 |
|
| 16178 |
CReapplyConceptLabelSet* locNominalNodeConSet = locNominalNode->getReapplyConceptLabelSet(true); |
| 16179 |
CConcept* nominalConcept = indi->getIndividualNominalConcept(); |
| 16180 |
CConceptDescriptor* nominalConDes = nullptr; |
| 16181 |
CDependencyTrackPoint* nominalConDepTrackPoint = nullptr; |
| 16182 |
if (-indi->getIndividualID() != locNominalNode->getIndividualNodeID()) { |
| 16183 |
locNominalNodeConSet->getConceptDescriptor(nominalConcept, nominalConDes, nominalConDepTrackPoint); |
| 16184 |
} |
| 16185 |
//CDependencyTrackPoint* nominalConDepTrackPoint = nullptr; |
| 16186 |
//if (-indi->getIndividualID() != locNominalNode->getIndividualNodeID()) { |
| 16187 |
// nominalConDepTrackPoint = locNominalNode->getIndividualMergingHash(true)->value(indi->getIndividualID()).getDependencyTrackPoint(); |
| 16188 |
//} |
| 16189 |
|
| 16190 |
|
| 16191 |
if (processIndi->isBlockableIndividual()) { |
| 16192 |
STATINC(INDIBLOCKABLENODENOMINALMERGINGCOUNT, calcAlgContext); |
| 16193 |
} |
| 16194 |
STATINC(INDINODENOMINALMERGECOUNT, calcAlgContext); |
| 16195 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 16196 |
// test if merging is possible |
| 16197 |
if (isIndividualNodesMergeable(processIndi, locNominalNode, clashDescriptors, calcAlgContext)) { |
| 16198 |
|
| 16199 |
propagateIndividualNodeNominalConnectionStatusToAncestors(processIndi, locNominalNode, calcAlgContext); |
| 16200 |
|
| 16201 |
// create dependency |
| 16202 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 16203 |
CNOMINALDependencyNode* nominalDepNode = createNOMINALDependency(nextDepTrackPoint, processIndi, conDes, depTrackPoint, nominalConDepTrackPoint, calcAlgContext); |
| 16204 |
|
| 16205 |
CIndividualProcessNode* mergedNode = getMergedIndividualNodes(processIndi, locNominalNode, nextDepTrackPoint, calcAlgContext); |
| 16206 |
|
| 16207 |
//propagateIndividualNodeNeighboursNominalConnectionToAncestors(mergedNode, calcAlgContext); |
| 16208 |
} else { |
| 16209 |
// clash |
| 16210 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, processIndi, conDes, depTrackPoint, calcAlgContext); |
| 16211 |
if (nominalConDes) { |
| 16212 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, locNominalNode, nominalConDes, nominalConDepTrackPoint, calcAlgContext); |
| 16213 |
} |
| 16214 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 16215 |
} |
| 16216 |
} |
| 16217 |
} else { |
| 16218 |
// CHECK: clash check may be incomplete? |
| 16219 |
// required for complex query answering (otherwise all nominal concepts must be created upfront) |
| 16220 |
bool clashed = false; |
| 16221 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 16222 |
if (processIndi->getNominalIndividual() && processIndi->getNominalIndividual()->getIndividualID() == indi->getIndividualID()) { |
| 16223 |
clashed = true; |
| 16224 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, processIndi, conDes, depTrackPoint, calcAlgContext); |
| 16225 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, nominalNode, nullptr, nominalNode->getDependencyTrackPoint(), calcAlgContext); |
| 16226 |
} |
| 16227 |
|
| 16228 |
CIndividualMergingHash* indiMergingHash = processIndi->getIndividualMergingHash(false); |
| 16229 |
if (indiMergingHash && indiMergingHash->hasMergedIndividual(indi->getIndividualID())) { |
| 16230 |
clashed = true; |
| 16231 |
const CIndividualMergingHashData& mergingData = indiMergingHash->value(indi->getIndividualID()); |
| 16232 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, processIndi, conDes, depTrackPoint, calcAlgContext); |
| 16233 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, processIndi, nullptr, mergingData.getDependencyTrackPoint(), calcAlgContext); |
| 16234 |
} |
| 16235 |
if (clashed) { |
| 16236 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 16237 |
} |
| 16238 |
|
| 16239 |
|
| 16240 |
CIndividualProcessNode* locNominalNode = getLocalizedIndividual(nominalNode, false, calcAlgContext); |
| 16241 |
CDependencyTrackPoint* nominalConDepTrackPoint = nullptr; |
| 16242 |
if (-indi->getIndividualID() != locNominalNode->getIndividualNodeID()) { |
| 16243 |
nominalConDepTrackPoint = locNominalNode->getIndividualMergingHash(true)->value(indi->getIndividualID()).getDependencyTrackPoint(); |
| 16244 |
} |
| 16245 |
|
| 16246 |
|
| 16247 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 16248 |
CNOMINALDependencyNode* nominalDepNode = createNOMINALDependency(nextDepTrackPoint, processIndi, conDes, depTrackPoint, nominalConDepTrackPoint, calcAlgContext); |
| 16249 |
|
| 16250 |
CDistinctEdge* disEdge = CObjectParameterizingAllocator< CDistinctEdge, CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 16251 |
disEdge->initDistinctEdge(processIndi, locNominalNode, nextDepTrackPoint); |
| 16252 |
|
| 16253 |
processIndi->getDistinctHash(true)->insertDistinctIndividual(locNominalNode->getIndividualNodeID(), disEdge); |
| 16254 |
locNominalNode->getDistinctHash(true)->insertDistinctIndividual(processIndi->getIndividualNodeID(), disEdge); |
| 16255 |
|
| 16256 |
} |
| 16257 |
} |
| 16258 |
|
| 16259 |
|
| 16260 |
|
| 16261 |
|
| 16262 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getCorrectedMergedIntoIndividualNode(CIndividualProcessNode* indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16263 |
while (indi->hasMergedIntoIndividualNodeID()) { |
| 16264 |
cint64 mergedIntoID = indi->getMergedIntoIndividualNodeID(); |
| 16265 |
indi = getUpToDateIndividual(mergedIntoID,calcAlgContext); |
| 16266 |
} |
| 16267 |
return indi; |
| 16268 |
} |
| 16269 |
|
| 16270 |
|
| 16271 |
|
| 16272 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isNominalIndividualNodeAvailable(cint64 indiID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16273 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 16274 |
return indiProcNodeVec->hasData(indiID); |
| 16275 |
} |
| 16276 |
|
| 16277 |
|
| 16278 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getCorrectedNominalIndividualNode(cint64 indiID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16279 |
CIndividualProcessNode* indi = getUpToDateIndividual(indiID,calcAlgContext); |
| 16280 |
if (indi) { |
| 16281 |
while (indi->hasMergedIntoIndividualNodeID()) { |
| 16282 |
STATINC(INDINODENOMINALCORRECTIDCOUNT,calcAlgContext); |
| 16283 |
cint64 mergedIntoID = indi->getMergedIntoIndividualNodeID(); |
| 16284 |
indi = getUpToDateIndividual(mergedIntoID,calcAlgContext); |
| 16285 |
// TODO: path compression? -> update merged into IDs |
| 16286 |
} |
| 16287 |
} else { |
| 16288 |
// throw error |
| 16289 |
throw CCalculationErrorProcessingException::getNominalMissingErrorException(); |
| 16290 |
} |
| 16291 |
return indi; |
| 16292 |
} |
| 16293 |
|
| 16294 |
|
| 16295 |
|
| 16296 |
|
| 16297 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyALLRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16298 |
STATINC(ALLRULEAPPLICATIONCOUNT,calcAlgContext); |
| 16299 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 16300 |
CConcept* concept = conDes->getConcept(); |
| 16301 |
CRole* role = concept->getRole(); |
| 16302 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 16303 |
CSortedNegLinker<CConcept*>* conceptOpLinker = concept->getOperandList(); |
| 16304 |
|
| 16305 |
|
| 16306 |
CIndividualLinkEdge* restLink = getLinkProcessingRestriction(conProDes); |
| 16307 |
if (restLink) { |
| 16308 |
++mAppliedALLRuleCount; |
| 16309 |
STATINC(ALLROLERESTRICTIONCOUNT,calcAlgContext); |
| 16310 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,restLink,calcAlgContext); |
| 16311 |
if (!isRestrictedTopObjectPropertyPropagation(processIndi, succIndi, concept, negate, calcAlgContext)) { |
| 16312 |
|
| 16313 |
CIndividualProcessNode* locSuccIndi = nullptr; |
| 16314 |
CReapplyConceptLabelSet* conLabelSet = succIndi->getReapplyConceptLabelSet(false); |
| 16315 |
|
| 16316 |
// create dependency |
| 16317 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 16318 |
CALLDependencyNode* allDepNode = nullptr; |
| 16319 |
bool allDepNodeCreated = false; |
| 16320 |
|
| 16321 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = conceptOpLinker; |
| 16322 |
while (conceptOpLinkerIt) { |
| 16323 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 16324 |
bool opConNeg = conceptOpLinkerIt->isNegated() ^ negate; |
| 16325 |
if (!conLabelSet->hasConcept(opConcept,opConNeg)) { |
| 16326 |
// add concept |
| 16327 |
if (!allDepNodeCreated) { |
| 16328 |
allDepNodeCreated = true; |
| 16329 |
allDepNode = createALLDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,restLink->getDependencyTrackPoint(),calcAlgContext); |
| 16330 |
} |
| 16331 |
if (!locSuccIndi) { |
| 16332 |
locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 16333 |
conLabelSet = locSuccIndi->getReapplyConceptLabelSet(true); |
| 16334 |
} |
| 16335 |
addConceptToIndividual(opConcept,opConNeg,locSuccIndi,nextDepTrackPoint,true,true,calcAlgContext); |
| 16336 |
} |
| 16337 |
conceptOpLinkerIt = conceptOpLinkerIt->getNext(); |
| 16338 |
} |
| 16339 |
if (locSuccIndi) { |
| 16340 |
addIndividualToProcessingQueue(locSuccIndi,calcAlgContext); |
| 16341 |
} |
| 16342 |
} |
| 16343 |
} else { |
| 16344 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 16345 |
if (roleSuccHash) { |
| 16346 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role); |
| 16347 |
while (roleSuccIt.hasNext()) { |
| 16348 |
++mAppliedALLRuleCount; |
| 16349 |
STATINC(ALLROLERESTRICTIONCOUNT,calcAlgContext); |
| 16350 |
CIndividualLinkEdge* link = roleSuccIt.next(true); |
| 16351 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 16352 |
if (!isRestrictedTopObjectPropertyPropagation(processIndi, succIndi, concept, negate, calcAlgContext)) { |
| 16353 |
CIndividualProcessNode* locSuccIndi = nullptr; |
| 16354 |
CReapplyConceptLabelSet* conLabelSet = succIndi->getReapplyConceptLabelSet(false); |
| 16355 |
|
| 16356 |
// create dependency |
| 16357 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 16358 |
CALLDependencyNode* allDepNode = nullptr; |
| 16359 |
bool allDepNodeCreated = false; |
| 16360 |
|
| 16361 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = conceptOpLinker; |
| 16362 |
while (conceptOpLinkerIt) { |
| 16363 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 16364 |
bool opConNeg = conceptOpLinkerIt->isNegated() ^ negate; |
| 16365 |
if (!conLabelSet->hasConcept(opConcept,opConNeg)) { |
| 16366 |
// add concept |
| 16367 |
if (!allDepNodeCreated) { |
| 16368 |
allDepNodeCreated = true; |
| 16369 |
allDepNode = createALLDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,link->getDependencyTrackPoint(),calcAlgContext); |
| 16370 |
} |
| 16371 |
if (!locSuccIndi) { |
| 16372 |
locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 16373 |
conLabelSet = locSuccIndi->getReapplyConceptLabelSet(true); |
| 16374 |
} |
| 16375 |
addConceptToIndividual(opConcept,opConNeg,locSuccIndi,nextDepTrackPoint,true,true,calcAlgContext); |
| 16376 |
} |
| 16377 |
conceptOpLinkerIt = conceptOpLinkerIt->getNext(); |
| 16378 |
} |
| 16379 |
if (locSuccIndi) { |
| 16380 |
addIndividualToProcessingQueue(locSuccIndi,calcAlgContext); |
| 16381 |
} |
| 16382 |
} |
| 16383 |
} |
| 16384 |
} |
| 16385 |
} |
| 16386 |
if (!conProDes->isConceptReapplied()) { |
| 16387 |
addConceptToReapplyQueue(conDes,role,processIndi,true,depTrackPoint,calcAlgContext); |
| 16388 |
} |
| 16389 |
} |
| 16390 |
|
| 16391 |
|
| 16392 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::initializeORProcessing(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CBranchingORProcessingRestrictionSpecification** plannedBranchingProcessRestriction, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16393 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 16394 |
CConcept* concept = conDes->getConcept(); |
| 16395 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 16396 |
|
| 16397 |
CConceptProcessPriority disjunctionDefaultPriority = calcAlgContext->getUsedConceptPriorityStrategy()->getPriorityForConcept(conDes, processIndi); |
| 16398 |
|
| 16399 |
|
| 16400 |
if (conProDes->getProcessPriority().getPriority() >= mDeterministicProcessPriority && conProDes->getProcessPriority().getPriority() >= disjunctionDefaultPriority.getPriority()) { |
| 16401 |
CConceptProcessData* conProData = (CConceptProcessData*)concept->getConceptData(); |
| 16402 |
if (conProData) { |
| 16403 |
CConcept* impConcept = nullptr; |
| 16404 |
CReplacementData* repData = conProData->getReplacementData(); |
| 16405 |
CXNegLinker<CConcept*>* commDisConLinker = nullptr; |
| 16406 |
if (repData) { |
| 16407 |
impConcept = repData->getImplicationReplacementConcept(); |
| 16408 |
commDisConLinker = repData->getCommonDisjunctConceptLinker(); |
| 16409 |
} |
| 16410 |
if (commDisConLinker) { |
| 16411 |
addConceptsToIndividual(commDisConLinker,false,processIndi,depTrackPoint,true,false,nullptr,calcAlgContext); |
| 16412 |
} |
| 16413 |
if (impConcept) { |
| 16414 |
STATINC(ORREPLACEMENTIMPLICATIONCOUNT,calcAlgContext); |
| 16415 |
addConceptToIndividual(impConcept,false,processIndi,depTrackPoint,true,false,calcAlgContext); |
| 16416 |
return true; |
| 16417 |
} |
| 16418 |
} |
| 16419 |
|
| 16420 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 16421 |
double priorityOffset = calcAlgContext->getUsedConceptPriorityStrategy()->getPriorityOffsetForDisjunctionDelayedConsidering(conDes,processIndi); |
| 16422 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,conProQueue,processIndi,true,nullptr,priorityOffset,calcAlgContext); |
| 16423 |
return true; |
| 16424 |
} |
| 16425 |
return false; |
| 16426 |
} |
| 16427 |
|
| 16428 |
|
| 16429 |
|
| 16430 |
|
| 16431 |
|
| 16432 |
|
| 16433 |
|
| 16434 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasSaturatedClashedFlagForConcept(CConcept* concept, bool negation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16435 |
CConceptData* conceptData = concept->getConceptData(); |
| 16436 |
CIndividualSaturationProcessNode* saturationIndiNode = nullptr; |
| 16437 |
if (conceptData) { |
| 16438 |
CConceptProcessData* conProcData = (CConceptProcessData*)conceptData; |
| 16439 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 16440 |
if (conRefLinking) { |
| 16441 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 16442 |
CSaturationConceptReferenceLinking* satCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(negation); |
| 16443 |
if (satCalcRefLinkData) { |
| 16444 |
saturationIndiNode = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 16445 |
} |
| 16446 |
} |
| 16447 |
} |
| 16448 |
|
| 16449 |
if (saturationIndiNode) { |
| 16450 |
if (saturationIndiNode->getIndirectStatusFlags()->hasClashedFlag()) { |
| 16451 |
return true; |
| 16452 |
} |
| 16453 |
} |
| 16454 |
return false; |
| 16455 |
} |
| 16456 |
|
| 16457 |
|
| 16458 |
|
| 16459 |
|
| 16460 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::getAdditionalDisjunctCheckingConcept(CConcept* opConcept, bool opConNegation, CConcept** checkingConcept, bool* checkingNegation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16461 |
if (opConcept->getOperatorCode() == CCAQCHOOCE) { |
| 16462 |
cint64 replaceCount = 0; |
| 16463 |
CConcept* replaceCheckingConcept = nullptr; |
| 16464 |
CSortedNegLinker<CConcept*>* opConceptOpLinkerIt = opConcept->getOperandList(); |
| 16465 |
while (opConceptOpLinkerIt) { |
| 16466 |
CConcept* opOpConcept = opConceptOpLinkerIt->getData(); |
| 16467 |
bool opOpNegation = opConceptOpLinkerIt->isNegated(); |
| 16468 |
if (opOpNegation == opConNegation) { |
| 16469 |
replaceCheckingConcept = opOpConcept; |
| 16470 |
replaceCount++; |
| 16471 |
} |
| 16472 |
opConceptOpLinkerIt = opConceptOpLinkerIt->getNext(); |
| 16473 |
} |
| 16474 |
|
| 16475 |
if (replaceCount == 1 && replaceCheckingConcept) { |
| 16476 |
if (checkingNegation) { |
| 16477 |
*checkingNegation = false; |
| 16478 |
} |
| 16479 |
if (checkingConcept) { |
| 16480 |
*checkingConcept = replaceCheckingConcept; |
| 16481 |
} |
| 16482 |
return true; |
| 16483 |
} |
| 16484 |
} |
| 16485 |
return false; |
| 16486 |
} |
| 16487 |
|
| 16488 |
|
| 16489 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::planORProcessing(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CBranchingORProcessingRestrictionSpecification** plannedBranchingProcessRestriction, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16490 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 16491 |
CConcept* concept = conDes->getConcept(); |
| 16492 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 16493 |
CProcessingRestrictionSpecification* procRest = conProDes->getProcessingRestrictionSpecification(); |
| 16494 |
|
| 16495 |
|
| 16496 |
if (initializeORProcessing(processIndi,conProDes,negate,plannedBranchingProcessRestriction,calcAlgContext)) { |
| 16497 |
return true; |
| 16498 |
} |
| 16499 |
|
| 16500 |
// plan OR processing |
| 16501 |
if (!procRest) { |
| 16502 |
STATINC(OREXECUTIONINITCOUNT,calcAlgContext); |
| 16503 |
// concept is processed first time |
| 16504 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 16505 |
|
| 16506 |
CSortedNegLinker<CConcept*>* firstNotPosAndNegContainedOperand = nullptr; |
| 16507 |
CSortedNegLinker<CConcept*>* secondNotPosAndNegContainedOperand = nullptr; |
| 16508 |
CSortedNegLinker<CConcept*>* containedOperand = nullptr; |
| 16509 |
CDisjunctBranchingStatistics* firstNotPosAndNegContainedOperandBranchStats = nullptr; |
| 16510 |
CDisjunctBranchingStatistics* secondNotPosAndNegContainedOperandBranchStats = nullptr; |
| 16511 |
|
| 16512 |
CClashedDependencyDescriptor* clashConDesLinker = nullptr; |
| 16513 |
|
| 16514 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 16515 |
CDisjunctBranchingStatistics* disjunctBranchStats = nullptr; |
| 16516 |
CConceptProcessData* conProcData = (CConceptProcessData*)concept->getConceptData(); |
| 16517 |
if (conProcData) { |
| 16518 |
CDisjunctionBranchingStatistics* disjunctionBranchStats = (CDisjunctionBranchingStatistics*)conProcData->getBranchingStatistics(); |
| 16519 |
if (disjunctionBranchStats) { |
| 16520 |
disjunctBranchStats = disjunctionBranchStats->getDisjunctBranchingStatistics(); |
| 16521 |
} |
| 16522 |
} |
| 16523 |
while (opLinker && !containedOperand) { |
| 16524 |
CConcept* opConcept = opLinker->getData(); |
| 16525 |
bool opConNegation = opLinker->isNegated() ^ negate; |
| 16526 |
bool containsNegation = false; |
| 16527 |
|
| 16528 |
bool opCheckingNegation = opConNegation; |
| 16529 |
CConcept* opCheckingConcept = opConcept; |
| 16530 |
|
| 16531 |
CConceptDescriptor* containedConDes = nullptr; |
| 16532 |
CDependencyTrackPoint* containedConDepTrackPoint = nullptr; |
| 16533 |
bool contains = conSet->getConceptDescriptor(opCheckingConcept,containedConDes,containedConDepTrackPoint); |
| 16534 |
if (!contains && getAdditionalDisjunctCheckingConcept(opCheckingConcept, opCheckingNegation, &opCheckingConcept, &opCheckingNegation, calcAlgContext)) { |
| 16535 |
contains = conSet->getConceptDescriptor(opCheckingConcept, containedConDes, containedConDepTrackPoint); |
| 16536 |
} |
| 16537 |
if (!contains) { |
| 16538 |
if (!hasSaturatedClashedFlagForConcept(opCheckingConcept, opCheckingNegation,calcAlgContext)) { |
| 16539 |
if (!firstNotPosAndNegContainedOperand) { |
| 16540 |
firstNotPosAndNegContainedOperand = opLinker; |
| 16541 |
firstNotPosAndNegContainedOperandBranchStats = disjunctBranchStats; |
| 16542 |
} else if (!secondNotPosAndNegContainedOperand) { |
| 16543 |
secondNotPosAndNegContainedOperand = opLinker; |
| 16544 |
secondNotPosAndNegContainedOperandBranchStats = disjunctBranchStats; |
| 16545 |
} |
| 16546 |
} |
| 16547 |
} else { |
| 16548 |
containsNegation = containedConDes->isNegated(); |
| 16549 |
if (containsNegation == opCheckingNegation) { |
| 16550 |
containedOperand = opLinker; |
| 16551 |
} else { |
| 16552 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,containedConDes,containedConDepTrackPoint,calcAlgContext); |
| 16553 |
} |
| 16554 |
} |
| 16555 |
opLinker = opLinker->getNext(); |
| 16556 |
if (disjunctBranchStats) { |
| 16557 |
disjunctBranchStats = disjunctBranchStats->getNext(); |
| 16558 |
} |
| 16559 |
} |
| 16560 |
|
| 16561 |
|
| 16562 |
if (containedOperand || !secondNotPosAndNegContainedOperand) { |
| 16563 |
STATINC(ORINSTANTCONTAINSEXECUTEDCOUNT,calcAlgContext); |
| 16564 |
// only one branch is applicable, execute OR rule |
| 16565 |
if (plannedBranchingProcessRestriction) { |
| 16566 |
CBranchingORProcessingRestrictionSpecification* branchORProcRest = CObjectAllocator< CBranchingORProcessingRestrictionSpecification >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 16567 |
branchORProcRest->initBranchingORProcessingRestriction(); |
| 16568 |
branchORProcRest->setContainedOperand(containedOperand); |
| 16569 |
branchORProcRest->setFirstNotPosAndNegContainedOperand(firstNotPosAndNegContainedOperand); |
| 16570 |
branchORProcRest->setSecondNotPosAndNegContainedOperand(secondNotPosAndNegContainedOperand); |
| 16571 |
branchORProcRest->setFirstNotPosAndNegContainedOperandBranchingStatistics(firstNotPosAndNegContainedOperandBranchStats); |
| 16572 |
branchORProcRest->setSecondNotPosAndNegContainedOperandBranchingStatistics(secondNotPosAndNegContainedOperandBranchStats); |
| 16573 |
branchORProcRest->addClashedConceptDescriptors(clashConDesLinker); |
| 16574 |
*plannedBranchingProcessRestriction = branchORProcRest; |
| 16575 |
} |
| 16576 |
return false; |
| 16577 |
} else { |
| 16578 |
// try to trigger branching |
| 16579 |
|
| 16580 |
CConceptProcessData* conProcessData = (CConceptProcessData*)concept->getConceptData(); |
| 16581 |
CConceptRoleBranchingTrigger* conRoleBranchTriggerLinkerIt = nullptr; |
| 16582 |
CConceptRoleBranchingTrigger* nextConRoleBranchTriggerLinkerIt = nullptr; |
| 16583 |
CBranchingORProcessingRestrictionSpecification* branchORProcRest = CObjectAllocator< CBranchingORProcessingRestrictionSpecification >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 16584 |
branchORProcRest->initBranchingORProcessingRestriction(); |
| 16585 |
branchORProcRest->setFirstNotPosAndNegContainedOperand(firstNotPosAndNegContainedOperand); |
| 16586 |
branchORProcRest->setSecondNotPosAndNegContainedOperand(secondNotPosAndNegContainedOperand); |
| 16587 |
branchORProcRest->setFirstNotPosAndNegContainedOperandBranchingStatistics(firstNotPosAndNegContainedOperandBranchStats); |
| 16588 |
branchORProcRest->setSecondNotPosAndNegContainedOperandBranchingStatistics(secondNotPosAndNegContainedOperandBranchStats); |
| 16589 |
branchORProcRest->addClashedConceptDescriptors(clashConDesLinker); |
| 16590 |
if (conProcessData) { |
| 16591 |
if (mConfBranchTriggering) { |
| 16592 |
conRoleBranchTriggerLinkerIt = conProcessData->getConceptRoleBranchTrigger(); |
| 16593 |
} |
| 16594 |
} |
| 16595 |
if (conRoleBranchTriggerLinkerIt) { |
| 16596 |
// search trigger |
| 16597 |
STATINC(ORTRIGGERSEARCHCOUNT,calcAlgContext); |
| 16598 |
conRoleBranchTriggerLinkerIt = searchNextConceptRoleBranchTrigger(processIndi,conRoleBranchTriggerLinkerIt,calcAlgContext); |
| 16599 |
} |
| 16600 |
if (conRoleBranchTriggerLinkerIt) { |
| 16601 |
// install trigger |
| 16602 |
STATINC(ORTRIGGEREDDELAYEDEXECUTEDCOUNT,calcAlgContext); |
| 16603 |
nextConRoleBranchTriggerLinkerIt = conRoleBranchTriggerLinkerIt->getNextBranchingTrigger(); |
| 16604 |
branchORProcRest->setConceptRoleBranchingTrigger(nextConRoleBranchTriggerLinkerIt); |
| 16605 |
installConceptRoleBranchTrigger(processIndi,conDes,depTrackPoint,branchORProcRest,conRoleBranchTriggerLinkerIt,calcAlgContext); |
| 16606 |
return true; |
| 16607 |
} else { |
| 16608 |
// branch triggering is not anymore possible, determine priority for this OR branch |
| 16609 |
// determine additional OR priority offset |
| 16610 |
STATINC(ORQUEUEDDELAYEDEXECUTEDCOUNT,calcAlgContext); |
| 16611 |
double priorityOffset = calcAlgContext->getUsedConceptPriorityStrategy()->getPriorityOffsetForDisjunctionDelayedProcessing(conDes,processIndi); |
| 16612 |
branchORProcRest->setPriorityOffset(priorityOffset); |
| 16613 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 16614 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,conProQueue,processIndi,true,branchORProcRest,priorityOffset,calcAlgContext); |
| 16615 |
return true; |
| 16616 |
} |
| 16617 |
} |
| 16618 |
|
| 16619 |
} else { |
| 16620 |
STATINC(OREXECUTIONCONTINUECOUNT,calcAlgContext); |
| 16621 |
// OR branching concept has already been considered before |
| 16622 |
// try triggering again |
| 16623 |
CBranchingORProcessingRestrictionSpecification* branchORProcRest = (CBranchingORProcessingRestrictionSpecification*)procRest; |
| 16624 |
if (branchORProcRest->getContainedOperand() || !branchORProcRest->getSecondNotPosAndNegContainedOperand()) { |
| 16625 |
*plannedBranchingProcessRestriction = branchORProcRest; |
| 16626 |
return false; |
| 16627 |
} |
| 16628 |
CConceptRoleBranchingTrigger* conRoleBranchTriggerLinkerIt = branchORProcRest->getConceptRoleBranchingTrigger(); |
| 16629 |
CConceptRoleBranchingTrigger* nextConRoleBranchTriggerLinkerIt = nullptr; |
| 16630 |
if (!conRoleBranchTriggerLinkerIt) { |
| 16631 |
// OR branch was not triggered, execute OR rule |
| 16632 |
if (plannedBranchingProcessRestriction) { |
| 16633 |
*plannedBranchingProcessRestriction = branchORProcRest; |
| 16634 |
} |
| 16635 |
return false; |
| 16636 |
} else { |
| 16637 |
// search trigger |
| 16638 |
STATINC(ORTRIGGERSEARCHCOUNT,calcAlgContext); |
| 16639 |
conRoleBranchTriggerLinkerIt = searchNextConceptRoleBranchTrigger(processIndi,conRoleBranchTriggerLinkerIt,calcAlgContext); |
| 16640 |
} |
| 16641 |
CBranchingORProcessingRestrictionSpecification* nextBranchORProcRest = CObjectAllocator< CBranchingORProcessingRestrictionSpecification >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 16642 |
nextBranchORProcRest->initBranchingORProcessingRestriction(branchORProcRest); |
| 16643 |
if (conRoleBranchTriggerLinkerIt) { |
| 16644 |
// install trigger |
| 16645 |
STATINC(ORTRIGGEREDDELAYEDEXECUTEDCOUNT,calcAlgContext); |
| 16646 |
nextConRoleBranchTriggerLinkerIt = conRoleBranchTriggerLinkerIt->getNextBranchingTrigger(); |
| 16647 |
nextBranchORProcRest->setConceptRoleBranchingTrigger(nextConRoleBranchTriggerLinkerIt); |
| 16648 |
installConceptRoleBranchTrigger(processIndi,conDes,depTrackPoint,nextBranchORProcRest,conRoleBranchTriggerLinkerIt,calcAlgContext); |
| 16649 |
return true; |
| 16650 |
} else { |
| 16651 |
STATINC(ORQUEUEDDELAYEDEXECUTEDCOUNT,calcAlgContext); |
| 16652 |
double priorityOffset = calcAlgContext->getUsedConceptPriorityStrategy()->getPriorityOffsetForDisjunctionDelayedProcessing(conDes,processIndi); |
| 16653 |
nextBranchORProcRest->setPriorityOffset(priorityOffset); |
| 16654 |
nextBranchORProcRest->setConceptRoleBranchingTrigger(nullptr); |
| 16655 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 16656 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,conProQueue,processIndi,true,nextBranchORProcRest,priorityOffset,calcAlgContext); |
| 16657 |
return true; |
| 16658 |
} |
| 16659 |
} |
| 16660 |
} |
| 16661 |
|
| 16662 |
|
| 16663 |
|
| 16664 |
|
| 16665 |
CNonDeterministicDependencyTrackPoint* CCalculationTableauCompletionTaskHandleAlgorithm::createNonDeterministicDependencyTrackPointBranch(CNonDeterministicDependencyNode* dependencyNode, bool singleBranch, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16666 |
CNonDeterministicDependencyTrackPoint* nonDepTrackPoint = nullptr; |
| 16667 |
if (mConfBuildDependencies && dependencyNode) { |
| 16668 |
if (singleBranch || mConfBuildAllBranchingNodes) { |
| 16669 |
CBranchTreeNode* branchNode = calcAlgContext->getNewBranchTreeNode(); |
| 16670 |
nonDepTrackPoint = dependencyNode->getDependencyTrackPointBranch(); |
| 16671 |
branchNode->branchingIncrement(nonDepTrackPoint); |
| 16672 |
nonDepTrackPoint->initBranch(branchNode); |
| 16673 |
} else { |
| 16674 |
CBranchTreeNode* branchNode = calcAlgContext->getUsedBranchTreeNode(); |
| 16675 |
nonDepTrackPoint = dependencyNode->getDependencyTrackPointBranch(); |
| 16676 |
branchNode->branchingIncrement(nonDepTrackPoint); |
| 16677 |
nonDepTrackPoint->initBranch(branchNode); |
| 16678 |
} |
| 16679 |
} |
| 16680 |
return nonDepTrackPoint; |
| 16681 |
} |
| 16682 |
|
| 16683 |
|
| 16684 |
|
| 16685 |
|
| 16686 |
CClashedDependencyDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createIndividualMergeCausingDescriptors(CClashedDependencyDescriptor* prevClashes, CIndividualProcessNode*& processIndi, CIndividualLinkEdge* link, CSortedNegLinker<CConcept*>* conceptAddLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16687 |
CClashedDependencyDescriptor* clashDes = prevClashes; |
| 16688 |
|
| 16689 |
if (link->getDependencyTrackPoint() != processIndi->getDependencyTrackPoint()) { |
| 16690 |
clashDes = createClashedIndividualLinkDescriptor(clashDes,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 16691 |
} |
| 16692 |
|
| 16693 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 16694 |
|
| 16695 |
CSortedNegLinker<CConcept*>* conceptAddLinkerIt = conceptAddLinker; |
| 16696 |
while (conceptAddLinkerIt) { |
| 16697 |
CConcept* concept = conceptAddLinkerIt->getData(); |
| 16698 |
bool conNegation = conceptAddLinkerIt->isNegated(); |
| 16699 |
|
| 16700 |
CConceptDescriptor* containedConDes = nullptr; |
| 16701 |
CDependencyTrackPoint* containedDepTrackPoint = nullptr; |
| 16702 |
conSet->getConceptDescriptor(concept,containedConDes,containedDepTrackPoint); |
| 16703 |
|
| 16704 |
clashDes = createClashedConceptDescriptor(clashDes,processIndi,containedConDes,containedDepTrackPoint,calcAlgContext); |
| 16705 |
|
| 16706 |
conceptAddLinkerIt = conceptAddLinkerIt->getNext(); |
| 16707 |
} |
| 16708 |
return clashDes; |
| 16709 |
} |
| 16710 |
|
| 16711 |
|
| 16712 |
|
| 16713 |
CClashedDependencyDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createClashedConceptDescriptor(CClashedDependencyDescriptor* prevClashes, CIndividualProcessNode*& processIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16714 |
CClashedDependencyDescriptor* clashDes = calcAlgContext->getClashDescriptorFactory()->createClashedConceptDescriptor(prevClashes,processIndi,conDes,prevDepTrackPoint,calcAlgContext); |
| 16715 |
return clashDes; |
| 16716 |
} |
| 16717 |
|
| 16718 |
CClashedDependencyDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createClashedIndividualLinkDescriptor(CClashedDependencyDescriptor* prevClashes, CIndividualLinkEdge* link, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16719 |
CClashedDependencyDescriptor* clashDes = calcAlgContext->getClashDescriptorFactory()->createClashedIndividualLinkDescriptor(prevClashes,link,prevDepTrackPoint,calcAlgContext); |
| 16720 |
return clashDes; |
| 16721 |
} |
| 16722 |
|
| 16723 |
CClashedDependencyDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createClashedIndividualDistinctDescriptor(CClashedDependencyDescriptor* prevClashes, CDistinctEdge* distinct, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16724 |
CClashedDependencyDescriptor* clashDes = calcAlgContext->getClashDescriptorFactory()->createClashedIndividualDistinctDescriptor(prevClashes,distinct,prevDepTrackPoint,calcAlgContext); |
| 16725 |
return clashDes; |
| 16726 |
} |
| 16727 |
|
| 16728 |
CClashedDependencyDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createClashedNegationDisjointDescriptor(CClashedDependencyDescriptor* prevClashes, CNegationDisjointEdge* disjointNegLink, CDependencyTrackPoint* prevDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16729 |
CClashedDependencyDescriptor* clashDes = calcAlgContext->getClashDescriptorFactory()->createClashedNegationDisjointDescriptor(prevClashes,disjointNegLink,prevDepTrackPoint,calcAlgContext); |
| 16730 |
return clashDes; |
| 16731 |
} |
| 16732 |
|
| 16733 |
|
| 16734 |
|
| 16735 |
|
| 16736 |
|
| 16737 |
void CCalculationTableauCompletionTaskHandleAlgorithm::executeORBranching(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CBranchingORProcessingRestrictionSpecification* plannedBranchingProcessRestriction, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 16738 |
++mAppliedORRuleCount; |
| 16739 |
STATINC(OREXECUTIONCOUNT,calcAlgContext); |
| 16740 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 16741 |
CConcept* concept = conDes->getConcept(); |
| 16742 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 16743 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 16744 |
|
| 16745 |
CSortedNegLinker<CConcept*>* containedOperand = nullptr; |
| 16746 |
CSortedNegLinker<CConcept*>* firstNotPosAndNegContainedOperand = nullptr; |
| 16747 |
CSortedNegLinker<CConcept*>* secondNotPosAndNegContainedOperand = nullptr; |
| 16748 |
CDisjunctBranchingStatistics* firstNotPosAndNegContainedOperandBranchStats = nullptr; |
| 16749 |
CDisjunctBranchingStatistics* secondNotPosAndNegContainedOperandBranchStats = nullptr; |
| 16750 |
|
| 16751 |
CPROCESSINGLIST< CSortedNegLinker<CConcept*>* > notContainedOperandsList(calcAlgContext->getUsedTaskProcessorContext()); |
| 16752 |
CPROCESSINGLIST< CDisjunctBranchingStatistics* > notContainedBranchingStatsList(calcAlgContext->getUsedTaskProcessorContext()); |
| 16753 |
|
| 16754 |
cint64 notPosAndNegContainedOperandCount = 0; |
| 16755 |
if (plannedBranchingProcessRestriction) { |
| 16756 |
containedOperand = plannedBranchingProcessRestriction->getContainedOperand(); |
| 16757 |
firstNotPosAndNegContainedOperand = plannedBranchingProcessRestriction->getFirstNotPosAndNegContainedOperand(); |
| 16758 |
secondNotPosAndNegContainedOperand = plannedBranchingProcessRestriction->getSecondNotPosAndNegContainedOperand(); |
| 16759 |
firstNotPosAndNegContainedOperandBranchStats = plannedBranchingProcessRestriction->getFirstNotPosAndNegContainedOperandBranchingStatistics(); |
| 16760 |
secondNotPosAndNegContainedOperandBranchStats = plannedBranchingProcessRestriction->getSecondNotPosAndNegContainedOperandBranchingStatistics(); |
| 16761 |
} |
| 16762 |
|
| 16763 |
CClashedDependencyDescriptor* clashConDesLinker = plannedBranchingProcessRestriction->getClashedConceptDescriptors(); |
| 16764 |
|
| 16765 |
if (!containedOperand) { |
| 16766 |
// check if one operand is already in the concept set |
| 16767 |
if (firstNotPosAndNegContainedOperand) { |
| 16768 |
bool containsNegation = false; |
| 16769 |
bool correctNegation = firstNotPosAndNegContainedOperand->isNegated() ^ negate; |
| 16770 |
CConceptDescriptor* containedConDes = nullptr; |
| 16771 |
CDependencyTrackPoint* containedConDepTrackPoint = nullptr; |
| 16772 |
bool opCheckingNegation = correctNegation; |
| 16773 |
CConcept* checkingConcept = firstNotPosAndNegContainedOperand->getData(); |
| 16774 |
bool contains = conSet->getConceptDescriptor(checkingConcept,containedConDes,containedConDepTrackPoint); |
| 16775 |
if (!contains && getAdditionalDisjunctCheckingConcept(checkingConcept, opCheckingNegation, &checkingConcept, &opCheckingNegation, calcAlgContext)) { |
| 16776 |
contains = conSet->getConceptDescriptor(checkingConcept, containedConDes, containedConDepTrackPoint); |
| 16777 |
} |
| 16778 |
if (contains) { |
| 16779 |
containsNegation = containedConDes->isNegated(); |
| 16780 |
if (containsNegation == opCheckingNegation) { |
| 16781 |
containedOperand = firstNotPosAndNegContainedOperand; |
| 16782 |
// update first/second not contained operands |
| 16783 |
firstNotPosAndNegContainedOperand = secondNotPosAndNegContainedOperand; |
| 16784 |
firstNotPosAndNegContainedOperandBranchStats = secondNotPosAndNegContainedOperandBranchStats; |
| 16785 |
} else { |
| 16786 |
firstNotPosAndNegContainedOperand = nullptr; |
| 16787 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,containedConDes,containedConDepTrackPoint,calcAlgContext); |
| 16788 |
} |
| 16789 |
} else { |
| 16790 |
++notPosAndNegContainedOperandCount; |
| 16791 |
notContainedOperandsList.append(firstNotPosAndNegContainedOperand); |
| 16792 |
notContainedBranchingStatsList.append(firstNotPosAndNegContainedOperandBranchStats); |
| 16793 |
} |
| 16794 |
if (!containedOperand && secondNotPosAndNegContainedOperand) { |
| 16795 |
bool remainingDisjunctsUseless = false; |
| 16796 |
CSortedNegLinker<CConcept*>* containsOperandCheckIt = secondNotPosAndNegContainedOperand; |
| 16797 |
CDisjunctBranchingStatistics* disjunctBranchStatsCheckIt = secondNotPosAndNegContainedOperandBranchStats; |
| 16798 |
secondNotPosAndNegContainedOperand = nullptr; |
| 16799 |
while (containsOperandCheckIt) { |
| 16800 |
bool containsNegation = false; |
| 16801 |
bool correctNegation = containsOperandCheckIt->isNegated() ^ negate; |
| 16802 |
CConceptDescriptor* containedConDes = nullptr; |
| 16803 |
CDependencyTrackPoint* containedConDepTrackPoint = nullptr; |
| 16804 |
bool opCheckingNegation = correctNegation; |
| 16805 |
CConcept* checkingConcept = containsOperandCheckIt->getData(); |
| 16806 |
bool contains = conSet->getConceptDescriptor(checkingConcept, containedConDes, containedConDepTrackPoint); |
| 16807 |
if (!contains && getAdditionalDisjunctCheckingConcept(checkingConcept, opCheckingNegation, &checkingConcept, &opCheckingNegation, calcAlgContext)) { |
| 16808 |
contains = conSet->getConceptDescriptor(checkingConcept, containedConDes, containedConDepTrackPoint); |
| 16809 |
} |
| 16810 |
if (contains) { |
| 16811 |
containsNegation = containedConDes->isNegated(); |
| 16812 |
if (containsNegation == opCheckingNegation) { |
| 16813 |
containedOperand = containsOperandCheckIt; |
| 16814 |
break; |
| 16815 |
} else { |
| 16816 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,containedConDes,containedConDepTrackPoint,calcAlgContext); |
| 16817 |
} |
| 16818 |
} else { |
| 16819 |
if (!hasSaturatedClashedFlagForConcept(checkingConcept, opCheckingNegation,calcAlgContext)) { |
| 16820 |
bool criticalWithOtherOperand = false; |
| 16821 |
if (remainingDisjunctsUseless) { |
| 16822 |
criticalWithOtherOperand = true; |
| 16823 |
} |
| 16824 |
for (CPROCESSINGLIST< CSortedNegLinker<CConcept*>* >::const_iterator opIt = notContainedOperandsList.constBegin(), opItEnd = notContainedOperandsList.constEnd(); opIt != opItEnd && !criticalWithOtherOperand; ++opIt) { |
| 16825 |
CSortedNegLinker<CConcept*>* notContOpLinker = *opIt; |
| 16826 |
if (containsOperandCheckIt->getData() == notContOpLinker->getData()) { |
| 16827 |
if (containsOperandCheckIt->isNegated() == notContOpLinker->isNegated()) { |
| 16828 |
criticalWithOtherOperand = true; |
| 16829 |
} else { |
| 16830 |
remainingDisjunctsUseless = true; |
| 16831 |
} |
| 16832 |
} |
| 16833 |
} |
| 16834 |
|
| 16835 |
if (!criticalWithOtherOperand) { |
| 16836 |
++notPosAndNegContainedOperandCount; |
| 16837 |
notContainedOperandsList.append(containsOperandCheckIt); |
| 16838 |
notContainedBranchingStatsList.append(disjunctBranchStatsCheckIt); |
| 16839 |
// update first/second not contained operands |
| 16840 |
if (!firstNotPosAndNegContainedOperand) { |
| 16841 |
firstNotPosAndNegContainedOperand = containsOperandCheckIt; |
| 16842 |
firstNotPosAndNegContainedOperandBranchStats = disjunctBranchStatsCheckIt; |
| 16843 |
} else { |
| 16844 |
if (!secondNotPosAndNegContainedOperand) { |
| 16845 |
secondNotPosAndNegContainedOperand = containsOperandCheckIt; |
| 16846 |
secondNotPosAndNegContainedOperandBranchStats = disjunctBranchStatsCheckIt; |
| 16847 |
} |
| 16848 |
} |
| 16849 |
} |
| 16850 |
} |
| 16851 |
} |
| 16852 |
containsOperandCheckIt = containsOperandCheckIt->getNext(); |
| 16853 |
if (disjunctBranchStatsCheckIt) { |
| 16854 |
disjunctBranchStatsCheckIt = disjunctBranchStatsCheckIt->getNext(); |
| 16855 |
} |
| 16856 |
} |
| 16857 |
} |
| 16858 |
} |
| 16859 |
} |
| 16860 |
|
| 16861 |
|
| 16862 |
if (!containedOperand) { |
| 16863 |
// collect clashes |
| 16864 |
// do branching |
| 16865 |
|
| 16866 |
|
| 16867 |
if (notPosAndNegContainedOperandCount == 1) { |
| 16868 |
STATINC(ORSINGLEBRANCHCOUNT,calcAlgContext); |
| 16869 |
|
| 16870 |
CDependency* dependencies = nullptr; |
| 16871 |
|
| 16872 |
for (CClashedDependencyDescriptor* clashConDesLinkerIt = clashConDesLinker; clashConDesLinkerIt; clashConDesLinkerIt = clashConDesLinkerIt->getNext()) { |
| 16873 |
CClashedConceptDescriptor* clashedConDes = (CClashedConceptDescriptor*)clashConDesLinkerIt; |
| 16874 |
CCONNECTIONDependencyNode* connDep = createCONNECTIONDependency(processIndi, clashedConDes->getConceptDescriptor(), clashConDesLinkerIt->getDependencyTrackPoint(), calcAlgContext); |
| 16875 |
dependencies = connDep->append(dependencies); |
| 16876 |
} |
| 16877 |
|
| 16878 |
CDependencyTrackPoint* newDependencyTrackPoint = nullptr; |
| 16879 |
CORONLYOPTIONDependencyNode* orDependencyNode = createORONLYOPTIONDependency(newDependencyTrackPoint, processIndi, conDes, depTrackPoint, dependencies, calcAlgContext); |
| 16880 |
|
| 16881 |
CPROCESSINGLIST< CSortedNegLinker<CConcept*>* >::const_iterator opIt = notContainedOperandsList.constBegin(); |
| 16882 |
CPROCESSINGLIST< CDisjunctBranchingStatistics* >::const_iterator disjBranchStatIt = notContainedBranchingStatsList.constBegin(); |
| 16883 |
CSortedNegLinker<CConcept*>* operandConcept = *opIt; |
| 16884 |
CDisjunctBranchingStatistics* disjBranchStats = nullptr; |
| 16885 |
if (notContainedOperandsList.count() == notContainedBranchingStatsList.count()) { |
| 16886 |
disjBranchStats = *disjBranchStatIt; |
| 16887 |
} |
| 16888 |
//if (newDependencyTrackPoint) { |
| 16889 |
// newDependencyTrackPoint->setDisjunctConceptLinker(operandConcept); |
| 16890 |
// newDependencyTrackPoint->setDisjunctBranchingStatistics(disjBranchStats); |
| 16891 |
//} |
| 16892 |
bool addOpNegated = operandConcept->isNegated() ^ negate; |
| 16893 |
addConceptToIndividual(operandConcept->getData(), addOpNegated, processIndi, newDependencyTrackPoint, true, false, calcAlgContext); |
| 16894 |
|
| 16895 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForBranchedDisjuncts(conProDes,processIndi,operandConcept)) { |
| 16896 |
testIndividualNodeUnsatisfiableCached(processIndi,calcAlgContext); |
| 16897 |
} |
| 16898 |
|
| 16899 |
|
| 16900 |
} else if (notPosAndNegContainedOperandCount > 1) { |
| 16901 |
STATINC(ORMULTIPLEBRANCHCOUNT,calcAlgContext); |
| 16902 |
|
| 16903 |
if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForDisjunctionBranching(conProDes, processIndi, ¬ContainedOperandsList)) { |
| 16904 |
testIndividualNodeUnsatisfiableCached(processIndi, calcAlgContext); |
| 16905 |
} |
| 16906 |
|
| 16907 |
|
| 16908 |
CORDependencyNode* orDependencyNode = createORDependency(processIndi, conDes, depTrackPoint, calcAlgContext); |
| 16909 |
if (orDependencyNode && clashConDesLinker) { |
| 16910 |
orDependencyNode->addBranchClashes(clashConDesLinker); |
| 16911 |
} |
| 16912 |
|
| 16913 |
|
| 16914 |
CSatisfiableCalculationTask* newTaskList = createDependendBranchingTaskList(notPosAndNegContainedOperandCount,calcAlgContext); |
| 16915 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 16916 |
|
| 16917 |
// semantic branching |
| 16918 |
CPROCESSINGLIST< CSortedNegLinker<CConcept*>* >::const_iterator branchOpConIt = notContainedOperandsList.constBegin(); |
| 16919 |
CPROCESSINGLIST< CDisjunctBranchingStatistics* >::const_iterator disjBranchStatIt = notContainedBranchingStatsList.constBegin(); |
| 16920 |
CSatisfiableCalculationTask* newTaskIt = newTaskList; |
| 16921 |
cint64 branchNumber = 1; |
| 16922 |
while (newTaskIt) { |
| 16923 |
|
| 16924 |
CSatisfiableCalculationTask* newSatCalcTask = newTaskIt; |
| 16925 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 16926 |
|
| 16927 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext,newProcessContext,newSatCalcTask); |
| 16928 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 16929 |
|
| 16930 |
CProcessTagger* newProcessTagger = newCalcAlgContext->getUsedProcessTagger(); |
| 16931 |
newProcessTagger->incBranchingTag(); |
| 16932 |
newProcessTagger->incLocalizationTag(); |
| 16933 |
|
| 16934 |
CSortedNegLinker<CConcept*>* addingConceptLinker = nullptr; |
| 16935 |
//CIndividualProcessNode* newLocIndiNode = getLocalizedIndividual(processIndi,false,newCalcAlgContext); |
| 16936 |
//CConceptProcessingQueue* newConProcQueue = newLocIndiNode->getConceptProcessingQueue(true); |
| 16937 |
|
| 16938 |
CORDisjunctDependencyTrackPoint* newDependencyTrackPoint = (CORDisjunctDependencyTrackPoint*)createNonDeterministicDependencyTrackPointBranch(orDependencyNode,false,newCalcAlgContext); |
| 16939 |
|
| 16940 |
CSortedNegLinker<CConcept*>* branchingOperandConcept = nullptr; |
| 16941 |
CPROCESSINGLIST< CSortedNegLinker<CConcept*>* >::const_iterator opIt = notContainedOperandsList.constBegin(); |
| 16942 |
do { |
| 16943 |
STATINC(TASKORBRANCHCREATIONCOUNT,calcAlgContext); |
| 16944 |
|
| 16945 |
CSortedNegLinker<CConcept*>* operandConcept = *opIt; |
| 16946 |
bool posOperand = (opIt == branchOpConIt); |
| 16947 |
if (posOperand) { |
| 16948 |
branchingOperandConcept = operandConcept; |
| 16949 |
} |
| 16950 |
|
| 16951 |
bool addOpNegated = !posOperand ^ operandConcept->isNegated() ^ negate; |
| 16952 |
|
| 16953 |
if (posOperand || mConfSemanticBranching || mConfAtomicSemanticBranching && isConceptAdditionAtomaric(operandConcept->getData(),addOpNegated,newCalcAlgContext)) { |
| 16954 |
CSortedNegLinker<CConcept*>* tmpAddingConceptLinker = CObjectAllocator< CSortedNegLinker<CConcept*> >::allocateAndConstruct(newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 16955 |
tmpAddingConceptLinker->init(operandConcept->getData(),addOpNegated); |
| 16956 |
addingConceptLinker = tmpAddingConceptLinker->append(addingConceptLinker); |
| 16957 |
//addConceptToIndividual(operandConcept->getData(),addOpNegated,newLocIndiNode,newDependencyTrackPoint,false,true,newCalcAlgContext); |
| 16958 |
} |
| 16959 |
|
| 16960 |
|
| 16961 |
} while (opIt++ != branchOpConIt); |
| 16962 |
++branchOpConIt; |
| 16963 |
|
| 16964 |
CDisjunctBranchingStatistics* disjBranchStats = nullptr; |
| 16965 |
if (notContainedOperandsList.count() == notContainedBranchingStatsList.count()) { |
| 16966 |
disjBranchStats = *disjBranchStatIt; |
| 16967 |
++disjBranchStatIt; |
| 16968 |
} |
| 16969 |
|
| 16970 |
|
| 16971 |
if (newDependencyTrackPoint) { |
| 16972 |
newDependencyTrackPoint->setDisjunctConceptLinker(branchingOperandConcept); |
| 16973 |
newDependencyTrackPoint->setDisjunctBranchingStatistics(disjBranchStats); |
| 16974 |
} |
| 16975 |
|
| 16976 |
//if (calcAlgContext->getUsedUnsatisfiableCacheRetrievalStrategy()->testUnsatisfiableCacheForBranchedDisjuncts(conProDes,processIndi,branchingOperandConcept)) { |
| 16977 |
// addIndividualNodeForCacheUnsatisfiableRetrieval(newLocIndiNode,newCalcAlgContext); |
| 16978 |
//} |
| 16979 |
//prepareBranchedTaskProcessing(newLocIndiNode,newTaskIt,newCalcAlgContext); |
| 16980 |
|
| 16981 |
CBranchingInstructionAddIndividualConcepts* branchingInstruction = CObjectAllocator< CBranchingInstructionAddIndividualConcepts >::allocateAndConstruct(newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 16982 |
branchingInstruction->initAddIndividualConceptsBranchingInstruction(processIndi,addingConceptLinker,newDependencyTrackPoint); |
| 16983 |
newProcessingDataBox->setBranchingInstruction(branchingInstruction); |
| 16984 |
|
| 16985 |
|
| 16986 |
// set new task priority |
| 16987 |
double newTaskPriority = calcAlgContext->getUsedTaskPriorityStrategy()->getPriorityForTaskBranching(newSatCalcTask,calcAlgContext->getUsedSatisfiableCalculationTask(),processIndi,conDes,branchingOperandConcept,branchNumber,disjBranchStats); |
| 16988 |
newSatCalcTask->setTaskPriority(newTaskPriority); |
| 16989 |
|
| 16990 |
++branchNumber; |
| 16991 |
newTaskIt = (CSatisfiableCalculationTask*)newTaskIt->getNext(); |
| 16992 |
} |
| 16993 |
|
| 16994 |
processorContext->getTaskProcessorCommunicator()->communicateTaskCreation(newTaskList); |
| 16995 |
|
| 16996 |
throw CCalculationStopProcessingException(true); |
| 16997 |
} else { |
| 16998 |
// throw clash |
| 16999 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 17000 |
throw CCalculationClashProcessingException(clashConDesLinker); |
| 17001 |
} |
| 17002 |
|
| 17003 |
} else { |
| 17004 |
// contains at least one operand, branching is not necessary, ignoring or concept |
| 17005 |
} |
| 17006 |
} |
| 17007 |
|
| 17008 |
|
| 17009 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isConceptAdditionAtomaric(CConcept* addingConcept, bool negated, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17010 |
cint64 opCode = addingConcept->getOperatorCode(); |
| 17011 |
if (negated && (opCode == CCSUB || opCode == CCIMPLTRIG) || opCode == CCATOM) { |
| 17012 |
return true; |
| 17013 |
} |
| 17014 |
return false; |
| 17015 |
} |
| 17016 |
|
| 17017 |
|
| 17018 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyORRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17019 |
STATINC(ORRULEAPPLICATIONCOUNT,calcAlgContext); |
| 17020 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 17021 |
CConcept* concept = conDes->getConcept(); |
| 17022 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 17023 |
|
| 17024 |
cint64 opCount = concept->getOperandCount(); |
| 17025 |
|
| 17026 |
if (opCount <= 0) { |
| 17027 |
|
| 17028 |
// throw clash |
| 17029 |
CClashedDependencyDescriptor* clashConDesLinker = nullptr; |
| 17030 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 17031 |
throw CCalculationClashProcessingException(clashConDesLinker); |
| 17032 |
|
| 17033 |
} else if (opCount == 1) { |
| 17034 |
// apply AND rule |
| 17035 |
applyANDRule(processIndi,conProDes,negate,calcAlgContext); |
| 17036 |
} else { |
| 17037 |
CBranchingORProcessingRestrictionSpecification* plannedBranchingProcessRestriction = nullptr; |
| 17038 |
if (!planORProcessing(processIndi,conProDes,negate,&plannedBranchingProcessRestriction,calcAlgContext)) { |
| 17039 |
if (mConfSatExpCachedDisjAbsorp && processIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED)) { |
| 17040 |
STATINC(SATCACHEDABSORBEDDISJUNCTIONCONCEPTSCOUNT,calcAlgContext); |
| 17041 |
addSatisfiableCachedAbsorbedDisjunctionConcept(conDes,processIndi,plannedBranchingProcessRestriction,depTrackPoint,calcAlgContext); |
| 17042 |
} else { |
| 17043 |
// delaying failed, execute OR rule |
| 17044 |
executeORBranching(processIndi,conProDes,negate,plannedBranchingProcessRestriction,calcAlgContext); |
| 17045 |
} |
| 17046 |
} |
| 17047 |
} |
| 17048 |
} |
| 17049 |
|
| 17050 |
|
| 17051 |
|
| 17052 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyIMPLICATIONRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17053 |
STATINC(IMPLICATIONRULEAPPLICATIONCOUNT,calcAlgContext); |
| 17054 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 17055 |
CConcept* concept = conDes->getConcept(); |
| 17056 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 17057 |
CProcessingRestrictionSpecification* procRest = conProDes->getProcessingRestrictionSpecification(); |
| 17058 |
cint64 opCount = concept->getOperandCount(); |
| 17059 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 17060 |
CTriggeredImplicationProcessingRestrictionSpecification* triggImpProcRes = nullptr; |
| 17061 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 17062 |
if (!procRest) { |
| 17063 |
triggImpProcRes = CObjectAllocator< CTriggeredImplicationProcessingRestrictionSpecification >::allocateAndConstruct(taskMemMan); |
| 17064 |
triggImpProcRes->setConceptImplicationTrigger(opLinker->getNext()); |
| 17065 |
|
| 17066 |
} else { |
| 17067 |
CTriggeredImplicationProcessingRestrictionSpecification* lastTriggImpProcRes = (CTriggeredImplicationProcessingRestrictionSpecification*)procRest; |
| 17068 |
triggImpProcRes = CObjectAllocator< CTriggeredImplicationProcessingRestrictionSpecification >::allocateAndConstruct(taskMemMan); |
| 17069 |
triggImpProcRes->initImplicationTriggeringProcessingRestriction(lastTriggImpProcRes); |
| 17070 |
} |
| 17071 |
|
| 17072 |
// search next not existing trigger |
| 17073 |
bool allTriggersAvailable = false; |
| 17074 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(true); |
| 17075 |
while (triggImpProcRes->hasConceptImplicationTrigger()) { |
| 17076 |
CSortedNegLinker<CConcept*>* nextTrigger = triggImpProcRes->getConceptImplicationTrigger(); |
| 17077 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 17078 |
CConceptDescriptor* triggerConDes = nullptr; |
| 17079 |
CDependencyTrackPoint* triggerDepTrackPoint = nullptr; |
| 17080 |
if (conSet->getConceptDescriptor(triggerConcept,triggerConDes,triggerDepTrackPoint)) { |
| 17081 |
if (triggerConDes->isNegated() == nextTrigger->isNegated()) { |
| 17082 |
return; |
| 17083 |
} else { |
| 17084 |
if (triggerDepTrackPoint != depTrackPoint) { |
| 17085 |
// add dependency track point |
| 17086 |
CCONNECTIONDependencyNode* connDep = createCONNECTIONDependency(processIndi,triggerConDes,triggerDepTrackPoint,calcAlgContext); |
| 17087 |
connDep->setNext(triggImpProcRes->getImplicationDependency()); |
| 17088 |
triggImpProcRes->setImplicationDependency(connDep); |
| 17089 |
} |
| 17090 |
triggImpProcRes->setConceptImplicationTrigger(nextTrigger->getNext()); |
| 17091 |
} |
| 17092 |
} else { |
| 17093 |
break; |
| 17094 |
} |
| 17095 |
} |
| 17096 |
if (!triggImpProcRes->hasConceptImplicationTrigger()) { |
| 17097 |
allTriggersAvailable = true; |
| 17098 |
} |
| 17099 |
|
| 17100 |
if (!allTriggersAvailable) { |
| 17101 |
// install to trigger |
| 17102 |
STATINC(IMPLICATIONTRIGGERINGCOUNT,calcAlgContext); |
| 17103 |
CSortedNegLinker<CConcept*>* nextTrigger = triggImpProcRes->getConceptImplicationTrigger(); |
| 17104 |
CConcept* triggerConcept = nextTrigger->getData(); |
| 17105 |
bool triggerNegation = !nextTrigger->isNegated(); |
| 17106 |
addConceptToReapplyQueue(conDes,triggerConcept,triggerNegation,processIndi,triggImpProcRes,depTrackPoint,calcAlgContext); |
| 17107 |
} else { |
| 17108 |
STATINC(IMPLICATIONEXECUTINGCOUNT,calcAlgContext); |
| 17109 |
CDependency* triggerDeps = triggImpProcRes->getImplicationDependency(); |
| 17110 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 17111 |
CIMPLICATIONDependencyNode* implDepNode = createIMPLICATIONDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,triggerDeps,calcAlgContext); |
| 17112 |
CConcept* implConcept = opLinker->getData(); |
| 17113 |
bool impConNeg = opLinker->isNegated(); |
| 17114 |
addConceptToIndividual(implConcept,impConNeg,processIndi,nextDepTrackPoint,true,false,calcAlgContext); |
| 17115 |
} |
| 17116 |
|
| 17117 |
|
| 17118 |
} |
| 17119 |
|
| 17120 |
|
| 17121 |
|
| 17122 |
|
| 17123 |
|
| 17124 |
|
| 17125 |
|
| 17126 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyNOMINALIMPLICATIONRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17127 |
STATINC(IMPLICATIONRULEAPPLICATIONCOUNT, calcAlgContext); |
| 17128 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 17129 |
CConcept* concept = conDes->getConcept(); |
| 17130 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 17131 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 17132 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 17133 |
|
| 17134 |
if (opLinker) { |
| 17135 |
bool triggersAvailable = false; |
| 17136 |
CDependencyTrackPoint* addNomTriggerDepTrackPoint = nullptr; |
| 17137 |
CIndividual* indi = concept->getNominalIndividual(); |
| 17138 |
if (indi) { |
| 17139 |
if (processIndi->getNominalIndividual()) { |
| 17140 |
if (processIndi->getNominalIndividual()->getIndividualID() == indi->getIndividualID()) { |
| 17141 |
triggersAvailable = true; |
| 17142 |
} else { |
| 17143 |
CIndividualMergingHash* mergingHash = processIndi->getIndividualMergingHash(false); |
| 17144 |
if (mergingHash) { |
| 17145 |
CIndividualMergingHashData mergedData = mergingHash->value(indi->getIndividualID()); |
| 17146 |
if (mergedData.isMergedWithIndividual()) { |
| 17147 |
triggersAvailable = true; |
| 17148 |
CDependencyTrackPoint* triggerDepTrackPoint = mergedData.getDependencyTrackPoint(); |
| 17149 |
if (triggerDepTrackPoint != processIndi->getDependencyTrackPoint()) { |
| 17150 |
addNomTriggerDepTrackPoint = triggerDepTrackPoint; |
| 17151 |
} |
| 17152 |
} |
| 17153 |
} |
| 17154 |
} |
| 17155 |
} |
| 17156 |
} |
| 17157 |
|
| 17158 |
if (!triggersAvailable) { |
| 17159 |
CIndividualMergingHash* mergingHash = processIndi->getIndividualMergingHash(true); |
| 17160 |
CIndividualMergingHashData& mergingHashData = (*mergingHash)[indi->getIndividualID()]; |
| 17161 |
CCondensedReapplyConceptDescriptor* reapplyConDes = CObjectAllocator< CCondensedReapplyConceptDescriptor >::allocateAndConstruct(taskMemMan); |
| 17162 |
reapplyConDes->initReapllyDescriptor(conDes,depTrackPoint); |
| 17163 |
mergingHashData.getReapplyQueue()->addReapplyConceptDescriptor(reapplyConDes); |
| 17164 |
//addConceptRestrictedToProcessingQueue(conDes, depTrackPoint,ConceptProcessingQueue*& conceptProcessingQueue, CIndividualProcessNode*& processIndi, bool reapplied, CProcessingRestrictionSpecification* procRestriction, 0, calcAlgContext); |
| 17165 |
} else { |
| 17166 |
STATINC(IMPLICATIONEXECUTINGCOUNT, calcAlgContext); |
| 17167 |
CCONNECTIONDependencyNode* connDep = createCONNECTIONDependency(processIndi, nullptr, addNomTriggerDepTrackPoint, calcAlgContext); |
| 17168 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 17169 |
CIMPLICATIONDependencyNode* implDepNode = createIMPLICATIONDependency(nextDepTrackPoint, processIndi, conDes, depTrackPoint, connDep, calcAlgContext); |
| 17170 |
addConceptsToIndividual(opLinker, false, processIndi, nextDepTrackPoint, true, false, nullptr, calcAlgContext); |
| 17171 |
} |
| 17172 |
} |
| 17173 |
} |
| 17174 |
|
| 17175 |
|
| 17176 |
|
| 17177 |
|
| 17178 |
CSatisfiableCalculationTask* CCalculationTableauCompletionTaskHandleAlgorithm::createDependendBranchingTaskList(cint64 newTaskCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17179 |
CSatisfiableCalculationTask* taskList = nullptr; |
| 17180 |
CMemoryTemporaryAllocationManager* taskMemMan = nullptr; |
| 17181 |
taskMemMan = calcAlgContext->getUsedTemporaryMemoryAllocationManager(); |
| 17182 |
for (cint64 i = 0; i < newTaskCount; ++i) { |
| 17183 |
STATINC(TASKCREATIONCOUNT,calcAlgContext); |
| 17184 |
CSatisfiableCalculationTask* satCalcTask = CObjectMemoryPoolAllocator<CSatisfiableCalculationTask>::allocateAndConstructWithMemroyPool(taskMemMan); |
| 17185 |
satCalcTask->initBranchDependedSatisfiableCalculationTask(calcAlgContext->getUsedSatisfiableCalculationTask(),calcAlgContext->getTaskProcessorContext()); |
| 17186 |
|
| 17187 |
if (calcAlgContext->getUsedSatisfiableCalculationTask()->getTaskDepth() < 90) { |
| 17188 |
satCalcTask->setTaskID(mDebugTaskIDVector[calcAlgContext->getUsedSatisfiableCalculationTask()->getTaskDepth()+1]++); |
| 17189 |
} |
| 17190 |
|
| 17191 |
taskList = (CSatisfiableCalculationTask*)satCalcTask->append(taskList); |
| 17192 |
} |
| 17193 |
return taskList; |
| 17194 |
} |
| 17195 |
|
| 17196 |
|
| 17197 |
void CCalculationTableauCompletionTaskHandleAlgorithm::prepareBranchedTaskProcessing(CIndividualProcessNode*& individual, CSatisfiableCalculationTask* newTask, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17198 |
addIndividualToProcessingQueue(individual,calcAlgContext); |
| 17199 |
} |
| 17200 |
|
| 17201 |
|
| 17202 |
void CCalculationTableauCompletionTaskHandleAlgorithm::installConceptRoleBranchTrigger(CIndividualProcessNode*& processIndi, CConceptDescriptor* conceptDescriptor, CDependencyTrackPoint* depTrackPoint, CProcessingRestrictionSpecification* procRest, CConceptRoleBranchingTrigger* trigger, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17203 |
if (trigger->isConceptTrigger()) { |
| 17204 |
STATINC(CONCEPTTRIGGERINSTALLCOUNT,calcAlgContext); |
| 17205 |
CConcept* triggerConcept = trigger->getTriggerConcept(); |
| 17206 |
bool triggerNegation = trigger->getTriggerNegation(); |
| 17207 |
addConceptToReapplyQueue(conceptDescriptor,triggerConcept,triggerNegation,processIndi,procRest,depTrackPoint,calcAlgContext); |
| 17208 |
} else { |
| 17209 |
STATINC(ROLETRIGGERINSTALLCOUNT,calcAlgContext); |
| 17210 |
CRole* role = trigger->getTriggerRole(); |
| 17211 |
addConceptToReapplyQueue(conceptDescriptor,role,processIndi,procRest,depTrackPoint,calcAlgContext); |
| 17212 |
} |
| 17213 |
} |
| 17214 |
|
| 17215 |
|
| 17216 |
|
| 17217 |
CConceptRoleBranchingTrigger* CCalculationTableauCompletionTaskHandleAlgorithm::searchNextConceptRoleBranchTrigger(CIndividualProcessNode*& processIndi, CConceptRoleBranchingTrigger* triggers, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17218 |
CReapplyRoleSuccessorHash* reapplySuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 17219 |
CReapplyConceptLabelSet* conSet = processIndi->getReapplyConceptLabelSet(false); |
| 17220 |
while (triggers) { |
| 17221 |
if (triggers->isConceptTrigger()) { |
| 17222 |
CConcept* triggerConcept = triggers->getTriggerConcept(); |
| 17223 |
bool triggerNegation = triggers->getTriggerNegation(); |
| 17224 |
if (!conSet || !conSet->containsConcept(triggerConcept,triggerNegation)) { |
| 17225 |
return triggers; |
| 17226 |
} |
| 17227 |
} else { |
| 17228 |
CRole* role = triggers->getTriggerRole(); |
| 17229 |
if (!reapplySuccHash || !reapplySuccHash->hasRoleSuccessor(role)) { |
| 17230 |
return triggers; |
| 17231 |
} |
| 17232 |
} |
| 17233 |
triggers = triggers->getNextBranchingTrigger(); |
| 17234 |
} |
| 17235 |
return nullptr; |
| 17236 |
} |
| 17237 |
|
| 17238 |
|
| 17239 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applySELFRule(CIndividualProcessNode*& processIndi, CConceptProcessDescriptor*& conProDes, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17240 |
STATINC(SELFRULEAPPLICATIONCOUNT,calcAlgContext); |
| 17241 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 17242 |
CConcept* concept = conDes->getConcept(); |
| 17243 |
CRole* role = concept->getRole(); |
| 17244 |
CDependencyTrackPoint* depTrackPoint = conProDes->getDependencyTrackPoint(); |
| 17245 |
bool reapplied = conProDes->isConceptReapplied(); |
| 17246 |
CIndividualLinkEdge* restLink = getLinkProcessingRestriction(conProDes); |
| 17247 |
if (!negate) { |
| 17248 |
CIndividualLinkEdge* link = getIndividualNodeLink(processIndi,processIndi,role,calcAlgContext); |
| 17249 |
if (!link) { |
| 17250 |
// self edge/link does not exist |
| 17251 |
// create dependency |
| 17252 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 17253 |
CSELFDependencyNode* selfDepNode = createSELFDependency(nextDepTrackPoint,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 17254 |
createNewIndividualsLinksReapplyed(processIndi,processIndi,role->getIndirectSuperRoleList(),role,nextDepTrackPoint,true,calcAlgContext); |
| 17255 |
} |
| 17256 |
} else { |
| 17257 |
if (restLink) { |
| 17258 |
if (restLink->isDestinationIndividual(processIndi) && restLink->isSourceIndividual(processIndi)) { |
| 17259 |
// throw clash |
| 17260 |
CClashedDependencyDescriptor* clashDes = nullptr; |
| 17261 |
clashDes = createClashedIndividualLinkDescriptor(clashDes,restLink,restLink->getDependencyTrackPoint(),calcAlgContext); |
| 17262 |
clashDes = createClashedConceptDescriptor(clashDes,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 17263 |
throw CCalculationClashProcessingException(clashDes); |
| 17264 |
} |
| 17265 |
} else { |
| 17266 |
CIndividualLinkEdge* link = getIndividualNodeLink(processIndi,processIndi,role,calcAlgContext); |
| 17267 |
if (link) { |
| 17268 |
// throw clash |
| 17269 |
CClashedDependencyDescriptor* clashDes = nullptr; |
| 17270 |
clashDes = createClashedIndividualLinkDescriptor(clashDes,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 17271 |
clashDes = createClashedConceptDescriptor(clashDes,processIndi,conDes,depTrackPoint,calcAlgContext); |
| 17272 |
throw CCalculationClashProcessingException(clashDes); |
| 17273 |
} |
| 17274 |
} |
| 17275 |
if (!reapplied) { |
| 17276 |
addConceptToReapplyQueue(conDes,role,processIndi,true,depTrackPoint,calcAlgContext); |
| 17277 |
} |
| 17278 |
} |
| 17279 |
} |
| 17280 |
|
| 17281 |
|
| 17282 |
CIndividualLinkEdge* CCalculationTableauCompletionTaskHandleAlgorithm::getLinkProcessingRestriction(CConceptProcessDescriptor*& conProDes) { |
| 17283 |
CProcessingRestrictionSpecification* procRestSpec = conProDes->getProcessingRestrictionSpecification(); |
| 17284 |
CIndividualLinkEdge* restLink = nullptr; |
| 17285 |
if (procRestSpec) { |
| 17286 |
CLinkProcessingRestrictionSpecification* linkProcRestSpec = (CLinkProcessingRestrictionSpecification*)procRestSpec; |
| 17287 |
restLink = linkProcRestSpec->getLinkRestriction(); |
| 17288 |
} |
| 17289 |
return restLink; |
| 17290 |
} |
| 17291 |
|
| 17292 |
|
| 17293 |
|
| 17294 |
|
| 17295 |
|
| 17296 |
|
| 17297 |
|
| 17298 |
|
| 17299 |
|
| 17300 |
|
| 17301 |
|
| 17302 |
|
| 17303 |
CIndividualLinkEdge* CCalculationTableauCompletionTaskHandleAlgorithm::getIndividualNodeLink(CIndividualProcessNode*& indiSource, CIndividualProcessNode*& indiDestination, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17304 |
CSuccessorRoleHash* succRoleHash = indiSource->getSuccessorRoleHash(false); |
| 17305 |
if (succRoleHash) { |
| 17306 |
CSuccessorRoleIterator succRoleIt = succRoleHash->getSuccessorRoleIterator(indiSource->getIndividualNodeID()); |
| 17307 |
while (succRoleIt.hasNext()) { |
| 17308 |
CIndividualLinkEdge* link = succRoleIt.next(true); |
| 17309 |
if (link->getLinkRole() == role) { |
| 17310 |
return link; |
| 17311 |
} |
| 17312 |
} |
| 17313 |
} |
| 17314 |
return nullptr; |
| 17315 |
} |
| 17316 |
|
| 17317 |
|
| 17318 |
|
| 17319 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptClashSet(CReapplyConceptLabelSet* subConceptSet, CReapplyConceptLabelSet* superConceptSet, bool* subSetFlag, bool ignoreNominalsForSubsetChecking, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17320 |
STATINC(LABELCONCEPTSUBSETTESTCOUNT,calcAlgContext); |
| 17321 |
cint64 subConSetCount = subConceptSet->getConceptCount(); |
| 17322 |
cint64 superConSetCount = superConceptSet->getConceptCount(); |
| 17323 |
cint64 thresholdFactor = mMapComparisonDirectLookupFactor; |
| 17324 |
if (subSetFlag) { |
| 17325 |
*subSetFlag = true; |
| 17326 |
} |
| 17327 |
if (subConSetCount * thresholdFactor < superConSetCount) { |
| 17328 |
CReapplyConceptLabelSetIterator subConSetIt = subConceptSet->getConceptLabelSetIterator(true,false,false); |
| 17329 |
while (subConSetIt.hasValue()) { |
| 17330 |
CConceptDescriptor* subConDes = subConSetIt.getConceptDescriptor(); |
| 17331 |
bool containedNegation = false; |
| 17332 |
if (superConceptSet->containsConcept(subConDes->getConcept(), &containedNegation)) { |
| 17333 |
if (containedNegation != subConDes->getNegation()) { |
| 17334 |
return true; |
| 17335 |
} |
| 17336 |
} else { |
| 17337 |
if (!ignoreNominalsForSubsetChecking || subConDes->getConcept()->getOperatorCode() != CCNOMINAL) { |
| 17338 |
if (subSetFlag) { |
| 17339 |
*subSetFlag = false; |
| 17340 |
} |
| 17341 |
} |
| 17342 |
} |
| 17343 |
subConSetIt.moveNext(); |
| 17344 |
} |
| 17345 |
} else { |
| 17346 |
CReapplyConceptLabelSetIterator subConSetIt(subConceptSet->getConceptLabelSetIterator(true,false,false)); |
| 17347 |
CReapplyConceptLabelSetIterator superConSetIt(superConceptSet->getConceptLabelSetIterator(true,false,false)); |
| 17348 |
CConceptDescriptor* superConDes = superConSetIt.getConceptDescriptor(); |
| 17349 |
cint64 superConTag = superConDes->getConceptTag(); |
| 17350 |
superConSetIt.moveNext(); |
| 17351 |
while (subConSetIt.hasValue()) { |
| 17352 |
CConceptDescriptor* subConDes = subConSetIt.getConceptDescriptor(); |
| 17353 |
cint64 subConTag = subConDes->getConceptTag(); |
| 17354 |
|
| 17355 |
bool conceptInSuperConSet = true; |
| 17356 |
while (superConTag < subConTag) { |
| 17357 |
if (!superConSetIt.hasValue()) { |
| 17358 |
if (subSetFlag) { |
| 17359 |
*subSetFlag = false; |
| 17360 |
} |
| 17361 |
return false; |
| 17362 |
} |
| 17363 |
superConDes = superConSetIt.getConceptDescriptor(); |
| 17364 |
superConTag = superConDes->getConceptTag(); |
| 17365 |
superConSetIt.moveNext(); |
| 17366 |
} |
| 17367 |
if (subConTag != superConTag) { |
| 17368 |
conceptInSuperConSet = false; |
| 17369 |
} else { |
| 17370 |
if (subConDes->isNegated() != superConDes->isNegated()) { |
| 17371 |
return true; |
| 17372 |
} |
| 17373 |
} |
| 17374 |
|
| 17375 |
if (!conceptInSuperConSet) { |
| 17376 |
if (!ignoreNominalsForSubsetChecking || subConDes->getConcept()->getOperatorCode() != CCNOMINAL) { |
| 17377 |
if (subSetFlag) { |
| 17378 |
*subSetFlag = false; |
| 17379 |
} |
| 17380 |
} |
| 17381 |
} |
| 17382 |
|
| 17383 |
subConSetIt.moveNext(); |
| 17384 |
} |
| 17385 |
} |
| 17386 |
return false; |
| 17387 |
} |
| 17388 |
|
| 17389 |
|
| 17390 |
|
| 17391 |
|
| 17392 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptSubSetIgnoreNominals(CReapplyConceptLabelSet* subConceptSet, CReapplyConceptLabelSet* superConceptSet, bool* clashFlag, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17393 |
STATINC(LABELCONCEPTSUBSETTESTCOUNT,calcAlgContext); |
| 17394 |
cint64 subConSetCount = subConceptSet->getConceptCount(); |
| 17395 |
cint64 superConSetCount = superConceptSet->getConceptCount(); |
| 17396 |
cint64 thresholdFactor = mMapComparisonDirectLookupFactor; |
| 17397 |
if (subConSetCount * thresholdFactor < superConSetCount) { |
| 17398 |
CReapplyConceptLabelSetIterator subConSetIt = subConceptSet->getConceptLabelSetIterator(true,false,false); |
| 17399 |
while (subConSetIt.hasValue()) { |
| 17400 |
CConceptDescriptor* subConDes = subConSetIt.getConceptDescriptor(); |
| 17401 |
bool containedNegation = false; |
| 17402 |
if (superConceptSet->containsConcept(subConDes->getConcept(), &containedNegation)) { |
| 17403 |
if (containedNegation != subConDes->getNegation()) { |
| 17404 |
if (clashFlag) { |
| 17405 |
*clashFlag = true; |
| 17406 |
} |
| 17407 |
return false; |
| 17408 |
} |
| 17409 |
} else { |
| 17410 |
if (subConDes->getConcept()->getOperatorCode() != CCNOMINAL) { |
| 17411 |
return false; |
| 17412 |
} |
| 17413 |
} |
| 17414 |
subConSetIt.moveNext(); |
| 17415 |
} |
| 17416 |
} else { |
| 17417 |
CReapplyConceptLabelSetIterator subConSetIt(subConceptSet->getConceptLabelSetIterator(true,false,false)); |
| 17418 |
CReapplyConceptLabelSetIterator superConSetIt(superConceptSet->getConceptLabelSetIterator(true,false,false)); |
| 17419 |
CConceptDescriptor* superConDes = superConSetIt.getConceptDescriptor(); |
| 17420 |
cint64 superConTag = superConDes->getConceptTag(); |
| 17421 |
superConSetIt.moveNext(); |
| 17422 |
while (subConSetIt.hasValue()) { |
| 17423 |
CConceptDescriptor* subConDes = subConSetIt.getConceptDescriptor(); |
| 17424 |
cint64 subConTag = subConDes->getConceptTag(); |
| 17425 |
|
| 17426 |
bool conceptInSuperConSet = true; |
| 17427 |
while (superConTag < subConTag) { |
| 17428 |
if (!superConSetIt.hasValue()) { |
| 17429 |
conceptInSuperConSet = false; |
| 17430 |
} |
| 17431 |
superConDes = superConSetIt.getConceptDescriptor(); |
| 17432 |
superConTag = superConDes->getConceptTag(); |
| 17433 |
superConSetIt.moveNext(); |
| 17434 |
} |
| 17435 |
if (subConTag != superConTag) { |
| 17436 |
conceptInSuperConSet = false; |
| 17437 |
} else { |
| 17438 |
if (subConDes->isNegated() != superConDes->isNegated()) { |
| 17439 |
if (clashFlag) { |
| 17440 |
*clashFlag = true; |
| 17441 |
} |
| 17442 |
return false; |
| 17443 |
} |
| 17444 |
} |
| 17445 |
|
| 17446 |
if (!conceptInSuperConSet) { |
| 17447 |
if (subConDes->getConcept()->getOperatorCode() != CCNOMINAL) { |
| 17448 |
return false; |
| 17449 |
} |
| 17450 |
} |
| 17451 |
|
| 17452 |
subConSetIt.moveNext(); |
| 17453 |
} |
| 17454 |
} |
| 17455 |
return true; |
| 17456 |
} |
| 17457 |
|
| 17458 |
|
| 17459 |
|
| 17460 |
|
| 17461 |
|
| 17462 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptSubSet(CReapplyConceptLabelSet* subConceptSet, CReapplyConceptLabelSet* superConceptSet, CConceptDescriptor** firstNotEntailedConDes, bool* equalConSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17463 |
STATINC(LABELCONCEPTSUBSETTESTCOUNT,calcAlgContext); |
| 17464 |
cint64 subConSetCount = subConceptSet->getConceptCount(); |
| 17465 |
cint64 superConSetCount = superConceptSet->getConceptCount(); |
| 17466 |
if (equalConSet) { |
| 17467 |
if (subConSetCount != superConSetCount) { |
| 17468 |
*equalConSet = false; |
| 17469 |
} else { |
| 17470 |
*equalConSet = true; |
| 17471 |
} |
| 17472 |
} |
| 17473 |
if (subConSetCount > superConSetCount) { |
| 17474 |
return false; |
| 17475 |
} |
| 17476 |
if (superConSetCount == 0) { |
| 17477 |
return true; |
| 17478 |
} |
| 17479 |
cint64 thresholdFactor = 10; |
| 17480 |
if (subConSetCount * thresholdFactor < superConSetCount) { |
| 17481 |
CReapplyConceptLabelSetIterator subConSetIt = subConceptSet->getConceptLabelSetIterator(true,false,false); |
| 17482 |
while (subConSetIt.hasValue()) { |
| 17483 |
CConceptDescriptor* subConDes = subConSetIt.getConceptDescriptor(); |
| 17484 |
if (!superConceptSet->containsConceptDescriptor(subConDes)) { |
| 17485 |
if (firstNotEntailedConDes) { |
| 17486 |
*firstNotEntailedConDes = subConDes; |
| 17487 |
} |
| 17488 |
return false; |
| 17489 |
} |
| 17490 |
subConSetIt.moveNext(); |
| 17491 |
} |
| 17492 |
} else { |
| 17493 |
CReapplyConceptLabelSetIterator subConSetIt = subConceptSet->getConceptLabelSetIterator(true,false,false); |
| 17494 |
CReapplyConceptLabelSetIterator superConSetIt = superConceptSet->getConceptLabelSetIterator(true,false,false); |
| 17495 |
CConceptDescriptor* superConDes = superConSetIt.getConceptDescriptor(); |
| 17496 |
cint64 superConTag = superConDes->getConceptTag(); |
| 17497 |
superConSetIt.moveNext(); |
| 17498 |
while (subConSetIt.hasValue()) { |
| 17499 |
CConceptDescriptor* subConDes = subConSetIt.getConceptDescriptor(); |
| 17500 |
cint64 subConTag = subConDes->getConceptTag(); |
| 17501 |
|
| 17502 |
while (superConTag < subConTag) { |
| 17503 |
if (!superConSetIt.hasValue()) { |
| 17504 |
if (firstNotEntailedConDes) { |
| 17505 |
*firstNotEntailedConDes = subConDes; |
| 17506 |
} |
| 17507 |
return false; |
| 17508 |
} |
| 17509 |
superConDes = superConSetIt.getConceptDescriptor(); |
| 17510 |
superConTag = superConDes->getConceptTag(); |
| 17511 |
superConSetIt.moveNext(); |
| 17512 |
if (equalConSet && superConTag < subConTag) { |
| 17513 |
*equalConSet = false; |
| 17514 |
} |
| 17515 |
} |
| 17516 |
if (subConTag != superConTag) { |
| 17517 |
if (firstNotEntailedConDes) { |
| 17518 |
*firstNotEntailedConDes = subConDes; |
| 17519 |
} |
| 17520 |
if (equalConSet) { |
| 17521 |
*equalConSet = false; |
| 17522 |
} |
| 17523 |
return false; |
| 17524 |
} else { |
| 17525 |
if (subConDes->isNegated() != superConDes->isNegated()) { |
| 17526 |
if (firstNotEntailedConDes) { |
| 17527 |
*firstNotEntailedConDes = subConDes; |
| 17528 |
} |
| 17529 |
if (equalConSet) { |
| 17530 |
*equalConSet = false; |
| 17531 |
} |
| 17532 |
return false; |
| 17533 |
} |
| 17534 |
} |
| 17535 |
subConSetIt.moveNext(); |
| 17536 |
} |
| 17537 |
} |
| 17538 |
return true; |
| 17539 |
} |
| 17540 |
|
| 17541 |
|
| 17542 |
|
| 17543 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptEqualSet(CReapplyConceptLabelSet* conceptSet1, CReapplyConceptLabelSet* conceptSet2, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17544 |
STATINC(LABELCONCEPTEQUALSETTESTCOUNT,calcAlgContext); |
| 17545 |
cint64 conceptSet1Count = conceptSet1->getConceptCount(); |
| 17546 |
cint64 conceptSet2Count = conceptSet2->getConceptCount(); |
| 17547 |
if (conceptSet1Count != conceptSet2Count) { |
| 17548 |
return false; |
| 17549 |
} |
| 17550 |
if (!conceptSet1->getConceptSignature()->isSignatureEquivalent(conceptSet2->getConceptSignature())) { |
| 17551 |
return false; |
| 17552 |
} |
| 17553 |
CReapplyConceptLabelSetIterator conSet1It = conceptSet1->getConceptLabelSetIterator(true,false,false); |
| 17554 |
CReapplyConceptLabelSetIterator conSet2It = conceptSet2->getConceptLabelSetIterator(true,false,false); |
| 17555 |
while (conSet1It.hasValue()) { |
| 17556 |
if (!conSet2It.hasValue()) { |
| 17557 |
return false; |
| 17558 |
} |
| 17559 |
CConceptDescriptor* conDes1 = conSet1It.getConceptDescriptor(); |
| 17560 |
CConceptDescriptor* conDes2 = conSet2It.getConceptDescriptor(); |
| 17561 |
if (conDes1->getConcept() != conDes2->getConcept()) { |
| 17562 |
return false; |
| 17563 |
} |
| 17564 |
if (conDes1->isNegated() != conDes2->isNegated()) { |
| 17565 |
return false; |
| 17566 |
} |
| 17567 |
conSet1It.moveNext(); |
| 17568 |
conSet2It.moveNext(); |
| 17569 |
} |
| 17570 |
return true; |
| 17571 |
} |
| 17572 |
|
| 17573 |
|
| 17574 |
|
| 17575 |
|
| 17576 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptEqualSetConsiderNominalsForClashOnly(CReapplyConceptLabelSet* conceptSet1, CReapplyConceptLabelSet* conceptSet2, bool* clashFlag, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17577 |
STATINC(LABELCONCEPTEQUALSETTESTCOUNT, calcAlgContext); |
| 17578 |
if (clashFlag) { |
| 17579 |
*clashFlag = false; |
| 17580 |
} |
| 17581 |
CReapplyConceptLabelSetIterator conSet1It(conceptSet1->getConceptLabelSetIterator(true, false, false)); |
| 17582 |
CReapplyConceptLabelSetIterator conSet2It(conceptSet2->getConceptLabelSetIterator(true, false, false)); |
| 17583 |
while (conSet1It.hasValue() || conSet2It.hasValue()) { |
| 17584 |
|
| 17585 |
bool conSet1Nominal = false; |
| 17586 |
bool conSet2Nominal = false; |
| 17587 |
if (conSet1It.hasValue() && conSet1It.getConceptDescriptor()->getConcept()->getOperatorCode() == CCNOMINAL) { |
| 17588 |
conSet1Nominal = true; |
| 17589 |
} |
| 17590 |
if (conSet2It.hasValue() && conSet2It.getConceptDescriptor()->getConcept()->getOperatorCode() == CCNOMINAL) { |
| 17591 |
conSet2Nominal = true; |
| 17592 |
} |
| 17593 |
|
| 17594 |
if (conSet1Nominal && conSet2Nominal) { |
| 17595 |
CConceptDescriptor* conDes1 = conSet1It.getConceptDescriptor(); |
| 17596 |
CConceptDescriptor* conDes2 = conSet2It.getConceptDescriptor(); |
| 17597 |
if (conDes1->getConcept() == conDes2->getConcept()) { |
| 17598 |
if (conDes1->isNegated() != conDes2->isNegated()) { |
| 17599 |
if (clashFlag) { |
| 17600 |
*clashFlag = true; |
| 17601 |
return false; |
| 17602 |
} |
| 17603 |
} |
| 17604 |
} |
| 17605 |
conSet1It.moveNext(); |
| 17606 |
conSet2It.moveNext(); |
| 17607 |
} else if (conSet1Nominal) { |
| 17608 |
conSet1It.moveNext(); |
| 17609 |
} else if (conSet2Nominal) { |
| 17610 |
conSet2It.moveNext(); |
| 17611 |
} else { |
| 17612 |
if (conSet1It.hasValue() && !conSet2It.hasValue() || !conSet1It.hasValue() && conSet2It.hasValue()) { |
| 17613 |
return false; |
| 17614 |
} else if (conSet1It.hasValue() && conSet2It.hasValue()) { |
| 17615 |
CConceptDescriptor* conDes1 = conSet1It.getConceptDescriptor(); |
| 17616 |
CConceptDescriptor* conDes2 = conSet2It.getConceptDescriptor(); |
| 17617 |
if (conDes1->getConcept() != conDes2->getConcept()) { |
| 17618 |
return false; |
| 17619 |
} |
| 17620 |
if (conDes1->isNegated() != conDes2->isNegated()) { |
| 17621 |
if (clashFlag) { |
| 17622 |
*clashFlag = true; |
| 17623 |
} |
| 17624 |
return false; |
| 17625 |
} |
| 17626 |
conSet1It.moveNext(); |
| 17627 |
conSet2It.moveNext(); |
| 17628 |
} |
| 17629 |
} |
| 17630 |
} |
| 17631 |
return true; |
| 17632 |
} |
| 17633 |
|
| 17634 |
|
| 17635 |
|
| 17636 |
|
| 17637 |
|
| 17638 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isPairwiseLabelConceptEqualSet(CReapplyConceptLabelSet* conceptSet1, CReapplyConceptLabelSet* conceptSet1Pair, CReapplyConceptLabelSet* conceptSet2, CReapplyConceptLabelSet* conceptSet2Pair, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17639 |
STATINC(LABELCONCEPTPAIRWISEEQUALSETTESTCOUNT,calcAlgContext); |
| 17640 |
cint64 conceptSet1Count = conceptSet1->getConceptCount(); |
| 17641 |
cint64 conceptSet1PCount = conceptSet1Pair->getConceptCount(); |
| 17642 |
if (conceptSet1Count != conceptSet1PCount) { |
| 17643 |
return false; |
| 17644 |
} |
| 17645 |
cint64 conceptSet2Count = conceptSet2->getConceptCount(); |
| 17646 |
cint64 conceptSet2PCount = conceptSet2Pair->getConceptCount(); |
| 17647 |
if (conceptSet2Count != conceptSet2PCount) { |
| 17648 |
return false; |
| 17649 |
} |
| 17650 |
if (!conceptSet1->getConceptSignature()->isSignatureEquivalent(conceptSet1Pair->getConceptSignature())) { |
| 17651 |
return false; |
| 17652 |
} |
| 17653 |
if (!conceptSet2->getConceptSignature()->isSignatureEquivalent(conceptSet2Pair->getConceptSignature())) { |
| 17654 |
return false; |
| 17655 |
} |
| 17656 |
CReapplyConceptLabelSetIterator conSet1It = conceptSet1->getConceptLabelSetIterator(true,false,false); |
| 17657 |
CReapplyConceptLabelSetIterator conSet1PairIt = conceptSet1Pair->getConceptLabelSetIterator(true,false,false); |
| 17658 |
while (conSet1It.hasValue()) { |
| 17659 |
if (!conSet1PairIt.hasValue()) { |
| 17660 |
return false; |
| 17661 |
} |
| 17662 |
CConceptDescriptor* conDes1 = conSet1It.getConceptDescriptor(); |
| 17663 |
CConceptDescriptor* conDes1Pair = conSet1PairIt.getConceptDescriptor(); |
| 17664 |
if (conDes1->getConcept() != conDes1Pair->getConcept()) { |
| 17665 |
return false; |
| 17666 |
} |
| 17667 |
if (conDes1->isNegated() != conDes1Pair->isNegated()) { |
| 17668 |
return false; |
| 17669 |
} |
| 17670 |
conSet1It.moveNext(); |
| 17671 |
conSet1PairIt.moveNext(); |
| 17672 |
} |
| 17673 |
CReapplyConceptLabelSetIterator conSet2It = conceptSet2->getConceptLabelSetIterator(true,false); |
| 17674 |
CReapplyConceptLabelSetIterator conSet2PairIt = conceptSet2Pair->getConceptLabelSetIterator(true,false,false); |
| 17675 |
while (conSet2It.hasValue()) { |
| 17676 |
if (!conSet2PairIt.hasValue()) { |
| 17677 |
return false; |
| 17678 |
} |
| 17679 |
CConceptDescriptor* conDes2 = conSet2It.getConceptDescriptor(); |
| 17680 |
CConceptDescriptor* conDes2Pair = conSet2PairIt.getConceptDescriptor(); |
| 17681 |
if (conDes2->getConcept() != conDes2Pair->getConcept()) { |
| 17682 |
return false; |
| 17683 |
} |
| 17684 |
if (conDes2->isNegated() != conDes2Pair->isNegated()) { |
| 17685 |
return false; |
| 17686 |
} |
| 17687 |
conSet2It.moveNext(); |
| 17688 |
conSet2PairIt.moveNext(); |
| 17689 |
} |
| 17690 |
return true; |
| 17691 |
} |
| 17692 |
|
| 17693 |
|
| 17694 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasOptimizedBlockingB2AutomateTransitionOperands(CConcept* concept, CRole* role, CReapplyConceptLabelSet* vConSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17695 |
STATINC(OPTIMIZEDBLOCKINGB2AUTOMATETRANSACTIONTESTCOUNT,calcAlgContext); |
| 17696 |
cint64 opCode = concept->getOperatorCode(); |
| 17697 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 17698 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_TYPE)) { |
| 17699 |
// recursive |
| 17700 |
CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); |
| 17701 |
while (opLinkerIt) { |
| 17702 |
CConcept* opConcept = opLinkerIt->getData(); |
| 17703 |
if (!hasOptimizedBlockingB2AutomateTransitionOperands(opConcept,role,vConSet,calcAlgContext)) { |
| 17704 |
return false; |
| 17705 |
} |
| 17706 |
opLinkerIt = opLinkerIt->getNext(); |
| 17707 |
} |
| 17708 |
} else if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQALL_TYPE)) { |
| 17709 |
CRole* conRole = concept->getRole(); |
| 17710 |
if (conRole == role) { |
| 17711 |
CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); |
| 17712 |
while (opLinkerIt) { |
| 17713 |
CConcept* opConcept = opLinkerIt->getData(); |
| 17714 |
if (!vConSet->containsConcept(opConcept,false)) { |
| 17715 |
return false; |
| 17716 |
} |
| 17717 |
opLinkerIt = opLinkerIt->getNext(); |
| 17718 |
} |
| 17719 |
} |
| 17720 |
} |
| 17721 |
return true; |
| 17722 |
} |
| 17723 |
|
| 17724 |
|
| 17725 |
|
| 17726 |
|
| 17727 |
|
| 17728 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isNominalVariablePropagationBindingSubSet(CIndividualProcessNode*& testIndi, CIndividualProcessNode*& blockingIndi, CIndividualNodeBlockingTestData* blockData, bool testContinueBlocking, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17729 |
|
| 17730 |
// checking back/candidate propagation |
| 17731 |
CIndividualProcessNode* ancestorIndiNode = nullptr; |
| 17732 |
CConceptPropagationBindingSetHash* conPropBindSetHash = testIndi->getConceptPropagationBindingSetHash(false); |
| 17733 |
CConceptPropagationBindingSetHash* blockerConPropBindSetHash = blockerConPropBindSetHash = blockingIndi->getConceptPropagationBindingSetHash(false); |
| 17734 |
if (conPropBindSetHash) { |
| 17735 |
for (CConceptPropagationBindingSetHash::iterator it1 = conPropBindSetHash->begin(), it1End = conPropBindSetHash->end(); it1 != it1End; ++it1) { |
| 17736 |
CConceptPropagationBindingSetHashData& hashData = it1.value(); |
| 17737 |
CPropagationBindingSet* propBindSet = hashData.mUsePropBindingSet; |
| 17738 |
CConceptDescriptor* conDes = propBindSet->getConceptDescriptor(); |
| 17739 |
|
| 17740 |
if (propBindSet && conDes) { |
| 17741 |
CConcept* concept = conDes->getConcept(); |
| 17742 |
CPropagationBindingSet* blockerPropBindSet = nullptr; |
| 17743 |
|
| 17744 |
CPropagationBindingMap* propBindMap = propBindSet->getPropagationBindingMap(); |
| 17745 |
for (CPropagationBindingMap::iterator it2 = propBindMap->begin(), it2End = propBindMap->end(); it2 != it2End; ++it2) { |
| 17746 |
CPropagationBindingMapData& mapData = it2.value(); |
| 17747 |
CPropagationBindingDescriptor* propBindDes = mapData.getPropagationBindingDescriptor(); |
| 17748 |
if (propBindDes) { |
| 17749 |
CPropagationBinding* propBind = propBindDes->getPropagationBinding(); |
| 17750 |
if (propBind) { |
| 17751 |
CVariable* propBindVar = propBind->getBindedVariable(); |
| 17752 |
if (propBindVar) { |
| 17753 |
if (propBindVar->isNominalVariable()) { |
| 17754 |
|
| 17755 |
// propagation variable binding is also required in blocker node |
| 17756 |
if (!blockerPropBindSet) { |
| 17757 |
if (!blockerConPropBindSetHash) { |
| 17758 |
return false; |
| 17759 |
} |
| 17760 |
blockerPropBindSet = blockerConPropBindSetHash->getPropagationBindingSet(concept,false); |
| 17761 |
if (!blockerPropBindSet) { |
| 17762 |
return false; |
| 17763 |
} |
| 17764 |
} |
| 17765 |
bool blockingPossible = false; |
| 17766 |
CPropagationBindingDescriptor* blockerPropBindDes = blockerPropBindSet->getPropagationBindingDescriptor(propBind); |
| 17767 |
if (blockerPropBindDes) { |
| 17768 |
blockingPossible = true; |
| 17769 |
} |
| 17770 |
|
| 17771 |
if (!blockingPossible) { |
| 17772 |
return false; |
| 17773 |
} |
| 17774 |
} |
| 17775 |
} |
| 17776 |
} |
| 17777 |
} |
| 17778 |
} |
| 17779 |
} |
| 17780 |
} |
| 17781 |
} |
| 17782 |
// checking back/candidate propagation for ancestor node |
| 17783 |
if (blockerConPropBindSetHash) { |
| 17784 |
if (!ancestorIndiNode) { |
| 17785 |
ancestorIndiNode = getAncestorIndividual(testIndi,calcAlgContext); |
| 17786 |
} |
| 17787 |
if (ancestorIndiNode) { |
| 17788 |
CConceptPropagationBindingSetHash* ancConPropBindSetHash = ancestorIndiNode->getConceptPropagationBindingSetHash(false); |
| 17789 |
for (CConceptPropagationBindingSetHash::iterator it1 = blockerConPropBindSetHash->begin(), it1End = blockerConPropBindSetHash->end(); it1 != it1End; ++it1) { |
| 17790 |
CConceptPropagationBindingSetHashData& hashData = it1.value(); |
| 17791 |
CPropagationBindingSet* blockerPropBindSet = hashData.mUsePropBindingSet; |
| 17792 |
CConceptDescriptor* conDes = blockerPropBindSet->getConceptDescriptor(); |
| 17793 |
|
| 17794 |
if (blockerPropBindSet && conDes) { |
| 17795 |
CConcept* concept = conDes->getConcept(); |
| 17796 |
cint64 opCode = concept->getOperatorCode(); |
| 17797 |
bool negation = conDes->isNegated(); |
| 17798 |
|
| 17799 |
if (!negation && (opCode == CCPBINDALL || opCode == CCPBINDAQALL)) { |
| 17800 |
CRole* role = concept->getRole(); |
| 17801 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = concept->getOperandList(); opConLinkerIt; opConLinkerIt = opConLinkerIt->getNext()) { |
| 17802 |
CConcept* opConcept = opConLinkerIt->getData(); |
| 17803 |
if (testIndi->hasRoleSuccessorToIndividual(role,ancestorIndiNode,true)) { |
| 17804 |
if (!ancConPropBindSetHash) { |
| 17805 |
return false; |
| 17806 |
} else { |
| 17807 |
CPropagationBindingSet* ancPropBindSet = nullptr; |
| 17808 |
CPropagationBindingMap* propBindMap = blockerPropBindSet->getPropagationBindingMap(); |
| 17809 |
for (CPropagationBindingMap::iterator it2 = propBindMap->begin(), it2End = propBindMap->end(); it2 != it2End; ++it2) { |
| 17810 |
CPropagationBindingMapData& mapData = it2.value(); |
| 17811 |
CPropagationBindingDescriptor* blockerPropBindDes = mapData.getPropagationBindingDescriptor(); |
| 17812 |
if (blockerPropBindDes) { |
| 17813 |
CPropagationBinding* blockerPropBind = blockerPropBindDes->getPropagationBinding(); |
| 17814 |
if (blockerPropBind) { |
| 17815 |
CVariable* blockerPropBindVar = blockerPropBind->getBindedVariable(); |
| 17816 |
if (blockerPropBindVar) { |
| 17817 |
if (blockerPropBindVar->isNominalVariable()) { |
| 17818 |
|
| 17819 |
bool blockingPossible = false; |
| 17820 |
if (!ancPropBindSet) { |
| 17821 |
ancPropBindSet = ancConPropBindSetHash->getPropagationBindingSet(opConcept); |
| 17822 |
if (!ancPropBindSet) { |
| 17823 |
return false; |
| 17824 |
} |
| 17825 |
} |
| 17826 |
CPropagationBindingDescriptor* ancPropBindDes = ancPropBindSet->getPropagationBindingDescriptor(blockerPropBind); |
| 17827 |
if (ancPropBindDes) { |
| 17828 |
blockingPossible = true; |
| 17829 |
} |
| 17830 |
if (!blockingPossible) { |
| 17831 |
return false; |
| 17832 |
} |
| 17833 |
|
| 17834 |
} |
| 17835 |
} |
| 17836 |
} |
| 17837 |
} |
| 17838 |
} |
| 17839 |
|
| 17840 |
} |
| 17841 |
} |
| 17842 |
} |
| 17843 |
} |
| 17844 |
|
| 17845 |
} |
| 17846 |
} |
| 17847 |
} |
| 17848 |
} |
| 17849 |
|
| 17850 |
|
| 17851 |
|
| 17852 |
// checking normal propagation |
| 17853 |
CConceptVariableBindingPathSetHash* conVarBindSetHash = testIndi->getConceptVariableBindingPathSetHash(false); |
| 17854 |
CConceptVariableBindingPathSetHash* blockerConVarBindSetHash = blockerConVarBindSetHash = blockingIndi->getConceptVariableBindingPathSetHash(false); |
| 17855 |
if (conVarBindSetHash) { |
| 17856 |
for (CConceptVariableBindingPathSetHash::iterator it1 = conVarBindSetHash->begin(), it1End = conVarBindSetHash->end(); it1 != it1End; ++it1) { |
| 17857 |
CConceptVariableBindingPathSetHashData& hashData = it1.value(); |
| 17858 |
CVariableBindingPathSet* varBindSet = hashData.mUseVariableBindingPathSet; |
| 17859 |
CConceptDescriptor* conDes = varBindSet->getConceptDescriptor(); |
| 17860 |
|
| 17861 |
if (varBindSet && conDes) { |
| 17862 |
CConcept* concept = conDes->getConcept(); |
| 17863 |
CVariableBindingPathSet* blockerVarBindSet = nullptr; |
| 17864 |
|
| 17865 |
CVariableBindingPathMap* varBindMap = varBindSet->getVariableBindingPathMap(); |
| 17866 |
for (CVariableBindingPathMap::iterator it2 = varBindMap->begin(), it2End = varBindMap->end(); it2 != it2End; ++it2) { |
| 17867 |
CVariableBindingPathMapData& mapData = it2.value(); |
| 17868 |
CVariableBindingPathDescriptor* varBindDes = mapData.getVariableBindingPathDescriptor(); |
| 17869 |
if (varBindDes) { |
| 17870 |
CVariableBindingPath* varBindPath = varBindDes->getVariableBindingPath(); |
| 17871 |
if (varBindPath) { |
| 17872 |
|
| 17873 |
// propagation variable binding is also required in blocker node |
| 17874 |
if (!blockerVarBindSet) { |
| 17875 |
if (!blockerConVarBindSetHash) { |
| 17876 |
return false; |
| 17877 |
} |
| 17878 |
blockerVarBindSet = blockerConVarBindSetHash->getVariableBindingPathSet(concept,false); |
| 17879 |
if (!blockerVarBindSet) { |
| 17880 |
return false; |
| 17881 |
} |
| 17882 |
} |
| 17883 |
bool blockingPossible = false; |
| 17884 |
CVariableBindingPathDescriptor* blockerVarBindDes = blockerVarBindSet->getVariableBindingPathDescriptor(varBindPath); |
| 17885 |
if (blockerVarBindDes) { |
| 17886 |
blockingPossible = true; |
| 17887 |
} |
| 17888 |
|
| 17889 |
if (!blockingPossible) { |
| 17890 |
return false; |
| 17891 |
} |
| 17892 |
} |
| 17893 |
} |
| 17894 |
} |
| 17895 |
} |
| 17896 |
} |
| 17897 |
} |
| 17898 |
// checking normal propagation for ancestor node |
| 17899 |
if (blockerConVarBindSetHash) { |
| 17900 |
if (!ancestorIndiNode) { |
| 17901 |
ancestorIndiNode = getAncestorIndividual(testIndi,calcAlgContext); |
| 17902 |
} |
| 17903 |
if (ancestorIndiNode) { |
| 17904 |
CConceptVariableBindingPathSetHash* ancConVarBindSetHash = ancestorIndiNode->getConceptVariableBindingPathSetHash(false); |
| 17905 |
for (CConceptVariableBindingPathSetHash::iterator it1 = blockerConVarBindSetHash->begin(), it1End = blockerConVarBindSetHash->end(); it1 != it1End; ++it1) { |
| 17906 |
CConceptVariableBindingPathSetHashData& hashData = it1.value(); |
| 17907 |
CVariableBindingPathSet* blockerVarBindSet = hashData.mUseVariableBindingPathSet; |
| 17908 |
CConceptDescriptor* conDes = blockerVarBindSet->getConceptDescriptor(); |
| 17909 |
|
| 17910 |
if (blockerVarBindSet && conDes) { |
| 17911 |
CConcept* concept = conDes->getConcept(); |
| 17912 |
cint64 opCode = concept->getOperatorCode(); |
| 17913 |
bool negation = conDes->isNegated(); |
| 17914 |
|
| 17915 |
if (!negation && (opCode == CCVARBINDALL || opCode == CCVARBINDAQALL)) { |
| 17916 |
CRole* role = concept->getRole(); |
| 17917 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = concept->getOperandList(); opConLinkerIt; opConLinkerIt = opConLinkerIt->getNext()) { |
| 17918 |
CConcept* opConcept = opConLinkerIt->getData(); |
| 17919 |
if (testIndi->hasRoleSuccessorToIndividual(role,ancestorIndiNode,true)) { |
| 17920 |
if (!ancConVarBindSetHash) { |
| 17921 |
return false; |
| 17922 |
} else { |
| 17923 |
CVariableBindingPathSet* ancVarBindSet = nullptr; |
| 17924 |
CVariableBindingPathMap* varBindMap = blockerVarBindSet->getVariableBindingPathMap(); |
| 17925 |
for (CVariableBindingPathMap::iterator it2 = varBindMap->begin(), it2End = varBindMap->end(); it2 != it2End; ++it2) { |
| 17926 |
CVariableBindingPathMapData& mapData = it2.value(); |
| 17927 |
CVariableBindingPathDescriptor* blockerVarBindDes = mapData.getVariableBindingPathDescriptor(); |
| 17928 |
if (blockerVarBindDes) { |
| 17929 |
CVariableBindingPath* blockerVarBindPath = blockerVarBindDes->getVariableBindingPath(); |
| 17930 |
if (blockerVarBindPath) { |
| 17931 |
|
| 17932 |
bool blockingPossible = false; |
| 17933 |
if (!ancVarBindSet) { |
| 17934 |
ancVarBindSet = ancConVarBindSetHash->getVariableBindingPathSet(opConcept); |
| 17935 |
if (!ancVarBindSet) { |
| 17936 |
return false; |
| 17937 |
} |
| 17938 |
} |
| 17939 |
CVariableBindingPathDescriptor* ancVarBindPathDes = ancVarBindSet->getVariableBindingPathDescriptor(blockerVarBindPath); |
| 17940 |
if (ancVarBindPathDes) { |
| 17941 |
blockingPossible = true; |
| 17942 |
} |
| 17943 |
if (!blockingPossible) { |
| 17944 |
return false; |
| 17945 |
} |
| 17946 |
|
| 17947 |
} |
| 17948 |
} |
| 17949 |
} |
| 17950 |
|
| 17951 |
} |
| 17952 |
} |
| 17953 |
} |
| 17954 |
} |
| 17955 |
|
| 17956 |
} |
| 17957 |
} |
| 17958 |
} |
| 17959 |
} |
| 17960 |
|
| 17961 |
|
| 17962 |
|
| 17963 |
// TODO: check representative propagation |
| 17964 |
|
| 17965 |
return true; |
| 17966 |
} |
| 17967 |
|
| 17968 |
|
| 17969 |
|
| 17970 |
|
| 17971 |
|
| 17972 |
|
| 17973 |
|
| 17974 |
|
| 17975 |
|
| 17976 |
|
| 17977 |
|
| 17978 |
|
| 17979 |
|
| 17980 |
|
| 17981 |
|
| 17982 |
|
| 17983 |
|
| 17984 |
|
| 17985 |
|
| 17986 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::areVariablePropagationBindingsCompatible(CVariableBindingPath* varBindPath1, CVariableBindingPath* varBindPath2, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 17987 |
if (varBindPath1->getPropagationID() == varBindPath2->getPropagationID()) { |
| 17988 |
return true; |
| 17989 |
} |
| 17990 |
CVariableBindingPath* lessVarBindPath = varBindPath1; |
| 17991 |
CVariableBindingPath* moreVarBindPath = varBindPath2; |
| 17992 |
if (varBindPath1->getVariableBindingCount() > varBindPath2->getVariableBindingCount()) { |
| 17993 |
moreVarBindPath = varBindPath1; |
| 17994 |
lessVarBindPath = varBindPath2; |
| 17995 |
} |
| 17996 |
for (CVariableBindingDescriptor* lessVarBindDesIt = lessVarBindPath->getVariableBindingDescriptorLinker(); lessVarBindDesIt; lessVarBindDesIt = lessVarBindDesIt->getNext()) { |
| 17997 |
CVariableBinding* lessVariableBinding = lessVarBindDesIt->getVariableBinding(); |
| 17998 |
CVariable* variable = lessVariableBinding->getBindedVariable(); |
| 17999 |
CIndividualProcessNode* boundIndi = lessVariableBinding->getBindedIndividual(); |
| 18000 |
for (CVariableBindingDescriptor* moreVarBindDesIt = moreVarBindPath->getVariableBindingDescriptorLinker(); moreVarBindDesIt; moreVarBindDesIt = moreVarBindDesIt->getNext()) { |
| 18001 |
CVariableBinding* moreVariableBinding = moreVarBindDesIt->getVariableBinding(); |
| 18002 |
if (moreVariableBinding->getBindedVariable() == variable && moreVariableBinding->getBindedIndividual()->getIndividualNodeID() != boundIndi->getIndividualNodeID()) { |
| 18003 |
return false; |
| 18004 |
} |
| 18005 |
} |
| 18006 |
|
| 18007 |
} |
| 18008 |
return true; |
| 18009 |
} |
| 18010 |
|
| 18011 |
|
| 18012 |
|
| 18013 |
QSet<CConcept*> CCalculationTableauCompletionTaskHandleAlgorithm::getConceptsForCompatibleVariablePropagationBindings(CIndividualProcessNode*& individualNode, CVariableBindingPath* varBindPath, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18014 |
//CPROCESSINGSET<CConcept*>* conceptSet = CObjectParameterizingAllocator< CPROCESSINGSET<CConcept*>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(), calcAlgContext->getUsedTaskProcessorContext()); |
| 18015 |
QSet<CConcept*> conceptSet; |
| 18016 |
CConceptVariableBindingPathSetHash* conVarBindSetHash = individualNode->getConceptVariableBindingPathSetHash(false); |
| 18017 |
if (conVarBindSetHash) { |
| 18018 |
for (CConceptVariableBindingPathSetHash::iterator it1 = conVarBindSetHash->begin(), it1End = conVarBindSetHash->end(); it1 != it1End; ++it1) { |
| 18019 |
CConceptVariableBindingPathSetHashData& hashData = it1.value(); |
| 18020 |
CVariableBindingPathSet* varBindSet = hashData.mUseVariableBindingPathSet; |
| 18021 |
CConceptDescriptor* conDes = varBindSet->getConceptDescriptor(); |
| 18022 |
|
| 18023 |
if (varBindSet && conDes) { |
| 18024 |
bool conceptsVarBindsCompatible = false; |
| 18025 |
CConcept* concept = conDes->getConcept(); |
| 18026 |
//TODO: use only specific binding trigger concepts? |
| 18027 |
|
| 18028 |
CVariableBindingPathMap* varBindMap = varBindSet->getVariableBindingPathMap(); |
| 18029 |
for (CVariableBindingPathMap::iterator itVarBind = varBindMap->begin(), itVarBindEnd = varBindMap->end(); itVarBind != itVarBindEnd && !conceptsVarBindsCompatible; ++itVarBind) { |
| 18030 |
CVariableBindingPathMapData& mapData = itVarBind.value(); |
| 18031 |
CVariableBindingPathDescriptor* varBindDes = mapData.getVariableBindingPathDescriptor(); |
| 18032 |
if (varBindDes) { |
| 18033 |
CVariableBindingPath* conVarBindPath = varBindDes->getVariableBindingPath(); |
| 18034 |
if (areVariablePropagationBindingsCompatible(varBindPath, conVarBindPath, calcAlgContext)) { |
| 18035 |
conceptsVarBindsCompatible = true; |
| 18036 |
} |
| 18037 |
} |
| 18038 |
} |
| 18039 |
if (conceptsVarBindsCompatible) { |
| 18040 |
conceptSet.insert(concept); |
| 18041 |
} |
| 18042 |
} |
| 18043 |
} |
| 18044 |
} |
| 18045 |
return conceptSet; |
| 18046 |
} |
| 18047 |
|
| 18048 |
|
| 18049 |
|
| 18050 |
|
| 18051 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::collectIndividualNodeVariablePropagationBindings(CIndividualProcessNode*& individualNode, QHash<cint64, CVariableBindingPath*>& collecingPropagationVariableBindingsHash, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18052 |
bool foundVarPropBindings = false; |
| 18053 |
// checking normal propagation |
| 18054 |
CConceptVariableBindingPathSetHash* conVarBindSetHash = individualNode->getConceptVariableBindingPathSetHash(false); |
| 18055 |
if (conVarBindSetHash) { |
| 18056 |
for (CConceptVariableBindingPathSetHash::iterator it1 = conVarBindSetHash->begin(), it1End = conVarBindSetHash->end(); it1 != it1End; ++it1) { |
| 18057 |
CConceptVariableBindingPathSetHashData& hashData = it1.value(); |
| 18058 |
CVariableBindingPathSet* varBindSet = hashData.mUseVariableBindingPathSet; |
| 18059 |
CConceptDescriptor* conDes = varBindSet->getConceptDescriptor(); |
| 18060 |
|
| 18061 |
if (varBindSet && conDes) { |
| 18062 |
CConcept* concept = conDes->getConcept(); |
| 18063 |
|
| 18064 |
CVariableBindingPathMap* varBindMap = varBindSet->getVariableBindingPathMap(); |
| 18065 |
for (CVariableBindingPathMap::iterator it2 = varBindMap->begin(), it2End = varBindMap->end(); it2 != it2End; ++it2) { |
| 18066 |
CVariableBindingPathMapData& mapData = it2.value(); |
| 18067 |
CVariableBindingPathDescriptor* varBindDes = mapData.getVariableBindingPathDescriptor(); |
| 18068 |
if (varBindDes) { |
| 18069 |
CVariableBindingPath* varBindPath = varBindDes->getVariableBindingPath(); |
| 18070 |
if (varBindPath) { |
| 18071 |
foundVarPropBindings = true; |
| 18072 |
collecingPropagationVariableBindingsHash.insert(varBindPath->getPropagationID(), varBindPath); |
| 18073 |
} |
| 18074 |
} |
| 18075 |
} |
| 18076 |
} |
| 18077 |
} |
| 18078 |
} |
| 18079 |
return foundVarPropBindings; |
| 18080 |
} |
| 18081 |
|
| 18082 |
|
| 18083 |
|
| 18084 |
QSet< QSet<CConcept*> > CCalculationTableauCompletionTaskHandleAlgorithm::getIndividualNodeAssociatedConceptsSetFromVariablePropagationBindingsCached(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18085 |
IndiAssociatedConceptSetCacheData& conceptSetCacheData = mCachedIndiAssociatedConceptSetHash[individualNode]; |
| 18086 |
if (!conceptSetCacheData.mCreated) { |
| 18087 |
STATINC(SIMPLEANALOGOUSPROPAGATIONBLOCKINGCONCEPTSETSBUILDINGCOUNT, calcAlgContext); |
| 18088 |
conceptSetCacheData.mConceptSet = getIndividualNodeAssociatedConceptsSetFromVariablePropagationBindings(individualNode, calcAlgContext); |
| 18089 |
conceptSetCacheData.mCreated = true; |
| 18090 |
} else { |
| 18091 |
STATINC(SIMPLEANALOGOUSPROPAGATIONBLOCKINGCONCEPTSETSCACHEREUSECOUNT, calcAlgContext); |
| 18092 |
} |
| 18093 |
return conceptSetCacheData.mConceptSet; |
| 18094 |
} |
| 18095 |
|
| 18096 |
|
| 18097 |
|
| 18098 |
QSet< QSet<CConcept*> > CCalculationTableauCompletionTaskHandleAlgorithm::getIndividualNodeAssociatedConceptsSetFromVariablePropagationBindings(CIndividualProcessNode*& individualNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18099 |
QSet< QSet<CConcept*> > associatedConceptsSet; |
| 18100 |
|
| 18101 |
QHash<cint64, CVariableBindingPath*> variablePropagationBindingCollectionHash; |
| 18102 |
collectIndividualNodeVariablePropagationBindings(individualNode, variablePropagationBindingCollectionHash, calcAlgContext); |
| 18103 |
|
| 18104 |
for (QHash<cint64, CVariableBindingPath*>::const_iterator it = variablePropagationBindingCollectionHash.constBegin(), itEnd = variablePropagationBindingCollectionHash.constEnd(); it != itEnd; ++it) { |
| 18105 |
CVariableBindingPath* varBindPath = it.value(); |
| 18106 |
const QSet<CConcept*>& associatedConceptSet = getConceptsForCompatibleVariablePropagationBindings(individualNode, varBindPath, calcAlgContext); |
| 18107 |
associatedConceptsSet.insert(associatedConceptSet); |
| 18108 |
} |
| 18109 |
return associatedConceptsSet; |
| 18110 |
} |
| 18111 |
|
| 18112 |
|
| 18113 |
|
| 18114 |
|
| 18115 |
|
| 18116 |
QSet< QList< QSet<CConcept*> > > CCalculationTableauCompletionTaskHandleAlgorithm::getIndividualNodesListAssociatedConceptsSetFromVariablePropagationBindings(CIndividualProcessNode*& individualNode, CIndividualProcessNode*& ancestorIndividualNode, const QList<cint64>& dependentNominalIdList, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18117 |
|
| 18118 |
QHash<cint64, CVariableBindingPath*> variablePropagationBindingCollectionHash; |
| 18119 |
collectIndividualNodeVariablePropagationBindings(individualNode, variablePropagationBindingCollectionHash, calcAlgContext); |
| 18120 |
collectIndividualNodeVariablePropagationBindings(ancestorIndividualNode, variablePropagationBindingCollectionHash, calcAlgContext); |
| 18121 |
// it is not necessary to collect the variable bindings/mappings from the nominal nodes since they are identical for the blocker node and the node that is to be blocked |
| 18122 |
|
| 18123 |
|
| 18124 |
QSet< QList< QSet<CConcept*> > > allVariableMappingsAssociatedConceptsOverNodesListSet; |
| 18125 |
|
| 18126 |
for (QHash<cint64, CVariableBindingPath*>::const_iterator itVarPropBind = variablePropagationBindingCollectionHash.constBegin(), itVarPropBindEnd = variablePropagationBindingCollectionHash.constEnd(); itVarPropBind != itVarPropBindEnd; ++itVarPropBind) { |
| 18127 |
CVariableBindingPath* varBindPath = itVarPropBind.value(); |
| 18128 |
|
| 18129 |
QList< QSet<CConcept*> > associatedConceptsOverNodesList; |
| 18130 |
const QSet<CConcept*>& testIndiAssociatedConceptSet = getConceptsForCompatibleVariablePropagationBindings(individualNode, varBindPath, calcAlgContext); |
| 18131 |
associatedConceptsOverNodesList.append(testIndiAssociatedConceptSet); |
| 18132 |
const QSet<CConcept*>& ancestorTestIndiAssociatedConceptSet = getConceptsForCompatibleVariablePropagationBindings(ancestorIndividualNode, varBindPath, calcAlgContext); |
| 18133 |
associatedConceptsOverNodesList.append(ancestorTestIndiAssociatedConceptSet); |
| 18134 |
|
| 18135 |
for (QList<cint64>::const_iterator itNomId = dependentNominalIdList.constBegin(), itNomIdEnd = dependentNominalIdList.constEnd(); itNomId != itNomIdEnd; ++itNomId) { |
| 18136 |
cint64 nomIndiId = *itNomId; |
| 18137 |
CIndividualProcessNode* nominalIndiNode = getCorrectedNominalIndividualNode(nomIndiId, calcAlgContext); |
| 18138 |
const QSet<CConcept*>& nominalIndiAssociatedConceptSet = getConceptsForCompatibleVariablePropagationBindings(nominalIndiNode, varBindPath, calcAlgContext); |
| 18139 |
associatedConceptsOverNodesList.append(nominalIndiAssociatedConceptSet); |
| 18140 |
} |
| 18141 |
|
| 18142 |
allVariableMappingsAssociatedConceptsOverNodesListSet.insert(associatedConceptsOverNodesList); |
| 18143 |
} |
| 18144 |
return allVariableMappingsAssociatedConceptsOverNodesListSet; |
| 18145 |
} |
| 18146 |
|
| 18147 |
|
| 18148 |
|
| 18149 |
|
| 18150 |
|
| 18151 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isAnonymousVariablePropagationBindingSingleIndividualAnalogousPath(CIndividualProcessNode*& testIndi, CIndividualProcessNode*& blockingIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18152 |
CBlockingVariableBindingsAnalogousPropagationData* testVarBindBlockData = testIndi->getVariableBindingsPropagationBlockingData(false); |
| 18153 |
CBlockingVariableBindingsAnalogousPropagationData* blockingVarBindBlockData = blockingIndi->getVariableBindingsPropagationBlockingData(false); |
| 18154 |
|
| 18155 |
CConceptVariableBindingPathSetHash* testConVarBindPathSetHash = testIndi->getConceptVariableBindingPathSetHash(false); |
| 18156 |
CConceptVariableBindingPathSetHash* blockingConVarBindPathSetHash = blockingIndi->getConceptVariableBindingPathSetHash(false); |
| 18157 |
|
| 18158 |
|
| 18159 |
if (testVarBindBlockData && blockingVarBindBlockData) { |
| 18160 |
if (testConVarBindPathSetHash && testVarBindBlockData->getLastPropagatedVariableBindingDescriptor() == testConVarBindPathSetHash->getLastVariableBindingDescriptionLinker()) { |
| 18161 |
if (blockingConVarBindPathSetHash && blockingVarBindBlockData->getLastPropagatedVariableBindingDescriptor() == blockingConVarBindPathSetHash->getLastVariableBindingDescriptionLinker()) { |
| 18162 |
if (testVarBindBlockData->getLastConceptSetsHashValue() != blockingVarBindBlockData->getLastConceptSetsHashValue()) { |
| 18163 |
STATINC(SIMPLEANALOGOUSPROPAGATIONBLOCKINGCONCEPTSETHASHVALUEDIFFERENCECOUNT, calcAlgContext); |
| 18164 |
return false; |
| 18165 |
} |
| 18166 |
} |
| 18167 |
} |
| 18168 |
} |
| 18169 |
|
| 18170 |
bool testIndiAssociatedConceptSetSetCreated = false;; |
| 18171 |
bool blockingIndiAssociatedConceptSetSetCreated = false;; |
| 18172 |
|
| 18173 |
QSet< QSet<CConcept*> > testIndiAssociatedConceptSetSet; |
| 18174 |
QSet< QSet<CConcept*> > blockingIndiAssociatedConceptSetSet; |
| 18175 |
|
| 18176 |
cint64 testConceptSetsHashValue = 0; |
| 18177 |
cint64 blockingConceptSetsHashValue = 0; |
| 18178 |
|
| 18179 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 18180 |
if (!testVarBindBlockData) { |
| 18181 |
testVarBindBlockData = CObjectAllocator< CBlockingVariableBindingsAnalogousPropagationData >::allocateAndConstruct(taskMemMan); |
| 18182 |
testIndi->setVariableBindingsPropagationBlockingData(testVarBindBlockData); |
| 18183 |
} |
| 18184 |
if (testConVarBindPathSetHash && testVarBindBlockData->getLastPropagatedVariableBindingDescriptor() != testConVarBindPathSetHash->getLastVariableBindingDescriptionLinker()) { |
| 18185 |
testIndiAssociatedConceptSetSet = getIndividualNodeAssociatedConceptsSetFromVariablePropagationBindingsCached(testIndi, calcAlgContext); |
| 18186 |
testConceptSetsHashValue = getBindingsCompatibleConceptSetsHashValue(testIndiAssociatedConceptSetSet, calcAlgContext); |
| 18187 |
testIndiAssociatedConceptSetSetCreated = true; |
| 18188 |
testVarBindBlockData = testIndi->getVariableBindingsPropagationBlockingData(true); |
| 18189 |
if (!testVarBindBlockData) { |
| 18190 |
testVarBindBlockData = CObjectAllocator< CBlockingVariableBindingsAnalogousPropagationData >::allocateAndConstruct(taskMemMan); |
| 18191 |
testIndi->setVariableBindingsPropagationBlockingData(testVarBindBlockData); |
| 18192 |
} |
| 18193 |
testVarBindBlockData->setLastConceptSetsHashValue(testConceptSetsHashValue); |
| 18194 |
testVarBindBlockData->setLastPropagatedVariableBindingDescriptor(testConVarBindPathSetHash->getLastVariableBindingDescriptionLinker()); |
| 18195 |
} |
| 18196 |
|
| 18197 |
|
| 18198 |
if (!blockingVarBindBlockData) { |
| 18199 |
blockingVarBindBlockData = CObjectAllocator< CBlockingVariableBindingsAnalogousPropagationData >::allocateAndConstruct(taskMemMan); |
| 18200 |
blockingIndi->setVariableBindingsPropagationBlockingData(blockingVarBindBlockData); |
| 18201 |
} |
| 18202 |
if (blockingConVarBindPathSetHash && blockingVarBindBlockData->getLastPropagatedVariableBindingDescriptor() != blockingConVarBindPathSetHash->getLastVariableBindingDescriptionLinker()) { |
| 18203 |
blockingIndiAssociatedConceptSetSet = getIndividualNodeAssociatedConceptsSetFromVariablePropagationBindings(blockingIndi, calcAlgContext); |
| 18204 |
blockingConceptSetsHashValue = getBindingsCompatibleConceptSetsHashValue(blockingIndiAssociatedConceptSetSet, calcAlgContext); |
| 18205 |
blockingIndiAssociatedConceptSetSetCreated = true; |
| 18206 |
blockingVarBindBlockData = blockingIndi->getVariableBindingsPropagationBlockingData(true); |
| 18207 |
if (!blockingVarBindBlockData) { |
| 18208 |
blockingVarBindBlockData = CObjectAllocator< CBlockingVariableBindingsAnalogousPropagationData >::allocateAndConstruct(taskMemMan); |
| 18209 |
blockingIndi->setVariableBindingsPropagationBlockingData(blockingVarBindBlockData); |
| 18210 |
} |
| 18211 |
blockingVarBindBlockData->setLastConceptSetsHashValue(blockingConceptSetsHashValue); |
| 18212 |
blockingVarBindBlockData->setLastPropagatedVariableBindingDescriptor(blockingConVarBindPathSetHash->getLastVariableBindingDescriptionLinker()); |
| 18213 |
} |
| 18214 |
|
| 18215 |
|
| 18216 |
if (testVarBindBlockData->getLastConceptSetsHashValue() != blockingVarBindBlockData->getLastConceptSetsHashValue()) { |
| 18217 |
STATINC(SIMPLEANALOGOUSPROPAGATIONBLOCKINGCONCEPTSETHASHVALUEDIFFERENCECOUNT, calcAlgContext); |
| 18218 |
return false; |
| 18219 |
} |
| 18220 |
|
| 18221 |
if (!testIndiAssociatedConceptSetSetCreated) { |
| 18222 |
testIndiAssociatedConceptSetSet = getIndividualNodeAssociatedConceptsSetFromVariablePropagationBindingsCached(testIndi, calcAlgContext); |
| 18223 |
testIndiAssociatedConceptSetSetCreated = true; |
| 18224 |
} |
| 18225 |
if (!blockingIndiAssociatedConceptSetSetCreated) { |
| 18226 |
blockingIndiAssociatedConceptSetSet = getIndividualNodeAssociatedConceptsSetFromVariablePropagationBindings(blockingIndi, calcAlgContext); |
| 18227 |
blockingIndiAssociatedConceptSetSetCreated = true; |
| 18228 |
} |
| 18229 |
|
| 18230 |
|
| 18231 |
KONCLUCE_TASK_ALGORITHM_VARIABLE_PROPAGATION_BLOCKING_DEBUGGING_INSTRUCTION( |
| 18232 |
if (mConfDebuggingWriteData) { |
| 18233 |
mAnalogousPropagationBlockingTestingIndiAssociatedConceptsString = generateDebugIndividualNodeAssociatedConceptsSetString(testIndi, testIndiAssociatedConceptSetSet, calcAlgContext); |
| 18234 |
mAnalogousPropagationBlockingBlockingIndiAssociatedConceptsString = generateDebugIndividualNodeAssociatedConceptsSetString(blockingIndi, blockingIndiAssociatedConceptSetSet, calcAlgContext); |
| 18235 |
|
| 18236 |
|
| 18237 |
if (file.open(QIODevice::Append)) { |
| 18238 |
file.write((QString("\r\n\r\nAnalogous propagation blocking test for testing individual %1 with blocking candidate %2\r\n").arg(testIndi->getIndividualNodeID()).arg(blockingIndi->getIndividualNodeID())).toLocal8Bit()); |
| 18239 |
file.write((QString("\r\nAssociated concepts sets for testing individual %1:\r\n").arg(testIndi->getIndividualNodeID())).toLocal8Bit()); |
| 18240 |
file.write((mAnalogousPropagationBlockingTestingIndiAssociatedConceptsString).toLocal8Bit()); |
| 18241 |
file.write((QString("\r\nAssociated concepts sets for blocking individual %1:\r\n").arg(blockingIndi->getIndividualNodeID())).toLocal8Bit()); |
| 18242 |
file.write((mAnalogousPropagationBlockingBlockingIndiAssociatedConceptsString).toLocal8Bit()); |
| 18243 |
file.close(); |
| 18244 |
} |
| 18245 |
} |
| 18246 |
); |
| 18247 |
|
| 18248 |
|
| 18249 |
|
| 18250 |
if (testIndiAssociatedConceptSetSet != blockingIndiAssociatedConceptSetSet) { |
| 18251 |
return false; |
| 18252 |
} |
| 18253 |
return true; |
| 18254 |
} |
| 18255 |
|
| 18256 |
|
| 18257 |
|
| 18258 |
cint64 CCalculationTableauCompletionTaskHandleAlgorithm::getBindingsCompatibleConceptSetsHashValue(const QSet< QSet<CConcept*> >& associatedConceptSets, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18259 |
|
| 18260 |
cint64 hashValue = associatedConceptSets.size(); |
| 18261 |
for (QSet< QSet<CConcept*> >::const_iterator it = associatedConceptSets.constBegin(), itEnd = associatedConceptSets.constEnd(); it != itEnd; ++it) { |
| 18262 |
const QSet<CConcept*>& conSet = *it; |
| 18263 |
|
| 18264 |
cint64 conSetHashValue = conSet.size(); |
| 18265 |
for (QSet<CConcept*>::const_iterator conIt = conSet.constBegin(), conItEnd = conSet.constEnd(); conIt != conItEnd; ++conIt) { |
| 18266 |
CConcept* concept = *conIt; |
| 18267 |
conSetHashValue += concept->getConceptTag(); |
| 18268 |
} |
| 18269 |
hashValue += conSetHashValue * conSet.size(); |
| 18270 |
} |
| 18271 |
|
| 18272 |
return hashValue; |
| 18273 |
} |
| 18274 |
|
| 18275 |
|
| 18276 |
|
| 18277 |
|
| 18278 |
|
| 18279 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isAnonymousVariablePropagationBindingAnalogousPath(CIndividualProcessNode*& testIndi, CIndividualProcessNode*& blockingIndi, CIndividualNodeBlockingTestData* blockData, bool testContinueBlocking, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18280 |
|
| 18281 |
KONCLUCE_TASK_ALGORITHM_VARIABLE_PROPAGATION_BLOCKING_DEBUGGING_INSTRUCTION( |
| 18282 |
QString writingFolder = "./Debugging/CompletionTasks/"; |
| 18283 |
QFile file(QString("%1%2-task.txt").arg(writingFolder, "propagation-blocking-testing")); |
| 18284 |
if (mConfDebuggingWriteData) { |
| 18285 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 18286 |
if (file.open(QIODevice::WriteOnly)) { |
| 18287 |
file.write(mEndTaskDebugIndiModelString.replace("<br>", "\r\n").toLocal8Bit()); |
| 18288 |
file.close(); |
| 18289 |
} |
| 18290 |
} |
| 18291 |
); |
| 18292 |
|
| 18293 |
if (!mFirstBlockingTestDebugWritten) { |
| 18294 |
mFirstBlockingTestDebugWritten = true; |
| 18295 |
if (mConfDebuggingWriteData) { |
| 18296 |
QString writingFolder = "./Debugging/CompletionTasks/"; |
| 18297 |
mEndTaskDebugIndiModelString = writeGeneratedExtendedDebugIndiModelStringList(QString("%1%2-task.txt").arg(writingFolder, "first-propagation-blocking-testing"), calcAlgContext); |
| 18298 |
} |
| 18299 |
} |
| 18300 |
|
| 18301 |
|
| 18302 |
STATINC(SIMPLEANALOGOUSPROPAGATIONBLOCKINGTESTCOUNT, calcAlgContext); |
| 18303 |
if (!isAnonymousVariablePropagationBindingSingleIndividualAnalogousPath(testIndi, blockingIndi, calcAlgContext)) { |
| 18304 |
STATINC(SIMPLEANALOGOUSPROPAGATIONBLOCKINGFAILCOUNT, calcAlgContext); |
| 18305 |
return false; |
| 18306 |
} |
| 18307 |
|
| 18308 |
|
| 18309 |
CIndividualProcessNode* ancestorIndiNode = getAncestorIndividual(testIndi, calcAlgContext); |
| 18310 |
CIndividualProcessNode* ancestorBlockingIndi = getAncestorIndividual(blockingIndi, calcAlgContext); |
| 18311 |
if (!isAnonymousVariablePropagationBindingSingleIndividualAnalogousPath(ancestorIndiNode, ancestorBlockingIndi, calcAlgContext)) { |
| 18312 |
STATINC(SIMPLEANALOGOUSPROPAGATIONBLOCKINGFAILCOUNT, calcAlgContext); |
| 18313 |
return false; |
| 18314 |
} |
| 18315 |
|
| 18316 |
|
| 18317 |
STATINC(SIMPLEANALOGOUSPROPAGATIONBLOCKINGSUCCESSCOUNT, calcAlgContext); |
| 18318 |
|
| 18319 |
// first: determine order of (nominal) nodes, e.g., current node, ancestor node, dependent nominal 1, dependent nominal 2, ... |
| 18320 |
QList<cint64> dependentNominalIdList; |
| 18321 |
CSuccessorConnectedNominalSet* testIndiSuccConnNomSet = testIndi->getSuccessorNominalConnectionSet(false); |
| 18322 |
if (testIndiSuccConnNomSet) { |
| 18323 |
for (CSuccessorConnectedNominalSet::const_iterator it = testIndiSuccConnNomSet->constBegin(), itEnd = testIndiSuccConnNomSet->constEnd(); it != itEnd; ++it) { |
| 18324 |
dependentNominalIdList.append(*it); |
| 18325 |
} |
| 18326 |
} |
| 18327 |
CSuccessorConnectedNominalSet* blockingIndiSuccConnNomSet = blockingIndi->getSuccessorNominalConnectionSet(false); |
| 18328 |
if (blockingIndiSuccConnNomSet) { |
| 18329 |
for (CSuccessorConnectedNominalSet::const_iterator it = blockingIndiSuccConnNomSet->constBegin(), itEnd = blockingIndiSuccConnNomSet->constEnd(); it != itEnd; ++it) { |
| 18330 |
if (!testIndiSuccConnNomSet || !testIndiSuccConnNomSet->contains(*it)) { |
| 18331 |
dependentNominalIdList.append(*it); |
| 18332 |
} |
| 18333 |
} |
| 18334 |
} |
| 18335 |
if (!dependentNominalIdList.isDetached()) { |
| 18336 |
STATINC(FULLANALOGOUSPROPAGATIONBLOCKINGNOMINALSINVOLVEDCOUNT, calcAlgContext); |
| 18337 |
} |
| 18338 |
|
| 18339 |
|
| 18340 |
STATINC(FULLANALOGOUSPROPAGATIONBLOCKINGTESTCOUNT, calcAlgContext); |
| 18341 |
// second: get associated concepts sets over these nodes |
| 18342 |
QSet< QList< QSet<CConcept*> > > testIndiAllVariableMappingsAssociatedConceptsOverNodesListSet = getIndividualNodesListAssociatedConceptsSetFromVariablePropagationBindings(testIndi, ancestorIndiNode, dependentNominalIdList, calcAlgContext); |
| 18343 |
QSet< QList< QSet<CConcept*> > > blockingIndiAllVariableMappingsAssociatedConceptsOverNodesListSet = getIndividualNodesListAssociatedConceptsSetFromVariablePropagationBindings(blockingIndi, ancestorBlockingIndi, dependentNominalIdList, calcAlgContext); |
| 18344 |
|
| 18345 |
|
| 18346 |
KONCLUCE_TASK_ALGORITHM_VARIABLE_PROPAGATION_BLOCKING_DEBUGGING_INSTRUCTION( |
| 18347 |
if (mConfDebuggingWriteData) { |
| 18348 |
mAnalogousPropagationBlockingTestingIndiAllAssociatedConceptsString = generateDebugIndividualNodesListAssociatedConceptsSetString(testIndi, ancestorIndiNode, dependentNominalIdList, testIndiAllVariableMappingsAssociatedConceptsOverNodesListSet, "testing", calcAlgContext); |
| 18349 |
mAnalogousPropagationBlockingBlockingIndiAllAssociatedConceptsString = generateDebugIndividualNodesListAssociatedConceptsSetString(blockingIndi, ancestorBlockingIndi, dependentNominalIdList, blockingIndiAllVariableMappingsAssociatedConceptsOverNodesListSet, "blocking", calcAlgContext); |
| 18350 |
|
| 18351 |
|
| 18352 |
if (file.open(QIODevice::Append)) { |
| 18353 |
file.write((QString("\r\n\r\n\r\nAdvanced analogous propagation blocking test with dependent nominals for testing individual %1 with blocking candidate %2\r\n").arg(testIndi->getIndividualNodeID()).arg(blockingIndi->getIndividualNodeID())).toLocal8Bit()); |
| 18354 |
QStringList dependentNominalIdStringList; |
| 18355 |
for (cint64 id : dependentNominalIdList) { |
| 18356 |
dependentNominalIdStringList.append(QString::number(id)); |
| 18357 |
} |
| 18358 |
file.write((QString("Dependent nominals %1:\r\n").arg(dependentNominalIdStringList.join(", "))).toLocal8Bit()); |
| 18359 |
|
| 18360 |
|
| 18361 |
file.write((QString("\r\nAssociated concepts sets over nominals for testing individual %1:\r\n").arg(testIndi->getIndividualNodeID())).toLocal8Bit()); |
| 18362 |
file.write((mAnalogousPropagationBlockingTestingIndiAllAssociatedConceptsString).toLocal8Bit()); |
| 18363 |
file.write((QString("\r\nAssociated concepts sets over nominals for blocking individual %1:\r\n").arg(blockingIndi->getIndividualNodeID())).toLocal8Bit()); |
| 18364 |
file.write((mAnalogousPropagationBlockingBlockingIndiAllAssociatedConceptsString).toLocal8Bit()); |
| 18365 |
file.close(); |
| 18366 |
} |
| 18367 |
} |
| 18368 |
); |
| 18369 |
|
| 18370 |
|
| 18371 |
// third: compare |
| 18372 |
if (testIndiAllVariableMappingsAssociatedConceptsOverNodesListSet != blockingIndiAllVariableMappingsAssociatedConceptsOverNodesListSet) { |
| 18373 |
STATINC(FULLANALOGOUSPROPAGATIONBLOCKINGFAILCOUNT, calcAlgContext); |
| 18374 |
return false; |
| 18375 |
} |
| 18376 |
|
| 18377 |
STATINC(FULLANALOGOUSPROPAGATIONBLOCKINGSUCCESSCOUNT, calcAlgContext); |
| 18378 |
return true; |
| 18379 |
} |
| 18380 |
|
| 18381 |
|
| 18382 |
|
| 18383 |
|
| 18384 |
|
| 18385 |
|
| 18386 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugIndividualNodeAssociatedConceptsString(cint64 indiNodeId, const QSet<CConcept*>& associatedConcepts, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18387 |
QMap<cint64, QString> conTagConceptStringMap; |
| 18388 |
for (QSet<CConcept*>::const_iterator it = associatedConcepts.constBegin(), itEnd = associatedConcepts.constEnd(); it != itEnd; ++it) { |
| 18389 |
CConcept* concept(*it); |
| 18390 |
//QString conceptString = CConceptTextFormater::getConceptString(concept, false); |
| 18391 |
QString conceptString = QString::number(concept->getConceptTag());; |
| 18392 |
conTagConceptStringMap.insert(concept->getConceptTag(), conceptString); |
| 18393 |
} |
| 18394 |
|
| 18395 |
QString conceptsString; |
| 18396 |
for (QMap<cint64, QString>::const_iterator it = conTagConceptStringMap.constBegin(), itEnd = conTagConceptStringMap.constEnd(); it != itEnd; ++it) { |
| 18397 |
QString conceptString = it.value(); |
| 18398 |
if (!conceptsString.isEmpty()) { |
| 18399 |
conceptsString += ", " + conceptString; |
| 18400 |
} else { |
| 18401 |
conceptsString = conceptString; |
| 18402 |
} |
| 18403 |
} |
| 18404 |
return QString("%1 : {%2}").arg(indiNodeId).arg(conceptsString); |
| 18405 |
} |
| 18406 |
|
| 18407 |
|
| 18408 |
|
| 18409 |
|
| 18410 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugIndividualNodeAssociatedConceptsSetString(CIndividualProcessNode*& individualNode, const QSet< QSet<CConcept*> >& allVariableMappingsAssociatedConceptsSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18411 |
QStringList allNodeListAssociatedConceptsStringList; |
| 18412 |
|
| 18413 |
for (QSet< QSet<CConcept*> >::const_iterator it = allVariableMappingsAssociatedConceptsSet.constBegin(), itEnd = allVariableMappingsAssociatedConceptsSet.constEnd(); it != itEnd; ++it) { |
| 18414 |
|
| 18415 |
const QSet<CConcept*>& testIndiAssociatedConcepts = *it; |
| 18416 |
QString testIndiAssociatedConceptsString = generateDebugIndividualNodeAssociatedConceptsString(individualNode->getIndividualNodeID(), testIndiAssociatedConcepts, calcAlgContext); |
| 18417 |
allNodeListAssociatedConceptsStringList.append(testIndiAssociatedConceptsString); |
| 18418 |
} |
| 18419 |
|
| 18420 |
return allNodeListAssociatedConceptsStringList.join("<br>\n"); |
| 18421 |
} |
| 18422 |
|
| 18423 |
|
| 18424 |
|
| 18425 |
|
| 18426 |
QString CCalculationTableauCompletionTaskHandleAlgorithm::generateDebugIndividualNodesListAssociatedConceptsSetString(CIndividualProcessNode*& individualNode, CIndividualProcessNode*& ancestorIndividualNode, const QList<cint64>& dependentNominalIdList, const QSet< QList< QSet<CConcept*> > >& allVariableMappingsAssociatedConceptsOverNodesListSet, const QString& nodeNaming, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18427 |
QStringList allNodeListAssociatedConceptsStringList; |
| 18428 |
|
| 18429 |
for (QSet< QList< QSet<CConcept*> > >::const_iterator it = allVariableMappingsAssociatedConceptsOverNodesListSet.constBegin(), itEnd = allVariableMappingsAssociatedConceptsOverNodesListSet.constEnd(); it != itEnd; ++it) { |
| 18430 |
const QList< QSet<CConcept*> >& nodeListAssociatedConcepts = *it; |
| 18431 |
|
| 18432 |
QList< QSet<CConcept*> >::const_iterator it2 = nodeListAssociatedConcepts.constBegin(); |
| 18433 |
|
| 18434 |
QStringList nodeListAssociatedConceptsStringList; |
| 18435 |
const QSet<CConcept*>& testIndiAssociatedConcepts = *it2; |
| 18436 |
QString testIndiAssociatedConceptsString = generateDebugIndividualNodeAssociatedConceptsString(individualNode->getIndividualNodeID(), testIndiAssociatedConcepts, calcAlgContext); |
| 18437 |
nodeListAssociatedConceptsStringList.append(QString("%1 node %2").arg(nodeNaming).arg(testIndiAssociatedConceptsString)); |
| 18438 |
++it2; |
| 18439 |
|
| 18440 |
const QSet<CConcept*>& ancestorTestIndiAssociatedConcepts = *it2; |
| 18441 |
QString ancestorTestIndiAssociatedConceptsString = generateDebugIndividualNodeAssociatedConceptsString(ancestorIndividualNode->getIndividualNodeID(), ancestorTestIndiAssociatedConcepts, calcAlgContext); |
| 18442 |
nodeListAssociatedConceptsStringList.append(QString("%1 predecessor %2").arg(nodeNaming).arg(ancestorTestIndiAssociatedConceptsString)); |
| 18443 |
++it2; |
| 18444 |
|
| 18445 |
QList<cint64>::const_iterator dependentNominalIdIt = dependentNominalIdList.constBegin(); |
| 18446 |
for (QList< QSet<CConcept*> >::const_iterator it2End = nodeListAssociatedConcepts.constEnd(); it2 != it2End; ++it2) { |
| 18447 |
const QSet<CConcept*>& nominalIndiAssociatedConcepts = *it2; |
| 18448 |
QString nominalIndiAssociatedConceptsString = generateDebugIndividualNodeAssociatedConceptsString(*dependentNominalIdIt, nominalIndiAssociatedConcepts, calcAlgContext); |
| 18449 |
nodeListAssociatedConceptsStringList.append(QString("nominal node %1").arg(nominalIndiAssociatedConceptsString)); |
| 18450 |
++dependentNominalIdIt; |
| 18451 |
} |
| 18452 |
|
| 18453 |
allNodeListAssociatedConceptsStringList.append(nodeListAssociatedConceptsStringList.join(" ||| ")); |
| 18454 |
|
| 18455 |
} |
| 18456 |
|
| 18457 |
return allNodeListAssociatedConceptsStringList.join("<br>\n"); |
| 18458 |
} |
| 18459 |
|
| 18460 |
|
| 18461 |
|
| 18462 |
|
| 18463 |
|
| 18464 |
|
| 18465 |
|
| 18466 |
|
| 18467 |
|
| 18468 |
|
| 18469 |
|
| 18470 |
|
| 18471 |
|
| 18472 |
|
| 18473 |
|
| 18474 |
|
| 18475 |
|
| 18476 |
|
| 18477 |
|
| 18478 |
|
| 18479 |
|
| 18480 |
|
| 18481 |
|
| 18482 |
|
| 18483 |
|
| 18484 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptOptimizedBlocking(CIndividualProcessNode*& testIndi, CIndividualProcessNode*& blockingIndi, CIndividualNodeBlockingTestData* blockData, bool testContinueBlocking, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18485 |
STATINC(OPTIMIZEDBLOCKINGTESTCOUNT,calcAlgContext); |
| 18486 |
CIndividualProcessNode* wNode = testIndi; |
| 18487 |
CIndividualProcessNode* wPredNode = blockingIndi; |
| 18488 |
|
| 18489 |
CReapplyConceptLabelSet* wSubConSet = wNode->getReapplyConceptLabelSet(false); |
| 18490 |
CReapplyConceptLabelSet* wPredSuperConSet = wPredNode->getReapplyConceptLabelSet(false); |
| 18491 |
CConceptDescriptor* firstNotEntailedConDes = nullptr; |
| 18492 |
// B1 test |
| 18493 |
bool equalSet = false; |
| 18494 |
bool subSet = isLabelConceptSubSet(wSubConSet,wPredSuperConSet,&firstNotEntailedConDes,&equalSet,calcAlgContext); |
| 18495 |
if (!subSet) { |
| 18496 |
return false; |
| 18497 |
} |
| 18498 |
|
| 18499 |
|
| 18500 |
CIndividualProcessNode* vNode = getAncestorIndividual(wNode,calcAlgContext); |
| 18501 |
CReapplyConceptLabelSet* vConSet = vNode->getReapplyConceptLabelSet(false); |
| 18502 |
// B2 test |
| 18503 |
|
| 18504 |
CSuccessorRoleHash* ancRoleHash = wNode->getSuccessorRoleHash(false); |
| 18505 |
if (!ancRoleHash) { |
| 18506 |
// no inverse roles |
| 18507 |
return true; |
| 18508 |
} |
| 18509 |
// assume blocking is possible |
| 18510 |
bool blocked = true; |
| 18511 |
|
| 18512 |
cint64 violatingB2Restrictions = 0; |
| 18513 |
cint64 violatingNonDetB2Restrictions = 0; |
| 18514 |
|
| 18515 |
CSuccessorRoleIterator baseAncRoleIt = ancRoleHash->getSuccessorRoleIterator(vNode->getIndividualNodeID()); |
| 18516 |
CSuccessorRoleIterator ancRoleIt1 = baseAncRoleIt; |
| 18517 |
while (ancRoleIt1.hasNext() && blocked) { |
| 18518 |
CIndividualLinkEdge* link = ancRoleIt1.next(); |
| 18519 |
// from w to v is a edge labeled with r, w is an inv(r)-successor of v |
| 18520 |
CRole* role = link->getLinkRole(); |
| 18521 |
// B2, (ALL r. C) in w' |
| 18522 |
CReapplyQueueIterator reapplyQuIt = wPredNode->getRoleReapplyIterator(role,false); |
| 18523 |
while (reapplyQuIt.hasNext() && blocked) { |
| 18524 |
CReapplyConceptDescriptor* reapplyConDes = reapplyQuIt.next(); |
| 18525 |
CConceptDescriptor* conDes = reapplyConDes->getConceptDescriptor(); |
| 18526 |
CConcept* concept = conDes->getConcept(); |
| 18527 |
bool conNeg = conDes->isNegated(); |
| 18528 |
cint64 conOpCode = concept->getOperatorCode(); |
| 18529 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 18530 |
if (!conNeg && (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE)) || conNeg && conOpCode == CCSOME) { |
| 18531 |
// B2a |
| 18532 |
CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); |
| 18533 |
while (opLinkerIt && blocked) { |
| 18534 |
CConcept* opConcept = opLinkerIt->getData(); |
| 18535 |
bool opConNeg = opLinkerIt->isNegated() ^ conNeg; |
| 18536 |
if (!vConSet->containsConcept(opConcept,opConNeg)) { |
| 18537 |
blocked = false; |
| 18538 |
CDependencyTrackPoint* depTrackPoint = conDes->getDependencyTrackPoint(); |
| 18539 |
bool nonDetDependency = depTrackPoint->getBranchingTag() > 0; |
| 18540 |
++violatingB2Restrictions; |
| 18541 |
if (nonDetDependency) { |
| 18542 |
++violatingNonDetB2Restrictions; |
| 18543 |
} |
| 18544 |
} |
| 18545 |
opLinkerIt = opLinkerIt->getNext(); |
| 18546 |
} |
| 18547 |
} else if (!conNeg && (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_TYPE))) { |
| 18548 |
// B2b, transitive and automate transitions |
| 18549 |
if (!hasOptimizedBlockingB2AutomateTransitionOperands(concept,role,vConSet,calcAlgContext)) { |
| 18550 |
blocked = false; |
| 18551 |
CDependencyTrackPoint* depTrackPoint = conDes->getDependencyTrackPoint(); |
| 18552 |
bool nonDetDependency = depTrackPoint->getBranchingTag() > 0; |
| 18553 |
++violatingB2Restrictions; |
| 18554 |
if (nonDetDependency) { |
| 18555 |
++violatingNonDetB2Restrictions; |
| 18556 |
} |
| 18557 |
} |
| 18558 |
} |
| 18559 |
} |
| 18560 |
} |
| 18561 |
|
| 18562 |
CReapplyRoleSuccessorHash* wPredSuccHash = wPredNode->getReapplyRoleSuccessorHash(false); |
| 18563 |
if (blocked) { |
| 18564 |
|
| 18565 |
// test c-blocked and a-blocked specific parts |
| 18566 |
// B3, B5 |
| 18567 |
|
| 18568 |
bool cBlocked = true; |
| 18569 |
bool aBlocked = true; |
| 18570 |
CSuccessorRoleIterator ancRoleIt2 = baseAncRoleIt; |
| 18571 |
while (ancRoleIt2.hasNext() && blocked) { |
| 18572 |
CIndividualLinkEdge* link = ancRoleIt2.next(); |
| 18573 |
CRole* role = link->getLinkRole(); |
| 18574 |
// B?, (ATMOST n r. C) in w' |
| 18575 |
CReapplyQueueIterator reapplyQuIt = wPredNode->getRoleReapplyIterator(role,false); |
| 18576 |
while (reapplyQuIt.hasNext() && blocked) { |
| 18577 |
CReapplyConceptDescriptor* reapplyConDes = reapplyQuIt.next(); |
| 18578 |
CConceptDescriptor* conDes = reapplyConDes->getConceptDescriptor(); |
| 18579 |
CConcept* concept = conDes->getConcept(); |
| 18580 |
bool conNeg = conDes->isNegated(); |
| 18581 |
cint64 conOpCode = concept->getOperatorCode(); |
| 18582 |
|
| 18583 |
bool checkBlockerRoleCardinality = false; |
| 18584 |
cint64 blockerMinSuccCardinality = 0; |
| 18585 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 18586 |
|
| 18587 |
if (!conNeg && conOpCode == CCATMOST || conNeg && conOpCode == CCATLEAST) { |
| 18588 |
cint64 cardinality = concept->getParameter(); |
| 18589 |
if (conNeg) { |
| 18590 |
--cardinality; |
| 18591 |
} |
| 18592 |
|
| 18593 |
CSortedNegLinker<CConcept*>* opLinkerIt = opLinker; |
| 18594 |
if (!opLinkerIt) { |
| 18595 |
cBlocked = false; |
| 18596 |
if (!checkBlockerRoleCardinality) { |
| 18597 |
checkBlockerRoleCardinality = true; |
| 18598 |
blockerMinSuccCardinality = cardinality; |
| 18599 |
} |
| 18600 |
} |
| 18601 |
while (opLinkerIt) { |
| 18602 |
CConcept* opConcept = opLinkerIt->getData(); |
| 18603 |
bool opConNeg = opLinkerIt->isNegated(); |
| 18604 |
bool containsNeg = false; |
| 18605 |
if (!vConSet->containsConcept(opConcept,&containsNeg)) { |
| 18606 |
// contains not positive and negative |
| 18607 |
cBlocked = false; |
| 18608 |
if (!checkBlockerRoleCardinality) { |
| 18609 |
checkBlockerRoleCardinality = true; |
| 18610 |
blockerMinSuccCardinality = cardinality; |
| 18611 |
} |
| 18612 |
} else { |
| 18613 |
if (containsNeg == opConNeg) { |
| 18614 |
cBlocked = false; |
| 18615 |
if (!checkBlockerRoleCardinality) { |
| 18616 |
checkBlockerRoleCardinality = true; |
| 18617 |
blockerMinSuccCardinality = cardinality; |
| 18618 |
} |
| 18619 |
} |
| 18620 |
} |
| 18621 |
opLinkerIt = opLinkerIt->getNext(); |
| 18622 |
} |
| 18623 |
} |
| 18624 |
|
| 18625 |
|
| 18626 |
if (checkBlockerRoleCardinality) { |
| 18627 |
// count |
| 18628 |
cint64 minRoleCardinality = 0; |
| 18629 |
if (wPredSuccHash) { |
| 18630 |
CRoleSuccessorLinkIterator succIt = wPredSuccHash->getRoleSuccessorLinkIterator(role); |
| 18631 |
while (succIt.hasNext() && blocked) { |
| 18632 |
CIndividualLinkEdge* succLink = succIt.next(); |
| 18633 |
CIndividualProcessNode* succIndiNode = getSuccessorIndividual(wPredNode,succLink,calcAlgContext); |
| 18634 |
if (succIndiNode->isNominalIndividualNode() || succIndiNode->getNominalIndividual() || succIndiNode->getIndividualAncestorDepth() > wPredNode->getIndividualAncestorDepth()) { |
| 18635 |
if (!opLinker) { |
| 18636 |
++minRoleCardinality; |
| 18637 |
if (minRoleCardinality >= blockerMinSuccCardinality) { |
| 18638 |
blocked = false; |
| 18639 |
} |
| 18640 |
} else { |
| 18641 |
if (containsIndividualNodeConcepts(succIndiNode,opLinker,false,calcAlgContext)) { |
| 18642 |
++minRoleCardinality; |
| 18643 |
if (minRoleCardinality >= blockerMinSuccCardinality) { |
| 18644 |
blocked = false; |
| 18645 |
} |
| 18646 |
} |
| 18647 |
} |
| 18648 |
} |
| 18649 |
} |
| 18650 |
} |
| 18651 |
} |
| 18652 |
} |
| 18653 |
} |
| 18654 |
|
| 18655 |
if (cBlocked) { |
| 18656 |
// test whether B6 holds |
| 18657 |
CReapplyConceptLabelSetIterator vConSetIt = vConSet->getConceptLabelSetIterator(false,false,false); |
| 18658 |
while (cBlocked && vConSetIt.hasNext()) { |
| 18659 |
CConceptDescriptor* conDes = vConSetIt.next(); |
| 18660 |
CConcept* concept = conDes->getConcept(); |
| 18661 |
bool conNeg = conDes->isNegated(); |
| 18662 |
cint64 conOpCode = concept->getOperatorCode(); |
| 18663 |
if (!conNeg && conOpCode == CCATLEAST || conNeg && conOpCode == CCATMOST) { |
| 18664 |
cint64 cardinality = concept->getParameter() + 1*conNeg; |
| 18665 |
if (cardinality > 1) { |
| 18666 |
CRole* role = concept->getRole(); |
| 18667 |
if (hasIndividualsLink(vNode,wNode,role,false,calcAlgContext)) { |
| 18668 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 18669 |
if (opLinker) { |
| 18670 |
if (!containsIndividualNodeConcepts(wSubConSet,opLinker,!conNeg,calcAlgContext)) { |
| 18671 |
cBlocked = false; |
| 18672 |
} |
| 18673 |
} else { |
| 18674 |
cBlocked = false; |
| 18675 |
} |
| 18676 |
} |
| 18677 |
} |
| 18678 |
} |
| 18679 |
} |
| 18680 |
if (cBlocked) { |
| 18681 |
return true; |
| 18682 |
} |
| 18683 |
} |
| 18684 |
} |
| 18685 |
|
| 18686 |
if (blocked) { |
| 18687 |
// test whether B4 holds |
| 18688 |
CReapplyConceptLabelSetIterator blockerConLabSetIt = wPredSuperConSet->getConceptLabelSetIterator(false,false,false); |
| 18689 |
while (blockerConLabSetIt.hasNext() && blocked) { |
| 18690 |
CConceptDescriptor* conDes = blockerConLabSetIt.next(); |
| 18691 |
CConcept* concept = conDes->getConcept(); |
| 18692 |
bool conNeg = conDes->isNegated(); |
| 18693 |
cint64 conOpCode = concept->getOperatorCode(); |
| 18694 |
CRole* role = concept->getRole(); |
| 18695 |
cint64 cardinality = concept->getParameter(); |
| 18696 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 18697 |
bool needsRestrictionTest = false; |
| 18698 |
bool negateOps = false; |
| 18699 |
if (!conNeg && conOpCode == CCATLEAST || conNeg && conOpCode == CCATMOST) { |
| 18700 |
if (conNeg) { |
| 18701 |
++cardinality; |
| 18702 |
} |
| 18703 |
needsRestrictionTest = true; |
| 18704 |
} else if (!conNeg && (conOpCode == CCSOME || conOpCode == CCAQSOME) || conNeg && conOpCode == CCALL) { |
| 18705 |
cardinality = 1; |
| 18706 |
needsRestrictionTest = true; |
| 18707 |
negateOps = conNeg; |
| 18708 |
} |
| 18709 |
|
| 18710 |
if (needsRestrictionTest) { |
| 18711 |
// B4b |
| 18712 |
bool restrictionHolds = false; |
| 18713 |
if (hasIndividualsLink(wNode,vNode,role,false,calcAlgContext)) { |
| 18714 |
if (containsIndividualNodeConcepts(vConSet,opLinker,negateOps,calcAlgContext)) { |
| 18715 |
restrictionHolds = true; |
| 18716 |
} |
| 18717 |
} |
| 18718 |
if (!restrictionHolds) { |
| 18719 |
// B4a |
| 18720 |
// w' needs m role-successors |
| 18721 |
cint64 minRoleCardinality = 0; |
| 18722 |
if (wPredSuccHash) { |
| 18723 |
CRoleSuccessorLinkIterator succIt = wPredSuccHash->getRoleSuccessorLinkIterator(role); |
| 18724 |
while (succIt.hasNext()) { |
| 18725 |
CIndividualLinkEdge* link = succIt.next(); |
| 18726 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(wPredNode,link,calcAlgContext); |
| 18727 |
if (succIndi->isNominalIndividualNode() || succIndi->getNominalIndividual() || succIndi->getIndividualAncestorDepth() > wPredNode->getIndividualAncestorDepth()) { |
| 18728 |
if (!opLinker) { |
| 18729 |
++minRoleCardinality; |
| 18730 |
} else { |
| 18731 |
if (containsIndividualNodeConcepts(succIndi,opLinker,negateOps,calcAlgContext)) { |
| 18732 |
++minRoleCardinality; |
| 18733 |
} |
| 18734 |
} |
| 18735 |
} |
| 18736 |
} |
| 18737 |
} |
| 18738 |
if (minRoleCardinality < cardinality) { |
| 18739 |
blocked = false; |
| 18740 |
} |
| 18741 |
} |
| 18742 |
} |
| 18743 |
} |
| 18744 |
} |
| 18745 |
|
| 18746 |
|
| 18747 |
if (!blocked && blockAltData && mConfSignatureMirroringBlocking && mOptSignatureMirroringBlockingInBlocking) { |
| 18748 |
cint64 diffConceptCount = wPredSuperConSet->getConceptCount() - wSubConSet->getConceptCount(); |
| 18749 |
|
| 18750 |
CBlockingAlternativeSignatureBlockingCandidateData* sigBlockCandData = nullptr; |
| 18751 |
if (*blockAltData) { |
| 18752 |
sigBlockCandData = dynamic_cast<CBlockingAlternativeSignatureBlockingCandidateData*>(*blockAltData); |
| 18753 |
} |
| 18754 |
if (!sigBlockCandData) { |
| 18755 |
CMemoryAllocationManager* tempMemMan = calcAlgContext->getUsedTemporaryMemoryAllocationManager(); |
| 18756 |
sigBlockCandData = CObjectAllocator<CBlockingAlternativeSignatureBlockingCandidateData>::allocateAndConstruct(tempMemMan); |
| 18757 |
sigBlockCandData->initSignatureBlockingCandidateData(wPredNode,violatingB2Restrictions,violatingNonDetB2Restrictions,diffConceptCount); |
| 18758 |
*blockAltData = sigBlockCandData; |
| 18759 |
} else { |
| 18760 |
bool lessViolNonDetRes = violatingNonDetB2Restrictions < sigBlockCandData->getViolatedNonDeterministicRestrictionCount(); |
| 18761 |
bool lessViolRes = violatingB2Restrictions < sigBlockCandData->getViolatedRestrictionCount(); |
| 18762 |
bool lessConcepts = diffConceptCount < sigBlockCandData->getConceptDifferenceCount(); |
| 18763 |
|
| 18764 |
double newScore = violatingNonDetB2Restrictions*1.2 + violatingB2Restrictions + diffConceptCount*0.1; |
| 18765 |
double oldScore = sigBlockCandData->getViolatedNonDeterministicRestrictionCount()*1.2 + sigBlockCandData->getViolatedRestrictionCount() + sigBlockCandData->getConceptDifferenceCount()*0.1; |
| 18766 |
|
| 18767 |
if (newScore > oldScore) { |
| 18768 |
sigBlockCandData->initSignatureBlockingCandidateData(wPredNode,violatingB2Restrictions,violatingNonDetB2Restrictions,diffConceptCount); |
| 18769 |
} |
| 18770 |
} |
| 18771 |
|
| 18772 |
|
| 18773 |
|
| 18774 |
} |
| 18775 |
|
| 18776 |
return blocked; |
| 18777 |
} |
| 18778 |
|
| 18779 |
|
| 18780 |
|
| 18781 |
|
| 18782 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::containsIndividualNodeConcept(CIndividualProcessNode*& testIndi, CConcept* conTest, bool* containsNegation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18783 |
CReapplyConceptLabelSet* conLabelSet = testIndi->getReapplyConceptLabelSet(false); |
| 18784 |
return containsIndividualNodeConcept(conLabelSet,conTest,containsNegation,calcAlgContext); |
| 18785 |
} |
| 18786 |
|
| 18787 |
|
| 18788 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::containsIndividualNodeConcept(CReapplyConceptLabelSet* conLabelSet, CConcept* conTest, bool* containsNegation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18789 |
bool containsNeg = false; |
| 18790 |
if (!conLabelSet->containsConcept(conTest,&containsNeg)) { |
| 18791 |
return false; |
| 18792 |
} |
| 18793 |
if (containsNegation) { |
| 18794 |
if (containsNeg) { |
| 18795 |
*containsNegation = true; |
| 18796 |
} else { |
| 18797 |
*containsNegation = false; |
| 18798 |
} |
| 18799 |
} |
| 18800 |
return true; |
| 18801 |
} |
| 18802 |
|
| 18803 |
|
| 18804 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::containsIndividualNodeConcepts(CReapplyConceptLabelSet* conLabelSet, CSortedNegLinker<CConcept*>* conTestLinkerIt, bool* containsNegation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18805 |
bool containsAllNegated = true; |
| 18806 |
bool containsAllNonNegated = true; |
| 18807 |
if (!conTestLinkerIt) { |
| 18808 |
// interpret as top |
| 18809 |
if (containsNegation) { |
| 18810 |
*containsNegation = false; |
| 18811 |
} |
| 18812 |
containsAllNegated = false; |
| 18813 |
} |
| 18814 |
while (conTestLinkerIt && (containsAllNegated || containsAllNonNegated)) { |
| 18815 |
CConcept* concept = conTestLinkerIt->getData(); |
| 18816 |
bool conNeg = conTestLinkerIt->isNegated(); |
| 18817 |
bool containsNeg = false; |
| 18818 |
if (!conLabelSet->containsConcept(concept,&containsNeg)) { |
| 18819 |
return false; |
| 18820 |
} |
| 18821 |
if (containsNeg == conNeg) { |
| 18822 |
containsAllNegated = false; |
| 18823 |
} else { |
| 18824 |
containsAllNonNegated = false; |
| 18825 |
} |
| 18826 |
conTestLinkerIt = conTestLinkerIt->getNext(); |
| 18827 |
} |
| 18828 |
if (containsNegation) { |
| 18829 |
if (containsAllNegated) { |
| 18830 |
*containsNegation = true; |
| 18831 |
return true; |
| 18832 |
} |
| 18833 |
if (containsAllNonNegated) { |
| 18834 |
*containsNegation = false; |
| 18835 |
return true; |
| 18836 |
} |
| 18837 |
} |
| 18838 |
if (containsAllNonNegated) { |
| 18839 |
return true; |
| 18840 |
} |
| 18841 |
if (containsAllNegated) { |
| 18842 |
return true; |
| 18843 |
} |
| 18844 |
return false; |
| 18845 |
} |
| 18846 |
|
| 18847 |
|
| 18848 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::containsIndividualNodeConcepts(CReapplyConceptLabelSet* conLabelSet, CSortedNegLinker<CConcept*>* conTestLinkerIt, bool negated, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18849 |
while (conTestLinkerIt) { |
| 18850 |
CConcept* concept = conTestLinkerIt->getData(); |
| 18851 |
bool conNeg = conTestLinkerIt->isNegated() ^ negated; |
| 18852 |
if (!conLabelSet->containsConcept(concept,conNeg)) { |
| 18853 |
return false; |
| 18854 |
} |
| 18855 |
conTestLinkerIt = conTestLinkerIt->getNext(); |
| 18856 |
} |
| 18857 |
return true; |
| 18858 |
} |
| 18859 |
|
| 18860 |
|
| 18861 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::containsIndividualNodeConcepts(CIndividualProcessNode*& testIndi, CSortedNegLinker<CConcept*>* conTestLinkerIt, bool negated, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18862 |
CReapplyConceptLabelSet* conLabelSet = testIndi->getReapplyConceptLabelSet(false); |
| 18863 |
return containsIndividualNodeConcepts(conLabelSet,conTestLinkerIt,negated,calcAlgContext); |
| 18864 |
} |
| 18865 |
|
| 18866 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::containsIndividualNodeConcepts(CIndividualProcessNode*& testIndi, CSortedNegLinker<CConcept*>* conTestLinkerIt, bool* containsNegation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18867 |
CReapplyConceptLabelSet* conLabelSet = testIndi->getReapplyConceptLabelSet(false); |
| 18868 |
return containsIndividualNodeConcepts(conLabelSet,conTestLinkerIt,containsNegation,calcAlgContext); |
| 18869 |
} |
| 18870 |
|
| 18871 |
|
| 18872 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::containsIndividualNodeConcepts(CIndividualProcessNode*& testIndi, CSortedNegLinker<CConcept*>* conTestLinkerIt, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18873 |
CReapplyConceptLabelSet* conLabelSet = testIndi->getReapplyConceptLabelSet(false); |
| 18874 |
return containsIndividualNodeConcepts(conLabelSet,conTestLinkerIt,(bool*)nullptr,calcAlgContext); |
| 18875 |
} |
| 18876 |
|
| 18877 |
|
| 18878 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptSubSetBlocking(CIndividualProcessNode*& testIndi, CIndividualProcessNode*& blockingIndi, CIndividualNodeBlockingTestData* blockData, bool testContinueBlocking, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18879 |
STATINC(SUBSETBLOCKINGTESTCOUNT,calcAlgContext); |
| 18880 |
if (testContinueBlocking) { |
| 18881 |
// is still sub set when added something to blocker individual node |
| 18882 |
return true; |
| 18883 |
} |
| 18884 |
CReapplyConceptLabelSet* subConSet = testIndi->getReapplyConceptLabelSet(false); |
| 18885 |
CReapplyConceptLabelSet* superConSet = blockingIndi->getReapplyConceptLabelSet(false); |
| 18886 |
CConceptDescriptor* firstNotEntailedConDes = nullptr; |
| 18887 |
bool subSet = isLabelConceptSubSet(subConSet,superConSet,&firstNotEntailedConDes,nullptr,calcAlgContext); |
| 18888 |
return subSet; |
| 18889 |
} |
| 18890 |
|
| 18891 |
|
| 18892 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptEqualBlocking(CIndividualProcessNode*& testIndi, CIndividualProcessNode*& blockingIndi, CIndividualNodeBlockingTestData* blockData, bool testContinueBlocking, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18893 |
STATINC(EQUALSETBLOCKINGTESTCOUNT,calcAlgContext); |
| 18894 |
CReapplyConceptLabelSet* conSet1 = testIndi->getReapplyConceptLabelSet(false); |
| 18895 |
CReapplyConceptLabelSet* conSet2 = blockingIndi->getReapplyConceptLabelSet(false); |
| 18896 |
return isLabelConceptEqualSet(conSet1,conSet2,calcAlgContext); |
| 18897 |
} |
| 18898 |
|
| 18899 |
|
| 18900 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptEqualPairwiseBlocking(CIndividualProcessNode*& testIndi, CIndividualProcessNode*& blockingIndi, CIndividualNodeBlockingTestData* blockData, bool testContinueBlocking, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18901 |
STATINC(PAIRWISEEQUALSETBLOCKINGTESTCOUNT,calcAlgContext); |
| 18902 |
CIndividualProcessNode* ancTestIndi = getAncestorIndividual(testIndi,calcAlgContext); |
| 18903 |
if (!ancTestIndi) { |
| 18904 |
return false; |
| 18905 |
} |
| 18906 |
CIndividualProcessNode* ancBlockingIndi = getAncestorIndividual(blockingIndi,calcAlgContext); |
| 18907 |
if (!ancBlockingIndi) { |
| 18908 |
return false; |
| 18909 |
} |
| 18910 |
CIndividualLinkEdge* testIndiAncLink = testIndi->getAncestorLink(); |
| 18911 |
CIndividualLinkEdge* blockingIndiAncLink = testIndi->getAncestorLink(); |
| 18912 |
if (testIndiAncLink->getLinkRole() != blockingIndiAncLink->getLinkRole()) { |
| 18913 |
return false; |
| 18914 |
} |
| 18915 |
CReapplyConceptLabelSet* conSet1 = testIndi->getReapplyConceptLabelSet(false); |
| 18916 |
CReapplyConceptLabelSet* conSet1Pair = blockingIndi->getReapplyConceptLabelSet(false); |
| 18917 |
CReapplyConceptLabelSet* conSet2 = ancTestIndi->getReapplyConceptLabelSet(false); |
| 18918 |
CReapplyConceptLabelSet* conSet2Pair = ancBlockingIndi->getReapplyConceptLabelSet(false); |
| 18919 |
return isPairwiseLabelConceptEqualSet(conSet1,conSet1Pair,conSet2,conSet2Pair,calcAlgContext); |
| 18920 |
} |
| 18921 |
|
| 18922 |
|
| 18923 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodeBlocking(CIndividualProcessNode*& testIndi, CIndividualProcessNode*& blockingIndi, CIndividualNodeBlockingTestData* blockData, bool testContinueBlocking, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18924 |
STATINC(INDINODEBLOCKINGTESTCOUNT,calcAlgContext); |
| 18925 |
// TODO: check config, first test concept set sizes |
| 18926 |
|
| 18927 |
CReapplyConceptLabelSet* testConSet = testIndi->getReapplyConceptLabelSet(false); |
| 18928 |
CReapplyConceptLabelSet* blockingConSet = blockingIndi->getReapplyConceptLabelSet(false); |
| 18929 |
cint64 testConSetCount = testConSet->getConceptCount(); |
| 18930 |
cint64 blockingConSetCount = blockingConSet->getConceptCount(); |
| 18931 |
if (testConSetCount > blockingConSetCount) { |
| 18932 |
return false; |
| 18933 |
} |
| 18934 |
|
| 18935 |
if (!testContinueBlocking) { |
| 18936 |
CConceptDescriptor* initConDes = testIndi->getIndividualInitializationConcept(); |
| 18937 |
if (initConDes) { |
| 18938 |
if (!blockingIndi->getReapplyConceptLabelSet(false)->containsConceptDescriptor(initConDes)) { |
| 18939 |
return false; |
| 18940 |
} |
| 18941 |
} |
| 18942 |
} |
| 18943 |
|
| 18944 |
|
| 18945 |
|
| 18946 |
bool testProcessingBlocking = false; |
| 18947 |
if (mOptDetExpPreporcessing) { |
| 18948 |
testProcessingBlocking = true; |
| 18949 |
} |
| 18950 |
|
| 18951 |
|
| 18952 |
bool blockingConcepts = false; |
| 18953 |
|
| 18954 |
if (testProcessingBlocking || mConfSubSetBlocking) { |
| 18955 |
if (isLabelConceptSubSetBlocking(testIndi,blockingIndi,blockData,testContinueBlocking,blockAltData,calcAlgContext)) { |
| 18956 |
blockingConcepts = true; |
| 18957 |
} |
| 18958 |
} else if (mConfOptimizedSubSetBlocking) { |
| 18959 |
if (isLabelConceptOptimizedBlocking(testIndi,blockingIndi,blockData,testContinueBlocking,blockAltData,calcAlgContext)) { |
| 18960 |
blockingConcepts = true; |
| 18961 |
} |
| 18962 |
} else if (mConfEqualSetBlocking) { |
| 18963 |
if (isLabelConceptEqualBlocking(testIndi,blockingIndi,blockData,testContinueBlocking,blockAltData,calcAlgContext)) { |
| 18964 |
blockingConcepts = true; |
| 18965 |
} |
| 18966 |
} else if (mConfPairwiseEqualSetBlocking) { |
| 18967 |
if (isLabelConceptEqualPairwiseBlocking(testIndi,blockingIndi,blockData,testContinueBlocking,blockAltData,calcAlgContext)) { |
| 18968 |
blockingConcepts = true; |
| 18969 |
} |
| 18970 |
} |
| 18971 |
|
| 18972 |
bool blockingPropBindings = false; |
| 18973 |
if (blockingConcepts) { |
| 18974 |
if (mOptAnalogousPropagationPathBlocking) { |
| 18975 |
blockingPropBindings = isAnonymousVariablePropagationBindingAnalogousPath(testIndi, blockingIndi, blockData, testContinueBlocking, blockAltData, calcAlgContext); |
| 18976 |
} else { |
| 18977 |
blockingPropBindings = isNominalVariablePropagationBindingSubSet(testIndi, blockingIndi, blockData, testContinueBlocking, blockAltData, calcAlgContext); |
| 18978 |
} |
| 18979 |
} |
| 18980 |
|
| 18981 |
return blockingConcepts && blockingPropBindings; |
| 18982 |
} |
| 18983 |
|
| 18984 |
|
| 18985 |
|
| 18986 |
|
| 18987 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::detectIndividualNodeBlockedStatus(CIndividualProcessNode*& testIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 18988 |
STATINC(DETECTINDINODEBLOCKINGSTATUSCOUNT,calcAlgContext); |
| 18989 |
bool previousProcessingBlocked = false; |
| 18990 |
bool previousBlocked = testIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFDIRECTBLOCKED | CIndividualProcessNode::PRFINDIRECTBLOCKED | CIndividualProcessNode::PRFPROCESSINGBLOCKED); |
| 18991 |
if (!mOptDetExpPreporcessing && testIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGBLOCKED)) { |
| 18992 |
testIndi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGBLOCKED); |
| 18993 |
previousProcessingBlocked = true; |
| 18994 |
} else if (mOptDetExpPreporcessing && testIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGBLOCKED)) { |
| 18995 |
return true; |
| 18996 |
} else { |
| 18997 |
if (!testIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEANCESTORMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEDIRECTMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEBLOCKERMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS)) { |
| 18998 |
return previousBlocked; |
| 18999 |
} |
| 19000 |
} |
| 19001 |
|
| 19002 |
|
| 19003 |
bool previousIndirectBlocked = testIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINDIRECTBLOCKED); |
| 19004 |
if (previousIndirectBlocked) { |
| 19005 |
if (!testIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS)) { |
| 19006 |
testIndi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEANCESTORMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEDIRECTMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEBLOCKERMODIFIED); |
| 19007 |
return true; |
| 19008 |
} |
| 19009 |
} |
| 19010 |
|
| 19011 |
bool previousDirectBlocked = testIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFDIRECTBLOCKED); |
| 19012 |
|
| 19013 |
CIndividualProcessNode* ancTestIndi = testIndi; |
| 19014 |
CIndividualProcessNode* blockingIndi = nullptr; |
| 19015 |
|
| 19016 |
CBlockingAlternativeData* blockAltData = nullptr; |
| 19017 |
|
| 19018 |
bool blocked = false; |
| 19019 |
|
| 19020 |
bool blockingTesting = true; |
| 19021 |
if (!previousBlocked && mCompGraphCacheHandler && mConfIgnoreBlockingCompletionGraphCachedNonBlockingNodes) { |
| 19022 |
if (mCompGraphCacheHandler->isIndividualNodeCompletionGraphConsistencePresentNonBlocked(testIndi, calcAlgContext)) { |
| 19023 |
blockingTesting = false; |
| 19024 |
} |
| 19025 |
} |
| 19026 |
|
| 19027 |
|
| 19028 |
|
| 19029 |
// test each modified ancestor |
| 19030 |
while (blockingTesting && !blocked && ancTestIndi && ancTestIndi->isBlockableIndividual() && !ancTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCONCRETEDATAINDINODE) && |
| 19031 |
ancTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEANCESTORMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEDIRECTMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEBLOCKERMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS) && |
| 19032 |
!ancTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING)) { |
| 19033 |
STATINC(DETECTANCINDINODEBLOCKINGSTATUSCOUNT,calcAlgContext); |
| 19034 |
CIndividualProcessNode* locAncTestIndi = getLocalizedIndividual(ancTestIndi,false,calcAlgContext); |
| 19035 |
|
| 19036 |
// search blocker node |
| 19037 |
blockAltData = nullptr; |
| 19038 |
blockingIndi = nullptr; |
| 19039 |
|
| 19040 |
if (mConfSaturationCachingTestingDuringBlockingTests) { |
| 19041 |
detectIndividualNodeSaturationCached(locAncTestIndi,calcAlgContext); |
| 19042 |
} |
| 19043 |
|
| 19044 |
bool skipBlockerSearch = false; |
| 19045 |
if (locAncTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED) && locAncTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED)) { |
| 19046 |
skipBlockerSearch = true; |
| 19047 |
} |
| 19048 |
|
| 19049 |
if (!skipBlockerSearch) { |
| 19050 |
blockingIndi = getBlockingIndividualNode(locAncTestIndi,&blockAltData,calcAlgContext); |
| 19051 |
} |
| 19052 |
|
| 19053 |
locAncTestIndi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEANCESTORMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEDIRECTMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEBLOCKERMODIFIED |
| 19054 |
| CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS | CIndividualProcessNode::PRFDIRECTBLOCKED | CIndividualProcessNode::PRFINDIRECTBLOCKED | CIndividualProcessNode::PRFPROCESSINGBLOCKED); |
| 19055 |
|
| 19056 |
if (!blockingIndi) { |
| 19057 |
STATINC(FAILEDBLOCKINGSTATUSDETECTIONCOUNT,calcAlgContext); |
| 19058 |
if (blockAltData) { |
| 19059 |
blocked = testAlternativeBlocked(locAncTestIndi,blockAltData,calcAlgContext); |
| 19060 |
} |
| 19061 |
if (!blocked) { |
| 19062 |
locAncTestIndi->setBlockerIndividualNode(nullptr); |
| 19063 |
ancTestIndi = getAncestorIndividual(locAncTestIndi,calcAlgContext); |
| 19064 |
|
| 19065 |
if (!previousBlocked && mCompGraphCacheHandler && mConfIgnoreBlockingCompletionGraphCachedNonBlockingNodes) { |
| 19066 |
if (mCompGraphCacheHandler->isIndividualNodeCompletionGraphConsistencePresentNonBlocked(locAncTestIndi, calcAlgContext)) { |
| 19067 |
blockingTesting = false; |
| 19068 |
} |
| 19069 |
} |
| 19070 |
|
| 19071 |
} |
| 19072 |
} else { |
| 19073 |
STATINC(SUCCESSBLOCKINGSTATUSDETECTIONCOUNT,calcAlgContext); |
| 19074 |
|
| 19075 |
//if (blockingIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 19076 |
// propagateIndividualNodeNominalConnectionToAncestors(locAncTestIndi,calcAlgContext); |
| 19077 |
//} |
| 19078 |
if (blockingIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 19079 |
propagateIndividualNodeNominalConnectionStatusToAncestors(locAncTestIndi,blockingIndi,calcAlgContext); |
| 19080 |
} |
| 19081 |
|
| 19082 |
|
| 19083 |
bool testProcessingBlocking = false; |
| 19084 |
if (mOptDetExpPreporcessing) { |
| 19085 |
testProcessingBlocking = true; |
| 19086 |
} |
| 19087 |
|
| 19088 |
|
| 19089 |
locAncTestIndi->setBlockerIndividualNode(blockingIndi); |
| 19090 |
locAncTestIndi->mDebugBlockerLastConceptDes = blockingIndi->getReapplyConceptLabelSet(false)->getAddingSortedConceptDescriptionLinker(); |
| 19091 |
|
| 19092 |
|
| 19093 |
if (!testProcessingBlocking) { |
| 19094 |
CIndividualProcessNode* locBlockingNode = getLocalizedIndividual(blockingIndi,false,calcAlgContext); |
| 19095 |
CXLinker<CIndividualProcessNode*>* blockedIndiNodeLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 19096 |
blockedIndiNodeLinker->initLinker(locAncTestIndi); |
| 19097 |
locBlockingNode->addBlockedIndividualsLinker(blockedIndiNodeLinker); |
| 19098 |
locAncTestIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFDIRECTBLOCKED); |
| 19099 |
} else { |
| 19100 |
locAncTestIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGBLOCKED); |
| 19101 |
addIndividualToBlockingUpdateReviewProcessingQueue(blockingIndi,calcAlgContext); |
| 19102 |
} |
| 19103 |
propagateIndirectSuccessorBlocking(locAncTestIndi,calcAlgContext); |
| 19104 |
blocked = true; |
| 19105 |
} |
| 19106 |
} |
| 19107 |
|
| 19108 |
|
| 19109 |
|
| 19110 |
if (!blockingIndi && previousBlocked) { |
| 19111 |
reactivateIndirectBlockedSuccessors(testIndi,false,calcAlgContext); |
| 19112 |
} |
| 19113 |
return blocked; |
| 19114 |
} |
| 19115 |
|
| 19116 |
|
| 19117 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getBlockingIndividualNode(CIndividualProcessNode* blockingTestIndi, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19118 |
CIndividualProcessNode* blockingIndi = nullptr; |
| 19119 |
if (!blockingIndi && mConfAnywhereBlockingLinkedCandidateHashSearch) { |
| 19120 |
blockingIndi = getAnywhereBlockingIndividualNodeLinkedCanidateHashed(blockingTestIndi,blockAltData,calcAlgContext); |
| 19121 |
} |
| 19122 |
if (!blockingIndi && mConfAnywhereBlockingCandidateHashSearch) { |
| 19123 |
blockingIndi = getAnywhereBlockingIndividualNodeCanidateHashed(blockingTestIndi,blockAltData,calcAlgContext); |
| 19124 |
} |
| 19125 |
if (!blockingIndi && mConfAnywhereBlockingSearch) { |
| 19126 |
blockingIndi = getAnywhereBlockingIndividualNode(blockingTestIndi,blockAltData,calcAlgContext); |
| 19127 |
} |
| 19128 |
if (!blockingIndi && mConfAncestorBlockingSearch) { |
| 19129 |
blockingIndi = getAncestorBlockingIndividualNode(blockingTestIndi,blockAltData,calcAlgContext); |
| 19130 |
} |
| 19131 |
return blockingIndi; |
| 19132 |
} |
| 19133 |
|
| 19134 |
|
| 19135 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::continueIndividualNodeBlock(CIndividualProcessNode*& indi, CIndividualNodeBlockingTestData* blockData, CIndividualProcessNode*& blockerIndiNode, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19136 |
CIndividualProcessNode* blockingIndiNode = nullptr; |
| 19137 |
if (blockData) { |
| 19138 |
blockingIndiNode = blockData->getBlockingIndividualNode(); |
| 19139 |
if (blockingIndiNode) { |
| 19140 |
STATINC(CONTINUEBLOCKINGTESTCOUNT,calcAlgContext); |
| 19141 |
blockingIndiNode = getUpToDateIndividual(blockingIndiNode,calcAlgContext); |
| 19142 |
if (blockingIndiNode->isBlockableIndividual() && isIndividualNodeValidBlocker(blockingIndiNode,calcAlgContext)) { |
| 19143 |
if (isIndividualNodeBlocking(indi,blockingIndiNode,blockData,true,blockAltData,calcAlgContext)) { |
| 19144 |
blockerIndiNode = blockingIndiNode; |
| 19145 |
return true; |
| 19146 |
} |
| 19147 |
} else if (blockingIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFDIRECTBLOCKED)) { |
| 19148 |
CIndividualNodeBlockingTestData* candidateBlockData = (CIndividualNodeBlockingTestData*)blockingIndiNode->getIndividualBlockData(false); |
| 19149 |
if (candidateBlockData) { |
| 19150 |
CIndividualProcessNode* candidateBlockingIndiNode = candidateBlockData->getBlockingIndividualNode(); |
| 19151 |
if (candidateBlockingIndiNode && candidateBlockingIndiNode->isBlockableIndividual() && isIndividualNodeValidBlocker(candidateBlockingIndiNode, calcAlgContext)) { |
| 19152 |
if (isIndividualNodeBlocking(indi, candidateBlockingIndiNode, blockData, true, blockAltData, calcAlgContext)) { |
| 19153 |
blockerIndiNode = candidateBlockingIndiNode; |
| 19154 |
blockData->setBlockingIndividualNode(candidateBlockingIndiNode); |
| 19155 |
return true; |
| 19156 |
} |
| 19157 |
} |
| 19158 |
} |
| 19159 |
} |
| 19160 |
} |
| 19161 |
} |
| 19162 |
return false; |
| 19163 |
} |
| 19164 |
|
| 19165 |
|
| 19166 |
|
| 19167 |
|
| 19168 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::signatureCachedIndividualNodeBlock(CIndividualProcessNode*& indi, CIndividualNodeBlockingTestData* blockData, CIndividualProcessNode*& blockerIndiNode, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19169 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED)) { |
| 19170 |
CSignatureBlockingIndividualNodeConceptExpansionData* sigBlockExpData = indi->getSignatureBlockingIndividualNodeConceptExpansionData(false); |
| 19171 |
if (sigBlockExpData) { |
| 19172 |
CIndividualProcessNode* blockingIndiNode = sigBlockExpData->getBlockerIndividualNode(); |
| 19173 |
if (blockingIndiNode) { |
| 19174 |
blockingIndiNode = getUpToDateIndividual(blockingIndiNode,calcAlgContext); |
| 19175 |
if (blockingIndiNode->isBlockableIndividual() && isIndividualNodeValidBlocker(blockingIndiNode,calcAlgContext)) { |
| 19176 |
if (isIndividualNodeBlocking(indi,blockingIndiNode,blockData,false,blockAltData,calcAlgContext)) { |
| 19177 |
blockerIndiNode = blockingIndiNode; |
| 19178 |
return true; |
| 19179 |
} |
| 19180 |
} |
| 19181 |
} |
| 19182 |
} |
| 19183 |
} |
| 19184 |
return false; |
| 19185 |
} |
| 19186 |
|
| 19187 |
|
| 19188 |
|
| 19189 |
void CCalculationTableauCompletionTaskHandleAlgorithm::clearBlockingCache(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19190 |
mCachedIndiAssociatedConceptSetHash.clear(); |
| 19191 |
} |
| 19192 |
|
| 19193 |
|
| 19194 |
|
| 19195 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getAncestorBlockingIndividualNode(CIndividualProcessNode* blockingTestIndi, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19196 |
clearBlockingCache(calcAlgContext); |
| 19197 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 19198 |
CIndividualProcessNode* blockerNode = nullptr; |
| 19199 |
CNodeSwitchHistory* nodeSwitchHistory = calcAlgContext->getUsedProcessingDataBox()->getNodeSwitchHistory(false); |
| 19200 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 19201 |
CIndividualNodeBlockingTestData* blockData = (CIndividualNodeBlockingTestData*)blockingTestIndi->getIndividualBlockData(false); |
| 19202 |
CIndividualNodeBlockingTestData* locBlockData = (CIndividualNodeBlockingTestData*)blockingTestIndi->getIndividualBlockData(true); |
| 19203 |
if (!locBlockData) { |
| 19204 |
locBlockData = CObjectAllocator<CIndividualNodeBlockingTestData>::allocateAndConstruct(taskMemMan); |
| 19205 |
locBlockData->initBlockData(blockData); |
| 19206 |
blockingTestIndi->setIndividualBlockData(locBlockData); |
| 19207 |
} |
| 19208 |
cint64 prevNodeSwitchTag = locBlockData->getNodeSwitchTag(); |
| 19209 |
cint64 prevNodeConceptLabelModTag = locBlockData->getConceptLabelSetModificationTag(); |
| 19210 |
cint64 minTestIndiNodeID = 0; |
| 19211 |
cint64 minTestAncIndiDepth = 0; |
| 19212 |
locBlockData->updateNodeSwitchTag(calcAlgContext->getUsedProcessTagger()); |
| 19213 |
locBlockData->updateConceptLabelSetModificationTag(calcAlgContext->getUsedProcessTagger()); |
| 19214 |
|
| 19215 |
CIndividualProcessNode* continueBlockingIndiNode = nullptr; |
| 19216 |
if (continueIndividualNodeBlock(blockingTestIndi,locBlockData,continueBlockingIndiNode,blockAltData,calcAlgContext)) { |
| 19217 |
blockerNode = continueBlockingIndiNode; |
| 19218 |
} else { |
| 19219 |
locBlockData->clearBlockingIndividualNode(); |
| 19220 |
if (signatureCachedIndividualNodeBlock(blockingTestIndi, locBlockData, continueBlockingIndiNode, blockAltData, calcAlgContext)) { |
| 19221 |
blockerNode = continueBlockingIndiNode; |
| 19222 |
} else { |
| 19223 |
if (nodeSwitchHistory && locBlockData && prevNodeSwitchTag > 0) { |
| 19224 |
nodeSwitchHistory->getMinIndividualAncestorDepthAndNodeID(prevNodeSwitchTag,minTestAncIndiDepth,minTestIndiNodeID); |
| 19225 |
minTestIndiNodeID = qMax(minTestIndiNodeID,(cint64)0); |
| 19226 |
minTestAncIndiDepth = qMax(minTestAncIndiDepth,(cint64)0); |
| 19227 |
} |
| 19228 |
CIndividualProcessNode* ancIndiNode = getAncestorIndividual(blockingTestIndi,calcAlgContext); |
| 19229 |
while (!blockerNode && ancIndiNode && isIndividualNodeValidBlocker(ancIndiNode,calcAlgContext) && ancIndiNode->getIndividualAncestorDepth() >= minTestAncIndiDepth) { |
| 19230 |
if (continueBlockingIndiNode != ancIndiNode) { |
| 19231 |
STATINC(ANCESTORBLOCKINGSEARCHINDINODECOUNT,calcAlgContext); |
| 19232 |
if (isIndividualNodeConceptLabelSetModified(ancIndiNode,prevNodeConceptLabelModTag,calcAlgContext) && isIndividualNodeBlocking(blockingTestIndi,ancIndiNode,locBlockData,false,blockAltData,calcAlgContext)) { |
| 19233 |
blockerNode = ancIndiNode; |
| 19234 |
} |
| 19235 |
} |
| 19236 |
if (!blockerNode) { |
| 19237 |
ancIndiNode = getAncestorIndividual(ancIndiNode,calcAlgContext); |
| 19238 |
} |
| 19239 |
} |
| 19240 |
} |
| 19241 |
} |
| 19242 |
locBlockData->setBlockingIndividualNode(blockerNode); |
| 19243 |
return blockerNode; |
| 19244 |
} |
| 19245 |
|
| 19246 |
|
| 19247 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getAnywhereBlockingIndividualNode(CIndividualProcessNode* blockingTestIndi, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19248 |
clearBlockingCache(calcAlgContext); |
| 19249 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 19250 |
CIndividualProcessNode* blockerNode = nullptr; |
| 19251 |
CNodeSwitchHistory* nodeSwitchHistory = calcAlgContext->getUsedProcessingDataBox()->getNodeSwitchHistory(false); |
| 19252 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 19253 |
CIndividualNodeBlockingTestData* blockData = (CIndividualNodeBlockingTestData*)blockingTestIndi->getIndividualBlockData(false); |
| 19254 |
CIndividualNodeBlockingTestData* locBlockData = (CIndividualNodeBlockingTestData*)blockingTestIndi->getIndividualBlockData(true); |
| 19255 |
if (!locBlockData) { |
| 19256 |
locBlockData = CObjectAllocator<CIndividualNodeBlockingTestData>::allocateAndConstruct(taskMemMan); |
| 19257 |
locBlockData->initBlockData(blockData); |
| 19258 |
blockingTestIndi->setIndividualBlockData(locBlockData); |
| 19259 |
} |
| 19260 |
cint64 prevNodeSwitchTag = locBlockData->getNodeSwitchTag(); |
| 19261 |
cint64 prevNodeConceptLabelModTag = locBlockData->getConceptLabelSetModificationTag(); |
| 19262 |
cint64 minTestIndiNodeID = 0; |
| 19263 |
cint64 minTestAncIndiDepth = 0; |
| 19264 |
locBlockData->updateNodeSwitchTag(calcAlgContext->getUsedProcessTagger()); |
| 19265 |
locBlockData->updateConceptLabelSetModificationTag(calcAlgContext->getUsedProcessTagger()); |
| 19266 |
|
| 19267 |
CIndividualProcessNode* continueBlockingIndiNode = nullptr; |
| 19268 |
if (continueIndividualNodeBlock(blockingTestIndi,locBlockData,continueBlockingIndiNode,blockAltData,calcAlgContext)) { |
| 19269 |
blockerNode = continueBlockingIndiNode; |
| 19270 |
} else { |
| 19271 |
locBlockData->clearBlockingIndividualNode(); |
| 19272 |
if (signatureCachedIndividualNodeBlock(blockingTestIndi, locBlockData, continueBlockingIndiNode, blockAltData, calcAlgContext)) { |
| 19273 |
blockerNode = continueBlockingIndiNode; |
| 19274 |
} else { |
| 19275 |
cint64 lastContinueTestedBlockingIndiNodeID = -1; |
| 19276 |
if (locBlockData->getBlockingIndividualNode()) { |
| 19277 |
lastContinueTestedBlockingIndiNodeID = locBlockData->getBlockingIndividualNode()->getIndividualNodeID(); |
| 19278 |
} |
| 19279 |
if (nodeSwitchHistory && locBlockData && prevNodeSwitchTag > 0) { |
| 19280 |
nodeSwitchHistory->getMinIndividualAncestorDepthAndNodeID(prevNodeSwitchTag,minTestAncIndiDepth,minTestIndiNodeID); |
| 19281 |
minTestIndiNodeID = qMax(minTestIndiNodeID,(cint64)0); |
| 19282 |
minTestAncIndiDepth = qMax(minTestAncIndiDepth,(cint64)0); |
| 19283 |
} |
| 19284 |
cint64 prevIndiID = blockingTestIndi->getIndividualNodeID() - 1; |
| 19285 |
CIndividualProcessNode* prevIndiNode = nullptr; |
| 19286 |
while (!blockerNode && prevIndiID > 0 && prevIndiID >= minTestIndiNodeID) { |
| 19287 |
if (prevIndiID != lastContinueTestedBlockingIndiNodeID) { |
| 19288 |
prevIndiNode = getUpToDateIndividual(prevIndiID,calcAlgContext); |
| 19289 |
if (prevIndiNode && isIndividualNodeValidBlocker(prevIndiNode, calcAlgContext) && isIndividualNodeConceptLabelSetModified(prevIndiNode, prevNodeConceptLabelModTag, calcAlgContext)) { |
| 19290 |
|
| 19291 |
bool invalidDescendant = false; |
| 19292 |
if (prevIndiNode->getIndividualAncestorDepth() >= blockingTestIndi->getIndividualAncestorDepth()) { |
| 19293 |
// make sure the candidate is not a descendant |
| 19294 |
CIndividualProcessNode* ancPrevIndiNode = prevIndiNode; |
| 19295 |
while (ancPrevIndiNode->getIndividualAncestorDepth() >= blockingTestIndi->getIndividualAncestorDepth() && !invalidDescendant) { |
| 19296 |
if (ancPrevIndiNode->getIndividualNodeID() == blockingTestIndi->getIndividualNodeID()) { |
| 19297 |
invalidDescendant = true; |
| 19298 |
} |
| 19299 |
ancPrevIndiNode = getAncestorIndividual(ancPrevIndiNode, calcAlgContext); |
| 19300 |
} |
| 19301 |
} |
| 19302 |
|
| 19303 |
|
| 19304 |
if (!invalidDescendant) { |
| 19305 |
STATINC(ANYWHEREBLOCKINGSEARCHINDINODECOUNT, calcAlgContext); |
| 19306 |
if (isIndividualNodeBlocking(blockingTestIndi, prevIndiNode, locBlockData, false, blockAltData, calcAlgContext)) { |
| 19307 |
blockerNode = prevIndiNode; |
| 19308 |
} |
| 19309 |
} |
| 19310 |
} |
| 19311 |
} |
| 19312 |
--prevIndiID; |
| 19313 |
} |
| 19314 |
} |
| 19315 |
} |
| 19316 |
locBlockData->setBlockingIndividualNode(blockerNode); |
| 19317 |
return blockerNode; |
| 19318 |
} |
| 19319 |
|
| 19320 |
|
| 19321 |
|
| 19322 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getAnywhereBlockingIndividualNodeLinkedCanidateHashed(CIndividualProcessNode* blockingTestIndi, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19323 |
clearBlockingCache(calcAlgContext); |
| 19324 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 19325 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 19326 |
CIndividualProcessNode* blockerNode = nullptr; |
| 19327 |
CIndividualNodeBlockingTestData* blockData = (CIndividualNodeBlockingTestData*)blockingTestIndi->getIndividualBlockData(false); |
| 19328 |
CIndividualNodeBlockingTestData* locBlockData = (CIndividualNodeBlockingTestData*)blockingTestIndi->getIndividualBlockData(true); |
| 19329 |
if (!locBlockData) { |
| 19330 |
locBlockData = CObjectAllocator<CIndividualNodeBlockingTestData>::allocateAndConstruct(taskMemMan); |
| 19331 |
locBlockData->initBlockData(blockData); |
| 19332 |
blockingTestIndi->setIndividualBlockData(locBlockData); |
| 19333 |
} |
| 19334 |
|
| 19335 |
CIndividualProcessNode* continueBlockingIndiNode = nullptr; |
| 19336 |
if (continueIndividualNodeBlock(blockingTestIndi,locBlockData,continueBlockingIndiNode,blockAltData,calcAlgContext)) { |
| 19337 |
blockerNode = continueBlockingIndiNode; |
| 19338 |
} else { |
| 19339 |
locBlockData->clearBlockingIndividualNode(); |
| 19340 |
if (signatureCachedIndividualNodeBlock(blockingTestIndi, locBlockData, continueBlockingIndiNode, blockAltData, calcAlgContext)) { |
| 19341 |
blockerNode = continueBlockingIndiNode; |
| 19342 |
} else { |
| 19343 |
cint64 lastContinueTestedBlockingIndiNodeID = -1; |
| 19344 |
if (locBlockData->getBlockingIndividualNode()) { |
| 19345 |
lastContinueTestedBlockingIndiNodeID = locBlockData->getBlockingIndividualNode()->getIndividualNodeID(); |
| 19346 |
} |
| 19347 |
|
| 19348 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 19349 |
CBlockingIndividualNodeLinkedCandidateHash* blockingCandHash = procDataBox->getBlockingIndividualNodeLinkedCandidateHash(false); |
| 19350 |
CReapplyConceptLabelSet* conSet = blockingTestIndi->getReapplyConceptLabelSet(false); |
| 19351 |
CCoreConceptDescriptor* coreConDesLinker = conSet->getCoreConceptDescriptorLinker(); |
| 19352 |
cint64 blockingTestIndiID = blockingTestIndi->getIndividualNodeID(); |
| 19353 |
|
| 19354 |
|
| 19355 |
if (!coreConDesLinker) { |
| 19356 |
|
| 19357 |
blockerNode = getAnywhereBlockingIndividualNodeCanidateHashed(blockingTestIndi,blockAltData,calcAlgContext); |
| 19358 |
|
| 19359 |
} else { |
| 19360 |
|
| 19361 |
CBlockingIndividualNodeLinkedCandidateData* minBlockingIndNodeCandData = nullptr; |
| 19362 |
cint64 minBlockingIndNodeCandDataCount = 0; |
| 19363 |
CConceptDescriptor* minBlockingConDes = nullptr; |
| 19364 |
|
| 19365 |
CCoreConceptDescriptor* lastAddedCoreConDes = locBlockData->getLastAddedCoreConceptDescriptor(); |
| 19366 |
CConceptDescriptor* lastConDes = locBlockData->getLastCoreBlockingCandidateConceptDescriptor(); |
| 19367 |
cint64 lastNodeDiff = locBlockData->getLastCoreBlockingCandidateConceptNodeDifference(); |
| 19368 |
if (lastAddedCoreConDes != coreConDesLinker) { |
| 19369 |
lastConDes = nullptr; |
| 19370 |
} |
| 19371 |
|
| 19372 |
CBlockingIndividualNodeLinkedCandidateData* lastMinBlockingIndNodeCandData = nullptr; |
| 19373 |
|
| 19374 |
if (lastConDes) { |
| 19375 |
CBlockingIndividualNodeLinkedCandidateData* blockingCandData = blockingCandHash->getBlockingIndividualCandidateData(lastConDes,false); |
| 19376 |
if (blockingCandData) { |
| 19377 |
cint64 blockingIndNodeCandDataCount = blockingCandData->getCandidateCount(); |
| 19378 |
if (blockingIndNodeCandDataCount <= lastNodeDiff) { |
| 19379 |
minBlockingIndNodeCandData = blockingCandData; |
| 19380 |
minBlockingIndNodeCandDataCount = blockingIndNodeCandDataCount; |
| 19381 |
} |
| 19382 |
} |
| 19383 |
} |
| 19384 |
|
| 19385 |
if (!minBlockingIndNodeCandData) { |
| 19386 |
|
| 19387 |
for (CCoreConceptDescriptor* coreConDesLinkerIt = coreConDesLinker; coreConDesLinkerIt; coreConDesLinkerIt = coreConDesLinkerIt->getNext()) { |
| 19388 |
CConceptDescriptor* conDes = coreConDesLinkerIt->getConceptDesciptor(); |
| 19389 |
CBlockingIndividualNodeLinkedCandidateData* blockingCandData = blockingCandHash->getBlockingIndividualCandidateData(conDes,false); |
| 19390 |
if (blockingCandData) { |
| 19391 |
cint64 blockingIndNodeCandDataCount = blockingCandData->getCandidateCount(); |
| 19392 |
if (!minBlockingIndNodeCandData || blockingIndNodeCandDataCount < minBlockingIndNodeCandDataCount) { |
| 19393 |
|
| 19394 |
lastMinBlockingIndNodeCandData = minBlockingIndNodeCandData; |
| 19395 |
|
| 19396 |
minBlockingIndNodeCandDataCount = blockingIndNodeCandDataCount; |
| 19397 |
minBlockingIndNodeCandData = blockingCandData; |
| 19398 |
minBlockingConDes = conDes; |
| 19399 |
} else if (!lastMinBlockingIndNodeCandData) { |
| 19400 |
lastMinBlockingIndNodeCandData = blockingCandData; |
| 19401 |
} |
| 19402 |
} |
| 19403 |
} |
| 19404 |
} |
| 19405 |
|
| 19406 |
locBlockData->setLastAddedCoreConceptDescriptor(coreConDesLinker); |
| 19407 |
locBlockData->setLastCoreBlockingCandidateConceptDescriptor(minBlockingConDes); |
| 19408 |
locBlockData->setLastCoreBlockingCandidateConceptNodeDifference(0); |
| 19409 |
if (lastMinBlockingIndNodeCandData) { |
| 19410 |
cint64 diffCount = lastMinBlockingIndNodeCandData->getCandidateCount(); |
| 19411 |
locBlockData->setLastCoreBlockingCandidateConceptNodeDifference(diffCount); |
| 19412 |
} |
| 19413 |
|
| 19414 |
CBlockingIndividualNodeLinkedCandidateData* blockingCandData = minBlockingIndNodeCandData; |
| 19415 |
if (blockingCandData) { |
| 19416 |
CBlockingIndividualNodeLinker* blockingIndNodeLinker = blockingCandData->getBlockingCandidatesIndividualNodeLinker(); |
| 19417 |
while (blockingIndNodeLinker && !blockerNode) { |
| 19418 |
CIndividualProcessNode* blockerCandIndiNode = blockingIndNodeLinker->getCandidateIndividualNode(); |
| 19419 |
cint64 blockerCandIndiNodeID = blockerCandIndiNode->getIndividualNodeID(); |
| 19420 |
|
| 19421 |
if (blockerCandIndiNodeID != lastContinueTestedBlockingIndiNodeID && blockerCandIndiNodeID != blockingTestIndiID) { |
| 19422 |
|
| 19423 |
STATINC(ANYWHERECORECONCEPTBLOCKINGCANDIDATEHASHSEARCHINDINODECOUNT,calcAlgContext); |
| 19424 |
CIndividualProcessNode* upBlockerCandIndiNode = getUpToDateIndividual(blockerCandIndiNode,calcAlgContext); |
| 19425 |
|
| 19426 |
if (isIndividualNodeValidBlocker(upBlockerCandIndiNode,calcAlgContext)) { |
| 19427 |
|
| 19428 |
bool invalidDescendant = false; |
| 19429 |
if (upBlockerCandIndiNode->getIndividualAncestorDepth() >= blockingTestIndi->getIndividualAncestorDepth()) { |
| 19430 |
// make sure the candidate is not a descendant |
| 19431 |
CIndividualProcessNode* ancPrevIndiNode = upBlockerCandIndiNode; |
| 19432 |
while (ancPrevIndiNode->getIndividualAncestorDepth() >= blockingTestIndi->getIndividualAncestorDepth() && !invalidDescendant) { |
| 19433 |
if (ancPrevIndiNode->getIndividualNodeID() == blockingTestIndi->getIndividualNodeID()) { |
| 19434 |
invalidDescendant = true; |
| 19435 |
} |
| 19436 |
ancPrevIndiNode = getAncestorIndividual(ancPrevIndiNode, calcAlgContext); |
| 19437 |
} |
| 19438 |
} |
| 19439 |
|
| 19440 |
|
| 19441 |
if (!invalidDescendant) { |
| 19442 |
if (isIndividualNodeBlocking(blockingTestIndi, upBlockerCandIndiNode, locBlockData, false, blockAltData, calcAlgContext)) { |
| 19443 |
blockerNode = upBlockerCandIndiNode; |
| 19444 |
} |
| 19445 |
} |
| 19446 |
} |
| 19447 |
|
| 19448 |
} |
| 19449 |
|
| 19450 |
blockingIndNodeLinker = blockingIndNodeLinker->getNext(); |
| 19451 |
} |
| 19452 |
} |
| 19453 |
|
| 19454 |
} |
| 19455 |
} |
| 19456 |
} |
| 19457 |
|
| 19458 |
return blockerNode; |
| 19459 |
} |
| 19460 |
|
| 19461 |
|
| 19462 |
|
| 19463 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getAnywhereBlockingIndividualNodeCanidateHashed(CIndividualProcessNode* blockingTestIndi, CBlockingAlternativeData** blockAltData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19464 |
clearBlockingCache(calcAlgContext); |
| 19465 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 19466 |
CIndividualProcessNode* blockerNode = nullptr; |
| 19467 |
CNodeSwitchHistory* nodeSwitchHistory = calcAlgContext->getUsedProcessingDataBox()->getNodeSwitchHistory(false); |
| 19468 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 19469 |
CIndividualNodeBlockingTestData* blockData = (CIndividualNodeBlockingTestData*)blockingTestIndi->getIndividualBlockData(false); |
| 19470 |
CIndividualNodeBlockingTestData* locBlockData = (CIndividualNodeBlockingTestData*)blockingTestIndi->getIndividualBlockData(true); |
| 19471 |
if (!locBlockData) { |
| 19472 |
locBlockData = CObjectAllocator<CIndividualNodeBlockingTestData>::allocateAndConstruct(taskMemMan); |
| 19473 |
locBlockData->initBlockData(blockData); |
| 19474 |
blockingTestIndi->setIndividualBlockData(locBlockData); |
| 19475 |
} |
| 19476 |
cint64 prevNodeSwitchTag = locBlockData->getNodeSwitchTag(); |
| 19477 |
cint64 prevNodeConceptLabelModTag = locBlockData->getConceptLabelSetModificationTag(); |
| 19478 |
cint64 minTestIndiNodeID = 0; |
| 19479 |
cint64 minTestAncIndiDepth = 0; |
| 19480 |
|
| 19481 |
CIndividualProcessNode* continueBlockingIndiNode = nullptr; |
| 19482 |
if (continueIndividualNodeBlock(blockingTestIndi,locBlockData,continueBlockingIndiNode,blockAltData,calcAlgContext)) { |
| 19483 |
blockerNode = continueBlockingIndiNode; |
| 19484 |
} else { |
| 19485 |
cint64 lastContinueTestedBlockingIndiNodeID = -1; |
| 19486 |
if (locBlockData->getBlockingIndividualNode()) { |
| 19487 |
lastContinueTestedBlockingIndiNodeID = locBlockData->getBlockingIndividualNode()->getIndividualNodeID(); |
| 19488 |
} |
| 19489 |
if (nodeSwitchHistory && locBlockData && prevNodeSwitchTag > 0) { |
| 19490 |
nodeSwitchHistory->getMinIndividualAncestorDepthAndNodeID(prevNodeSwitchTag,minTestAncIndiDepth,minTestIndiNodeID); |
| 19491 |
minTestIndiNodeID = qMax(minTestIndiNodeID,(cint64)0); |
| 19492 |
minTestAncIndiDepth = qMax(minTestAncIndiDepth,(cint64)0); |
| 19493 |
} |
| 19494 |
if (blockingTestIndi->getIndividualInitializationConcept()) { |
| 19495 |
CBlockingIndividualNodeCandidateIterator indiNodeCandIt(getBlockingIndividualNodeCandidateIterator(blockingTestIndi,calcAlgContext)); |
| 19496 |
while (!blockerNode && indiNodeCandIt.hasNext()) { |
| 19497 |
CIndividualProcessNode* indiNode = indiNodeCandIt.nextIndividualCandidate(true); |
| 19498 |
CIndividualProcessNode* upIndiNode = getUpToDateIndividual(indiNode,calcAlgContext); |
| 19499 |
cint64 upIndiNodeID = upIndiNode->getIndividualNodeID(); |
| 19500 |
if (upIndiNodeID != lastContinueTestedBlockingIndiNodeID) { |
| 19501 |
if (upIndiNode->hasPurgedBlockedProcessingRestrictionFlags() || !upIndiNode->isBlockableIndividual()) { |
| 19502 |
STATINC(ANYWHEREBLOCKINGCANDIDATEHASHUDATEREMOVECOUNT,calcAlgContext); |
| 19503 |
indiNodeCandIt.removeLastIndividualCandidate(); |
| 19504 |
} else if (isIndividualNodeValidBlocker(upIndiNode,calcAlgContext) && isIndividualNodeConceptLabelSetModified(upIndiNode,prevNodeConceptLabelModTag,calcAlgContext)) { |
| 19505 |
STATINC(ANYWHEREBLOCKINGCANDIDATEHASHSEARCHINDINODECOUNT,calcAlgContext); |
| 19506 |
if (isIndividualNodeBlocking(blockingTestIndi,upIndiNode,locBlockData,false,blockAltData,calcAlgContext)) { |
| 19507 |
blockerNode = upIndiNode; |
| 19508 |
} |
| 19509 |
} |
| 19510 |
} |
| 19511 |
} |
| 19512 |
} else { |
| 19513 |
cint64 prevIndiID = blockingTestIndi->getIndividualNodeID() - 1; |
| 19514 |
CIndividualProcessNode* prevIndiNode = nullptr; |
| 19515 |
while (!blockerNode && prevIndiID > 0 && prevIndiID >= minTestIndiNodeID) { |
| 19516 |
if (prevIndiID != lastContinueTestedBlockingIndiNodeID) { |
| 19517 |
prevIndiNode = getUpToDateIndividual(prevIndiID,calcAlgContext); |
| 19518 |
if (prevIndiNode && isIndividualNodeValidBlocker(prevIndiNode,calcAlgContext) && isIndividualNodeConceptLabelSetModified(prevIndiNode,prevNodeConceptLabelModTag,calcAlgContext)) { |
| 19519 |
STATINC(ANYWHEREBLOCKINGCANDIDATEHASHSEARCHINDINODECOUNT,calcAlgContext); |
| 19520 |
if (isIndividualNodeBlocking(blockingTestIndi,prevIndiNode,locBlockData,false,blockAltData,calcAlgContext)) { |
| 19521 |
blockerNode = prevIndiNode; |
| 19522 |
} |
| 19523 |
} |
| 19524 |
} |
| 19525 |
--prevIndiID; |
| 19526 |
} |
| 19527 |
} |
| 19528 |
} |
| 19529 |
locBlockData->setBlockingIndividualNode(blockerNode); |
| 19530 |
if (!blockerNode) { |
| 19531 |
locBlockData->updateNodeSwitchTag(calcAlgContext->getUsedProcessTagger()); |
| 19532 |
locBlockData->updateConceptLabelSetModificationTag(calcAlgContext->getUsedProcessTagger()); |
| 19533 |
} |
| 19534 |
return blockerNode; |
| 19535 |
} |
| 19536 |
|
| 19537 |
|
| 19538 |
|
| 19539 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualNodeCandidateForConcept(CIndividualProcessNode*& indi, CConceptDescriptor* conDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19540 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 19541 |
CBlockingIndividualNodeCandidateHash* blockingCandHash = procDataBox->getBlockingIndividualNodeCandidateHash(true); |
| 19542 |
CBlockingIndividualNodeCandidateData* blockingCandData = blockingCandHash->getBlockingIndividualCandidateData(conDes,true); |
| 19543 |
STATINC(ANYWHEREBLOCKINGCANDIDATEHASHUDATEADDCOUNT,calcAlgContext); |
| 19544 |
blockingCandData->insertBlockingCandidateIndividualNode(indi); |
| 19545 |
} |
| 19546 |
|
| 19547 |
|
| 19548 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualNodeCandidateForConcept(CIndividualProcessNode*& indi, CSortedNegLinker<CConcept*>* concepts, bool negated, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19549 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 19550 |
CBlockingIndividualNodeCandidateHash* blockingCandHash = procDataBox->getBlockingIndividualNodeCandidateHash(true); |
| 19551 |
CSortedNegLinker<CConcept*>* conceptIt = concepts; |
| 19552 |
while (conceptIt) { |
| 19553 |
CConcept* concept = conceptIt->getData(); |
| 19554 |
bool conceptNeg = conceptIt->isNegated()^negated; |
| 19555 |
CBlockingIndividualNodeCandidateData* blockingCandData = blockingCandHash->getBlockingIndividualCandidateData(concept,conceptNeg,true); |
| 19556 |
STATINC(ANYWHEREBLOCKINGCANDIDATEHASHUDATEADDCOUNT,calcAlgContext); |
| 19557 |
blockingCandData->insertBlockingCandidateIndividualNode(indi); |
| 19558 |
cint64 opCode = concept->getOperatorCode(); |
| 19559 |
if (!conceptNeg && opCode == CCAND || conceptNeg && opCode == CCOR) { |
| 19560 |
addIndividualNodeCandidateForConcept(indi,concept->getOperandList(),conceptNeg,calcAlgContext); |
| 19561 |
} |
| 19562 |
conceptIt = conceptIt->getNext(); |
| 19563 |
} |
| 19564 |
} |
| 19565 |
|
| 19566 |
|
| 19567 |
CBlockingIndividualNodeCandidateIterator CCalculationTableauCompletionTaskHandleAlgorithm::getBlockingIndividualNodeCandidateIterator(CIndividualProcessNode* blockingTestIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19568 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 19569 |
cint64 testingIndiID = blockingTestIndi->getIndividualNodeID(); |
| 19570 |
CConceptDescriptor* initializationConceptDes = blockingTestIndi->getIndividualInitializationConcept(); |
| 19571 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 19572 |
CNodeSwitchHistory* nodeSwitchHistory = procDataBox->getNodeSwitchHistory(false); |
| 19573 |
// test whether hash has to be updated |
| 19574 |
bool needsHashUpdate = true; |
| 19575 |
CBlockingIndividualNodeCandidateHash* blockingCandHash = procDataBox->getBlockingIndividualNodeCandidateHash(true); |
| 19576 |
CBlockingIndividualNodeCandidateData* blockingCandData = blockingCandHash->getBlockingIndividualCandidateData(initializationConceptDes,true); |
| 19577 |
|
| 19578 |
if (mConfAnywhereBlockingLazyExactHashing) { |
| 19579 |
cint64 maxValidIndiID = blockingCandData->getMaxValidIndividualID()+1; |
| 19580 |
cint64 conLabelSetModTag = blockingCandData->getConceptLabelSetModificationTag(); |
| 19581 |
cint64 nodeSwitchTag = blockingCandData->getNodeSwitchTag(); |
| 19582 |
cint64 minTestIndiNodeID = 1; |
| 19583 |
cint64 minTestAncIndiDepth = 0; |
| 19584 |
if (nodeSwitchHistory && nodeSwitchTag > 0) { |
| 19585 |
nodeSwitchHistory->getMinIndividualAncestorDepthAndNodeID(nodeSwitchTag,minTestAncIndiDepth,minTestIndiNodeID); |
| 19586 |
minTestIndiNodeID = qMax(minTestIndiNodeID,(cint64)1); |
| 19587 |
minTestAncIndiDepth = qMax(minTestAncIndiDepth,(cint64)0); |
| 19588 |
} |
| 19589 |
if (maxValidIndiID >= testingIndiID && minTestIndiNodeID >= testingIndiID) { |
| 19590 |
needsHashUpdate = false; |
| 19591 |
} |
| 19592 |
if (needsHashUpdate) { |
| 19593 |
STATINC(ANYWHEREBLOCKINGCANDIDATEHASHUDATECOUNT,calcAlgContext); |
| 19594 |
if (maxValidIndiID != testingIndiID) { |
| 19595 |
// insert testing node |
| 19596 |
STATINC(ANYWHEREBLOCKINGCANDIDATEHASHUDATEADDCOUNT,calcAlgContext); |
| 19597 |
blockingCandData->insertBlockingCandidateIndividualNode(blockingTestIndi); |
| 19598 |
} |
| 19599 |
cint64 destIndiID = qMin(maxValidIndiID,minTestIndiNodeID); |
| 19600 |
destIndiID = qMax(destIndiID,(cint64)0); |
| 19601 |
for (cint64 indiID = testingIndiID-1; indiID >= destIndiID; --indiID) { |
| 19602 |
CIndividualProcessNode* indi = getUpToDateIndividual(indiID,calcAlgContext); |
| 19603 |
if (indi && indi->isBlockableIndividual() && !indi->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 19604 |
if (indiID >= maxValidIndiID || isIndividualNodeConceptLabelSetModified(indi,conLabelSetModTag,calcAlgContext)) { |
| 19605 |
if (indi->getReapplyConceptLabelSet(false)->containsConceptDescriptor(initializationConceptDes)) { |
| 19606 |
// add to candidate hash |
| 19607 |
STATINC(ANYWHEREBLOCKINGCANDIDATEHASHUDATEADDCOUNT,calcAlgContext); |
| 19608 |
blockingCandData->insertBlockingCandidateIndividualNode(indi); |
| 19609 |
} |
| 19610 |
} |
| 19611 |
} |
| 19612 |
} |
| 19613 |
CProcessTagger* processTagger = calcAlgContext->getUsedProcessTagger(); |
| 19614 |
blockingCandData->updateConceptLabelSetModificationTag(processTagger); |
| 19615 |
blockingCandData->updateNodeSwitchTag(processTagger); |
| 19616 |
blockingCandData->setMaxValidIndividualID(qMax(maxValidIndiID,testingIndiID)); |
| 19617 |
} |
| 19618 |
} |
| 19619 |
|
| 19620 |
return blockingCandData->getBlockingCandidatesIndividualNodeIterator(blockingTestIndi); |
| 19621 |
} |
| 19622 |
|
| 19623 |
|
| 19624 |
|
| 19625 |
|
| 19626 |
|
| 19627 |
|
| 19628 |
|
| 19629 |
|
| 19630 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualNodeModified(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19631 |
bool addIndividualToProcessingQueueDueToModification = false; |
| 19632 |
if (!indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHEDRETESTDUETOMODIFICATION)) { |
| 19633 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHEDRETESTDUETOMODIFICATION); |
| 19634 |
} |
| 19635 |
if (!indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEDIRECTMODIFIED) && !indi->getNominalIndividual()) { |
| 19636 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEDIRECTMODIFIED); |
| 19637 |
propagateProcessingRestrictionToSuccessors(indi,CIndividualProcessNode::PRFBLOCKINGRETESTDUEANCESTORMODIFIED,true, |
| 19638 |
CIndividualProcessNode::PRFDIRECTBLOCKED | CIndividualProcessNode::PRFINDIRECTBLOCKED | CIndividualProcessNode::PRFPROCESSINGBLOCKED,calcAlgContext); |
| 19639 |
addIndividualToProcessingQueueDueToModification = true; |
| 19640 |
} |
| 19641 |
eliminiateBlockedIndividuals(indi,calcAlgContext); |
| 19642 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED) && !indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATISFIABLECACHEDDUEDIRECTMODIFIED)) { |
| 19643 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATISFIABLECACHEDDUEDIRECTMODIFIED); |
| 19644 |
addIndividualToProcessingQueueDueToModification = true; |
| 19645 |
} |
| 19646 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED) && !indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSIGNATUREBLOCKINGCACHEDDUEDIRECTMODIFIED)) { |
| 19647 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSIGNATUREBLOCKINGCACHEDDUEDIRECTMODIFIED); |
| 19648 |
addIndividualToProcessingQueueDueToModification = true; |
| 19649 |
} |
| 19650 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED) && !indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTCOMPLETIONGRAPHCACHEDDUEDIRECTMODIFIED)) { |
| 19651 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTCOMPLETIONGRAPHCACHEDDUEDIRECTMODIFIED); |
| 19652 |
addIndividualToProcessingQueueDueToModification = true; |
| 19653 |
} |
| 19654 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED) && !indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATURATIONBLOCKINGCACHEDDUEDIRECTMODIFIED)) { |
| 19655 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATURATIONBLOCKINGCACHEDDUEDIRECTMODIFIED); |
| 19656 |
addIndividualToProcessingQueueDueToModification = true; |
| 19657 |
} |
| 19658 |
|
| 19659 |
if (addIndividualToProcessingQueueDueToModification) { |
| 19660 |
addIndividualToBlockingUpdateReviewProcessingQueue(indi,calcAlgContext); |
| 19661 |
} |
| 19662 |
|
| 19663 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKEND | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED) && !indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTBACKENDSYNCHRONIZATIONDUEDIRECTMODIFIED)) { |
| 19664 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTBACKENDSYNCHRONIZATIONDUEDIRECTMODIFIED); |
| 19665 |
if (!addIndividualToProcessingQueueDueToModification) { |
| 19666 |
addIndividualToBackendSynchronisationRetestQueue(indi,calcAlgContext); |
| 19667 |
} |
| 19668 |
} |
| 19669 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION) && !indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTBACKENDSYNCHRONIZATIONDUEDIRECTMODIFIED) && !indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDFULLEXPANSION)) { |
| 19670 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTBACKENDSYNCHRONIZATIONDUEDIRECTMODIFIED); |
| 19671 |
if (!addIndividualToProcessingQueueDueToModification) { |
| 19672 |
addIndividualToBackendDirectInfluenceExpansionQueue(indi, calcAlgContext); |
| 19673 |
} |
| 19674 |
} |
| 19675 |
if (mOptIncrementalCompatibleExpansion && indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANDING) && !indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANSIONRETESTDUEDIRECTMODIFIED)) { |
| 19676 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANSIONRETESTDUEDIRECTMODIFIED); |
| 19677 |
addIndividualToIncrementalCompatibilityCheckingQueue(indi,calcAlgContext); |
| 19678 |
} |
| 19679 |
|
| 19680 |
if (indi->isNominalIndividualNode() && indi->getNominalIndividual() && indi->isDelayedNominalProcessingQueued()) { |
| 19681 |
indi->setDelayedNominalProcessingQueued(false); |
| 19682 |
addIndividualToProcessingQueue(indi,calcAlgContext); |
| 19683 |
} |
| 19684 |
} |
| 19685 |
|
| 19686 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndirectSuccessorBlocking(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19687 |
propagateAddingBlockedProcessingRestrictionToSuccessors(indi,CIndividualProcessNode::PRFINDIRECTBLOCKED,true,CIndividualProcessNode::PRFINDIRECTBLOCKED,calcAlgContext); |
| 19688 |
propagateClearingProcessingRestrictionToSuccessors(indi, CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS, true, CIndividualProcessNode::PRFINDIRECTBLOCKED, calcAlgContext); |
| 19689 |
} |
| 19690 |
|
| 19691 |
|
| 19692 |
|
| 19693 |
|
| 19694 |
|
| 19695 |
void CCalculationTableauCompletionTaskHandleAlgorithm::pruneSuccessors(CIndividualProcessNode*& indi, CIndividualProcessNode* ancestorIndi, bool removeNominalLinks, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19696 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED); |
| 19697 |
|
| 19698 |
eliminiateBlockedIndividuals(indi,calcAlgContext); |
| 19699 |
|
| 19700 |
if (removeNominalLinks && ancestorIndi) { |
| 19701 |
cint64 ancIndiID = ancestorIndi->getIndividualNodeID(); |
| 19702 |
CConnectionSuccessorSet* connSuccSet = indi->getConnectionSuccessorSet(false); |
| 19703 |
if (connSuccSet) { |
| 19704 |
if (connSuccSet->getConnectionSuccessorCount() > 0) { |
| 19705 |
CConnectionSuccessorSetIterator conSuccIt = connSuccSet->getConnectionSuccessorIterator(); |
| 19706 |
while (conSuccIt.hasNext()) { |
| 19707 |
cint64 connID = conSuccIt.next(true); |
| 19708 |
if (ancIndiID != connID) { |
| 19709 |
CIndividualProcessNode* nomIndi = getUpToDateIndividual(connID,calcAlgContext); |
| 19710 |
if (nomIndi->isNominalIndividualNode()) { |
| 19711 |
CIndividualProcessNode* locNomIndi = getLocalizedIndividual(nomIndi,false,calcAlgContext); |
| 19712 |
CSuccessorRoleIterator succRoleIt = locNomIndi->getSuccessorRoleIterator(indi); |
| 19713 |
while (succRoleIt.hasNext()) { |
| 19714 |
CIndividualLinkEdge* link = succRoleIt.next(true); |
| 19715 |
locNomIndi->removeIndividualLink(link); |
| 19716 |
} |
| 19717 |
locNomIndi->removeIndividualConnection(indi); |
| 19718 |
} |
| 19719 |
} |
| 19720 |
} |
| 19721 |
} |
| 19722 |
} |
| 19723 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 19724 |
while (succIt.hasNext()) { |
| 19725 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 19726 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 19727 |
if (succIndi->isNominalIndividualNode() && succIndi->getIndividualNodeID() != ancIndiID) { |
| 19728 |
CIndividualProcessNode* locNomIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 19729 |
CSuccessorRoleIterator succRoleIt = locNomIndi->getSuccessorRoleIterator(indi); |
| 19730 |
while (succRoleIt.hasNext()) { |
| 19731 |
CIndividualLinkEdge* link = succRoleIt.next(true); |
| 19732 |
locNomIndi->removeIndividualLink(link); |
| 19733 |
} |
| 19734 |
locNomIndi->removeIndividualConnection(indi); |
| 19735 |
} |
| 19736 |
} |
| 19737 |
|
| 19738 |
} |
| 19739 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 19740 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 19741 |
while (succIt.hasNext()) { |
| 19742 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 19743 |
if (succLink->getCreatorIndividual()->getIndividualNodeID() == indi->getIndividualNodeID()) { |
| 19744 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 19745 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 19746 |
if (succAncDepth > ancDepth) { |
| 19747 |
if (succIndi->isBlockableIndividual() && !succIndi->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 19748 |
CIndividualProcessNode* locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 19749 |
pruneSuccessors(locSuccIndi,indi,true,calcAlgContext); |
| 19750 |
} |
| 19751 |
} |
| 19752 |
} |
| 19753 |
} |
| 19754 |
} |
| 19755 |
|
| 19756 |
|
| 19757 |
|
| 19758 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateProcessingRestrictionToAncestor(CIndividualProcessNode*& indi, cint64 addRestrictionFlags, bool recursive, cint64 whileNotContainsFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19759 |
propagateAddingProcessingRestrictionToAncestor(indi,addRestrictionFlags,recursive,whileNotContainsFlags,calcAlgContext); |
| 19760 |
} |
| 19761 |
|
| 19762 |
|
| 19763 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateAddingProcessingRestrictionToAncestor(CIndividualProcessNode*& indi, cint64 addRestrictionFlags, bool recursive, cint64 whileNotContainsFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19764 |
if (indi->hasIndividualAncestor()) { |
| 19765 |
CIndividualProcessNode* ancIndi = getAncestorIndividual(indi,calcAlgContext); |
| 19766 |
if (!ancIndi->hasPartialProcessingRestrictionFlags(whileNotContainsFlags)) { |
| 19767 |
CIndividualProcessNode* locAncIndi = getLocalizedIndividual(ancIndi,false,calcAlgContext); |
| 19768 |
locAncIndi->addProcessingRestrictionFlags(addRestrictionFlags); |
| 19769 |
if (recursive) { |
| 19770 |
propagateAddingProcessingRestrictionToAncestor(locAncIndi,addRestrictionFlags,recursive,whileNotContainsFlags,calcAlgContext); |
| 19771 |
} |
| 19772 |
} |
| 19773 |
} |
| 19774 |
} |
| 19775 |
|
| 19776 |
|
| 19777 |
|
| 19778 |
|
| 19779 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateProcessingRestrictionToSuccessors(CIndividualProcessNode*& indi, cint64 addRestrictionFlags, bool recursive, cint64 whileNotContainsFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19780 |
propagateAddingProcessingRestrictionToSuccessors(indi,addRestrictionFlags,recursive,whileNotContainsFlags,calcAlgContext); |
| 19781 |
} |
| 19782 |
|
| 19783 |
|
| 19784 |
|
| 19785 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateAddingBlockedProcessingRestrictionToSuccessors(CIndividualProcessNode*& indi, cint64 addRestrictionFlags, bool recursive, cint64 whileNotContainsFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19786 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 19787 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 19788 |
while (succIt.hasNext()) { |
| 19789 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 19790 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 19791 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 19792 |
if (succAncDepth > ancDepth) { |
| 19793 |
if (!succIndi->hasPartialProcessingRestrictionFlags(whileNotContainsFlags)) { |
| 19794 |
CIndividualProcessNode* locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 19795 |
locSuccIndi->addProcessingRestrictionFlags(addRestrictionFlags); |
| 19796 |
if (recursive) { |
| 19797 |
propagateAddingBlockedProcessingRestrictionToSuccessors(locSuccIndi,addRestrictionFlags,recursive,whileNotContainsFlags,calcAlgContext); |
| 19798 |
} |
| 19799 |
eliminiateBlockedIndividuals(locSuccIndi,calcAlgContext); |
| 19800 |
} |
| 19801 |
} |
| 19802 |
} |
| 19803 |
} |
| 19804 |
|
| 19805 |
|
| 19806 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateAddingProcessingRestrictionToSuccessors(CIndividualProcessNode*& indi, cint64 addRestrictionFlags, bool recursive, cint64 whileNotContainsFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19807 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 19808 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 19809 |
while (succIt.hasNext()) { |
| 19810 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 19811 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 19812 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 19813 |
if (succAncDepth > ancDepth) { |
| 19814 |
if (!succIndi->hasPartialProcessingRestrictionFlags(whileNotContainsFlags)) { |
| 19815 |
CIndividualProcessNode* locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 19816 |
locSuccIndi->addProcessingRestrictionFlags(addRestrictionFlags); |
| 19817 |
if (recursive) { |
| 19818 |
propagateAddingProcessingRestrictionToSuccessors(locSuccIndi,addRestrictionFlags,recursive,whileNotContainsFlags,calcAlgContext); |
| 19819 |
} |
| 19820 |
} |
| 19821 |
} |
| 19822 |
} |
| 19823 |
} |
| 19824 |
|
| 19825 |
|
| 19826 |
|
| 19827 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateClearingProcessingRestrictionToSuccessors(CIndividualProcessNode*& indi, cint64 clearRestrictionFlags, bool recursive, cint64 whileContainsFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19828 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 19829 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 19830 |
while (succIt.hasNext()) { |
| 19831 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 19832 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 19833 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 19834 |
if (succAncDepth > ancDepth) { |
| 19835 |
if (succIndi->hasPartialProcessingRestrictionFlags(whileContainsFlags)) { |
| 19836 |
CIndividualProcessNode* locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 19837 |
locSuccIndi->clearProcessingRestrictionFlags(clearRestrictionFlags); |
| 19838 |
if (recursive) { |
| 19839 |
propagateClearingProcessingRestrictionToSuccessors(locSuccIndi,clearRestrictionFlags,recursive,whileContainsFlags,calcAlgContext); |
| 19840 |
} |
| 19841 |
} |
| 19842 |
} |
| 19843 |
} |
| 19844 |
} |
| 19845 |
|
| 19846 |
|
| 19847 |
void CCalculationTableauCompletionTaskHandleAlgorithm::reactivateIndirectBlockedSuccessors(CIndividualProcessNode*& indi, bool recursive, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19848 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 19849 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 19850 |
while (succIt.hasNext()) { |
| 19851 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 19852 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 19853 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 19854 |
if (succAncDepth > ancDepth) { |
| 19855 |
if (succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINDIRECTBLOCKED)) { |
| 19856 |
if (!succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS)) { |
| 19857 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(succIndi,true,calcAlgContext); |
| 19858 |
locBlockedIndiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS); |
| 19859 |
addIndividualToProcessingQueue(locBlockedIndiNode,calcAlgContext); |
| 19860 |
} |
| 19861 |
} |
| 19862 |
} |
| 19863 |
} |
| 19864 |
} |
| 19865 |
|
| 19866 |
|
| 19867 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::reactivateBlockedIndividuals(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19868 |
CXLinker<CIndividualProcessNode*>* blockedIndiNodeIt = indi->getBlockedIndividualsLinker(); |
| 19869 |
while (blockedIndiNodeIt) { |
| 19870 |
CIndividualProcessNode* blockedIndiNode = blockedIndiNodeIt->getData(); |
| 19871 |
if (!blockedIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEBLOCKERMODIFIED)) { |
| 19872 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNode,true,calcAlgContext); |
| 19873 |
locBlockedIndiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEBLOCKERMODIFIED); |
| 19874 |
addIndividualToProcessingQueue(locBlockedIndiNode,calcAlgContext); |
| 19875 |
} |
| 19876 |
blockedIndiNodeIt = blockedIndiNodeIt->getNext(); |
| 19877 |
} |
| 19878 |
indi->clearBlockedIndividualsLinker(); |
| 19879 |
return true; |
| 19880 |
} |
| 19881 |
|
| 19882 |
|
| 19883 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualProcessedAndReactivate(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19884 |
if (mOptProcessedNodePropagation || mOptProcessedConsNodePropagation && indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCONSNODEPREPARATIONINDINODE)) { |
| 19885 |
if (!indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGCOMPLETED)) { |
| 19886 |
indi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGCOMPLETED); |
| 19887 |
|
| 19888 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORALLPROCESSED) || !hasAncestorIndividualNode(indi,calcAlgContext)) { |
| 19889 |
// wake up next individual nodes |
| 19890 |
|
| 19891 |
searchReactivateIndividualsProcessedPropagated(indi,calcAlgContext); |
| 19892 |
} |
| 19893 |
} |
| 19894 |
} |
| 19895 |
} |
| 19896 |
|
| 19897 |
void CCalculationTableauCompletionTaskHandleAlgorithm::searchReactivateIndividualsProcessedPropagated(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19898 |
|
| 19899 |
|
| 19900 |
CXLinker<CIndividualProcessNode*>* processingBlockedNodeLinker = indi->getProcessingBlockedIndividualsLinker(); |
| 19901 |
while (processingBlockedNodeLinker) { |
| 19902 |
CIndividualProcessNode* blockedNode = processingBlockedNodeLinker->getData(); |
| 19903 |
CIndividualProcessNode* locBlockedNode = getLocalizedIndividual(blockedNode,true,calcAlgContext); |
| 19904 |
locBlockedNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEPROCESSINGCOMPLETED); |
| 19905 |
addIndividualToProcessingQueue(locBlockedNode,calcAlgContext); |
| 19906 |
// set blocking retest flag, clear processing blocked flag |
| 19907 |
processingBlockedNodeLinker = processingBlockedNodeLinker->getNext(); |
| 19908 |
} |
| 19909 |
indi->clearBlockedIndividualsLinker(); |
| 19910 |
|
| 19911 |
cint64 indiID = indi->getIndividualNodeID(); |
| 19912 |
|
| 19913 |
// TODO: check multiple not processed ancestors |
| 19914 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 19915 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 19916 |
while (succIt.hasNext()) { |
| 19917 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 19918 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 19919 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 19920 |
if (succAncDepth > ancDepth) { |
| 19921 |
if (!succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORALLPROCESSED)) { |
| 19922 |
// test whether have unprocessed nominals or ancestor |
| 19923 |
bool allProcessedAncestor = true; |
| 19924 |
CConnectionSuccessorSetIterator connIt = succIndi->getConnectionSuccessorIterator(); |
| 19925 |
while (allProcessedAncestor && connIt.hasNext()) { |
| 19926 |
cint64 connIndiNodeID = connIt.next(); |
| 19927 |
if (connIndiNodeID != indiID) { |
| 19928 |
CIndividualProcessNode* ancNomIndi = getUpToDateIndividual(connIndiNodeID,calcAlgContext); |
| 19929 |
if (ancNomIndi->getIndividualAncestorDepth() >= ancDepth || ancNomIndi->isNominalIndividualNode()) { |
| 19930 |
if (!ancNomIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGCOMPLETED | CIndividualProcessNode::PRFANCESTORALLPROCESSED)) { |
| 19931 |
allProcessedAncestor = false; |
| 19932 |
} |
| 19933 |
} |
| 19934 |
} |
| 19935 |
} |
| 19936 |
if (allProcessedAncestor) { |
| 19937 |
CIndividualProcessNode* locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 19938 |
locSuccIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORALLPROCESSED); |
| 19939 |
if (!locSuccIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGCOMPLETED)) { |
| 19940 |
if (locSuccIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGBLOCKED)) { |
| 19941 |
locSuccIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEPROCESSINGCOMPLETED); |
| 19942 |
addIndividualToProcessingQueue(locSuccIndi,calcAlgContext); |
| 19943 |
} |
| 19944 |
} else { |
| 19945 |
// search recursive all nodes which has to be reactivated |
| 19946 |
searchReactivateIndividualsProcessedPropagated(locSuccIndi,calcAlgContext); |
| 19947 |
} |
| 19948 |
} |
| 19949 |
} |
| 19950 |
} |
| 19951 |
} |
| 19952 |
} |
| 19953 |
|
| 19954 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualUnprocessed(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19955 |
if (mOptProcessedNodePropagation) { |
| 19956 |
propagateIndividualUnprocessed(indi,false,calcAlgContext); |
| 19957 |
} else if (mOptProcessedConsNodePropagation) { |
| 19958 |
propagateIndividualUnprocessed(indi,true,calcAlgContext); |
| 19959 |
} |
| 19960 |
} |
| 19961 |
|
| 19962 |
|
| 19963 |
|
| 19964 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualUnprocessed(CIndividualProcessNode*& indi, bool requiresConsFlag, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19965 |
if (!requiresConsFlag || indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCONSNODEPREPARATIONINDINODE)) { |
| 19966 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGCOMPLETED)) { |
| 19967 |
indi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGCOMPLETED); |
| 19968 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORALLPROCESSED)) { |
| 19969 |
|
| 19970 |
CSuccessorIterator succIt = indi->getSuccessorIterator(); |
| 19971 |
cint64 ancDepth = indi->getIndividualAncestorDepth(); |
| 19972 |
while (succIt.hasNext()) { |
| 19973 |
CIndividualLinkEdge* succLink = succIt.nextLink(true); |
| 19974 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi,succLink,calcAlgContext); |
| 19975 |
cint64 succAncDepth = succIndi->getIndividualAncestorDepth(); |
| 19976 |
if (succAncDepth > ancDepth) { |
| 19977 |
if (!succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORALLPROCESSED)) { |
| 19978 |
CIndividualProcessNode* locSuccIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 19979 |
locSuccIndi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORALLPROCESSED); |
| 19980 |
propagateIndividualUnprocessed(locSuccIndi,CIndividualProcessNode::PRFANCESTORALLPROCESSED,calcAlgContext); |
| 19981 |
} |
| 19982 |
} |
| 19983 |
} |
| 19984 |
|
| 19985 |
} |
| 19986 |
} |
| 19987 |
} |
| 19988 |
} |
| 19989 |
|
| 19990 |
|
| 19991 |
|
| 19992 |
|
| 19993 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodeProcessingBlocked(CIndividualProcessNode* blockingTestIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 19994 |
STATINC(INDINODEPROCESSINGBLOCKINGTESTCOUNT,calcAlgContext); |
| 19995 |
if (blockingTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENPROCESSINGDELAYING)) { |
| 19996 |
return true; |
| 19997 |
} |
| 19998 |
if (blockingTestIndi->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 19999 |
return true; |
| 20000 |
} |
| 20001 |
if (isSaturationCachedProcessingBlocked(blockingTestIndi,calcAlgContext)) { |
| 20002 |
return true; |
| 20003 |
} |
| 20004 |
if (isIndividualNodeCompletionGraphCached(blockingTestIndi,calcAlgContext)) { |
| 20005 |
return true; |
| 20006 |
} |
| 20007 |
if (isSatisfiableCachedProcessingBlocked(blockingTestIndi,calcAlgContext)) { |
| 20008 |
return true; |
| 20009 |
} |
| 20010 |
if (isSignatureBlockedProcessingBlocked(blockingTestIndi,calcAlgContext)) { |
| 20011 |
return true; |
| 20012 |
} |
| 20013 |
if (blockingTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFPROCESSINGBLOCKED)) { |
| 20014 |
if (mOptDetExpPreporcessing) { |
| 20015 |
return true; |
| 20016 |
} else { |
| 20017 |
return detectIndividualNodeBlockedStatus(blockingTestIndi,calcAlgContext); |
| 20018 |
} |
| 20019 |
} |
| 20020 |
if (blockingTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINDIRECTBLOCKED)) { |
| 20021 |
if (blockingTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS)) { |
| 20022 |
return detectIndividualNodeBlockedStatus(blockingTestIndi,calcAlgContext); |
| 20023 |
} else { |
| 20024 |
return true; |
| 20025 |
} |
| 20026 |
} |
| 20027 |
if (blockingTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFDIRECTBLOCKED)) { |
| 20028 |
if (blockingTestIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEDIRECTMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEBLOCKERMODIFIED)) { |
| 20029 |
return detectIndividualNodeBlockedStatus(blockingTestIndi,calcAlgContext); |
| 20030 |
} else { |
| 20031 |
return true; |
| 20032 |
} |
| 20033 |
} |
| 20034 |
return false; |
| 20035 |
} |
| 20036 |
|
| 20037 |
|
| 20038 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodeExpansionBlocked(CIndividualProcessNode* blockingTestIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20039 |
STATINC(INDINODEEXPANSIONBLOCKINGTESTCOUNT,calcAlgContext); |
| 20040 |
return detectIndividualNodeBlockedStatus(blockingTestIndi,calcAlgContext); |
| 20041 |
} |
| 20042 |
|
| 20043 |
|
| 20044 |
|
| 20045 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::needsIndividualNodeExpansionBlockingTest(CConceptProcessDescriptor* conProDes, CIndividualProcessNode* blockingTestIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20046 |
CConceptDescriptor* conDes = conProDes->getConceptDescriptor(); |
| 20047 |
CConcept* concept = conDes->getConcept(); |
| 20048 |
double conPriority = conProDes->getProcessPriority().getPriority(); |
| 20049 |
bool conNeg = conDes->getNegation(); |
| 20050 |
cint64 opCode = concept->getOperatorCode(); |
| 20051 |
cint64 opCount = concept->getOperandCount();; |
| 20052 |
cint64 parameter = concept->getParameter(); |
| 20053 |
bool needsBlockingTest = false; |
| 20054 |
if (!conNeg) { |
| 20055 |
switch (opCode) { |
| 20056 |
case CCSOME : case CCATLEAST : case CCAQSOME: { |
| 20057 |
needsBlockingTest = true; |
| 20058 |
break; |
| 20059 |
} |
| 20060 |
case CCOR : { |
| 20061 |
if (mOptNonStrictIndiNodeProcessing) { |
| 20062 |
if (opCount >= 1) { |
| 20063 |
needsBlockingTest = true; |
| 20064 |
} |
| 20065 |
} |
| 20066 |
break; |
| 20067 |
} |
| 20068 |
case CCATMOST : { |
| 20069 |
if (mOptNonStrictIndiNodeProcessing) { |
| 20070 |
if (parameter > 1) { |
| 20071 |
needsBlockingTest = true; |
| 20072 |
} |
| 20073 |
} |
| 20074 |
break; |
| 20075 |
} |
| 20076 |
} |
| 20077 |
} else { |
| 20078 |
switch (opCode) { |
| 20079 |
case CCALL : case CCATMOST : { |
| 20080 |
needsBlockingTest = true; |
| 20081 |
break; |
| 20082 |
} |
| 20083 |
case CCAND : case CCEQ : { |
| 20084 |
if (mOptNonStrictIndiNodeProcessing) { |
| 20085 |
if (opCount >= 1) { |
| 20086 |
needsBlockingTest = true; |
| 20087 |
} |
| 20088 |
} |
| 20089 |
break; |
| 20090 |
} |
| 20091 |
case CCATLEAST : { |
| 20092 |
if (mOptNonStrictIndiNodeProcessing) { |
| 20093 |
if (parameter > 2) { |
| 20094 |
needsBlockingTest = true; |
| 20095 |
} |
| 20096 |
} |
| 20097 |
break; |
| 20098 |
} |
| 20099 |
} |
| 20100 |
|
| 20101 |
} |
| 20102 |
return needsBlockingTest; |
| 20103 |
} |
| 20104 |
|
| 20105 |
|
| 20106 |
|
| 20107 |
|
| 20108 |
|
| 20109 |
|
| 20110 |
|
| 20111 |
|
| 20112 |
|
| 20113 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasAncestorIndividualNode(CIndividualProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20114 |
CIndividualProcessNode* ancIndi = nullptr; |
| 20115 |
CIndividualLinkEdge* ancLink = processIndi->getAncestorLink(); |
| 20116 |
return ancLink != nullptr; |
| 20117 |
|
| 20118 |
} |
| 20119 |
|
| 20120 |
|
| 20121 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasRoleSuccessorConcept(CIndividualProcessNode*& processIndi, CRole* role, CConcept* concept, bool conceptNegation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20122 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 20123 |
if (roleSuccHash) { |
| 20124 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role); |
| 20125 |
while (roleSuccIt.hasNext()) { |
| 20126 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 20127 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 20128 |
CReapplyConceptLabelSet* conLabelSet = succIndi->getReapplyConceptLabelSet(false); |
| 20129 |
bool contained = conLabelSet->hasConcept(concept,conceptNegation); |
| 20130 |
if (contained) { |
| 20131 |
return true; |
| 20132 |
} |
| 20133 |
} |
| 20134 |
} |
| 20135 |
return false; |
| 20136 |
} |
| 20137 |
|
| 20138 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasRoleSuccessorConcepts(CIndividualProcessNode*& processIndi, CRole* role, CSortedNegLinker<CConcept*>* conceptLinker, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20139 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 20140 |
if (roleSuccHash) { |
| 20141 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role); |
| 20142 |
while (roleSuccIt.hasNext()) { |
| 20143 |
bool allContained = true; |
| 20144 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 20145 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 20146 |
CReapplyConceptLabelSet* conLabelSet = succIndi->getReapplyConceptLabelSet(false); |
| 20147 |
CSortedNegLinker<CConcept*>* conceptLinkerIt = conceptLinker; |
| 20148 |
while (conceptLinkerIt && allContained) { |
| 20149 |
CConcept* concept = conceptLinkerIt->getData(); |
| 20150 |
bool conceptNegation = conceptLinkerIt->isNegated() ^ negate; |
| 20151 |
bool contained = conLabelSet->hasConcept(concept,conceptNegation); |
| 20152 |
allContained &= contained; |
| 20153 |
conceptLinkerIt = conceptLinkerIt->getNext(); |
| 20154 |
} |
| 20155 |
if (allContained) { |
| 20156 |
if (processIndi->isIndividualAncestor(succIndi)) { |
| 20157 |
} |
| 20158 |
return true; |
| 20159 |
} |
| 20160 |
} |
| 20161 |
} |
| 20162 |
return false; |
| 20163 |
} |
| 20164 |
|
| 20165 |
|
| 20166 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getRoleSuccessorWithConcepts(CIndividualProcessNode*& processIndi, CRole* role, CSortedNegLinker<CConcept*>* conceptLinker, bool negate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20167 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 20168 |
if (roleSuccHash) { |
| 20169 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role); |
| 20170 |
while (roleSuccIt.hasNext()) { |
| 20171 |
bool allContained = true; |
| 20172 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 20173 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 20174 |
CReapplyConceptLabelSet* conLabelSet = succIndi->getReapplyConceptLabelSet(false); |
| 20175 |
CSortedNegLinker<CConcept*>* conceptLinkerIt = conceptLinker; |
| 20176 |
while (conceptLinkerIt && allContained) { |
| 20177 |
CConcept* concept = conceptLinkerIt->getData(); |
| 20178 |
bool conceptNegation = conceptLinkerIt->isNegated() ^ negate; |
| 20179 |
bool contained = conLabelSet->hasConcept(concept,conceptNegation); |
| 20180 |
allContained &= contained; |
| 20181 |
conceptLinkerIt = conceptLinkerIt->getNext(); |
| 20182 |
} |
| 20183 |
if (allContained) { |
| 20184 |
return succIndi; |
| 20185 |
} |
| 20186 |
} |
| 20187 |
} |
| 20188 |
return nullptr; |
| 20189 |
} |
| 20190 |
|
| 20191 |
|
| 20192 |
|
| 20193 |
|
| 20194 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasDistinctRoleSuccessorConcepts(CIndividualProcessNode*& processIndi, CRole* role, CSortedNegLinker<CConcept*>* conceptLinker, bool negate, cint64 distinctCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20195 |
CReapplyRoleSuccessorHash* roleSuccHash = processIndi->getReapplyRoleSuccessorHash(false); |
| 20196 |
if (roleSuccHash) { |
| 20197 |
CRoleSuccessorLinkIterator roleSuccIt = roleSuccHash->getRoleSuccessorLinkIterator(role); |
| 20198 |
while (roleSuccIt.hasNext()) { |
| 20199 |
bool allContained = true; |
| 20200 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 20201 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(processIndi,link,calcAlgContext); |
| 20202 |
cint64 succIndiID = succIndi->getIndividualNodeID(); |
| 20203 |
CDistinctHash* disHash = succIndi->getDistinctHash(false); |
| 20204 |
if (disHash) { |
| 20205 |
cint64 maxSuccDisCount = disHash->getDistinctCount()+1; |
| 20206 |
if (maxSuccDisCount >= distinctCount && containsIndividualNodeConcepts(succIndi,conceptLinker,negate,calcAlgContext)) { |
| 20207 |
cint64 succDisCount = 1; |
| 20208 |
cint64 failDisCount = 0; |
| 20209 |
CDistinctIterator disIt = disHash->getDistinctIterator(); |
| 20210 |
while (disIt.hasNext() && maxSuccDisCount-failDisCount >= distinctCount && succDisCount < distinctCount) { |
| 20211 |
cint64 disIndiID = disIt.nextDistinctIndividualID(); |
| 20212 |
if (disIndiID != succIndiID && processIndi->hasRoleSuccessorToIndividual(role,disIndiID,true)) { |
| 20213 |
// check has necessary concept |
| 20214 |
if (disIndiID < succIndiID) { |
| 20215 |
// the combination has been already checked, where successor individual node had the smaller ID |
| 20216 |
break; |
| 20217 |
} |
| 20218 |
CIndividualProcessNode* disIndi = getUpToDateIndividual(disIndiID,calcAlgContext); |
| 20219 |
if (containsIndividualNodeConcepts(disIndi,conceptLinker,negate,calcAlgContext)) { |
| 20220 |
++succDisCount; |
| 20221 |
} else { |
| 20222 |
++failDisCount; |
| 20223 |
} |
| 20224 |
} |
| 20225 |
} |
| 20226 |
if (succDisCount >= distinctCount) { |
| 20227 |
return true; |
| 20228 |
} |
| 20229 |
} |
| 20230 |
} |
| 20231 |
} |
| 20232 |
} |
| 20233 |
return false; |
| 20234 |
} |
| 20235 |
|
| 20236 |
|
| 20237 |
void CCalculationTableauCompletionTaskHandleAlgorithm::createIndividualNodeDisjointRolesLinks(CIndividualProcessNode*& sourceIndi, CIndividualProcessNode*& destinationIndi, CSortedNegLinker<CRole*>* disjointRoleLinker, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20238 |
if (disjointRoleLinker) { |
| 20239 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 20240 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 20241 |
|
| 20242 |
CSortedNegLinker<CRole*>* disjointRoleLinkerIt = disjointRoleLinker; |
| 20243 |
while (disjointRoleLinkerIt) { |
| 20244 |
CRole* disjointRole = disjointRoleLinkerIt->getData(); |
| 20245 |
|
| 20246 |
// add negation / disjoint edge |
| 20247 |
CNegationDisjointEdge* negDisEdge = CObjectParameterizingAllocator< CNegationDisjointEdge,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 20248 |
negDisEdge->initNegationDisjointEdge(sourceIndi,destinationIndi,disjointRole,depTrackPoint); |
| 20249 |
|
| 20250 |
CIndividualLinkEdge* linkIndi = sourceIndi->getRoleSuccessorToIndividualLink(disjointRole,destinationIndi,true); |
| 20251 |
if (linkIndi) { |
| 20252 |
// create clash |
| 20253 |
CClashedDependencyDescriptor* clashDes = nullptr; |
| 20254 |
clashDes = createClashedIndividualLinkDescriptor(clashDes,linkIndi,linkIndi->getDependencyTrackPoint(),calcAlgContext); |
| 20255 |
clashDes = createClashedNegationDisjointDescriptor(clashDes,negDisEdge,depTrackPoint,calcAlgContext); |
| 20256 |
throw CCalculationClashProcessingException(clashDes); |
| 20257 |
} else { |
| 20258 |
sourceIndi->setDisjointRoleConnections(true); |
| 20259 |
destinationIndi->setDisjointRoleConnections(true); |
| 20260 |
sourceIndi->installDisjointLink(negDisEdge); |
| 20261 |
} |
| 20262 |
disjointRoleLinkerIt = disjointRoleLinkerIt->getNext(); |
| 20263 |
} |
| 20264 |
// it is not necessary to install to the destination individual node the connection from the source node, the disjoint roles have a role link which does this already |
| 20265 |
} |
| 20266 |
} |
| 20267 |
|
| 20268 |
|
| 20269 |
|
| 20270 |
void CCalculationTableauCompletionTaskHandleAlgorithm::createIndividualNodeNegationLink(CIndividualProcessNode*& sourceIndi, CIndividualProcessNode*& destinationIndi, CRole* negationRole, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20271 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 20272 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 20273 |
|
| 20274 |
CNegationDisjointEdge* negDisEdge = CObjectParameterizingAllocator< CNegationDisjointEdge,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 20275 |
negDisEdge->initNegationDisjointEdge(sourceIndi,destinationIndi,negationRole,depTrackPoint); |
| 20276 |
|
| 20277 |
CIndividualLinkEdge* linkIndi = sourceIndi->getRoleSuccessorToIndividualLink(negationRole,destinationIndi,true); |
| 20278 |
if (linkIndi) { |
| 20279 |
// create clash |
| 20280 |
CClashedDependencyDescriptor* clashDes = nullptr; |
| 20281 |
clashDes = createClashedIndividualLinkDescriptor(clashDes,linkIndi,linkIndi->getDependencyTrackPoint(),calcAlgContext); |
| 20282 |
clashDes = createClashedNegationDisjointDescriptor(clashDes,negDisEdge,depTrackPoint,calcAlgContext); |
| 20283 |
throw CCalculationClashProcessingException(clashDes); |
| 20284 |
} else { |
| 20285 |
// add negation / disjoint edge |
| 20286 |
sourceIndi->installDisjointLink(negDisEdge); |
| 20287 |
sourceIndi->setDisjointRoleConnections(true); |
| 20288 |
destinationIndi->setDisjointRoleConnections(true); |
| 20289 |
destinationIndi->getConnectionSuccessorSet(true)->insertConnectionSuccessor(sourceIndi->getIndividualNodeID()); |
| 20290 |
} |
| 20291 |
} |
| 20292 |
|
| 20293 |
|
| 20294 |
|
| 20295 |
|
| 20296 |
|
| 20297 |
|
| 20298 |
|
| 20299 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualNodeNewNominalConnectionToAncestors(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20300 |
propagateIndividualNodeNominalConnectionFlagsToAncestors(indi,CIndividualProcessNode::PRFSUCCESSORNEWNOMINALCONNECTION | CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION,calcAlgContext); |
| 20301 |
} |
| 20302 |
|
| 20303 |
|
| 20304 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualNodeNominalConnectionToAncestors(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20305 |
propagateIndividualNodeNominalConnectionFlagsToAncestors(indi,CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION,calcAlgContext); |
| 20306 |
} |
| 20307 |
|
| 20308 |
|
| 20309 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualNodeNominalConnectionFlagsToAncestors(CIndividualProcessNode*& indi, cint64 nominalPropagationFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20310 |
|
| 20311 |
CIndividualProcessNode* ancIndi = indi; |
| 20312 |
while (ancIndi && !ancIndi->hasPartialProcessingRestrictionFlags(nominalPropagationFlags)) { |
| 20313 |
ancIndi->addProcessingRestrictionFlags(nominalPropagationFlags); |
| 20314 |
|
| 20315 |
CXLinker<CIndividualProcessNode*>* procBlockIndiLinkerIt = ancIndi->getProcessingBlockedIndividualsLinker(); |
| 20316 |
while (procBlockIndiLinkerIt) { |
| 20317 |
CIndividualProcessNode* blockedIndiNode = procBlockIndiLinkerIt->getData(); |
| 20318 |
if (!blockedIndiNode->hasPartialProcessingRestrictionFlags(nominalPropagationFlags)) { |
| 20319 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNode,true,calcAlgContext); |
| 20320 |
propagateIndividualNodeNominalConnectionFlagsToAncestors(locBlockedIndiNode,nominalPropagationFlags,calcAlgContext); |
| 20321 |
} |
| 20322 |
procBlockIndiLinkerIt = procBlockIndiLinkerIt->getNext(); |
| 20323 |
} |
| 20324 |
CXLinker<CIndividualProcessNode*>* blockedIndiLinkerIt = ancIndi->getBlockedIndividualsLinker(); |
| 20325 |
while (blockedIndiLinkerIt) { |
| 20326 |
CIndividualProcessNode* blockedIndiNode = blockedIndiLinkerIt->getData(); |
| 20327 |
if (!blockedIndiNode->hasPartialProcessingRestrictionFlags(nominalPropagationFlags)) { |
| 20328 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNode,true,calcAlgContext); |
| 20329 |
propagateIndividualNodeNominalConnectionFlagsToAncestors(locBlockedIndiNode,nominalPropagationFlags,calcAlgContext); |
| 20330 |
} |
| 20331 |
blockedIndiLinkerIt = blockedIndiLinkerIt->getNext(); |
| 20332 |
} |
| 20333 |
CBlockingFollowSet* followSet = ancIndi->getBlockingFollowSet(false); |
| 20334 |
if (followSet) { |
| 20335 |
for (CBlockingFollowSet::const_iterator it = followSet->constBegin(), itEnd = followSet->constEnd(); it != itEnd; ++it) { |
| 20336 |
cint64 blockedIndiNodeID = *it; |
| 20337 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNodeID,calcAlgContext); |
| 20338 |
propagateIndividualNodeNominalConnectionFlagsToAncestors(locBlockedIndiNode,nominalPropagationFlags,calcAlgContext); |
| 20339 |
} |
| 20340 |
} |
| 20341 |
if (ancIndi->hasSuccessorIndividualNodeBackwardDependencyLinker()) { |
| 20342 |
CXLinker<CIndividualProcessNode*>* succIndiNodeBackwardDepLinkerIt = ancIndi->getSuccessorIndividualNodeBackwardDependencyLinker(); |
| 20343 |
while (succIndiNodeBackwardDepLinkerIt) { |
| 20344 |
CIndividualProcessNode* succIndiNodeBackwardDep = succIndiNodeBackwardDepLinkerIt->getData(); |
| 20345 |
if (ancIndi->hasSuccessorIndividualNode(succIndiNodeBackwardDep) && !succIndiNodeBackwardDep->hasPartialProcessingRestrictionFlags(nominalPropagationFlags)) { |
| 20346 |
CIndividualProcessNode* locSuccIndiNodeBackwardDep = getLocalizedIndividual(succIndiNodeBackwardDep,true,calcAlgContext); |
| 20347 |
propagateIndividualNodeNominalConnectionFlagsToAncestors(locSuccIndiNodeBackwardDep,nominalPropagationFlags,calcAlgContext); |
| 20348 |
} |
| 20349 |
succIndiNodeBackwardDepLinkerIt = succIndiNodeBackwardDepLinkerIt->getNext(); |
| 20350 |
} |
| 20351 |
} |
| 20352 |
|
| 20353 |
if (ancIndi->hasIndividualAncestor()) { |
| 20354 |
ancIndi = getAncestorIndividual(ancIndi,calcAlgContext); |
| 20355 |
CIndividualProcessNode* locAncIndi = getLocalizedIndividual(ancIndi,false,calcAlgContext); |
| 20356 |
ancIndi = locAncIndi; |
| 20357 |
} else { |
| 20358 |
ancIndi = nullptr; |
| 20359 |
} |
| 20360 |
} |
| 20361 |
} |
| 20362 |
|
| 20363 |
|
| 20364 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualNodeNominalConnectionStatusToAncestors(CIndividualProcessNode*& indi, CIndividualProcessNode* copyFromIndiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20365 |
if (copyFromIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION) || copyFromIndiNode->isNominalIndividualNode()) { |
| 20366 |
if (mConfExactNominalDependencyTracking) { |
| 20367 |
CSuccessorConnectedNominalSet* copySuccConnNomSet = copyFromIndiNode->getSuccessorNominalConnectionSet(false); |
| 20368 |
if (copySuccConnNomSet) { |
| 20369 |
for (CSuccessorConnectedNominalSet::const_iterator it = copySuccConnNomSet->constBegin(), itEnd = copySuccConnNomSet->constEnd(); it != itEnd; ++it) { |
| 20370 |
cint64 nominalID = *it; |
| 20371 |
if (!indi->hasSuccessorConnectionToNominal(nominalID)) { |
| 20372 |
propagateIndividualNodeConnectedNominalToAncestors(indi,nominalID,calcAlgContext); |
| 20373 |
} |
| 20374 |
} |
| 20375 |
} |
| 20376 |
} |
| 20377 |
if (copyFromIndiNode->isNominalIndividualNode()) { |
| 20378 |
CIndividual* nominalIndi = copyFromIndiNode->getNominalIndividual(); |
| 20379 |
if (mConfExactNominalDependencyTracking && nominalIndi) { |
| 20380 |
cint64 nominalID = -nominalIndi->getIndividualID(); |
| 20381 |
if (!indi->hasSuccessorConnectionToNominal(nominalID)) { |
| 20382 |
propagateIndividualNodeConnectedNominalToAncestors(indi,nominalID,calcAlgContext); |
| 20383 |
} |
| 20384 |
} |
| 20385 |
cint64 level = copyFromIndiNode->getIndividualNominalLevelOrAncestorDepth(); |
| 20386 |
if (!nominalIndi || level > 0) { |
| 20387 |
propagateIndividualNodeNewNominalConnectionToAncestors(indi,calcAlgContext); |
| 20388 |
} |
| 20389 |
} |
| 20390 |
if (!indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 20391 |
propagateIndividualNodeNominalConnectionToAncestors(indi,calcAlgContext); |
| 20392 |
} |
| 20393 |
|
| 20394 |
|
| 20395 |
if (copyFromIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNEWNOMINALCONNECTION)) { |
| 20396 |
propagateIndividualNodeNewNominalConnectionToAncestors(indi,calcAlgContext); |
| 20397 |
} |
| 20398 |
} |
| 20399 |
} |
| 20400 |
|
| 20401 |
|
| 20402 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualNodeConnectedNominalToAncestors(CIndividualProcessNode*& indi, cint64 nominalID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20403 |
cint64 nominalPropagationFlags = CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION; |
| 20404 |
CIndividualProcessNode* ancIndi = indi; |
| 20405 |
while (ancIndi && !ancIndi->hasSuccessorConnectionToNominal(nominalID)) { |
| 20406 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(ancIndi, calcAlgContext); |
| 20407 |
ancIndi->addProcessingRestrictionFlags(nominalPropagationFlags); |
| 20408 |
ancIndi->addSuccessorConnectionToNominal(nominalID); |
| 20409 |
|
| 20410 |
CXLinker<CIndividualProcessNode*>* procBlockIndiLinkerIt = ancIndi->getProcessingBlockedIndividualsLinker(); |
| 20411 |
while (procBlockIndiLinkerIt) { |
| 20412 |
CIndividualProcessNode* blockedIndiNode = procBlockIndiLinkerIt->getData(); |
| 20413 |
if (!blockedIndiNode->hasSuccessorConnectionToNominal(nominalID)) { |
| 20414 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNode,true,calcAlgContext); |
| 20415 |
propagateIndividualNodeConnectedNominalToAncestors(locBlockedIndiNode,nominalID,calcAlgContext); |
| 20416 |
} |
| 20417 |
procBlockIndiLinkerIt = procBlockIndiLinkerIt->getNext(); |
| 20418 |
} |
| 20419 |
CXLinker<CIndividualProcessNode*>* blockedIndiLinkerIt = ancIndi->getBlockedIndividualsLinker(); |
| 20420 |
while (blockedIndiLinkerIt) { |
| 20421 |
CIndividualProcessNode* blockedIndiNode = blockedIndiLinkerIt->getData(); |
| 20422 |
if (!blockedIndiNode->hasSuccessorConnectionToNominal(nominalID)) { |
| 20423 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNode,true,calcAlgContext); |
| 20424 |
propagateIndividualNodeConnectedNominalToAncestors(locBlockedIndiNode,nominalID,calcAlgContext); |
| 20425 |
} |
| 20426 |
blockedIndiLinkerIt = blockedIndiLinkerIt->getNext(); |
| 20427 |
} |
| 20428 |
CBlockingFollowSet* followSet = ancIndi->getBlockingFollowSet(false); |
| 20429 |
if (followSet) { |
| 20430 |
for (CBlockingFollowSet::const_iterator it = followSet->constBegin(), itEnd = followSet->constEnd(); it != itEnd; ++it) { |
| 20431 |
cint64 blockedIndiNodeID = *it; |
| 20432 |
CIndividualProcessNode* locBlockedIndiNode = getLocalizedIndividual(blockedIndiNodeID,calcAlgContext); |
| 20433 |
propagateIndividualNodeConnectedNominalToAncestors(locBlockedIndiNode,nominalID,calcAlgContext); |
| 20434 |
} |
| 20435 |
} |
| 20436 |
if (ancIndi->hasSuccessorIndividualNodeBackwardDependencyLinker()) { |
| 20437 |
CXLinker<CIndividualProcessNode*>* succIndiNodeBackwardDepLinkerIt = ancIndi->getSuccessorIndividualNodeBackwardDependencyLinker(); |
| 20438 |
while (succIndiNodeBackwardDepLinkerIt) { |
| 20439 |
CIndividualProcessNode* succIndiNodeBackwardDep = succIndiNodeBackwardDepLinkerIt->getData(); |
| 20440 |
if (ancIndi->hasSuccessorIndividualNode(succIndiNodeBackwardDep) && !succIndiNodeBackwardDep->hasSuccessorConnectionToNominal(nominalID)) { |
| 20441 |
CIndividualProcessNode* locSuccIndiNodeBackwardDep = getLocalizedIndividual(succIndiNodeBackwardDep,true,calcAlgContext); |
| 20442 |
propagateIndividualNodeConnectedNominalToAncestors(locSuccIndiNodeBackwardDep,nominalID,calcAlgContext); |
| 20443 |
} |
| 20444 |
succIndiNodeBackwardDepLinkerIt = succIndiNodeBackwardDepLinkerIt->getNext(); |
| 20445 |
} |
| 20446 |
} |
| 20447 |
|
| 20448 |
if (ancIndi->hasIndividualAncestor()) { |
| 20449 |
ancIndi = getAncestorIndividual(ancIndi,calcAlgContext); |
| 20450 |
CIndividualProcessNode* locAncIndi = getLocalizedIndividual(ancIndi,false,calcAlgContext); |
| 20451 |
ancIndi = locAncIndi; |
| 20452 |
} else { |
| 20453 |
ancIndi = nullptr; |
| 20454 |
} |
| 20455 |
} |
| 20456 |
} |
| 20457 |
|
| 20458 |
|
| 20459 |
|
| 20460 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndividualNodeNeighboursNominalConnectionToAncestors(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20461 |
CConnectionSuccessorSetIterator conSuccIt = indi->getConnectionSuccessorIterator(); |
| 20462 |
while (conSuccIt.hasNext()) { |
| 20463 |
cint64 neighbourID = conSuccIt.nextSuccessorConnectionID(); |
| 20464 |
CIndividualProcessNode* neighbourIndiNode = getUpToDateIndividual(neighbourID,calcAlgContext); |
| 20465 |
if (!neighbourIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 20466 |
CIndividualProcessNode* locNeighbourIndiNode = getLocalizedIndividual(neighbourIndiNode,false,calcAlgContext); |
| 20467 |
propagateIndividualNodeNominalConnectionStatusToAncestors(locNeighbourIndiNode,indi,calcAlgContext); |
| 20468 |
} |
| 20469 |
} |
| 20470 |
} |
| 20471 |
|
| 20472 |
|
| 20473 |
|
| 20474 |
|
| 20475 |
|
| 20476 |
|
| 20477 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodesMergeableWithoutNewRuleApplications(CIndividualProcessNode* mergeIntoIndi1, CIndividualProcessNode* indi2, bool* mergingPossiblyRequiresRuleApplications, bool cancelOnPossiblyNewRuleApplications, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20478 |
STATINC(INDINODESMERGEABLETESTCOUNT, calcAlgContext); |
| 20479 |
CDistinctHash* disHash = mergeIntoIndi1->getDistinctHash(false); |
| 20480 |
STATINC(INDINODESMERGEABLEDISTINCTTESTCOUNT, calcAlgContext); |
| 20481 |
|
| 20482 |
|
| 20483 |
bool labelIsSubsetByIgnoringNominals = false; |
| 20484 |
if (isLabelConceptClashSet(indi2->getReapplyConceptLabelSet(false), mergeIntoIndi1->getReapplyConceptLabelSet(false), &labelIsSubsetByIgnoringNominals, true, calcAlgContext)) { |
| 20485 |
return false; |
| 20486 |
} else { |
| 20487 |
if (mergingPossiblyRequiresRuleApplications) { |
| 20488 |
if (!labelIsSubsetByIgnoringNominals) { |
| 20489 |
*mergingPossiblyRequiresRuleApplications = true; |
| 20490 |
if (cancelOnPossiblyNewRuleApplications) { |
| 20491 |
return false; |
| 20492 |
} |
| 20493 |
} |
| 20494 |
} |
| 20495 |
} |
| 20496 |
|
| 20497 |
|
| 20498 |
if (mergingPossiblyRequiresRuleApplications && labelIsSubsetByIgnoringNominals) { |
| 20499 |
CReapplyConceptLabelSetIterator conIt = mergeIntoIndi1->getReapplyConceptLabelSet(false)->getConceptLabelSetIterator(false, false, false); |
| 20500 |
while (conIt.hasNext() && !*mergingPossiblyRequiresRuleApplications) { |
| 20501 |
CConceptDescriptor* conDes = conIt.next(); |
| 20502 |
CConcept* concept = conDes->getConcept(); |
| 20503 |
bool conNeg = conDes->isNegated(); |
| 20504 |
cint64 conOpCode = concept->getOperatorCode(); |
| 20505 |
CRole* role = concept->getRole(); |
| 20506 |
|
| 20507 |
CSortedNegLinker<CConcept*>* opLinker = concept->getOperandList(); |
| 20508 |
|
| 20509 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 20510 |
|
| 20511 |
if (!conNeg && (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE)) || conNeg && conOpCode == CCSOME) { |
| 20512 |
|
| 20513 |
CRoleSuccessorLinkIterator roleSuccIt = indi2->getRoleSuccessorLinkIterator(role); |
| 20514 |
while (roleSuccIt.hasNext()) { |
| 20515 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 20516 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi2, link, calcAlgContext); |
| 20517 |
|
| 20518 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = opLinker; opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 20519 |
CConcept* opConcept = opLinkerIt->getData(); |
| 20520 |
bool opConNeg = opLinkerIt->isNegated() ^ conNeg; |
| 20521 |
bool containsNeg = false; |
| 20522 |
if (succIndi->getReapplyConceptLabelSet(false)->containsConcept(concept, &containsNeg)) { |
| 20523 |
if (containsNeg != opConNeg) { |
| 20524 |
return false; |
| 20525 |
} |
| 20526 |
} else { |
| 20527 |
*mergingPossiblyRequiresRuleApplications = true; |
| 20528 |
if (cancelOnPossiblyNewRuleApplications) { |
| 20529 |
return false; |
| 20530 |
} |
| 20531 |
} |
| 20532 |
} |
| 20533 |
} |
| 20534 |
|
| 20535 |
|
| 20536 |
|
| 20537 |
|
| 20538 |
} else if (!conNeg && conOpCode == CCATMOST || conNeg && conOpCode == CCATLEAST) { |
| 20539 |
cint64 cardinality = concept->getParameter(); |
| 20540 |
if (conNeg) { |
| 20541 |
--cardinality; |
| 20542 |
} |
| 20543 |
|
| 20544 |
|
| 20545 |
cint64 usedCount = mergeIntoIndi1->getRoleSuccessorCount(role); |
| 20546 |
cint64 requiredCount = indi2->getRoleSuccessorCount(role); |
| 20547 |
|
| 20548 |
if (usedCount + requiredCount > cardinality) { |
| 20549 |
cint64 triviallyMergableCount = 0; |
| 20550 |
cint64 triviallyNonMergableCount = 0; |
| 20551 |
|
| 20552 |
CRoleSuccessorLinkIterator roleSuccIt = indi2->getRoleSuccessorLinkIterator(role); |
| 20553 |
while (roleSuccIt.hasNext() && usedCount + requiredCount - triviallyMergableCount > cardinality && usedCount + triviallyNonMergableCount <= cardinality) { |
| 20554 |
CIndividualLinkEdge* link = roleSuccIt.next(); |
| 20555 |
CIndividualProcessNode* succIndi = getSuccessorIndividual(indi2, link, calcAlgContext); |
| 20556 |
|
| 20557 |
bool mergeable = true; |
| 20558 |
bool successorRelevant = false; |
| 20559 |
if (succIndi->isNominalIndividualNode()) { |
| 20560 |
CSortedNegLinker<CConcept*>* opLinkerIt = opLinker; |
| 20561 |
if (!opLinkerIt) { |
| 20562 |
successorRelevant = true; |
| 20563 |
} |
| 20564 |
while (opLinkerIt && !successorRelevant) { |
| 20565 |
CConcept* opConcept = opLinkerIt->getData(); |
| 20566 |
bool opConNeg = opLinkerIt->isNegated(); |
| 20567 |
bool containsNeg = false; |
| 20568 |
if (succIndi->getReapplyConceptLabelSet(false)->containsConcept(concept, &containsNeg)) { |
| 20569 |
if (containsNeg == opConNeg) { |
| 20570 |
successorRelevant = true; |
| 20571 |
} |
| 20572 |
} else { |
| 20573 |
successorRelevant = true; |
| 20574 |
} |
| 20575 |
opLinkerIt = opLinkerIt->getNext(); |
| 20576 |
} |
| 20577 |
if (successorRelevant) { |
| 20578 |
if (!mergeIntoIndi1->hasRoleSuccessorToIndividual(role, succIndi, false)) { |
| 20579 |
mergeable = false; |
| 20580 |
} |
| 20581 |
} |
| 20582 |
} else if (succIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCONCRETEDATAINDINODE)) { |
| 20583 |
successorRelevant = true; |
| 20584 |
} |
| 20585 |
|
| 20586 |
if (!successorRelevant || mergeable) { |
| 20587 |
triviallyMergableCount++; |
| 20588 |
} |
| 20589 |
if (successorRelevant && !mergeable) { |
| 20590 |
triviallyNonMergableCount++; |
| 20591 |
} |
| 20592 |
} |
| 20593 |
|
| 20594 |
if (usedCount + requiredCount - triviallyMergableCount > cardinality) { |
| 20595 |
*mergingPossiblyRequiresRuleApplications = true; |
| 20596 |
if (cancelOnPossiblyNewRuleApplications) { |
| 20597 |
return false; |
| 20598 |
} |
| 20599 |
} |
| 20600 |
} |
| 20601 |
} |
| 20602 |
} |
| 20603 |
} |
| 20604 |
|
| 20605 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 20606 |
|
| 20607 |
if (disHash) { |
| 20608 |
CDistinctEdge* disEdge = disHash->getIndividualDistinctEdge(indi2->getIndividualNodeID()); |
| 20609 |
if (disEdge) { |
| 20610 |
clashDescriptors = createClashedIndividualDistinctDescriptor(clashDescriptors, disEdge, disEdge->getDependencyTrackPoint(), calcAlgContext); |
| 20611 |
return false; |
| 20612 |
} |
| 20613 |
} |
| 20614 |
|
| 20615 |
if (mConfUniqueNameAssumption) { |
| 20616 |
if (mergeIntoIndi1->isNominalIndividualNode() && indi2->isNominalIndividualNode()) { |
| 20617 |
if (mergeIntoIndi1->getNominalIndividual() != indi2->getNominalIndividual()) { |
| 20618 |
// TODO: clashes correct? |
| 20619 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, mergeIntoIndi1, nullptr, mergeIntoIndi1->getDependencyTrackPoint(), calcAlgContext); |
| 20620 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, indi2, nullptr, indi2->getDependencyTrackPoint(), calcAlgContext); |
| 20621 |
return false; |
| 20622 |
} |
| 20623 |
} |
| 20624 |
} |
| 20625 |
|
| 20626 |
|
| 20627 |
|
| 20628 |
|
| 20629 |
if (!areIndividualNodesDisjointRolesMergeable(mergeIntoIndi1, indi2, clashDescriptors, calcAlgContext)) { |
| 20630 |
return false; |
| 20631 |
} |
| 20632 |
|
| 20633 |
STATINC(INDINODESMERGEABLETESTSUCCESSCOUNT, calcAlgContext); |
| 20634 |
return true; |
| 20635 |
} |
| 20636 |
|
| 20637 |
|
| 20638 |
|
| 20639 |
|
| 20640 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandBackendCacheIndividualNodesNominalMerging(CIndividualProcessNode* indi1, CIndividualProcessNode* indi2, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20641 |
// check for each neighbour of indi1, whether there is a neighbouing link in the backend cache to that individual for indi2 and vice versa |
| 20642 |
|
| 20643 |
bool expanded = false; |
| 20644 |
expanded |= expandBackendCacheIndividualNodesNominalMergingNeighbouringConnections(indi1, indi2, calcAlgContext); |
| 20645 |
expanded |= expandBackendCacheIndividualNodesNominalMergingNeighbouringConnections(indi2, indi1, calcAlgContext); |
| 20646 |
return expanded; |
| 20647 |
} |
| 20648 |
|
| 20649 |
|
| 20650 |
|
| 20651 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandBackendCacheIndividualNodesNominalMergingNeighbouringConnections(CIndividualProcessNode* indi1, CIndividualProcessNode* indi2, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20652 |
// check for each nominal neighbour of a blockable node indi1, whether there is a neighbouing link in the backend cache to that individual for indi2 and vice versa |
| 20653 |
|
| 20654 |
cint64 indi1ID = indi1->getIndividualNodeID(); |
| 20655 |
cint64 indi2ID = indi2->getIndividualNodeID(); |
| 20656 |
CConnectionSuccessorSet* connSuccSet1 = indi1->getConnectionSuccessorSet(false); |
| 20657 |
|
| 20658 |
if (connSuccSet1 && !indi1->getNominalIndividual()) { |
| 20659 |
// TODO: check if required adaptation for mConfNewMergingsOnlyInferringExpansion |
| 20660 |
// if two nominal/abox individual nodes are merged, then all connections are expanded any way |
| 20661 |
|
| 20662 |
|
| 20663 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData2 = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indi2->getIndividualBackendCacheSynchronisationData(false); |
| 20664 |
if (backendSyncData2) { |
| 20665 |
if (backendSyncData2) { |
| 20666 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assData2 = backendSyncData2->getAssocitaionData(); |
| 20667 |
if (assData2) { |
| 20668 |
CBackendRepresentativeMemoryCacheIndividualNeighbourRoleSetHash* neighbourRoleSetHash2 = assData2->getNeighbourRoleSetHash(); |
| 20669 |
if (neighbourRoleSetHash2) { |
| 20670 |
|
| 20671 |
CPROCESSINGLIST<cint64> indi2ExpansionList(calcAlgContext->getUsedTaskProcessorContext()); |
| 20672 |
// links which point to adding individual node |
| 20673 |
CConnectionSuccessorSetIterator conn1It = connSuccSet1->getConnectionSuccessorIterator(); |
| 20674 |
while (conn1It.hasNext()) { |
| 20675 |
cint64 conn1ID = conn1It.next(); |
| 20676 |
|
| 20677 |
if (conn1ID == indi1ID) { |
| 20678 |
if (!indi2->hasSuccessorIndividualNode(indi2ID)) { |
| 20679 |
if (neighbourRoleSetHash2->getNeighbourRoleSetLabel(indi2ID)) { |
| 20680 |
indi2ExpansionList.append(indi2ID); |
| 20681 |
} |
| 20682 |
} |
| 20683 |
} else if (conn1ID <= 0) { |
| 20684 |
if (!indi2->hasSuccessorIndividualNode(conn1ID)) { |
| 20685 |
if (neighbourRoleSetHash2->getNeighbourRoleSetLabel(conn1ID)) { |
| 20686 |
indi2ExpansionList.append(conn1ID); |
| 20687 |
} |
| 20688 |
} |
| 20689 |
} |
| 20690 |
|
| 20691 |
} |
| 20692 |
|
| 20693 |
bool expanded = false; |
| 20694 |
for (CPROCESSINGLIST<cint64>::const_iterator indi2ExpIt = indi2ExpansionList.constBegin(), indi2ExpItEnd = indi2ExpansionList.constEnd(); indi2ExpIt != indi2ExpItEnd; ++indi2ExpIt) { |
| 20695 |
cint64 indi2ExpIndiId = *indi2ExpIt; |
| 20696 |
expanded |= expandIndividualNeighbourNodeFromBackendCache(indi2, indi2ExpIndiId, calcAlgContext); |
| 20697 |
} |
| 20698 |
return expanded; |
| 20699 |
|
| 20700 |
} |
| 20701 |
} |
| 20702 |
} |
| 20703 |
} |
| 20704 |
} |
| 20705 |
return false; |
| 20706 |
} |
| 20707 |
|
| 20708 |
|
| 20709 |
|
| 20710 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodesMergeable(CIndividualProcessNode* indi1, CIndividualProcessNode* indi2, CClashedDependencyDescriptor*& clashDescriptors, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20711 |
STATINC(INDINODESMERGEABLETESTCOUNT,calcAlgContext); |
| 20712 |
CDistinctHash* disHash = indi1->getDistinctHash(false); |
| 20713 |
STATINC(INDINODESMERGEABLEDISTINCTTESTCOUNT,calcAlgContext); |
| 20714 |
|
| 20715 |
expandBackendCacheIndividualNodesNominalMerging(indi1, indi2, calcAlgContext); |
| 20716 |
|
| 20717 |
if (disHash) { |
| 20718 |
CDistinctEdge* disEdge = disHash->getIndividualDistinctEdge(indi2->getIndividualNodeID()); |
| 20719 |
if (disEdge) { |
| 20720 |
clashDescriptors = createClashedIndividualDistinctDescriptor(clashDescriptors,disEdge,disEdge->getDependencyTrackPoint(),calcAlgContext); |
| 20721 |
return false; |
| 20722 |
} |
| 20723 |
} |
| 20724 |
|
| 20725 |
if (mConfUniqueNameAssumption) { |
| 20726 |
if (indi1->isNominalIndividualNode() && indi2->isNominalIndividualNode()) { |
| 20727 |
if (indi1->getNominalIndividual() != indi2->getNominalIndividual()) { |
| 20728 |
// TODO: clashes correct? |
| 20729 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors,indi1,nullptr,indi1->getDependencyTrackPoint(),calcAlgContext); |
| 20730 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors,indi2,nullptr,indi2->getDependencyTrackPoint(),calcAlgContext); |
| 20731 |
return false; |
| 20732 |
} |
| 20733 |
} |
| 20734 |
} |
| 20735 |
|
| 20736 |
|
| 20737 |
if (isLabelConceptClashSet(indi1,indi2,clashDescriptors,calcAlgContext)) { |
| 20738 |
return false; |
| 20739 |
} |
| 20740 |
|
| 20741 |
if (!areIndividualNodesDisjointRolesMergeable(indi1,indi2,clashDescriptors,calcAlgContext)) { |
| 20742 |
return false; |
| 20743 |
} |
| 20744 |
|
| 20745 |
STATINC(INDINODESMERGEABLETESTSUCCESSCOUNT,calcAlgContext); |
| 20746 |
return true; |
| 20747 |
} |
| 20748 |
|
| 20749 |
|
| 20750 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::areIndividualNodesDisjointRolesMergeable(CIndividualProcessNode* indi1, CIndividualProcessNode* indi2, CClashedDependencyDescriptor*& clashDescriptors, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20751 |
if (indi1->hasDisjointRoleConnections() || indi2->hasDisjointRoleConnections()) { |
| 20752 |
if (!isIndividualNodeDisjointRolesMergeable(indi1,indi2,clashDescriptors,calcAlgContext)) { |
| 20753 |
return false; |
| 20754 |
} |
| 20755 |
if (!isIndividualNodeDisjointRolesMergeable(indi2,indi1,clashDescriptors,calcAlgContext)) { |
| 20756 |
return false; |
| 20757 |
} |
| 20758 |
} |
| 20759 |
return true; |
| 20760 |
} |
| 20761 |
|
| 20762 |
|
| 20763 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodeDisjointRolesMergeable(CIndividualProcessNode* indi1, CIndividualProcessNode* indi2, CClashedDependencyDescriptor*& clashDescriptors, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20764 |
STATINC(INDINODESMERGEABLEDISJOINTROLETESTCOUNT,calcAlgContext); |
| 20765 |
CConnectionSuccessorSet* connSuccSet1 = indi1->getConnectionSuccessorSet(false); |
| 20766 |
CIndividualProcessNode* indi = indi1; |
| 20767 |
CIndividualProcessNode* othIndi = indi2; |
| 20768 |
CConnectionSuccessorSet* connSuccSet = connSuccSet1; |
| 20769 |
|
| 20770 |
cint64 indiID = indi->getIndividualNodeID(); |
| 20771 |
cint64 othIndiID = othIndi->getIndividualNodeID(); |
| 20772 |
|
| 20773 |
if (connSuccSet) { |
| 20774 |
// links which point to adding individual node |
| 20775 |
CConnectionSuccessorSetIterator connIt = connSuccSet->getConnectionSuccessorIterator(); |
| 20776 |
while (connIt.hasNext()) { |
| 20777 |
cint64 connID = connIt.next(); |
| 20778 |
|
| 20779 |
if (connID == indiID) { |
| 20780 |
// test self links |
| 20781 |
CDisjointSuccessorRoleIterator connDisSuccRoleIt(indi->getDisjointSuccessorRoleIterator(indi)); |
| 20782 |
while (connDisSuccRoleIt.hasNext()) { |
| 20783 |
CNegationDisjointEdge* disNegLink = connDisSuccRoleIt.next(); |
| 20784 |
CRole* role = disNegLink->getLinkRole(); |
| 20785 |
CIndividualLinkEdge* link = othIndi->getRoleSuccessorToIndividualLink(role,othIndi,false); |
| 20786 |
if (link) { |
| 20787 |
clashDescriptors = createClashedIndividualLinkDescriptor(clashDescriptors,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 20788 |
clashDescriptors = createClashedNegationDisjointDescriptor(clashDescriptors,disNegLink,disNegLink->getDependencyTrackPoint(),calcAlgContext); |
| 20789 |
return false; |
| 20790 |
} |
| 20791 |
} |
| 20792 |
} else if (othIndiID == connID) { |
| 20793 |
// test ancestor/successor merging link clashes |
| 20794 |
CDisjointSuccessorRoleIterator connDisSuccRoleIt(othIndi->getDisjointSuccessorRoleIterator(indi)); |
| 20795 |
while (connDisSuccRoleIt.hasNext()) { |
| 20796 |
CNegationDisjointEdge* disNegLink = connDisSuccRoleIt.next(); |
| 20797 |
CRole* role = disNegLink->getLinkRole(); |
| 20798 |
CIndividualLinkEdge* link = nullptr; |
| 20799 |
// ancestor self test |
| 20800 |
link = othIndi->getRoleSuccessorToIndividualLink(role,othIndi,false); |
| 20801 |
if (link) { |
| 20802 |
clashDescriptors = createClashedIndividualLinkDescriptor(clashDescriptors,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 20803 |
clashDescriptors = createClashedNegationDisjointDescriptor(clashDescriptors,disNegLink,disNegLink->getDependencyTrackPoint(),calcAlgContext); |
| 20804 |
return false; |
| 20805 |
} |
| 20806 |
// successor self test |
| 20807 |
link = indi->getRoleSuccessorToIndividualLink(role,indi,false); |
| 20808 |
if (link) { |
| 20809 |
clashDescriptors = createClashedIndividualLinkDescriptor(clashDescriptors,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 20810 |
clashDescriptors = createClashedNegationDisjointDescriptor(clashDescriptors,disNegLink,disNegLink->getDependencyTrackPoint(),calcAlgContext); |
| 20811 |
return false; |
| 20812 |
} |
| 20813 |
// ancestor to successor test |
| 20814 |
link = othIndi->getRoleSuccessorToIndividualLink(role,indi,false); |
| 20815 |
if (link) { |
| 20816 |
clashDescriptors = createClashedIndividualLinkDescriptor(clashDescriptors,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 20817 |
clashDescriptors = createClashedNegationDisjointDescriptor(clashDescriptors,disNegLink,disNegLink->getDependencyTrackPoint(),calcAlgContext); |
| 20818 |
return false; |
| 20819 |
} |
| 20820 |
// successor to ancestor test |
| 20821 |
link = indi->getRoleSuccessorToIndividualLink(role,othIndi,false); |
| 20822 |
if (link) { |
| 20823 |
clashDescriptors = createClashedIndividualLinkDescriptor(clashDescriptors,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 20824 |
clashDescriptors = createClashedNegationDisjointDescriptor(clashDescriptors,disNegLink,disNegLink->getDependencyTrackPoint(),calcAlgContext); |
| 20825 |
return false; |
| 20826 |
} |
| 20827 |
} |
| 20828 |
|
| 20829 |
} else { |
| 20830 |
|
| 20831 |
CIndividualProcessNode* connIndi = getUpToDateIndividual(connID,calcAlgContext); |
| 20832 |
|
| 20833 |
CDisjointSuccessorRoleIterator connDisSuccRoleIt(connIndi->getDisjointSuccessorRoleIterator(indi)); |
| 20834 |
while (connDisSuccRoleIt.hasNext()) { |
| 20835 |
CNegationDisjointEdge* disNegLink = connDisSuccRoleIt.next(); |
| 20836 |
CRole* role = disNegLink->getLinkRole(); |
| 20837 |
CIndividualLinkEdge* link = connIndi->getRoleSuccessorToIndividualLink(role,othIndi,false); |
| 20838 |
if (link) { |
| 20839 |
clashDescriptors = createClashedIndividualLinkDescriptor(clashDescriptors,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 20840 |
clashDescriptors = createClashedNegationDisjointDescriptor(clashDescriptors,disNegLink,disNegLink->getDependencyTrackPoint(),calcAlgContext); |
| 20841 |
return false; |
| 20842 |
} |
| 20843 |
} |
| 20844 |
CDisjointSuccessorRoleIterator disSuccRoleIt(indi->getDisjointSuccessorRoleIterator(connIndi)); |
| 20845 |
while (disSuccRoleIt.hasNext()) { |
| 20846 |
CNegationDisjointEdge* disNegLink = disSuccRoleIt.next(); |
| 20847 |
CRole* role = disNegLink->getLinkRole(); |
| 20848 |
CIndividualLinkEdge* link = othIndi->getRoleSuccessorToIndividualLink(role,connIndi,false); |
| 20849 |
if (link) { |
| 20850 |
clashDescriptors = createClashedIndividualLinkDescriptor(clashDescriptors,link,link->getDependencyTrackPoint(),calcAlgContext); |
| 20851 |
clashDescriptors = createClashedNegationDisjointDescriptor(clashDescriptors,disNegLink,disNegLink->getDependencyTrackPoint(),calcAlgContext); |
| 20852 |
return false; |
| 20853 |
} |
| 20854 |
} |
| 20855 |
} |
| 20856 |
} |
| 20857 |
} |
| 20858 |
return true; |
| 20859 |
} |
| 20860 |
|
| 20861 |
|
| 20862 |
|
| 20863 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isLabelConceptClashSet(CIndividualProcessNode* subSetIndi, CIndividualProcessNode* superSetIndi, CClashedDependencyDescriptor*& clashDescriptors, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20864 |
STATINC(INDINODESMERGEABLECONCEPTSETTESTCOUNT,calcAlgContext); |
| 20865 |
|
| 20866 |
CReapplyConceptLabelSet* subConceptSet = subSetIndi->getReapplyConceptLabelSet(false); |
| 20867 |
CReapplyConceptLabelSet* superConceptSet = superSetIndi->getReapplyConceptLabelSet(false); |
| 20868 |
if (superConceptSet->getConceptCount() < subConceptSet->getConceptCount()) { |
| 20869 |
CReapplyConceptLabelSet* tmpConSet = subConceptSet; |
| 20870 |
subConceptSet = superConceptSet; |
| 20871 |
superConceptSet = tmpConSet; |
| 20872 |
CIndividualProcessNode* tmpIndi = subSetIndi; |
| 20873 |
subSetIndi = superSetIndi; |
| 20874 |
superSetIndi = tmpIndi; |
| 20875 |
} |
| 20876 |
|
| 20877 |
cint64 subConSetCount = subConceptSet->getConceptCount(); |
| 20878 |
cint64 superConSetCount = superConceptSet->getConceptCount(); |
| 20879 |
cint64 thresholdFactor = mMapComparisonDirectLookupFactor; |
| 20880 |
if (subConSetCount * thresholdFactor < superConSetCount) { |
| 20881 |
CReapplyConceptLabelSetIterator subConSetIt = subConceptSet->getConceptLabelSetIterator(true, false, false); |
| 20882 |
while (subConSetIt.hasValue()) { |
| 20883 |
CConceptDescriptor* subConDes = subConSetIt.getConceptDescriptor(); |
| 20884 |
CDependencyTrackPoint* subDepTrackPoint = subConSetIt.getDependencyTrackPoint(); |
| 20885 |
CConceptDescriptor* superConDes = nullptr; |
| 20886 |
CDependencyTrackPoint* superDepTrackPoint = nullptr; |
| 20887 |
if (superConceptSet->getConceptDescriptor(subConDes->getConcept(), superConDes, superDepTrackPoint)) { |
| 20888 |
if (superConDes->getNegation() != subConDes->getNegation()) { |
| 20889 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, subSetIndi, subConDes, subDepTrackPoint, calcAlgContext); |
| 20890 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, superSetIndi, superConDes, superDepTrackPoint, calcAlgContext); |
| 20891 |
} |
| 20892 |
} |
| 20893 |
subConSetIt.moveNext(); |
| 20894 |
} |
| 20895 |
} else { |
| 20896 |
|
| 20897 |
CReapplyConceptLabelSetIterator conSet1It = subConceptSet->getConceptLabelSetIterator(true, false, false); |
| 20898 |
CReapplyConceptLabelSetIterator conSet2It = superConceptSet->getConceptLabelSetIterator(true, false, false); |
| 20899 |
CConceptDescriptor* conDes2 = conSet2It.getConceptDescriptor(); |
| 20900 |
CDependencyTrackPoint* depTrackPoint2 = conSet2It.getDependencyTrackPoint(); |
| 20901 |
cint64 conTag2 = conDes2->getConceptTag(); |
| 20902 |
conSet2It.moveNext(); |
| 20903 |
while (conSet1It.hasValue()) { |
| 20904 |
CConceptDescriptor* conDes1 = conSet1It.getConceptDescriptor(); |
| 20905 |
CDependencyTrackPoint* depTrackPoint1 = conSet1It.getDependencyTrackPoint(); |
| 20906 |
cint64 conTag1 = conDes1->getConceptTag(); |
| 20907 |
|
| 20908 |
while (conTag2 < conTag1) { |
| 20909 |
if (!conSet2It.hasValue()) { |
| 20910 |
return false; |
| 20911 |
} |
| 20912 |
conDes2 = conSet2It.getConceptDescriptor(); |
| 20913 |
depTrackPoint2 = conSet2It.getDependencyTrackPoint(); |
| 20914 |
conTag2 = conDes2->getConceptTag(); |
| 20915 |
conSet2It.moveNext(); |
| 20916 |
} |
| 20917 |
if (conTag1 == conTag2) { |
| 20918 |
if (conDes1->isNegated() != conDes2->isNegated()) { |
| 20919 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, subSetIndi, conDes1, depTrackPoint1, calcAlgContext); |
| 20920 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, superSetIndi, conDes2, depTrackPoint2, calcAlgContext); |
| 20921 |
return true; |
| 20922 |
} |
| 20923 |
} |
| 20924 |
conSet1It.moveNext(); |
| 20925 |
} |
| 20926 |
} |
| 20927 |
return false; |
| 20928 |
} |
| 20929 |
|
| 20930 |
|
| 20931 |
|
| 20932 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getMergedIndividualNodes(CIndividualProcessNode*& preferedMergeIntoIndividualNode, CIndividualProcessNode*& individual2, CDependencyTrackPoint* mergeDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20933 |
|
| 20934 |
|
| 20935 |
CIndividualProcessNode* mergedIndividual = nullptr; |
| 20936 |
CIndividualProcessNode* addingIndividual = nullptr; |
| 20937 |
bool switchNodes = false; |
| 20938 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 20939 |
|
| 20940 |
bool individualComputation = calcAlgContext->getUsedSatisfiableCalculationTask()->getSatisfiableRepresentativeBackendCacheUpdatingAdapter() != nullptr; |
| 20941 |
|
| 20942 |
if (!individualComputation && !mOptMergeConstructedIndividualNode && procDataBox->getConstructedIndividualNode()->getIndividualNodeID() == preferedMergeIntoIndividualNode->getIndividualNodeID()) { |
| 20943 |
switchNodes = false; |
| 20944 |
} else if (!individualComputation && !mOptMergeConstructedIndividualNode && !individual2->getNominalIndividual() && procDataBox->getConstructedIndividualNode()->getIndividualNodeID() == individual2->getIndividualNodeID()) { |
| 20945 |
switchNodes = true; |
| 20946 |
} else if (preferedMergeIntoIndividualNode->isNominalIndividualNode() && individual2->isNominalIndividualNode()) { |
| 20947 |
if (individual2->getIndividualNominalLevel() < preferedMergeIntoIndividualNode->getIndividualNominalLevel()) { |
| 20948 |
switchNodes = true; |
| 20949 |
} else if (individual2->getIndividualNominalLevel() == preferedMergeIntoIndividualNode->getIndividualNominalLevel()) { |
| 20950 |
if (individual2->getIndividualNodeID() > preferedMergeIntoIndividualNode->getIndividualNodeID()) { |
| 20951 |
switchNodes = true; |
| 20952 |
} |
| 20953 |
} |
| 20954 |
} else if (preferedMergeIntoIndividualNode->isNominalIndividualNode()) { |
| 20955 |
switchNodes = false; |
| 20956 |
} else if (individual2->isNominalIndividualNode()) { |
| 20957 |
switchNodes = true; |
| 20958 |
} else if (preferedMergeIntoIndividualNode->isIndividualAncestor(individual2)) { |
| 20959 |
switchNodes = false; |
| 20960 |
} else if (individual2->isIndividualAncestor(preferedMergeIntoIndividualNode)) { |
| 20961 |
switchNodes = true; |
| 20962 |
} else { |
| 20963 |
if (individual2->getIndividualAncestorDepth() < preferedMergeIntoIndividualNode->getIndividualAncestorDepth()) { |
| 20964 |
switchNodes = true; |
| 20965 |
} |
| 20966 |
// TODO: check is this if useful? |
| 20967 |
//else if (individual2->getIndividualID() < preferedMergeIntoIndividualNode->getIndividualID()) { |
| 20968 |
// switchNodes = true; |
| 20969 |
//} |
| 20970 |
} |
| 20971 |
|
| 20972 |
if (!switchNodes) { |
| 20973 |
mergedIndividual = preferedMergeIntoIndividualNode; |
| 20974 |
addingIndividual = individual2; |
| 20975 |
} else { |
| 20976 |
mergedIndividual = individual2; |
| 20977 |
addingIndividual = preferedMergeIntoIndividualNode; |
| 20978 |
} |
| 20979 |
mergeIndividualNodeInto(mergedIndividual,addingIndividual,mergeDepTrackPoint,calcAlgContext); |
| 20980 |
return mergedIndividual; |
| 20981 |
} |
| 20982 |
|
| 20983 |
|
| 20984 |
|
| 20985 |
|
| 20986 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getIntoEmptyMergedIndividualNode(CIndividualProcessNode*& mergingIndividualNode, bool createAsNominal, CIndividualProcessNode* mergerNode, CDependencyTrackPoint* mergeDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 20987 |
CIndividualProcessNode* newEmptyIndiNode = createNewEmptyIndividual(calcAlgContext); |
| 20988 |
if (!createAsNominal) { |
| 20989 |
newEmptyIndiNode->setIndividualNominalLevel(mergingIndividualNode->getIndividualNominalLevel()); |
| 20990 |
newEmptyIndiNode->setIndividualAncestorDepth(mergingIndividualNode->getIndividualAncestorDepth()); |
| 20991 |
if (mergingIndividualNode->isNominalIndividualNode()) { |
| 20992 |
newEmptyIndiNode->setIndividualType(CIndividualProcessNode::NOMINALINDIVIDUALTYPE); |
| 20993 |
} else { |
| 20994 |
newEmptyIndiNode->setIndividualType(CIndividualProcessNode::BLOCKABLEINDIVIDUALTYPE); |
| 20995 |
} |
| 20996 |
} else { |
| 20997 |
newEmptyIndiNode->setIndividualType(CIndividualProcessNode::NOMINALINDIVIDUALTYPE); |
| 20998 |
newEmptyIndiNode->setIndividualNominalLevel(mergerNode->getIndividualNominalLevel()+1); |
| 20999 |
} |
| 21000 |
mergeIndividualNodeInto(newEmptyIndiNode,mergingIndividualNode,mergeDepTrackPoint,calcAlgContext); |
| 21001 |
return newEmptyIndiNode; |
| 21002 |
} |
| 21003 |
|
| 21004 |
|
| 21005 |
|
| 21006 |
void CCalculationTableauCompletionTaskHandleAlgorithm::mergeIndividualNodeInto(CIndividualProcessNode*& mergeIntoIndividualNode, CIndividualProcessNode*& individual, CDependencyTrackPoint* mergeDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 21007 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 21008 |
STATINC(INDINODEMERGECOUNT,calcAlgContext); |
| 21009 |
|
| 21010 |
|
| 21011 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mBeforeMergingTaskDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 21012 |
|
| 21013 |
//mMergedStringList.append(QString("merged %1 into %2").arg(individual->getIndividualID()).arg(mergeIntoIndividualNode->getIndividualID())); |
| 21014 |
|
| 21015 |
//if (individual->isNominalIndividual()) { |
| 21016 |
// ++mNominalMergedCount; |
| 21017 |
// cout << " start-nominal-merge "; |
| 21018 |
|
| 21019 |
KONCLUCE_TASK_ALGORITHM_MERGING_DEBUGGING_INSTRUCTION( |
| 21020 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 21021 |
QFile file(QString("./Debugging/CompletionTasks/merging-step-start-%1-%2-%3.txt").arg(mNominalMergedCount).arg(individual->getIndividualNodeID()).arg(mergeIntoIndividualNode->getIndividualNodeID())); |
| 21022 |
if (file.open(QIODevice::WriteOnly)) { |
| 21023 |
file.write(mEndTaskDebugIndiModelString.replace("<br>", "\r\n").toLocal8Bit()); |
| 21024 |
file.close(); |
| 21025 |
} |
| 21026 |
); |
| 21027 |
|
| 21028 |
//} |
| 21029 |
|
| 21030 |
|
| 21031 |
//if (debugSameIndiExp || debugIncExpChecking || mergeIntoIndividualNode->getIndividualMergingHash() && (mergeIntoIndividualNode->getIndividualMergingHash()->contains(individual->getIndividualNodeID()) || mergeIntoIndividualNode->getIndividualMergingHash()->contains(-individual->getIndividualNodeID()))) { |
| 21032 |
// mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 21033 |
// QFile file(QString("./Debugging/CompletionTasks/merging-step-start-%1-%2-%3.txt").arg(mNominalMergedCount).arg(individual->getIndividualNodeID()).arg(mergeIntoIndividualNode->getIndividualNodeID())); |
| 21034 |
// if (file.open(QIODevice::WriteOnly)) { |
| 21035 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>", "\r\n").toLocal8Bit()); |
| 21036 |
// file.close(); |
| 21037 |
// } |
| 21038 |
// bool debug = true; |
| 21039 |
//} |
| 21040 |
|
| 21041 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(mergeIntoIndividualNode, calcAlgContext); |
| 21042 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(individual, calcAlgContext); |
| 21043 |
|
| 21044 |
|
| 21045 |
|
| 21046 |
|
| 21047 |
if (mCompGraphCacheHandler && mConfCompletionGraphCaching && individual->isNominalIndividualNode() && !mergeIntoIndividualNode->isNominalIndividualNode()) { |
| 21048 |
if (!individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED) && individual->getIndividualNodeID() <= calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 21049 |
individual->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHEDNODELOCATED); |
| 21050 |
|
| 21051 |
if (individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTCOMPLETIONGRAPHCACHEDDUEDIRECTMODIFIED)) { |
| 21052 |
individual->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTCOMPLETIONGRAPHCACHEDDUEDIRECTMODIFIED); |
| 21053 |
} |
| 21054 |
|
| 21055 |
clearCompletionGraphCaching(individual, calcAlgContext); |
| 21056 |
|
| 21057 |
} |
| 21058 |
} |
| 21059 |
|
| 21060 |
|
| 21061 |
|
| 21062 |
|
| 21063 |
mergeIntoIndividualNode->setLastMergedIntoIndividualNode(individual); |
| 21064 |
individual->setMergedDependencyTrackPoint(mergeDepTrackPoint); |
| 21065 |
|
| 21066 |
bool newLinksAdded = false; |
| 21067 |
|
| 21068 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 21069 |
// merge concept label set |
| 21070 |
CReapplyConceptLabelSet* addingConceptLabelSet = individual->getReapplyConceptLabelSet(false); |
| 21071 |
CConceptProcessingQueue* mergeIntoConProQueue = mergeIntoIndividualNode->getConceptProcessingQueue(true); |
| 21072 |
if (addingConceptLabelSet) { |
| 21073 |
CReapplyConceptLabelSet* mergeIntoConceptLabelSet = mergeIntoIndividualNode->getReapplyConceptLabelSet(true); |
| 21074 |
|
| 21075 |
cint64 thresholdFactor = mMapComparisonDirectLookupFactor; |
| 21076 |
if (addingConceptLabelSet->getConceptCount() * thresholdFactor < mergeIntoConceptLabelSet->getConceptCount()) { |
| 21077 |
|
| 21078 |
CReapplyConceptLabelSetIterator conSetIt = addingConceptLabelSet->getConceptLabelSetIterator(true, true, false); |
| 21079 |
cint64 prevDataTag = 0; |
| 21080 |
while (conSetIt.hasNext()) { |
| 21081 |
|
| 21082 |
cint64 conTag = conSetIt.getDataTag(); |
| 21083 |
CConceptDescriptor* conDes = conSetIt.getConceptDescriptor(); |
| 21084 |
CDependencyTrackPoint* depTrackPoint = conSetIt.getDependencyTrackPoint(); |
| 21085 |
if (conDes) { |
| 21086 |
if (!mergeIntoConceptLabelSet->containsConcept(conDes->getConcept(), nullptr)) { |
| 21087 |
STATINC(INDINODEMERGECONCEPTSADDCOUNT, calcAlgContext); |
| 21088 |
|
| 21089 |
// create dependency |
| 21090 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 21091 |
CMERGEDCONCEPTDependencyNode* mergedConDepNode = createMERGEDCONCEPTDependency(newDepTrackPoint, mergeIntoIndividualNode, conDes, mergeDepTrackPoint, depTrackPoint, calcAlgContext); |
| 21092 |
|
| 21093 |
addConceptToIndividual(conDes->getConcept(), conDes->getNegation(), mergeIntoIndividualNode, newDepTrackPoint, false, true, calcAlgContext); |
| 21094 |
} |
| 21095 |
} |
| 21096 |
conSetIt.moveNext(); |
| 21097 |
} |
| 21098 |
|
| 21099 |
} else { |
| 21100 |
|
| 21101 |
CReapplyConceptLabelSetIterator prevSetIt = mergeIntoConceptLabelSet->getConceptLabelSetIterator(true,true,false); |
| 21102 |
CReapplyConceptLabelSetIterator conSetIt = addingConceptLabelSet->getConceptLabelSetIterator(true,true,false); |
| 21103 |
cint64 prevDataTag = 0; |
| 21104 |
bool hasPrevData = false; |
| 21105 |
if (prevSetIt.hasNext()) { |
| 21106 |
prevDataTag = prevSetIt.getDataTag(); |
| 21107 |
hasPrevData = true; |
| 21108 |
prevSetIt.moveNext(); |
| 21109 |
} |
| 21110 |
while (conSetIt.hasNext()) { |
| 21111 |
|
| 21112 |
cint64 conTag = conSetIt.getDataTag(); |
| 21113 |
CConceptDescriptor* conDes = conSetIt.getConceptDescriptor(); |
| 21114 |
CDependencyTrackPoint* depTrackPoint = conSetIt.getDependencyTrackPoint(); |
| 21115 |
if (conDes) { |
| 21116 |
while (hasPrevData && prevDataTag < conTag) { |
| 21117 |
if (prevSetIt.hasNext()) { |
| 21118 |
prevDataTag = prevSetIt.getDataTag(); |
| 21119 |
hasPrevData = true; |
| 21120 |
prevSetIt.moveNext(); |
| 21121 |
} else { |
| 21122 |
hasPrevData = false; |
| 21123 |
} |
| 21124 |
} |
| 21125 |
if (!hasPrevData || (hasPrevData && prevDataTag != conTag)) { |
| 21126 |
STATINC(INDINODEMERGECONCEPTSADDCOUNT,calcAlgContext); |
| 21127 |
|
| 21128 |
// create dependency |
| 21129 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 21130 |
CMERGEDCONCEPTDependencyNode* mergedConDepNode = createMERGEDCONCEPTDependency(newDepTrackPoint,mergeIntoIndividualNode,conDes,mergeDepTrackPoint,depTrackPoint,calcAlgContext); |
| 21131 |
|
| 21132 |
addConceptToIndividual(conDes->getConcept(),conDes->getNegation(),mergeIntoIndividualNode,newDepTrackPoint,false,true,calcAlgContext); |
| 21133 |
} |
| 21134 |
} |
| 21135 |
conSetIt.moveNext(); |
| 21136 |
} |
| 21137 |
} |
| 21138 |
} |
| 21139 |
|
| 21140 |
|
| 21141 |
CPROCESSINGHASH<CDependencyTrackPoint*,CDependencyTrackPoint*> depTrackPointHash(calcAlgContext->getUsedTaskProcessorContext()); |
| 21142 |
|
| 21143 |
// move all connected incoming links |
| 21144 |
CConnectionSuccessorSet* connSuccSet = individual->getConnectionSuccessorSet(false); |
| 21145 |
if (connSuccSet) { |
| 21146 |
|
| 21147 |
// links which point to adding individual node |
| 21148 |
CConnectionSuccessorSetIterator connIt = connSuccSet->getConnectionSuccessorIterator(); |
| 21149 |
while (connIt.hasNext()) { |
| 21150 |
cint64 connID = connIt.next(); |
| 21151 |
if (connID == individual->getIndividualNodeID()) { |
| 21152 |
|
| 21153 |
CSuccessorRoleIterator connRoleIt(individual->getSuccessorRoleIterator(individual)); |
| 21154 |
while (connRoleIt.hasNext()) { |
| 21155 |
CIndividualLinkEdge* link = connRoleIt.next(); |
| 21156 |
CRole* role = link->getLinkRole(); |
| 21157 |
|
| 21158 |
if (!mergeIntoIndividualNode->hasRoleSuccessorToIndividual(role, mergeIntoIndividualNode, true)) { |
| 21159 |
STATINC(INDINODEMERGELINKSADDCOUNT, calcAlgContext); |
| 21160 |
|
| 21161 |
// create dependency |
| 21162 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 21163 |
CDependencyTrackPoint* prevLinkDepTrackPoint = link->getDependencyTrackPoint(); |
| 21164 |
if (depTrackPointHash.contains(prevLinkDepTrackPoint)) { |
| 21165 |
newDepTrackPoint = depTrackPointHash.value(prevLinkDepTrackPoint); |
| 21166 |
} else { |
| 21167 |
CMERGEDLINKDependencyNode* mergedLinkDepNode = createMERGEDLINKDependency(newDepTrackPoint, mergeIntoIndividualNode, mergeDepTrackPoint, prevLinkDepTrackPoint, calcAlgContext); |
| 21168 |
depTrackPointHash.insert(prevLinkDepTrackPoint, newDepTrackPoint); |
| 21169 |
} |
| 21170 |
|
| 21171 |
// generate new link |
| 21172 |
newLinksAdded = true; |
| 21173 |
createNewIndividualsLinkReapplyed(mergeIntoIndividualNode, mergeIntoIndividualNode, mergeIntoIndividualNode, role, newDepTrackPoint, calcAlgContext); |
| 21174 |
} |
| 21175 |
} |
| 21176 |
|
| 21177 |
} else { |
| 21178 |
CIndividualProcessNode* locConnIndi = getLocalizedIndividual(connID,calcAlgContext); |
| 21179 |
if (individual->isNominalIndividualNode() || locConnIndi->isNominalIndividualNode() || individual->isIndividualAncestor(locConnIndi) || mergeIntoIndividualNode->hasSuccessorIndividualNode(locConnIndi)) { |
| 21180 |
|
| 21181 |
if (!individual->isNominalIndividualNode() || !locConnIndi->isIndividualAncestor(individual)) { |
| 21182 |
|
| 21183 |
if (individual->getNominalIndividual() && locConnIndi->getNominalIndividual() && mergeIntoIndividualNode->getNominalIndividual()) { |
| 21184 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(locConnIndi, calcAlgContext); |
| 21185 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 21186 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = locBackendSyncData->getAssocitaionData(); |
| 21187 |
|
| 21188 |
cint64 mergedIntoNeighbourIndiId = mergeIntoIndividualNode->getNominalIndividual()->getIndividualID(); |
| 21189 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[mergedIntoNeighbourIndiId]; |
| 21190 |
if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 21191 |
CDependencyTrackPoint* backDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 21192 |
expandIndividualNeighbourNodeFromBackendCache(locConnIndi, assocData, mergedIntoNeighbourIndiId, neighbourExpansionData, false, false, nullptr, backDepTrackPoint, calcAlgContext); |
| 21193 |
} |
| 21194 |
} |
| 21195 |
|
| 21196 |
// links from connected individual node |
| 21197 |
CSuccessorRoleIterator connRoleIt(locConnIndi->getSuccessorRoleIterator(individual)); |
| 21198 |
while (connRoleIt.hasNext()) { |
| 21199 |
CIndividualLinkEdge* link = connRoleIt.next(); |
| 21200 |
CRole* role = link->getLinkRole(); |
| 21201 |
CIndividualProcessNode* creatorIndiNode = mergeIntoIndividualNode; |
| 21202 |
if (link->isCreatorIndividualID(locConnIndi)) { |
| 21203 |
creatorIndiNode = locConnIndi; |
| 21204 |
} |
| 21205 |
if (!locConnIndi->hasRoleSuccessorToIndividual(role,mergeIntoIndividualNode,true)) { |
| 21206 |
STATINC(INDINODEMERGELINKSADDCOUNT,calcAlgContext); |
| 21207 |
|
| 21208 |
// create dependency |
| 21209 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 21210 |
CDependencyTrackPoint* prevLinkDepTrackPoint = link->getDependencyTrackPoint(); |
| 21211 |
if (depTrackPointHash.contains(prevLinkDepTrackPoint)) { |
| 21212 |
newDepTrackPoint = depTrackPointHash.value(prevLinkDepTrackPoint); |
| 21213 |
} else { |
| 21214 |
CMERGEDLINKDependencyNode* mergedLinkDepNode = createMERGEDLINKDependency(newDepTrackPoint,mergeIntoIndividualNode,mergeDepTrackPoint,prevLinkDepTrackPoint,calcAlgContext); |
| 21215 |
depTrackPointHash.insert(prevLinkDepTrackPoint,newDepTrackPoint); |
| 21216 |
} |
| 21217 |
|
| 21218 |
// generate new link |
| 21219 |
newLinksAdded = true; |
| 21220 |
createNewIndividualsLinkReapplyed(creatorIndiNode,locConnIndi,mergeIntoIndividualNode,role,newDepTrackPoint,calcAlgContext); |
| 21221 |
} |
| 21222 |
locConnIndi->removeIndividualLink(link); |
| 21223 |
} |
| 21224 |
// and reverse |
| 21225 |
CSuccessorRoleIterator succRoleIt(individual->getSuccessorRoleIterator(locConnIndi)); |
| 21226 |
while (succRoleIt.hasNext()) { |
| 21227 |
CIndividualLinkEdge* link = succRoleIt.next(); |
| 21228 |
CIndividualProcessNode* creatorIndiNode = mergeIntoIndividualNode; |
| 21229 |
if (link->isCreatorIndividualID(locConnIndi)) { |
| 21230 |
creatorIndiNode = locConnIndi; |
| 21231 |
} |
| 21232 |
CRole* role = link->getLinkRole(); |
| 21233 |
if (!mergeIntoIndividualNode->hasRoleSuccessorToIndividual(role,locConnIndi,true)) { |
| 21234 |
STATINC(INDINODEMERGELINKSADDCOUNT,calcAlgContext); |
| 21235 |
|
| 21236 |
// create dependency |
| 21237 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 21238 |
CDependencyTrackPoint* prevLinkDepTrackPoint = link->getDependencyTrackPoint(); |
| 21239 |
if (depTrackPointHash.contains(prevLinkDepTrackPoint)) { |
| 21240 |
newDepTrackPoint = depTrackPointHash.value(prevLinkDepTrackPoint); |
| 21241 |
} else { |
| 21242 |
CMERGEDLINKDependencyNode* mergedLinkDepNode = createMERGEDLINKDependency(newDepTrackPoint,mergeIntoIndividualNode,mergeDepTrackPoint,link->getDependencyTrackPoint(),calcAlgContext); |
| 21243 |
depTrackPointHash.insert(prevLinkDepTrackPoint,newDepTrackPoint); |
| 21244 |
} |
| 21245 |
|
| 21246 |
// generate new link |
| 21247 |
newLinksAdded = true; |
| 21248 |
createNewIndividualsLinkReapplyed(creatorIndiNode,mergeIntoIndividualNode,locConnIndi,role,newDepTrackPoint,calcAlgContext); |
| 21249 |
} |
| 21250 |
} |
| 21251 |
|
| 21252 |
|
| 21253 |
// neg/disjoint links from connected individual node |
| 21254 |
CDisjointSuccessorRoleIterator connNegDisIt(locConnIndi->getDisjointSuccessorRoleIterator(individual)); |
| 21255 |
while (connNegDisIt.hasNext()) { |
| 21256 |
CNegationDisjointEdge* negDisLink = connNegDisIt.next(); |
| 21257 |
CRole* role = negDisLink->getLinkRole(); |
| 21258 |
if (!locConnIndi->hasNegationDisjointToIndividual(role,mergeIntoIndividualNode)) { |
| 21259 |
// TODO: change stat to neg/dis link |
| 21260 |
STATINC(INDINODEMERGELINKSADDCOUNT,calcAlgContext); |
| 21261 |
|
| 21262 |
// create dependency |
| 21263 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 21264 |
CMERGEDLINKDependencyNode* mergedLinkDepNode = createMERGEDLINKDependency(newDepTrackPoint,mergeIntoIndividualNode,mergeDepTrackPoint,negDisLink->getDependencyTrackPoint(),calcAlgContext); |
| 21265 |
|
| 21266 |
// generate new negation link |
| 21267 |
createIndividualNodeNegationLink(locConnIndi,mergeIntoIndividualNode,role,newDepTrackPoint,calcAlgContext); |
| 21268 |
} |
| 21269 |
} |
| 21270 |
locConnIndi->removeDisjointLinks(individual->getIndividualNodeID()); |
| 21271 |
// and reverse |
| 21272 |
CDisjointSuccessorRoleIterator succNegDisIt(individual->getDisjointSuccessorRoleIterator(locConnIndi)); |
| 21273 |
while (succNegDisIt.hasNext()) { |
| 21274 |
CNegationDisjointEdge* negDisLink = succNegDisIt.next(); |
| 21275 |
CRole* role = negDisLink->getLinkRole(); |
| 21276 |
if (!mergeIntoIndividualNode->hasNegationDisjointToIndividual(role,locConnIndi)) { |
| 21277 |
// TODO: change stat to neg/dis link |
| 21278 |
STATINC(INDINODEMERGELINKSADDCOUNT,calcAlgContext); |
| 21279 |
|
| 21280 |
// create dependency |
| 21281 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 21282 |
CMERGEDLINKDependencyNode* mergedLinkDepNode = createMERGEDLINKDependency(newDepTrackPoint,mergeIntoIndividualNode,mergeDepTrackPoint,negDisLink->getDependencyTrackPoint(),calcAlgContext); |
| 21283 |
|
| 21284 |
// generate new negation link |
| 21285 |
createIndividualNodeNegationLink(mergeIntoIndividualNode,locConnIndi,role,newDepTrackPoint,calcAlgContext); |
| 21286 |
} |
| 21287 |
} |
| 21288 |
|
| 21289 |
|
| 21290 |
locConnIndi->removeIndividualConnection(individual); |
| 21291 |
} |
| 21292 |
} |
| 21293 |
} |
| 21294 |
} |
| 21295 |
} |
| 21296 |
|
| 21297 |
if (individual->isNominalIndividualNode()) { |
| 21298 |
CIndividual* nominalIndividual = individual->getNominalIndividual(); |
| 21299 |
if (!mergeIntoIndividualNode->isNominalIndividualNode()) { |
| 21300 |
mergeIntoIndividualNode->setIndividualType(CIndividualProcessNode::NOMINALINDIVIDUALTYPE); |
| 21301 |
mergeIntoIndividualNode->setNominalIndividual(nominalIndividual); |
| 21302 |
} |
| 21303 |
|
| 21304 |
if (nominalIndividual) { |
| 21305 |
|
| 21306 |
CIndividualMergingHash* otherIndiMergingHash = individual->getIndividualMergingHash(false); |
| 21307 |
CIndividualMergingHash* indiMergingHash = mergeIntoIndividualNode->getIndividualMergingHash(true); |
| 21308 |
if (otherIndiMergingHash) { |
| 21309 |
if (indiMergingHash->isEmpty()) { |
| 21310 |
indiMergingHash->initIndividualMergingHash(otherIndiMergingHash); |
| 21311 |
for (CIndividualMergingHash::iterator it = indiMergingHash->begin(), itEnd = indiMergingHash->end(); it != itEnd; ++it) { |
| 21312 |
cint64 individualId = it.key(); |
| 21313 |
CIndividualMergingHashData& mergingData = it.value(); |
| 21314 |
mergingData.getReapplyQueue()->initReapplyQueue(nullptr); |
| 21315 |
if (mergingData.isMergedWithIndividual()) { |
| 21316 |
CDependencyTrackPoint* indiDepTrackPoint = mergingData.getDependencyTrackPoint(); |
| 21317 |
// create dependency |
| 21318 |
if (indiDepTrackPoint) { |
| 21319 |
CDependencyTrackPoint* newIndiDepTrackPoint = nullptr; |
| 21320 |
CMERGEDIndividualDependencyNode* mergedIndiDepNode = createMERGEDINDIVIDUALDependency(newIndiDepTrackPoint, mergeIntoIndividualNode, mergeDepTrackPoint, indiDepTrackPoint, calcAlgContext); |
| 21321 |
mergingData.setDependencyTrackPoint(newIndiDepTrackPoint); |
| 21322 |
} |
| 21323 |
} |
| 21324 |
|
| 21325 |
} |
| 21326 |
} else { |
| 21327 |
for (CIndividualMergingHash::iterator it = otherIndiMergingHash->begin(), itEnd = otherIndiMergingHash->end(); it != itEnd; ++it) { |
| 21328 |
cint64 individualId = it.key(); |
| 21329 |
CIndividualMergingHashData& mergingData = it.value(); |
| 21330 |
CDependencyTrackPoint* indiDepTrackPoint = mergingData.getDependencyTrackPoint(); |
| 21331 |
|
| 21332 |
if (mergingData.isMergedWithIndividual()) { |
| 21333 |
CXLinker<cint64>* individualMergingLinker = CObjectAllocator< CXLinker<cint64> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 21334 |
individualMergingLinker->initLinker(individualId); |
| 21335 |
indiMergingHash->addMergedIndividualLinker(individualMergingLinker); |
| 21336 |
|
| 21337 |
// create dependency |
| 21338 |
CIndividualMergingHashData& mergeIntoMergingData = (*indiMergingHash)[individualId]; |
| 21339 |
mergeIntoMergingData.setMergedWithIndividual(true); |
| 21340 |
if (indiDepTrackPoint) { |
| 21341 |
CDependencyTrackPoint* newIndiDepTrackPoint = nullptr; |
| 21342 |
CMERGEDIndividualDependencyNode* mergedIndiDepNode = createMERGEDINDIVIDUALDependency(newIndiDepTrackPoint, mergeIntoIndividualNode, mergeDepTrackPoint, indiDepTrackPoint, calcAlgContext); |
| 21343 |
mergeIntoMergingData.setDependencyTrackPoint(newIndiDepTrackPoint); |
| 21344 |
} |
| 21345 |
if (!mergeIntoMergingData.getReapplyQueue()->isEmpty()) { |
| 21346 |
CCondensedReapplyQueueIterator reapplyIt = mergeIntoMergingData.getReapplyQueue()->getIterator(true, true); |
| 21347 |
applyReapplyQueueConcepts(mergeIntoIndividualNode, &reapplyIt, calcAlgContext); |
| 21348 |
mergeIntoMergingData.getReapplyQueue()->initReapplyQueue(nullptr); |
| 21349 |
} |
| 21350 |
} |
| 21351 |
} |
| 21352 |
} |
| 21353 |
} |
| 21354 |
|
| 21355 |
if (nominalIndividual->getIndividualID() == -individual->getIndividualNodeID()) { |
| 21356 |
CDependencyTrackPoint* indiDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 21357 |
// create dependency |
| 21358 |
CDependencyTrackPoint* newIndiDepTrackPoint = nullptr; |
| 21359 |
CMERGEDIndividualDependencyNode* mergedIndiDepNode = createMERGEDINDIVIDUALDependency(newIndiDepTrackPoint,mergeIntoIndividualNode,mergeDepTrackPoint,indiDepTrackPoint,calcAlgContext); |
| 21360 |
|
| 21361 |
CIndividualMergingHashData& mergeIntoMergingData = (*indiMergingHash)[nominalIndividual->getIndividualID()]; |
| 21362 |
mergeIntoMergingData.setDependencyTrackPoint(newIndiDepTrackPoint); |
| 21363 |
mergeIntoMergingData.setMergedWithIndividual(true); |
| 21364 |
|
| 21365 |
CXLinker<cint64>* individualMergingLinker = CObjectAllocator< CXLinker<cint64> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 21366 |
individualMergingLinker->initLinker(nominalIndividual->getIndividualID()); |
| 21367 |
indiMergingHash->addMergedIndividualLinker(individualMergingLinker); |
| 21368 |
|
| 21369 |
|
| 21370 |
if (!mergeIntoMergingData.getReapplyQueue()->isEmpty()) { |
| 21371 |
CCondensedReapplyQueueIterator reapplyIt = mergeIntoMergingData.getReapplyQueue()->getIterator(true, true); |
| 21372 |
applyReapplyQueueConcepts(mergeIntoIndividualNode, &reapplyIt, calcAlgContext); |
| 21373 |
mergeIntoMergingData.getReapplyQueue()->initReapplyQueue(nullptr); |
| 21374 |
} |
| 21375 |
} |
| 21376 |
} |
| 21377 |
} |
| 21378 |
|
| 21379 |
if (!mergeIntoIndividualNode->getDependencyTrackPoint()) { |
| 21380 |
mergeIntoIndividualNode->setDependencyTrackPoint(depTrackPointHash.value(individual->getDependencyTrackPoint())); |
| 21381 |
} |
| 21382 |
if (mConfMinimizeMerging) { |
| 21383 |
if (mergeIntoIndividualNode->isBlockableIndividual() && !mergeIntoIndividualNode->hasIndividualAncestor() && mergeIntoIndividualNode->getIndividualAncestorDepth() >= individual->getIndividualAncestorDepth()) { |
| 21384 |
CIndividualLinkEdge* ancLink = individual->getAncestorLink(); |
| 21385 |
if (ancLink) { |
| 21386 |
CIndividualProcessNode* ancIndiNode = getAncestorIndividual(individual,calcAlgContext); |
| 21387 |
CIndividualLinkEdge* mergedNewAncLink = ancIndiNode->getRoleSuccessorToIndividualLink(ancLink->getLinkRole(),mergeIntoIndividualNode,false); |
| 21388 |
mergeIntoIndividualNode->setAncestorLink(mergedNewAncLink); |
| 21389 |
} |
| 21390 |
} |
| 21391 |
} |
| 21392 |
|
| 21393 |
|
| 21394 |
// add distinct information |
| 21395 |
bool mergedNodeDatatypeDistinctChangeNotified = false; |
| 21396 |
CDistinctHash* addDisHash = individual->getDistinctHash(false); |
| 21397 |
if (addDisHash) { |
| 21398 |
CDistinctHash* mergeDisHash = mergeIntoIndividualNode->getDistinctHash(true); |
| 21399 |
CDistinctIterator disIt = addDisHash->getDistinctIterator(); |
| 21400 |
while (disIt.hasNext()) { |
| 21401 |
CDependencyTrackPoint* depTrackPoint = nullptr; |
| 21402 |
cint64 disIndiID = disIt.nextDistinctIndividualID(depTrackPoint); |
| 21403 |
CIndividualProcessNode* locDisIndiNode = getLocalizedIndividual(disIndiID,calcAlgContext); |
| 21404 |
CDistinctHash* disHash = locDisIndiNode->getDistinctHash(true); |
| 21405 |
disHash->removeDistinctIndividual(individual->getIndividualNodeID()); |
| 21406 |
if (!mergeDisHash->isIndividualDistinct(disIndiID)) { |
| 21407 |
STATINC(INDINODEMERGEDISTINCTADDCOUNT,calcAlgContext); |
| 21408 |
STATINC(DISTINCTCREATIONCOUNT,calcAlgContext); |
| 21409 |
|
| 21410 |
// create dependency |
| 21411 |
CDependencyTrackPoint* newDepTrackPoint = nullptr; |
| 21412 |
CMERGEDLINKDependencyNode* mergedLinkDepNode = createMERGEDLINKDependency(newDepTrackPoint,mergeIntoIndividualNode,mergeDepTrackPoint,depTrackPoint,calcAlgContext); |
| 21413 |
|
| 21414 |
|
| 21415 |
CDistinctEdge* disEdge = CObjectParameterizingAllocator< CDistinctEdge,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 21416 |
disEdge->initDistinctEdge(locDisIndiNode,mergeIntoIndividualNode,newDepTrackPoint); |
| 21417 |
|
| 21418 |
mergeDisHash->insertDistinctIndividual(disIndiID,disEdge); |
| 21419 |
disHash->insertDistinctIndividual(mergeIntoIndividualNode->getIndividualNodeID(),disEdge); |
| 21420 |
|
| 21421 |
if (mDatatypeHandler) { |
| 21422 |
mDatatypeHandler->notifyDistinctChanges(locDisIndiNode,calcAlgContext); |
| 21423 |
if (!mergedNodeDatatypeDistinctChangeNotified) { |
| 21424 |
mergedNodeDatatypeDistinctChangeNotified = true; |
| 21425 |
mDatatypeHandler->notifyDistinctChanges(mergeIntoIndividualNode,calcAlgContext); |
| 21426 |
} |
| 21427 |
} |
| 21428 |
|
| 21429 |
} |
| 21430 |
} |
| 21431 |
} |
| 21432 |
|
| 21433 |
// prune nodes |
| 21434 |
individual->setMergedIntoIndividualNodeID(mergeIntoIndividualNode->getIndividualNodeID()); |
| 21435 |
pruneSuccessors(individual,nullptr,false,calcAlgContext); |
| 21436 |
|
| 21437 |
|
| 21438 |
if (individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING)) { |
| 21439 |
mergeIntoIndividualNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING); |
| 21440 |
} |
| 21441 |
|
| 21442 |
|
| 21443 |
if (mConfExactNominalDependencyTracking) { |
| 21444 |
if (individual->isNominalIndividualNode() && mergeIntoIndividualNode->isNominalIndividualNode()) { |
| 21445 |
CSuccessorConnectedNominalSet* copySuccConnNomSet = individual->getSuccessorNominalConnectionSet(false); |
| 21446 |
if (copySuccConnNomSet) { |
| 21447 |
for (CSuccessorConnectedNominalSet::const_iterator it = copySuccConnNomSet->constBegin(), itEnd = copySuccConnNomSet->constEnd(); it != itEnd; ++it) { |
| 21448 |
cint64 nominalID = *it; |
| 21449 |
mergeIntoIndividualNode->addSuccessorConnectionToNominal(nominalID); |
| 21450 |
} |
| 21451 |
} |
| 21452 |
CIndividual* nominalIndi = individual->getNominalIndividual(); |
| 21453 |
if (nominalIndi) { |
| 21454 |
cint64 nominalID = -nominalIndi->getIndividualID(); |
| 21455 |
mergeIntoIndividualNode->addSuccessorConnectionToNominal(nominalID); |
| 21456 |
} |
| 21457 |
} |
| 21458 |
} |
| 21459 |
|
| 21460 |
// is not necessary since rules are applied again for new added concepts |
| 21461 |
//if (individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSUCCESSORNOMINALCONNECTION)) { |
| 21462 |
// propagateIndividualNodeNominalConnectionToAncestors(mergeIntoIndividualNode,calcAlgContext); |
| 21463 |
//} |
| 21464 |
|
| 21465 |
|
| 21466 |
|
| 21467 |
//if (individual->isNominalIndividual()) { |
| 21468 |
// ++mNominalMergedCount; |
| 21469 |
// cout<<" end-nominal-merge "; |
| 21470 |
|
| 21471 |
KONCLUCE_TASK_ALGORITHM_MERGING_DEBUGGING_INSTRUCTION( |
| 21472 |
mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 21473 |
QFile fileend(QString("./Debugging/CompletionTasks/merging-step-stop-%1-%2-%3.txt").arg(mNominalMergedCount).arg(individual->getIndividualNodeID()).arg(mergeIntoIndividualNode->getIndividualNodeID())); |
| 21474 |
if (fileend.open(QIODevice::WriteOnly)) { |
| 21475 |
fileend.write(mEndTaskDebugIndiModelString.replace("<br>", "\r\n").toLocal8Bit()); |
| 21476 |
fileend.close(); |
| 21477 |
} |
| 21478 |
); |
| 21479 |
|
| 21480 |
//} |
| 21481 |
|
| 21482 |
|
| 21483 |
|
| 21484 |
CRoleAssertionLinker* roleAssLinker = individual->getAssertionRoleLinker(); |
| 21485 |
CReverseRoleAssertionLinker* reverseRoleAssLinker = individual->getReverseAssertionRoleLinker(); |
| 21486 |
if (roleAssLinker || reverseRoleAssLinker) { |
| 21487 |
CAdditionalProcessRoleAssertionsLinker* additionalRoleAssLinker = CObjectAllocator< CAdditionalProcessRoleAssertionsLinker >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 21488 |
additionalRoleAssLinker->initAdditionalProcessRoleAssertionsLinker(individual->getNominalIndividual(),roleAssLinker,reverseRoleAssLinker, mergeDepTrackPoint); |
| 21489 |
mergeIntoIndividualNode->addAdditionalRoleAssertionsLinker(additionalRoleAssLinker); |
| 21490 |
newLinksAdded = true; |
| 21491 |
} |
| 21492 |
for (CAdditionalProcessRoleAssertionsLinker* additionalRoleAssLinkerIt = individual->getAdditionalRoleAssertionsLinker(); additionalRoleAssLinkerIt; additionalRoleAssLinkerIt = additionalRoleAssLinkerIt->getNext()) { |
| 21493 |
CAdditionalProcessRoleAssertionsLinker* additionalRoleAssLinker = CObjectAllocator< CAdditionalProcessRoleAssertionsLinker >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 21494 |
CDependencyTrackPoint* newIndiDepTrackPoint = nullptr; |
| 21495 |
CMERGEDIndividualDependencyNode* mergedIndiDepNode = createMERGEDINDIVIDUALDependency(newIndiDepTrackPoint, mergeIntoIndividualNode, mergeDepTrackPoint, additionalRoleAssLinkerIt->getDependencyTrackPoint(), calcAlgContext); |
| 21496 |
additionalRoleAssLinker->initAdditionalProcessRoleAssertionsLinker(additionalRoleAssLinkerIt->getIndividual(),additionalRoleAssLinkerIt->getRoleAssertionLinker(),additionalRoleAssLinkerIt->getReverseRoleAssertionLinker(), newIndiDepTrackPoint); |
| 21497 |
mergeIntoIndividualNode->addAdditionalRoleAssertionsLinker(additionalRoleAssLinker); |
| 21498 |
newLinksAdded = true; |
| 21499 |
} |
| 21500 |
|
| 21501 |
|
| 21502 |
for (CXSortedNegLinker<CConcept*>* initLinker = individual->getProcessInitializingConceptLinker(); initLinker; initLinker = initLinker->getNext()) { |
| 21503 |
CXSortedNegLinker<CConcept*>* newInitLinker = CObjectAllocator< CXSortedNegLinker<CConcept*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 21504 |
newInitLinker->initNegLinker(initLinker->getData(), initLinker->getNegation()); |
| 21505 |
mergeIntoIndividualNode->addInitializingConceptLinker(newInitLinker); |
| 21506 |
} |
| 21507 |
|
| 21508 |
|
| 21509 |
CDataAssertionLinker* dataAssLinker = individual->getAssertionDataLinker(); |
| 21510 |
if (dataAssLinker) { |
| 21511 |
CAdditionalProcessDataAssertionsLinker* additionalDataAssLinker = CObjectAllocator< CAdditionalProcessDataAssertionsLinker >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 21512 |
additionalDataAssLinker->initAdditionalProcessDataAssertionsLinker(individual->getNominalIndividual(), dataAssLinker, mergeDepTrackPoint); |
| 21513 |
mergeIntoIndividualNode->addAdditionalDataAssertionsLinker(additionalDataAssLinker); |
| 21514 |
newLinksAdded = true; |
| 21515 |
} |
| 21516 |
for (CAdditionalProcessDataAssertionsLinker* additionalDataAssLinkerIt = individual->getAdditionalDataAssertionsLinker(); additionalDataAssLinkerIt; additionalDataAssLinkerIt = additionalDataAssLinkerIt->getNext()) { |
| 21517 |
CAdditionalProcessDataAssertionsLinker* additionalDataAssLinker = CObjectAllocator< CAdditionalProcessDataAssertionsLinker >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 21518 |
CDependencyTrackPoint* newIndiDepTrackPoint = nullptr; |
| 21519 |
CMERGEDIndividualDependencyNode* mergedIndiDepNode = createMERGEDINDIVIDUALDependency(newIndiDepTrackPoint, mergeIntoIndividualNode, mergeDepTrackPoint, additionalDataAssLinkerIt->getDependencyTrackPoint(), calcAlgContext); |
| 21520 |
additionalDataAssLinker->initAdditionalProcessDataAssertionsLinker(additionalDataAssLinkerIt->getIndividual(), additionalDataAssLinkerIt->getDataAssertionLinker(), newIndiDepTrackPoint); |
| 21521 |
mergeIntoIndividualNode->addAdditionalDataAssertionsLinker(additionalDataAssLinker); |
| 21522 |
newLinksAdded = true; |
| 21523 |
} |
| 21524 |
|
| 21525 |
|
| 21526 |
for (CProcessAssertedDataLiteralLinker* assertedDataLiteralLinkerIt = individual->getAssertedDataLiteralLinker(); assertedDataLiteralLinkerIt; assertedDataLiteralLinkerIt = assertedDataLiteralLinkerIt->getNext()) { |
| 21527 |
CProcessAssertedDataLiteralLinker* additionalDataLitLinker = CObjectAllocator< CProcessAssertedDataLiteralLinker >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 21528 |
CDependencyTrackPoint* newIndiDepTrackPoint = nullptr; |
| 21529 |
CMERGEDIndividualDependencyNode* mergedIndiDepNode = createMERGEDINDIVIDUALDependency(newIndiDepTrackPoint, mergeIntoIndividualNode, mergeDepTrackPoint, assertedDataLiteralLinkerIt->getDependencyTrackPoint(), calcAlgContext); |
| 21530 |
additionalDataLitLinker->initProcessDataLiteralLinker(assertedDataLiteralLinkerIt->getData(), newIndiDepTrackPoint); |
| 21531 |
mergeIntoIndividualNode->addAssertedDataLiteralLinker(additionalDataLitLinker); |
| 21532 |
newLinksAdded = true; |
| 21533 |
} |
| 21534 |
|
| 21535 |
if (mergeIntoIndividualNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED) |
| 21536 |
|| individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENNEIGHBOURDPARTIALEXPANSION | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED)) { |
| 21537 |
newLinksAdded = true; |
| 21538 |
} |
| 21539 |
|
| 21540 |
|
| 21541 |
if (individual->getIndividualBackendCacheSynchronisationData(false) && !mergeIntoIndividualNode->getIndividualBackendCacheSynchronisationData(false)) { |
| 21542 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = CObjectParameterizingAllocator< CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData, CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 21543 |
backendSyncData->initSynchronisationData((CBackendRepresentativeMemoryCacheIndividualAssociationData*)((CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)individual->getIndividualBackendCacheSynchronisationData(false))->getAssocitaionData()); |
| 21544 |
backendSyncData->setBackendCacheSynchron(false); |
| 21545 |
mergeIntoIndividualNode->setIndividualBackendCacheSynchronisationData(backendSyncData); |
| 21546 |
addIndividualToBackendIndirectCompatibilityExpansionQueue(mergeIntoIndividualNode, calcAlgContext); |
| 21547 |
} |
| 21548 |
|
| 21549 |
|
| 21550 |
if (newLinksAdded) { |
| 21551 |
propagateIndividualNodeModified(mergeIntoIndividualNode, calcAlgContext); |
| 21552 |
} |
| 21553 |
addIndividualToProcessingQueue(mergeIntoIndividualNode, calcAlgContext); |
| 21554 |
|
| 21555 |
|
| 21556 |
KONCLUCE_TASK_ALGORITHM_MODEL_STRING_INSTRUCTION(mAfterMergingTaskDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext)); |
| 21557 |
|
| 21558 |
} |
| 21559 |
|
| 21560 |
|
| 21561 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::tryExtendFunctionalSuccessorIndividual(CIndividualProcessNode*& indi, CConceptDescriptor* conDes, CSortedNegLinker<CRole*>* roleLinkerIt, CRole* ancRole, CSortedNegLinker<CConcept*>* conceptLinkerIt, bool negate, CDependencyTrackPoint* depTrackPoint, CIndividualSaturationProcessNode* saturationIndiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 21562 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 21563 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 21564 |
CIndividualProcessNode* succIndi = nullptr; |
| 21565 |
|
| 21566 |
|
| 21567 |
// TODO: test super roles for functional |
| 21568 |
CReapplyRoleSuccessorHash* roleSucc = indi->getReapplyRoleSuccessorHash(false); |
| 21569 |
CIndividualLinkEdge* mergeLink = nullptr; |
| 21570 |
if (roleSucc) { |
| 21571 |
CSortedNegLinker<CRole*>* funTestRoleLinkerIt = roleLinkerIt; |
| 21572 |
while (funTestRoleLinkerIt && !succIndi) { |
| 21573 |
CRole* role = funTestRoleLinkerIt->getData(); |
| 21574 |
bool invRole = funTestRoleLinkerIt->isNegated(); |
| 21575 |
bool functionalRole = !invRole && role->isFunctional(); |
| 21576 |
if (functionalRole) { |
| 21577 |
CRoleSuccessorLinkIterator roleSuccIt = roleSucc->getRoleSuccessorLinkIterator(role); |
| 21578 |
if (roleSuccIt.hasNext()) { |
| 21579 |
CIndividualLinkEdge* link = roleSuccIt.next(false); |
| 21580 |
succIndi = getLocalizedSuccessorIndividual(indi,link,calcAlgContext); |
| 21581 |
mergeLink = link; |
| 21582 |
} |
| 21583 |
} |
| 21584 |
funTestRoleLinkerIt = funTestRoleLinkerIt->getNext(); |
| 21585 |
} |
| 21586 |
} |
| 21587 |
if (succIndi) { |
| 21588 |
// create dependency |
| 21589 |
CDependencyTrackPoint* nextAllDepTrackPoint = nullptr; |
| 21590 |
CALLDependencyNode* allDepNode = createALLDependency(nextAllDepTrackPoint,indi,conDes,depTrackPoint,mergeLink->getDependencyTrackPoint(),calcAlgContext); |
| 21591 |
|
| 21592 |
bool satCachingPossible; |
| 21593 |
CConceptDescriptor* lastSatCachPossibleConDes = nullptr; |
| 21594 |
if (mConfExpandCreatedSuccessorsFromSaturation) { |
| 21595 |
tryExpansionFromSaturatedData(indi,succIndi,conDes,nextAllDepTrackPoint,saturationIndiNode,&satCachingPossible,&lastSatCachPossibleConDes,calcAlgContext); |
| 21596 |
} |
| 21597 |
// update successor links |
| 21598 |
bool newLinksAdded = false; |
| 21599 |
CSortedNegLinker<CRole*>* tmpRoleLinkerIt = roleLinkerIt; |
| 21600 |
while (tmpRoleLinkerIt) { |
| 21601 |
CRole* role = tmpRoleLinkerIt->getData(); |
| 21602 |
bool invRole = tmpRoleLinkerIt->isNegated(); |
| 21603 |
if (!invRole) { |
| 21604 |
if (!hasIndividualsLink(indi,succIndi,role,true,calcAlgContext)) { |
| 21605 |
// add link |
| 21606 |
createNewIndividualsLinkReapplyed(indi,indi,succIndi,role,nextAllDepTrackPoint,calcAlgContext); |
| 21607 |
newLinksAdded = true; |
| 21608 |
} |
| 21609 |
} else { |
| 21610 |
if (!hasIndividualsLink(succIndi,indi,role,true,calcAlgContext)) { |
| 21611 |
// add link |
| 21612 |
createNewIndividualsLinkReapplyed(indi,succIndi,indi,role,nextAllDepTrackPoint,calcAlgContext); |
| 21613 |
newLinksAdded = true; |
| 21614 |
} |
| 21615 |
} |
| 21616 |
tmpRoleLinkerIt = tmpRoleLinkerIt->getNext(); |
| 21617 |
} |
| 21618 |
if (newLinksAdded) { |
| 21619 |
propagateIndividualNodeModified(succIndi,calcAlgContext); |
| 21620 |
} |
| 21621 |
|
| 21622 |
addConceptsToIndividual(conceptLinkerIt,negate,succIndi,nextAllDepTrackPoint,true,true,nullptr,calcAlgContext); |
| 21623 |
if (mConfCachingBlockingFromSaturation) { |
| 21624 |
tryEstablishSaturationCaching(indi,succIndi,saturationIndiNode,&satCachingPossible,&lastSatCachPossibleConDes,calcAlgContext); |
| 21625 |
} |
| 21626 |
} |
| 21627 |
return succIndi; |
| 21628 |
} |
| 21629 |
|
| 21630 |
|
| 21631 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::createSuccessorIndividual(CIndividualProcessNode*& indi, CConceptDescriptor* conDes, CSortedNegLinker<CRole*>* roleLinkerIt, CRole* ancRole, CSortedNegLinker<CConcept*>* conceptLinkerIt, bool negate, CDependencyTrackPoint* depTrackPoint, CIndividualSaturationProcessNode* saturationIndiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 21632 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 21633 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 21634 |
CIndividualProcessNode* succIndi = nullptr; |
| 21635 |
|
| 21636 |
// create dependency |
| 21637 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 21638 |
CSOMEDependencyNode* someDepNode = createSOMEDependency(nextDepTrackPoint,indi,conDes,depTrackPoint,calcAlgContext); |
| 21639 |
|
| 21640 |
// generate new role successor |
| 21641 |
succIndi = createNewIndividual(nextDepTrackPoint,ancRole->isDataRole(),calcAlgContext); |
| 21642 |
|
| 21643 |
bool satCachingPossible = true; |
| 21644 |
CConceptDescriptor* lastSatCachPossibleConDes = nullptr; |
| 21645 |
if (mConfExpandCreatedSuccessorsFromSaturation) { |
| 21646 |
tryExpansionFromSaturatedData(indi,succIndi,conDes,nextDepTrackPoint,saturationIndiNode,&satCachingPossible,&lastSatCachPossibleConDes,calcAlgContext); |
| 21647 |
} |
| 21648 |
CIndividualLinkEdge* ancLink = createNewIndividualsLinksReapplyed(indi,succIndi,roleLinkerIt,ancRole,nextDepTrackPoint,false,calcAlgContext); |
| 21649 |
succIndi->setAncestorLink(ancLink); |
| 21650 |
succIndi->setIndividualAncestorDepth(indi->getIndividualAncestorDepth()+1); |
| 21651 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED)) { |
| 21652 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED); |
| 21653 |
} |
| 21654 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED)) { |
| 21655 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED); |
| 21656 |
} |
| 21657 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED | CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED)) { |
| 21658 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED); |
| 21659 |
} |
| 21660 |
|
| 21661 |
addConceptsToIndividual(conceptLinkerIt,negate,succIndi,nextDepTrackPoint,true,true,nullptr,calcAlgContext); |
| 21662 |
if (mConfCachingBlockingFromSaturation) { |
| 21663 |
tryEstablishSaturationCaching(indi,succIndi,saturationIndiNode,&satCachingPossible,&lastSatCachPossibleConDes,calcAlgContext); |
| 21664 |
} |
| 21665 |
return succIndi; |
| 21666 |
} |
| 21667 |
|
| 21668 |
|
| 21669 |
|
| 21670 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::tryEstablishSaturationCaching(CIndividualProcessNode*& indi, CIndividualProcessNode* succIndi, CIndividualSaturationProcessNode* saturationIndiNode, bool* satCachingPossible, CConceptDescriptor** lastSatCachPossibleConDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 21671 |
|
| 21672 |
if (saturationIndiNode && saturationIndiNode->isInitialized() && saturationIndiNode->isCompleted()) { |
| 21673 |
bool cachingEstablishmentPossible = false; |
| 21674 |
|
| 21675 |
CIndividualSaturationProcessNodeStatusFlags* flags = saturationIndiNode->getIndirectStatusFlags(); |
| 21676 |
if (!flags->hasFlags(CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT | CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED,false)) { |
| 21677 |
if (validateSaturationCachingPossible(succIndi,saturationIndiNode,satCachingPossible,lastSatCachPossibleConDes,nullptr,false,calcAlgContext)) { |
| 21678 |
|
| 21679 |
bool nominalNodesCompatible = true; |
| 21680 |
|
| 21681 |
if (flags->hasFlags(CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGNOMINALCONNECTION,false)) { |
| 21682 |
if (!mConfSaturationCachingWithNominals) { |
| 21683 |
nominalNodesCompatible = false; |
| 21684 |
} |
| 21685 |
CSuccessorConnectedNominalSet* succConnNominalSet = saturationIndiNode->getSuccessorConnectedNominalSet(false); |
| 21686 |
if (!succConnNominalSet) { |
| 21687 |
nominalNodesCompatible = false; |
| 21688 |
} else if (!tryInstallSaturationCachingReactivation(succIndi,succConnNominalSet,calcAlgContext)) { |
| 21689 |
nominalNodesCompatible = false; |
| 21690 |
} |
| 21691 |
} |
| 21692 |
|
| 21693 |
if (nominalNodesCompatible) { |
| 21694 |
cachingEstablishmentPossible = true; |
| 21695 |
} |
| 21696 |
} |
| 21697 |
} |
| 21698 |
|
| 21699 |
cint64 succIndiConCount = succIndi->getReapplyConceptLabelSet(false)->getConceptCount(); |
| 21700 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 21701 |
CIndividualNodeSaturationBlockingData* satBlockingData = CObjectAllocator< CIndividualNodeSaturationBlockingData >::allocateAndConstruct(taskMemMan); |
| 21702 |
satBlockingData->initSaturationBlockingData(succIndiConCount,*lastSatCachPossibleConDes,saturationIndiNode); |
| 21703 |
succIndi->setIndividualSaturationBlockingData(satBlockingData); |
| 21704 |
|
| 21705 |
if (cachingEstablishmentPossible) { |
| 21706 |
STATINC(SATURATIONCACHEESTABLISHCOUNT,calcAlgContext); |
| 21707 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED); |
| 21708 |
propagateIndirectSuccessorSaturationBlocked(succIndi,calcAlgContext); |
| 21709 |
|
| 21710 |
if (!flags->hasFlags(CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCARDINALITYPROPLEMATIC,false)) { |
| 21711 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONSUCCESSORCREATIONBLOCKINGCACHED); |
| 21712 |
} |
| 21713 |
return true; |
| 21714 |
} |
| 21715 |
} |
| 21716 |
|
| 21717 |
|
| 21718 |
return false; |
| 21719 |
} |
| 21720 |
|
| 21721 |
|
| 21722 |
|
| 21723 |
|
| 21724 |
|
| 21725 |
|
| 21726 |
|
| 21727 |
|
| 21728 |
|
| 21729 |
|
| 21730 |
|
| 21731 |
|
| 21732 |
|
| 21733 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::tryInitalizingFromSaturatedData(CIndividualProcessNode*& indi, CXSortedNegLinker<CConcept*>* initConceptLinker, CDependencyTrackPoint* depTrackPoint, bool allowPreprocess, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 21734 |
if (initConceptLinker) { |
| 21735 |
CConcept* concept = initConceptLinker->getData(); |
| 21736 |
bool conceptNegation = initConceptLinker->isNegated(); |
| 21737 |
CConceptData* conceptData = concept->getConceptData(); |
| 21738 |
CIndividualSaturationProcessNode* baseSatIndiNode = nullptr; |
| 21739 |
if (conceptData) { |
| 21740 |
CConceptProcessData* conProcData = (CConceptProcessData*)conceptData; |
| 21741 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 21742 |
if (conRefLinking) { |
| 21743 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 21744 |
CSaturationConceptReferenceLinking* extSatCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(conceptNegation); |
| 21745 |
if (extSatCalcRefLinkData) { |
| 21746 |
baseSatIndiNode = (CIndividualSaturationProcessNode*)extSatCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 21747 |
} |
| 21748 |
} |
| 21749 |
} |
| 21750 |
|
| 21751 |
if (baseSatIndiNode && baseSatIndiNode->isInitialized()) { |
| 21752 |
CIndividualSaturationProcessNode* satIndiNode = baseSatIndiNode; |
| 21753 |
while (satIndiNode->hasSubstituteIndividualNode()) { |
| 21754 |
satIndiNode = satIndiNode->getSubstituteIndividualNode(); |
| 21755 |
} |
| 21756 |
CReapplyConceptSaturationLabelSet* satConSet = satIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 21757 |
if (satConSet) { |
| 21758 |
if (satIndiNode->getIndirectStatusFlags()->hasClashedFlag() || baseSatIndiNode->getIndirectStatusFlags()->hasClashedFlag()) { |
| 21759 |
CClashedDependencyDescriptor* clashDes = nullptr; |
| 21760 |
addConceptToIndividualSkipANDProcessing(concept,conceptNegation,indi,depTrackPoint,false,false, true,calcAlgContext); |
| 21761 |
CConceptDescriptor* clashedConDes = nullptr; |
| 21762 |
CDependencyTrackPoint* clashedDepTrackPoint = nullptr; |
| 21763 |
indi->getReapplyConceptLabelSet(false)->getConceptDescriptor(concept,clashedConDes,clashedDepTrackPoint); |
| 21764 |
clashDes = createClashedConceptDescriptor(clashDes,indi,clashedConDes,clashedDepTrackPoint,calcAlgContext); |
| 21765 |
throw CCalculationClashProcessingException(clashDes); |
| 21766 |
} else { |
| 21767 |
|
| 21768 |
bool nominalConnectionFlag = satIndiNode->getIndirectStatusFlags()->hasNominalConnectionFlag(); |
| 21769 |
if (nominalConnectionFlag) { |
| 21770 |
propagateIndividualNodeNominalConnectionToAncestors(indi,calcAlgContext); |
| 21771 |
if (mConfExactNominalDependencyTracking) { |
| 21772 |
CSuccessorConnectedNominalSet* satSuccConnNomSet = satIndiNode->getSuccessorConnectedNominalSet(false); |
| 21773 |
if (satSuccConnNomSet) { |
| 21774 |
CSuccessorConnectedNominalSet* succConnNomSet = indi->getSuccessorNominalConnectionSet(true); |
| 21775 |
for (CSuccessorConnectedNominalSet::const_iterator it = satSuccConnNomSet->constBegin(), itEnd = satSuccConnNomSet->constEnd(); it != itEnd; ++it) { |
| 21776 |
cint64 nominalID = -*it; |
| 21777 |
succConnNomSet->insert(nominalID); |
| 21778 |
} |
| 21779 |
} |
| 21780 |
} |
| 21781 |
} |
| 21782 |
|
| 21783 |
bool satCachingPossible = true; |
| 21784 |
CConceptDescriptor* lastSatCachPossibleConDes = nullptr; |
| 21785 |
|
| 21786 |
if (satIndiNode = baseSatIndiNode) { |
| 21787 |
addConceptToIndividualSkipANDProcessing(concept,conceptNegation,indi,depTrackPoint,allowPreprocess,false, true,calcAlgContext); |
| 21788 |
} else { |
| 21789 |
addConceptToIndividual(concept,conceptNegation,indi,depTrackPoint,allowPreprocess,false,calcAlgContext); |
| 21790 |
} |
| 21791 |
CConceptDescriptor* conDes = nullptr; |
| 21792 |
CDependencyTrackPoint* conDepTrackPoint = nullptr; |
| 21793 |
indi->getReapplyConceptLabelSet(false)->getConceptDescriptor(concept,conDes,conDepTrackPoint); |
| 21794 |
|
| 21795 |
CDependencyTrackPoint* expandDepTrackPoint = nullptr; |
| 21796 |
CANDDependencyNode* andDepNode = createANDDependency(expandDepTrackPoint,indi,conDes,conDepTrackPoint,calcAlgContext); |
| 21797 |
|
| 21798 |
for (CConceptSaturationDescriptor* conSatDesIt = satConSet->getConceptSaturationDescriptionLinker(); conSatDesIt; conSatDesIt = conSatDesIt->getNext()) { |
| 21799 |
CConcept* satConcept = conSatDesIt->getConcept(); |
| 21800 |
bool satConceptNegation = conSatDesIt->isNegated(); |
| 21801 |
STATINC(SATURATIONCACHECONCEPTEXPANSIONCOUNT,calcAlgContext); |
| 21802 |
if (satConcept != concept || conceptNegation != satConceptNegation) { |
| 21803 |
addConceptToIndividualSkipANDProcessing(satConcept,satConceptNegation,indi,expandDepTrackPoint,allowPreprocess,false, true,calcAlgContext); |
| 21804 |
validateSaturationCachingPossible(indi,satIndiNode,&satCachingPossible,&lastSatCachPossibleConDes,satConcept,satConceptNegation,calcAlgContext); |
| 21805 |
} |
| 21806 |
} |
| 21807 |
|
| 21808 |
CSaturationNodeAssociatedDeterministicConceptExpansion* detExpansion = nullptr; |
| 21809 |
CSaturationNodeExpansionCacheHandler* satCacheHandler = calcAlgContext->getUsedSaturationNodeExpansionCacheHandler(); |
| 21810 |
if (satCacheHandler) { |
| 21811 |
if (satCacheHandler->getCachedDeterministicExpansion(baseSatIndiNode,detExpansion,calcAlgContext)) { |
| 21812 |
if (detExpansion && (mConfSaturationIncompleteExpansionFromCache || !detExpansion->requiresNonDeterministicExpansion())) { |
| 21813 |
for (CSaturationNodeAssociatedConceptLinker* conceptExpansionLinkerIt = detExpansion->getConceptExpansionLinker(); conceptExpansionLinkerIt; conceptExpansionLinkerIt = conceptExpansionLinkerIt->getNext()) { |
| 21814 |
CCacheValue* cacheValue = conceptExpansionLinkerIt->getCacheValue(); |
| 21815 |
|
| 21816 |
CConcept* expansionConcept = (CConcept*)cacheValue->getIdentification(); |
| 21817 |
bool expansionConceptNeg = cacheValue->getCacheValueIdentifier() == CCacheValue::CACHEVALTAGANDNEGATEDCONCEPT; |
| 21818 |
addConceptToIndividualSkipANDProcessing(expansionConcept,expansionConceptNeg,indi,expandDepTrackPoint,allowPreprocess,false, true,calcAlgContext); |
| 21819 |
} |
| 21820 |
} |
| 21821 |
} |
| 21822 |
} |
| 21823 |
|
| 21824 |
|
| 21825 |
|
| 21826 |
cint64 indiConCount = indi->getReapplyConceptLabelSet(false)->getConceptCount(); |
| 21827 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 21828 |
CIndividualNodeSaturationBlockingData* satBlockingData = CObjectAllocator< CIndividualNodeSaturationBlockingData >::allocateAndConstruct(taskMemMan); |
| 21829 |
satBlockingData->initSaturationBlockingData(indiConCount,lastSatCachPossibleConDes,baseSatIndiNode); |
| 21830 |
indi->setIndividualSaturationBlockingData(satBlockingData); |
| 21831 |
|
| 21832 |
} |
| 21833 |
|
| 21834 |
CXSortedNegLinker<CConcept*>* nextInitConceptLinker = initConceptLinker; |
| 21835 |
if (baseSatIndiNode == satIndiNode) { |
| 21836 |
nextInitConceptLinker = initConceptLinker->getNext(); |
| 21837 |
} |
| 21838 |
for (CXSortedNegLinker<CConcept*>* nextInitConceptLinkerIt = nextInitConceptLinker; nextInitConceptLinkerIt; nextInitConceptLinkerIt = nextInitConceptLinkerIt->getNext()) { |
| 21839 |
CConcept* nextConcept = nextInitConceptLinkerIt->getData(); |
| 21840 |
bool nextConceptNegation = nextInitConceptLinkerIt->isNegated(); |
| 21841 |
addConceptToIndividual(nextConcept,nextConceptNegation,indi,depTrackPoint,allowPreprocess,true,calcAlgContext); |
| 21842 |
} |
| 21843 |
return true; |
| 21844 |
} |
| 21845 |
} |
| 21846 |
} |
| 21847 |
return false; |
| 21848 |
} |
| 21849 |
|
| 21850 |
|
| 21851 |
|
| 21852 |
|
| 21853 |
|
| 21854 |
|
| 21855 |
|
| 21856 |
|
| 21857 |
void CCalculationTableauCompletionTaskHandleAlgorithm::propagateIndirectSuccessorSaturationBlocked(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 21858 |
propagateAddingBlockedProcessingRestrictionToSuccessors(indi,CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED,true,CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED,calcAlgContext); |
| 21859 |
} |
| 21860 |
|
| 21861 |
|
| 21862 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::validateSaturationCachingPossible(CIndividualProcessNode* indi, CIndividualSaturationProcessNode*& saturationIndiNode, bool* satCachingPossible, CConceptDescriptor** lastSatCachPossibleConDes, CConcept* addedConcept, bool addedConceptNegation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 21863 |
bool satCachingStillPossible = true; |
| 21864 |
if (satCachingPossible) { |
| 21865 |
satCachingStillPossible = *satCachingPossible; |
| 21866 |
} |
| 21867 |
if (satCachingStillPossible) { |
| 21868 |
if (!saturationIndiNode->isCompleted()) { |
| 21869 |
satCachingStillPossible = false; |
| 21870 |
} else { |
| 21871 |
CReapplyConceptLabelSet* conSet = indi->getReapplyConceptLabelSet(false); |
| 21872 |
CReapplyConceptSaturationLabelSet* satConSet = saturationIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 21873 |
if (conSet && satConSet) { |
| 21874 |
CConceptDescriptor* conDesLinker = conSet->getAddingSortedConceptDescriptionLinker(); |
| 21875 |
CConceptDescriptor* conDesIt = conDesLinker; |
| 21876 |
CConceptDescriptor* lastTestedConDesIt = nullptr; |
| 21877 |
if (lastSatCachPossibleConDes) { |
| 21878 |
lastTestedConDesIt = *lastSatCachPossibleConDes; |
| 21879 |
} |
| 21880 |
if (addedConcept && conDesIt != lastTestedConDesIt) { |
| 21881 |
if (conDesIt->getConcept() == addedConcept || conDesIt->isNegated() == addedConceptNegation) { |
| 21882 |
conDesIt = conDesIt->getNext(); |
| 21883 |
} |
| 21884 |
} |
| 21885 |
//while (conDesIt != lastTestedConDesIt && fromSatDataConceptsAddedCount > 0) { |
| 21886 |
// --fromSatDataConceptsAddedCount; |
| 21887 |
// conDesIt = conDesIt->getNext(); |
| 21888 |
//} |
| 21889 |
while (conDesIt != lastTestedConDesIt && satCachingStillPossible) { |
| 21890 |
if (!satConSet->hasConcept(conDesIt->getConcept(),conDesIt->isNegated())) { |
| 21891 |
satCachingStillPossible = false; |
| 21892 |
} |
| 21893 |
conDesIt = conDesIt->getNext(); |
| 21894 |
} |
| 21895 |
if (lastSatCachPossibleConDes) { |
| 21896 |
*lastSatCachPossibleConDes = conDesLinker; |
| 21897 |
} |
| 21898 |
} else { |
| 21899 |
satCachingStillPossible = false; |
| 21900 |
} |
| 21901 |
} |
| 21902 |
} |
| 21903 |
if (satCachingPossible) { |
| 21904 |
*satCachingPossible = satCachingStillPossible; |
| 21905 |
} |
| 21906 |
return satCachingStillPossible; |
| 21907 |
} |
| 21908 |
|
| 21909 |
|
| 21910 |
|
| 21911 |
|
| 21912 |
|
| 21913 |
CIndividualSaturationProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getCreationSuccessorSaturationNode(CIndividualProcessNode*& indi, CConceptDescriptor* conDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 21914 |
CConcept* concept = conDes->getConcept(); |
| 21915 |
bool conceptNegation = conDes->isNegated(); |
| 21916 |
CConceptData* conceptData = concept->getConceptData(); |
| 21917 |
CIndividualSaturationProcessNode* existIndiNode = nullptr; |
| 21918 |
if (conceptData) { |
| 21919 |
CConceptProcessData* conProcData = (CConceptProcessData*)conceptData; |
| 21920 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 21921 |
if (conRefLinking) { |
| 21922 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 21923 |
CSaturationConceptReferenceLinking* extSatCalcRefLinkData = confSatRefLinkingData->getExistentialSuccessorConceptSaturationReferenceLinkingData(); |
| 21924 |
if (extSatCalcRefLinkData) { |
| 21925 |
existIndiNode = (CIndividualSaturationProcessNode*)extSatCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 21926 |
} |
| 21927 |
} |
| 21928 |
} |
| 21929 |
|
| 21930 |
if (!existIndiNode) { |
| 21931 |
CSortedNegLinker<CConcept*>* conceptOpLinker = concept->getOperandList(); |
| 21932 |
if (conceptOpLinker && !conceptOpLinker->hasNext()) { |
| 21933 |
CConcept* opConcept = conceptOpLinker->getData(); |
| 21934 |
bool opConNegation = conceptOpLinker->isNegated()^conceptNegation; |
| 21935 |
CConceptData* opConceptData = opConcept->getConceptData(); |
| 21936 |
if (opConceptData) { |
| 21937 |
CConceptProcessData* conProcData = (CConceptProcessData*)opConceptData; |
| 21938 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 21939 |
if (conRefLinking) { |
| 21940 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 21941 |
CSaturationConceptReferenceLinking* satCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(opConNegation); |
| 21942 |
if (satCalcRefLinkData) { |
| 21943 |
existIndiNode = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 21944 |
} |
| 21945 |
} |
| 21946 |
} |
| 21947 |
} |
| 21948 |
} |
| 21949 |
|
| 21950 |
if (mConfSuccessorSaturationExpansionRestrictionsResolving && existIndiNode) { |
| 21951 |
CSaturationIndividualNodeSuccessorExtensionData* extensionData = existIndiNode->getSuccessorExtensionData(false); |
| 21952 |
if (extensionData) { |
| 21953 |
CSaturationIndividualNodeExtensionResolveData* resolveData = extensionData->getExtensionResolveData(); |
| 21954 |
if (resolveData) { |
| 21955 |
|
| 21956 |
|
| 21957 |
STATINC(NODESUCCESSOREXPANSIONSATURATIONRESOLVINGTRYINGCOUNT, calcAlgContext); |
| 21958 |
// collect universal restrictions from predecessor |
| 21959 |
CPROCESSINGHASH<cint64, CConceptNegationPair>* conExtensionMap = nullptr; |
| 21960 |
CReapplyRoleSuccessorHash* roleSuccHash = indi->getReapplyRoleSuccessorHash(false); |
| 21961 |
CRole* creationRole = conDes->getConcept()->getRole(); |
| 21962 |
CSortedNegLinker<CRole*>* roleLinkerIt = creationRole->getIndirectSuperRoleList(); |
| 21963 |
CReapplyConceptSaturationLabelSet* conSet = existIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 21964 |
|
| 21965 |
while (roleSuccHash && roleLinkerIt) { |
| 21966 |
CRole* role = roleLinkerIt->getData(); |
| 21967 |
bool invRole = roleLinkerIt->isNegated(); |
| 21968 |
if (!invRole) { |
| 21969 |
CReapplyQueueIterator reapplyQueueIt = roleSuccHash->getRoleReapplyIterator(role, false); |
| 21970 |
|
| 21971 |
while (reapplyQueueIt.hasNext()) { |
| 21972 |
CReapplyConceptDescriptor* reapplyConceptDes = reapplyQueueIt.next(); |
| 21973 |
CConceptDescriptor* reaConDes = reapplyConceptDes->getConceptDescriptor(); |
| 21974 |
|
| 21975 |
CDependencyTrackPoint* depTrackPoint = reapplyConceptDes->getDependencyTrackPoint(); |
| 21976 |
CProcessingRestrictionSpecification* procRest = reapplyConceptDes->getReapplyProcessingRestriction(); |
| 21977 |
|
| 21978 |
bool nondeterministically = true; |
| 21979 |
if (depTrackPoint->getBranchingTag() <= calcAlgContext->getProcessingDataBox()->getMaximumDeterministicBranchTag() || depTrackPoint == conDes->getDependencyTrackPoint()) { |
| 21980 |
nondeterministically = false; |
| 21981 |
} |
| 21982 |
|
| 21983 |
if (!nondeterministically) { |
| 21984 |
CConcept* reaConcept = reaConDes->getConcept(); |
| 21985 |
cint64 reaConceptCode = reaConcept->getOperatorCode(); |
| 21986 |
bool reaConNegation = reaConDes->isNegated(); |
| 21987 |
collectReapplyAutomatTransactionsRestrictions(indi, role, reaConcept, reaConNegation, conExtensionMap, conSet, calcAlgContext); |
| 21988 |
} |
| 21989 |
|
| 21990 |
} |
| 21991 |
|
| 21992 |
} |
| 21993 |
|
| 21994 |
roleLinkerIt = roleLinkerIt->getNext(); |
| 21995 |
} |
| 21996 |
|
| 21997 |
|
| 21998 |
CIndividualSaturationProcessNode* resolvedIndiNode = getSaturationResolvedIndividualNodeExtension(resolveData, conExtensionMap, calcAlgContext); |
| 21999 |
if (resolvedIndiNode && resolvedIndiNode != existIndiNode) { |
| 22000 |
STATINC(NODESUCCESSOREXPANSIONSATURATIONRESOLVEDCOUNT, calcAlgContext); |
| 22001 |
existIndiNode = resolvedIndiNode; |
| 22002 |
} |
| 22003 |
|
| 22004 |
} |
| 22005 |
} |
| 22006 |
} |
| 22007 |
|
| 22008 |
return existIndiNode; |
| 22009 |
} |
| 22010 |
|
| 22011 |
|
| 22012 |
|
| 22013 |
|
| 22014 |
|
| 22015 |
void CCalculationTableauCompletionTaskHandleAlgorithm::collectReapplyAutomatTransactionsRestrictions(CIndividualProcessNode*& processIndi, CRole* collectingRole, CConcept* concept, bool negated, CPROCESSINGHASH<cint64, CConceptNegationPair>*& conExtensionMap, CReapplyConceptSaturationLabelSet* conSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22016 |
|
| 22017 |
cint64 opCode = concept->getOperatorCode(); |
| 22018 |
CSortedNegLinker<CConcept*>* opConcepts = concept->getOperandList(); |
| 22019 |
if (mConfSpecializedAutomateRules && !negated && concept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_TYPE)) { |
| 22020 |
while (opConcepts) { |
| 22021 |
CConcept* opCon = opConcepts->getData(); |
| 22022 |
bool opConNeg = opConcepts->isNegated(); |
| 22023 |
collectReapplyAutomatTransactionsRestrictions(processIndi, collectingRole, opCon, opConNeg, conExtensionMap, conSet, calcAlgContext); |
| 22024 |
opConcepts = opConcepts->getNext(); |
| 22025 |
} |
| 22026 |
} else if (!negated && concept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE) || negated && concept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_SOME_TYPE)) { |
| 22027 |
CRole* role = concept->getRole(); |
| 22028 |
if (role == collectingRole) { |
| 22029 |
if ((!negated && concept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE)) || (negated && concept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_SOME_TYPE))) { |
| 22030 |
for (CSortedNegLinker<CConcept*>* reaOpConceptIt = concept->getOperandList(); reaOpConceptIt; reaOpConceptIt = reaOpConceptIt->getNext()) { |
| 22031 |
bool reaOpConNegation = reaOpConceptIt->isNegated() ^ negated; |
| 22032 |
|
| 22033 |
if (!conSet || !conSet->containsConcept(reaOpConceptIt->getData(), reaOpConNegation)) { |
| 22034 |
STATINC(NODESUCCESSOREXPANSIONSATURATIONRESOLVINGCONCEPTCANDIDATECOUNT, calcAlgContext); |
| 22035 |
if (!conExtensionMap) { |
| 22036 |
conExtensionMap = CObjectParameterizingAllocator< CPROCESSINGHASH<cint64, CConceptNegationPair>, CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(), calcAlgContext->getUsedTaskProcessorContext()); |
| 22037 |
} |
| 22038 |
conExtensionMap->insert(reaOpConceptIt->getData()->getConceptTag(), CConceptNegationPair(reaOpConceptIt->getData(), reaOpConNegation)); |
| 22039 |
} |
| 22040 |
} |
| 22041 |
} |
| 22042 |
|
| 22043 |
} |
| 22044 |
} |
| 22045 |
} |
| 22046 |
|
| 22047 |
|
| 22048 |
|
| 22049 |
|
| 22050 |
CIndividualSaturationProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getSaturationResolvedIndividualNodeExtension(CSaturationIndividualNodeExtensionResolveData* resolveData, CPROCESSINGHASH<cint64, CConceptNegationPair>* conExtensionMap, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22051 |
CIndividualSaturationProcessNode* lastResolvedIndiNode = resolveData->getProcessingIndividualNode(); |
| 22052 |
if (conExtensionMap) { |
| 22053 |
|
| 22054 |
for (CPROCESSHASH<cint64, CConceptNegationPair>::const_iterator it = conExtensionMap->constBegin(), itEnd = conExtensionMap->constEnd(); it != itEnd; ++it) { |
| 22055 |
const CConceptNegationPair& conExtDat(it.value()); |
| 22056 |
CConcept* concept = conExtDat.first; |
| 22057 |
bool negation = conExtDat.second; |
| 22058 |
|
| 22059 |
CSaturationIndividualNodeExtensionResolveHashData resolveHashData = resolveData->getIndividualNodeExtensionResolveHash(true)->getNonCreatingResolvedIndividualNodeExtensionData(concept, negation); |
| 22060 |
if (resolveHashData.mResolveData) { |
| 22061 |
STATINC(NODESUCCESSOREXPANSIONSATURATIONRESOLVEDCONCEPTCANDIDATECOUNT, calcAlgContext); |
| 22062 |
resolveData = resolveHashData.mResolveData; |
| 22063 |
if (resolveData->hasProcessingIndividualNode()) { |
| 22064 |
lastResolvedIndiNode = resolveData->getProcessingIndividualNode(); |
| 22065 |
} |
| 22066 |
} |
| 22067 |
} |
| 22068 |
} |
| 22069 |
|
| 22070 |
return lastResolvedIndiNode; |
| 22071 |
} |
| 22072 |
|
| 22073 |
|
| 22074 |
|
| 22075 |
|
| 22076 |
|
| 22077 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::tryExpansionFromSaturatedData(CIndividualProcessNode*& indi, CIndividualProcessNode* createdSuccIndi, CConceptDescriptor* conDes, CDependencyTrackPoint* depTrackPoint, CIndividualSaturationProcessNode*& saturationIndiNode, bool* satCachingPossible, CConceptDescriptor** lastSatCachPossibleConDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22078 |
if (saturationIndiNode && saturationIndiNode->isInitialized()) { |
| 22079 |
CReapplyConceptSaturationLabelSet* satConSet = saturationIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 22080 |
if (satConSet) { |
| 22081 |
bool nominalConnectionFlag = saturationIndiNode->getIndirectStatusFlags()->hasNominalConnectionFlag(); |
| 22082 |
if (saturationIndiNode->getIndirectStatusFlags()->hasClashedFlag()) { |
| 22083 |
if (!nominalConnectionFlag || !mOptIncrementalExpansion) { |
| 22084 |
CClashedDependencyDescriptor* clashDes = nullptr; |
| 22085 |
clashDes = createClashedConceptDescriptor(clashDes,indi,conDes,depTrackPoint,calcAlgContext); |
| 22086 |
throw CCalculationClashProcessingException(clashDes); |
| 22087 |
} |
| 22088 |
} else { |
| 22089 |
if (!mOptIncrementalExpansion || !nominalConnectionFlag) { |
| 22090 |
|
| 22091 |
if (nominalConnectionFlag) { |
| 22092 |
propagateIndividualNodeNominalConnectionToAncestors(createdSuccIndi,calcAlgContext); |
| 22093 |
if (mConfExactNominalDependencyTracking) { |
| 22094 |
CSuccessorConnectedNominalSet* satSuccConnNomSet = saturationIndiNode->getSuccessorConnectedNominalSet(false); |
| 22095 |
if (satSuccConnNomSet) { |
| 22096 |
CSuccessorConnectedNominalSet* succConnNomSet = createdSuccIndi->getSuccessorNominalConnectionSet(true); |
| 22097 |
for (CSuccessorConnectedNominalSet::const_iterator it = satSuccConnNomSet->constBegin(), itEnd = satSuccConnNomSet->constEnd(); it != itEnd; ++it) { |
| 22098 |
cint64 nominalID = -*it; |
| 22099 |
succConnNomSet->insert(nominalID); |
| 22100 |
} |
| 22101 |
} |
| 22102 |
} |
| 22103 |
propagateIndividualNodeNominalConnectionStatusToAncestors(indi,createdSuccIndi,calcAlgContext); |
| 22104 |
} |
| 22105 |
|
| 22106 |
for (CConceptSaturationDescriptor* conSatDesIt = satConSet->getConceptSaturationDescriptionLinker(); conSatDesIt; conSatDesIt = conSatDesIt->getNext()) { |
| 22107 |
CConcept* satConcept = conSatDesIt->getConcept(); |
| 22108 |
bool satConceptNegation = conSatDesIt->isNegated(); |
| 22109 |
STATINC(SATURATIONCACHECONCEPTEXPANSIONCOUNT,calcAlgContext); |
| 22110 |
addConceptToIndividualSkipANDProcessing(satConcept,satConceptNegation,createdSuccIndi,depTrackPoint,true,false, true,calcAlgContext); |
| 22111 |
validateSaturationCachingPossible(createdSuccIndi,saturationIndiNode,satCachingPossible,lastSatCachPossibleConDes,satConcept,satConceptNegation,calcAlgContext); |
| 22112 |
} |
| 22113 |
|
| 22114 |
CSaturationNodeAssociatedDeterministicConceptExpansion* detExpansion = nullptr; |
| 22115 |
CSaturationNodeExpansionCacheHandler* satCacheHandler = calcAlgContext->getUsedSaturationNodeExpansionCacheHandler(); |
| 22116 |
if (satCacheHandler) { |
| 22117 |
if (satCacheHandler->getCachedDeterministicExpansion(saturationIndiNode,detExpansion,calcAlgContext)) { |
| 22118 |
if (detExpansion && (mConfSaturationIncompleteExpansionFromCache || !detExpansion->requiresNonDeterministicExpansion())) { |
| 22119 |
for (CSaturationNodeAssociatedConceptLinker* conceptExpansionLinkerIt = detExpansion->getConceptExpansionLinker(); conceptExpansionLinkerIt; conceptExpansionLinkerIt = conceptExpansionLinkerIt->getNext()) { |
| 22120 |
CCacheValue* cacheValue = conceptExpansionLinkerIt->getCacheValue(); |
| 22121 |
|
| 22122 |
CConcept* expansionConcept = (CConcept*)cacheValue->getIdentification(); |
| 22123 |
bool expansionConceptNeg = cacheValue->getCacheValueIdentifier() == CCacheValue::CACHEVALTAGANDNEGATEDCONCEPT; |
| 22124 |
addConceptToIndividualSkipANDProcessing(expansionConcept,expansionConceptNeg,createdSuccIndi,depTrackPoint,true,false, true,calcAlgContext); |
| 22125 |
|
| 22126 |
} |
| 22127 |
} |
| 22128 |
} |
| 22129 |
} |
| 22130 |
return true; |
| 22131 |
} |
| 22132 |
} |
| 22133 |
} |
| 22134 |
} |
| 22135 |
return false; |
| 22136 |
} |
| 22137 |
|
| 22138 |
|
| 22139 |
void CCalculationTableauCompletionTaskHandleAlgorithm::createDistinctSuccessorIndividuals(CIndividualProcessNode*& indi, CConceptDescriptor* conDes, CPROCESSINGLIST<CIndividualProcessNode*>& indiList, CSortedNegLinker<CRole*>* roleLinkerIt, CRole* ancRole, CSortedNegLinker<CConcept*>* conceptLinkerIt, bool negate, CDependencyTrackPoint* depTrackPoint, cint64 succCardCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22140 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 22141 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 22142 |
|
| 22143 |
for (cint64 i = 0; i < succCardCount; ++i) { |
| 22144 |
CIndividualProcessNode* succIndi = nullptr; |
| 22145 |
succIndi = createNewIndividual(depTrackPoint,ancRole->isDataRole(),calcAlgContext); |
| 22146 |
indiList.append(succIndi); |
| 22147 |
} |
| 22148 |
|
| 22149 |
CIndividualSaturationProcessNode* saturationIndiNode = getCreationSuccessorSaturationNode(indi, conDes, calcAlgContext); |
| 22150 |
|
| 22151 |
createIndividualsDistinct(indiList,depTrackPoint,calcAlgContext); |
| 22152 |
|
| 22153 |
for (CPROCESSINGLIST<CIndividualProcessNode*>::const_iterator it = indiList.constBegin(), itEnd = indiList.constEnd(); it != itEnd; ++it) { |
| 22154 |
CIndividualProcessNode* succIndi = *it; |
| 22155 |
|
| 22156 |
bool satCachingPossible = true; |
| 22157 |
CConceptDescriptor* lastSatCachPossibleConDes = nullptr; |
| 22158 |
if (mConfExpandCreatedSuccessorsFromSaturation && saturationIndiNode) { |
| 22159 |
tryExpansionFromSaturatedData(indi, succIndi, conDes, depTrackPoint, saturationIndiNode, &satCachingPossible, &lastSatCachPossibleConDes, calcAlgContext); |
| 22160 |
} |
| 22161 |
|
| 22162 |
|
| 22163 |
CIndividualLinkEdge* ancLink = createNewIndividualsLinksReapplyed(indi,succIndi,roleLinkerIt,ancRole,depTrackPoint,false,calcAlgContext); |
| 22164 |
succIndi->setAncestorLink(ancLink); |
| 22165 |
succIndi->setIndividualAncestorDepth(indi->getIndividualAncestorDepth()+1); |
| 22166 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED | CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED)) { |
| 22167 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED); |
| 22168 |
} |
| 22169 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED | CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED)) { |
| 22170 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED); |
| 22171 |
} |
| 22172 |
if (indi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATURATIONBLOCKINGCACHED | CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED)) { |
| 22173 |
succIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED); |
| 22174 |
} |
| 22175 |
addConceptsToIndividual(conceptLinkerIt,negate,succIndi,depTrackPoint,true,true,nullptr,calcAlgContext); |
| 22176 |
|
| 22177 |
if (mConfCachingBlockingFromSaturation && saturationIndiNode) { |
| 22178 |
tryEstablishSaturationCaching(indi, succIndi, saturationIndiNode, &satCachingPossible, &lastSatCachPossibleConDes, calcAlgContext); |
| 22179 |
} |
| 22180 |
|
| 22181 |
} |
| 22182 |
} |
| 22183 |
|
| 22184 |
|
| 22185 |
|
| 22186 |
|
| 22187 |
|
| 22188 |
void CCalculationTableauCompletionTaskHandleAlgorithm::createNominalsSuccessorIndividuals(CIndividualProcessNode*& indi, CSortedNegLinker<CRole*>* roleLinkerIt, CRole* ancRole, CSortedNegLinker<CConcept*>* conceptLinkerIt, bool negate, CDependencyTrackPoint* depTrackPoint, cint64 succCardCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22189 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 22190 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 22191 |
|
| 22192 |
for (cint64 i = 0; i < succCardCount; ++i) { |
| 22193 |
STATINC(NOMINALSUCCESSORINDINODECREATIONCOUNT,calcAlgContext); |
| 22194 |
CIndividualProcessNode* succIndi = nullptr; |
| 22195 |
succIndi = createNewIndividual(depTrackPoint,false,calcAlgContext); |
| 22196 |
CIndividualLinkEdge* ancLink = createNewIndividualsLinksReapplyed(indi,succIndi,roleLinkerIt,ancRole,depTrackPoint,false,calcAlgContext); |
| 22197 |
succIndi->setIndividualType(CIndividualProcessNode::NOMINALINDIVIDUALTYPE); |
| 22198 |
succIndi->setIndividualNominalLevel(indi->getIndividualNominalLevel()+1); |
| 22199 |
|
| 22200 |
addIndividualToProcessingQueue(succIndi,calcAlgContext); |
| 22201 |
} |
| 22202 |
} |
| 22203 |
|
| 22204 |
|
| 22205 |
|
| 22206 |
|
| 22207 |
|
| 22208 |
CIndividualLinkEdge* CCalculationTableauCompletionTaskHandleAlgorithm::createNewIndividualsLinks(CIndividualProcessNode*& indiSource, CIndividualProcessNode*& indiDestination, CSortedNegLinker<CRole*>* roleLinkerIt, CRole* ancRole, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22209 |
CIndividualLinkEdge* ancRoleLink = nullptr; |
| 22210 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 22211 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 22212 |
bool generatedInvLink = false; |
| 22213 |
while (roleLinkerIt) { |
| 22214 |
CRole* role = roleLinkerIt->getData(); |
| 22215 |
bool invRole = roleLinkerIt->isNegated(); |
| 22216 |
STATINC(LINKSCREATIONCOUNT,calcAlgContext); |
| 22217 |
CIndividualLinkEdge* individualLink = CObjectParameterizingAllocator< CIndividualLinkEdge,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 22218 |
if (!invRole) { |
| 22219 |
createIndividualNodeDisjointRolesLinks(indiSource,indiDestination,role->getDisjointRoleList(),depTrackPoint,calcAlgContext); |
| 22220 |
individualLink->initIndividualLinkEdge(indiSource,indiSource,indiDestination,role,depTrackPoint); |
| 22221 |
//indiSource->installIndividualLink(individualLink); |
| 22222 |
installIndividualNodeRoleLink(indiSource,indiDestination,individualLink,calcAlgContext); |
| 22223 |
} else { |
| 22224 |
generatedInvLink = true; |
| 22225 |
createIndividualNodeDisjointRolesLinks(indiDestination,indiSource,role->getDisjointRoleList(),depTrackPoint,calcAlgContext); |
| 22226 |
individualLink->initIndividualLinkEdge(indiSource,indiDestination,indiSource,role,depTrackPoint); |
| 22227 |
//indiDestination->installIndividualLink(individualLink); |
| 22228 |
installIndividualNodeRoleLink(indiDestination,indiSource,individualLink,calcAlgContext); |
| 22229 |
} |
| 22230 |
if (ancRole == role) { |
| 22231 |
ancRoleLink = individualLink; |
| 22232 |
} |
| 22233 |
roleLinkerIt = roleLinkerIt->getNext(); |
| 22234 |
} |
| 22235 |
if (generatedInvLink || indiDestination->isNominalIndividualNode()) { |
| 22236 |
indiSource->getConnectionSuccessorSet(true)->insertConnectionSuccessor(indiDestination->getIndividualNodeID()); |
| 22237 |
} |
| 22238 |
indiDestination->getConnectionSuccessorSet(true)->insertConnectionSuccessor(indiSource->getIndividualNodeID()); |
| 22239 |
if (mOptIncrementalCompatibleExpansion) { |
| 22240 |
linkCreationDirectlyChangedNeighbourConnectionUpdate(indiDestination,indiSource,true,calcAlgContext); |
| 22241 |
} |
| 22242 |
return ancRoleLink; |
| 22243 |
} |
| 22244 |
|
| 22245 |
|
| 22246 |
|
| 22247 |
void CCalculationTableauCompletionTaskHandleAlgorithm::installIndividualNodeRoleLink(CIndividualProcessNode*& sourceIndi, CIndividualProcessNode*& destinationIndi, CIndividualLinkEdge* individualLink, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22248 |
CNegationDisjointEdge* negDisEdge = nullptr; |
| 22249 |
CDisjointSuccessorRoleHash* disSuccRoleHash = sourceIndi->getDisjointSuccessorRoleHash(false); |
| 22250 |
if (disSuccRoleHash) { |
| 22251 |
negDisEdge = disSuccRoleHash->getDisjointSuccessorRoleLink(destinationIndi->getIndividualNodeID(),individualLink->getLinkRole()); |
| 22252 |
if (negDisEdge) { |
| 22253 |
CClashedDependencyDescriptor* clashDes = nullptr; |
| 22254 |
clashDes = createClashedIndividualLinkDescriptor(clashDes,individualLink,individualLink->getDependencyTrackPoint(),calcAlgContext); |
| 22255 |
clashDes = createClashedNegationDisjointDescriptor(clashDes,negDisEdge,negDisEdge->getDependencyTrackPoint(),calcAlgContext); |
| 22256 |
throw CCalculationClashProcessingException(clashDes); |
| 22257 |
} |
| 22258 |
} |
| 22259 |
cint64 succLinkCount = sourceIndi->installIndividualLink(individualLink); |
| 22260 |
|
| 22261 |
if (mConfOccurrenceStatisticsCollecting && mOptCollectOccurrenceStatistics) { |
| 22262 |
bool nondeterministically = hasNondeterministicDependency(individualLink->getDependencyTrackPoint(), calcAlgContext); |
| 22263 |
mOccStatsCacheHandler->incRoleInstanceOccurrencceStatistics(individualLink->getLinkRole(), nondeterministically, !sourceIndi->getNominalIndividual(), succLinkCount <= 1); |
| 22264 |
} |
| 22265 |
} |
| 22266 |
|
| 22267 |
|
| 22268 |
CReapplyQueueIterator CCalculationTableauCompletionTaskHandleAlgorithm::installIndividualNodeRoleLinkReapplied(CIndividualProcessNode*& sourceIndi, CIndividualProcessNode*& destinationIndi, CIndividualLinkEdge* individualLink, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22269 |
CReapplyQueueIterator reapplyIterator; |
| 22270 |
CNegationDisjointEdge* negDisEdge = nullptr; |
| 22271 |
CDisjointSuccessorRoleHash* disSuccRoleHash = sourceIndi->getDisjointSuccessorRoleHash(false); |
| 22272 |
if (disSuccRoleHash) { |
| 22273 |
negDisEdge = disSuccRoleHash->getDisjointSuccessorRoleLink(destinationIndi->getIndividualNodeID(),individualLink->getLinkRole()); |
| 22274 |
if (negDisEdge) { |
| 22275 |
CClashedDependencyDescriptor* clashDes = nullptr; |
| 22276 |
clashDes = createClashedIndividualLinkDescriptor(clashDes,individualLink,individualLink->getDependencyTrackPoint(),calcAlgContext); |
| 22277 |
clashDes = createClashedNegationDisjointDescriptor(clashDes,negDisEdge,negDisEdge->getDependencyTrackPoint(),calcAlgContext); |
| 22278 |
throw CCalculationClashProcessingException(clashDes); |
| 22279 |
} |
| 22280 |
} |
| 22281 |
cint64 succLinkCount = sourceIndi->installIndividualLink(individualLink,&reapplyIterator); |
| 22282 |
|
| 22283 |
if (mConfOccurrenceStatisticsCollecting && mOptCollectOccurrenceStatistics) { |
| 22284 |
bool nondeterministically = hasNondeterministicDependency(individualLink->getDependencyTrackPoint(), calcAlgContext); |
| 22285 |
mOccStatsCacheHandler->incRoleInstanceOccurrencceStatistics(individualLink->getLinkRole(), nondeterministically, !sourceIndi->getNominalIndividual(), succLinkCount <= 1); |
| 22286 |
} |
| 22287 |
return reapplyIterator; |
| 22288 |
} |
| 22289 |
|
| 22290 |
|
| 22291 |
CIndividualLinkEdge* CCalculationTableauCompletionTaskHandleAlgorithm::createNewIndividualsLinksReapplyed(CIndividualProcessNode*& indiSource, CIndividualProcessNode*& indiDestination, CSortedNegLinker<CRole*>* roleLinkerIt, CRole* ancRole, CDependencyTrackPoint* depTrackPoint, bool checkRoleExisting, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22292 |
CIndividualLinkEdge* ancRoleLink = nullptr; |
| 22293 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 22294 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 22295 |
bool generatedInvLink = false; |
| 22296 |
while (roleLinkerIt) { |
| 22297 |
CRole* role = roleLinkerIt->getData(); |
| 22298 |
bool invRole = roleLinkerIt->isNegated(); |
| 22299 |
CSortedNegLinker<CConcept *> *rangeConLinkerIt = role->getRangeConceptList(); |
| 22300 |
STATINC(LINKSCREATIONCOUNT,calcAlgContext); |
| 22301 |
CIndividualLinkEdge* individualLink = CObjectParameterizingAllocator< CIndividualLinkEdge,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 22302 |
if (!invRole) { |
| 22303 |
if (!checkRoleExisting || !hasIndividualsLink(indiSource,indiDestination,role,true,calcAlgContext)) { |
| 22304 |
createIndividualNodeDisjointRolesLinks(indiSource,indiDestination,role->getDisjointRoleList(),depTrackPoint,calcAlgContext); |
| 22305 |
individualLink->initIndividualLinkEdge(indiSource,indiSource,indiDestination,role,depTrackPoint); |
| 22306 |
CReapplyQueueIterator reapplyIterator; |
| 22307 |
reapplyIterator = installIndividualNodeRoleLinkReapplied(indiSource,indiDestination,individualLink,calcAlgContext); |
| 22308 |
if (rangeConLinkerIt) { |
| 22309 |
addConceptsToIndividual(rangeConLinkerIt,false,indiDestination,depTrackPoint,true,false,nullptr,calcAlgContext); |
| 22310 |
} |
| 22311 |
CSortedNegLinker<CConcept *> *domainConLinkerIt = role->getDomainConceptList(); |
| 22312 |
if (domainConLinkerIt) { |
| 22313 |
addConceptsToIndividual(domainConLinkerIt,false,indiSource,depTrackPoint,true,false,nullptr,calcAlgContext); |
| 22314 |
} |
| 22315 |
applyReapplyQueueConceptsRestricted(indiSource,&reapplyIterator,individualLink,calcAlgContext); |
| 22316 |
} |
| 22317 |
} else { |
| 22318 |
if (!checkRoleExisting || !hasIndividualsLink(indiDestination,indiSource,role,true,calcAlgContext)) { |
| 22319 |
generatedInvLink = true; |
| 22320 |
createIndividualNodeDisjointRolesLinks(indiDestination,indiSource,role->getDisjointRoleList(),depTrackPoint,calcAlgContext); |
| 22321 |
individualLink->initIndividualLinkEdge(indiSource,indiDestination,indiSource,role,depTrackPoint); |
| 22322 |
CReapplyQueueIterator reapplyIterator; |
| 22323 |
reapplyIterator = installIndividualNodeRoleLinkReapplied(indiDestination,indiSource,individualLink,calcAlgContext); |
| 22324 |
if (rangeConLinkerIt) { |
| 22325 |
addConceptsToIndividual(rangeConLinkerIt,false,indiSource,depTrackPoint,true,false,nullptr,calcAlgContext); |
| 22326 |
} |
| 22327 |
CSortedNegLinker<CConcept *> *domainConLinkerIt = role->getDomainConceptList(); |
| 22328 |
if (domainConLinkerIt) { |
| 22329 |
addConceptsToIndividual(domainConLinkerIt,false,indiDestination,depTrackPoint,true,false,nullptr,calcAlgContext); |
| 22330 |
} |
| 22331 |
applyReapplyQueueConceptsRestricted(indiDestination,&reapplyIterator,individualLink,calcAlgContext); |
| 22332 |
} |
| 22333 |
} |
| 22334 |
if (ancRole == role) { |
| 22335 |
ancRoleLink = individualLink; |
| 22336 |
} |
| 22337 |
roleLinkerIt = roleLinkerIt->getNext(); |
| 22338 |
} |
| 22339 |
if (generatedInvLink || indiDestination->isNominalIndividualNode()) { |
| 22340 |
indiSource->getConnectionSuccessorSet(true)->insertConnectionSuccessor(indiDestination->getIndividualNodeID()); |
| 22341 |
} |
| 22342 |
indiDestination->getConnectionSuccessorSet(true)->insertConnectionSuccessor(indiSource->getIndividualNodeID()); |
| 22343 |
if (mOptIncrementalCompatibleExpansion) { |
| 22344 |
linkCreationDirectlyChangedNeighbourConnectionUpdate(indiDestination,indiSource,true,calcAlgContext); |
| 22345 |
} |
| 22346 |
return ancRoleLink; |
| 22347 |
} |
| 22348 |
|
| 22349 |
|
| 22350 |
CIndividualLinkEdge* CCalculationTableauCompletionTaskHandleAlgorithm::createNewIndividualsLink(CIndividualProcessNode*& indiCreator, CIndividualProcessNode*& indiSource, CIndividualProcessNode*& indiDestination, CRole* role, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22351 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 22352 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 22353 |
STATINC(LINKSCREATIONCOUNT,calcAlgContext); |
| 22354 |
createIndividualNodeDisjointRolesLinks(indiSource,indiDestination,role->getDisjointRoleList(),depTrackPoint,calcAlgContext); |
| 22355 |
CIndividualLinkEdge* individualLink = CObjectParameterizingAllocator< CIndividualLinkEdge,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 22356 |
individualLink->initIndividualLinkEdge(indiCreator,indiSource,indiDestination,role,depTrackPoint); |
| 22357 |
//indiSource->installIndividualLink(individualLink); |
| 22358 |
installIndividualNodeRoleLink(indiSource,indiDestination,individualLink,calcAlgContext); |
| 22359 |
indiDestination->getConnectionSuccessorSet(true)->insertConnectionSuccessor(indiSource->getIndividualNodeID()); |
| 22360 |
if (mOptIncrementalCompatibleExpansion) { |
| 22361 |
linkCreationDirectlyChangedNeighbourConnectionUpdate(indiDestination,indiSource,true,calcAlgContext); |
| 22362 |
} |
| 22363 |
return individualLink; |
| 22364 |
} |
| 22365 |
|
| 22366 |
|
| 22367 |
CIndividualLinkEdge* CCalculationTableauCompletionTaskHandleAlgorithm::createNewIndividualsLinkReapplyed(CIndividualProcessNode*& indiCreator, CIndividualProcessNode*& indiSource, CIndividualProcessNode*& indiDestination, CRole* role, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22368 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 22369 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 22370 |
createIndividualNodeDisjointRolesLinks(indiSource,indiDestination,role->getDisjointRoleList(),depTrackPoint,calcAlgContext); |
| 22371 |
CReapplyQueueIterator reapplyIterator; |
| 22372 |
STATINC(LINKSCREATIONCOUNT,calcAlgContext); |
| 22373 |
CIndividualLinkEdge* individualLink = CObjectParameterizingAllocator< CIndividualLinkEdge,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 22374 |
individualLink->initIndividualLinkEdge(indiCreator,indiSource,indiDestination,role,depTrackPoint); |
| 22375 |
//indiSource->installIndividualLink(individualLink,&reapplyIterator); |
| 22376 |
reapplyIterator = installIndividualNodeRoleLinkReapplied(indiSource,indiDestination,individualLink,calcAlgContext); |
| 22377 |
CSortedNegLinker<CConcept *> *rangeConLinkerIt = role->getRangeConceptList(); |
| 22378 |
if (rangeConLinkerIt) { |
| 22379 |
// no preprocessing, because of possible not intercepted clashes while merging |
| 22380 |
addConceptsToIndividual(rangeConLinkerIt,false,indiDestination,depTrackPoint,false,false,nullptr,calcAlgContext); |
| 22381 |
} |
| 22382 |
CSortedNegLinker<CConcept *> *domainConLinkerIt = role->getDomainConceptList(); |
| 22383 |
if (domainConLinkerIt) { |
| 22384 |
// no preprocessing, because of possible not intercepted clashes while merging |
| 22385 |
addConceptsToIndividual(domainConLinkerIt,false,indiSource,depTrackPoint,false,false,nullptr,calcAlgContext); |
| 22386 |
} |
| 22387 |
applyReapplyQueueConceptsRestricted(indiSource,&reapplyIterator,individualLink,calcAlgContext); |
| 22388 |
indiDestination->getConnectionSuccessorSet(true)->insertConnectionSuccessor(indiSource->getIndividualNodeID()); |
| 22389 |
if (mOptIncrementalCompatibleExpansion) { |
| 22390 |
linkCreationDirectlyChangedNeighbourConnectionUpdate(indiDestination,indiSource,true,calcAlgContext); |
| 22391 |
} |
| 22392 |
return individualLink; |
| 22393 |
} |
| 22394 |
|
| 22395 |
|
| 22396 |
void CCalculationTableauCompletionTaskHandleAlgorithm::createIndividualsDistinct(CIndividualProcessNode*& indiSource, CIndividualProcessNode*& indiDestination, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22397 |
STATINC(DISTINCTCREATIONCOUNT,calcAlgContext); |
| 22398 |
|
| 22399 |
CDistinctEdge* disEdge = CObjectParameterizingAllocator< CDistinctEdge,CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getUsedProcessContext()); |
| 22400 |
disEdge->initDistinctEdge(indiSource,indiDestination,depTrackPoint); |
| 22401 |
|
| 22402 |
indiSource->getDistinctHash(true)->insertDistinctIndividual(indiDestination->getIndividualNodeID(),disEdge); |
| 22403 |
indiDestination->getDistinctHash(true)->insertDistinctIndividual(indiSource->getIndividualNodeID(),disEdge); |
| 22404 |
} |
| 22405 |
|
| 22406 |
|
| 22407 |
|
| 22408 |
void CCalculationTableauCompletionTaskHandleAlgorithm::createIndividualsDistinct(CPROCESSINGLIST<CIndividualProcessNode*>& indiList, CDependencyTrackPoint* depTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22409 |
for (CPROCESSINGLIST<CIndividualProcessNode*>::const_iterator it = indiList.constBegin(), itEnd = indiList.constEnd(); it != itEnd; ++it) { |
| 22410 |
CIndividualProcessNode* indi1 = *it; |
| 22411 |
CDistinctHash* disHash1 = indi1->getDistinctHash(true); |
| 22412 |
CPROCESSINGLIST<CIndividualProcessNode*>::const_iterator it2 = it; |
| 22413 |
for (++it2; it2 != itEnd; ++it2) { |
| 22414 |
CIndividualProcessNode* indi2 = *it2; |
| 22415 |
CDistinctHash* disHash2 = indi2->getDistinctHash(true); |
| 22416 |
STATINC(DISTINCTCREATIONCOUNT,calcAlgContext); |
| 22417 |
|
| 22418 |
CDistinctEdge* disEdge = CObjectParameterizingAllocator< CDistinctEdge,CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getUsedProcessContext()); |
| 22419 |
disEdge->initDistinctEdge(indi1,indi2,depTrackPoint); |
| 22420 |
|
| 22421 |
disHash1->insertDistinctIndividual(indi2->getIndividualNodeID(),disEdge); |
| 22422 |
disHash2->insertDistinctIndividual(indi1->getIndividualNodeID(),disEdge); |
| 22423 |
} |
| 22424 |
} |
| 22425 |
} |
| 22426 |
|
| 22427 |
|
| 22428 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasIndividualsLink(CIndividualProcessNode*& indiSource, CIndividualProcessNode*& indiDestination, CRole* role, bool locateable, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22429 |
return indiSource->hasRoleSuccessorToIndividual(role,indiDestination,locateable); |
| 22430 |
} |
| 22431 |
|
| 22432 |
|
| 22433 |
|
| 22434 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::createNewEmptyIndividual(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22435 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 22436 |
STATINC(SUCCESSORINDINODECREATIONCOUNT,calcAlgContext); |
| 22437 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 22438 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 22439 |
CIndividualProcessNode* newIndividual = CObjectParameterizingAllocator< CIndividualProcessNode,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 22440 |
cint64 newIndividualID = calcAlgContext->getProcessingDataBox()->getNextIndividualNodeID(); |
| 22441 |
newIndividualID = qMax(indiProcNodeVec->getItemMaxIndex()+1,newIndividualID); |
| 22442 |
newIndividual->setIndividualNodeID(newIndividualID); |
| 22443 |
indiProcNodeVec->setLocalData(newIndividualID,newIndividual); |
| 22444 |
|
| 22445 |
if (mOptConsistenceNodeMarking) { |
| 22446 |
newIndividual->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCONSNODEPREPARATIONINDINODE); |
| 22447 |
} |
| 22448 |
if (mOptIncrementalCompatibleExpansion) { |
| 22449 |
newIndividual->addProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANDING); |
| 22450 |
newIndividual->setIncrementalExpansionID(calcAlgContext->getProcessingDataBox()->getIncrementalExpansionID()); |
| 22451 |
} |
| 22452 |
return newIndividual; |
| 22453 |
} |
| 22454 |
|
| 22455 |
|
| 22456 |
|
| 22457 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::createNewIndividual(CDependencyTrackPoint* depTrackPoint, bool dataNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22458 |
CIndividualProcessNode* newIndividual = createNewEmptyIndividual(calcAlgContext); |
| 22459 |
newIndividual->initDependencyTracker(depTrackPoint); |
| 22460 |
if (!dataNode) { |
| 22461 |
CConcept* topConcept = calcAlgContext->getProcessingDataBox()->getOntologyTopConcept(); |
| 22462 |
addConceptToIndividual(topConcept,false,newIndividual,depTrackPoint,true,false,calcAlgContext); |
| 22463 |
} else { |
| 22464 |
newIndividual->setExtendedQueueProcessing(true); |
| 22465 |
CConcept* topDataRangeConcept = calcAlgContext->getProcessingDataBox()->getOntologyTopDataRangeConcept(); |
| 22466 |
addConceptToIndividual(topDataRangeConcept,false,newIndividual,depTrackPoint,true,false,calcAlgContext); |
| 22467 |
newIndividual->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCONCRETEDATAINDINODE); |
| 22468 |
} |
| 22469 |
return newIndividual; |
| 22470 |
} |
| 22471 |
|
| 22472 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getAvailableUpToDateIndividual(cint64 indiID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22473 |
if (isNominalIndividualNodeAvailable(indiID,calcAlgContext)) { |
| 22474 |
return getUpToDateIndividual(indiID,calcAlgContext); |
| 22475 |
} |
| 22476 |
return nullptr; |
| 22477 |
} |
| 22478 |
|
| 22479 |
|
| 22480 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getUpToDateIndividual(CIndividualProcessNode* indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22481 |
if (!indi->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger()->getCurrentLocalizationTag()) && indi->isRelocalized()) { |
| 22482 |
STATINC(INDINODEUPDATELOADCOUNT,calcAlgContext); |
| 22483 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 22484 |
CIndividualProcessNode* upToDateIndi = indiProcNodeVec->getData(indi->getIndividualNodeID()); |
| 22485 |
return upToDateIndi; |
| 22486 |
} |
| 22487 |
return indi; |
| 22488 |
} |
| 22489 |
|
| 22490 |
|
| 22491 |
|
| 22492 |
CIndividual* CCalculationTableauCompletionTaskHandleAlgorithm::createNewTemporaryNominalIndividual(cint64 indiId, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22493 |
CIndividualVector* indiVector = calcAlgContext->getProcessingDataBox()->getIndividualVector(true); |
| 22494 |
CIndividual* newIndi = CObjectAllocator<CIndividual>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 22495 |
newIndi->initIndividual(indiId); |
| 22496 |
newIndi->setTemporaryIndividual(true); |
| 22497 |
indiVector->setLocalData(indiId, newIndi); |
| 22498 |
return newIndi; |
| 22499 |
} |
| 22500 |
|
| 22501 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getUpToDateIndividual(cint64 indiID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22502 |
STATINC(INDINODEUPDATELOADCOUNT,calcAlgContext); |
| 22503 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 22504 |
CIndividualProcessNode* upToDateIndi = indiProcNodeVec->getData(indiID); |
| 22505 |
if (!upToDateIndi) { |
| 22506 |
CIndividualVector* indiVec = calcAlgContext->getProcessingDataBox()->getIndividualVector(false); |
| 22507 |
if (indiVec) { |
| 22508 |
if (indiID <= 0) { |
| 22509 |
CIndividual* individual = indiVec->getData(-(indiID)); |
| 22510 |
if (!individual) { |
| 22511 |
individual = createNewTemporaryNominalIndividual(-(indiID), calcAlgContext); |
| 22512 |
} |
| 22513 |
if (individual) { |
| 22514 |
|
| 22515 |
trackIndividualReferredDependence(indiID,calcAlgContext); |
| 22516 |
|
| 22517 |
STATINC(INDINODELOCALIZEDLOADCOUNT,calcAlgContext); |
| 22518 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 22519 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 22520 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 22521 |
CIndividualProcessNode* localicedIndi = CObjectParameterizingAllocator< CIndividualProcessNode,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 22522 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 22523 |
localicedIndi->initDependencyTracker(depTrackPoint); |
| 22524 |
localicedIndi->setNominalIndividual(individual); |
| 22525 |
localicedIndi->setIndividualType(CIndividualProcessNode::NOMINALINDIVIDUALTYPE); |
| 22526 |
localicedIndi->setIndividualNodeID(indiID); |
| 22527 |
indiProcNodeVec->setLocalData(localicedIndi->getIndividualNodeID(),localicedIndi); |
| 22528 |
|
| 22529 |
localicedIndi->setAssertionRoleLinker(individual->getAssertionRoleLinker()); |
| 22530 |
localicedIndi->setReverseAssertionRoleLinker(individual->getReverseAssertionRoleLinker()); |
| 22531 |
localicedIndi->setAssertionDataLinker(individual->getAssertionDataLinker()); |
| 22532 |
localicedIndi->setRoleAssertionCreationID(calcAlgContext->getUsedProcessingDataBox()->getNextRoleAssertionCreationID()); |
| 22533 |
localicedIndi->setNominalIndividualTriplesAssertions(true); |
| 22534 |
|
| 22535 |
|
| 22536 |
CConcept* univConnNomValueConcept = calcAlgContext->getProcessingDataBox()->getOntology()->getTBox()->getUniversalConnectionNominalValueConcept(); |
| 22537 |
if (univConnNomValueConcept) { |
| 22538 |
addConceptToIndividual(univConnNomValueConcept,false,localicedIndi,depTrackPoint,true,true,calcAlgContext); |
| 22539 |
} |
| 22540 |
CConcept* nominalConcept = individual->getIndividualNominalConcept(); |
| 22541 |
if (nominalConcept) { |
| 22542 |
addConceptToIndividual(nominalConcept,false,localicedIndi,depTrackPoint,true,true,calcAlgContext); |
| 22543 |
} |
| 22544 |
|
| 22545 |
if (mOptConsistenceNodeMarking) { |
| 22546 |
localicedIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCONSNODEPREPARATIONINDINODE); |
| 22547 |
} |
| 22548 |
|
| 22549 |
if (!mOptIncrementalCompatibleExpansion) { |
| 22550 |
|
| 22551 |
bool expansionBlocked = false; |
| 22552 |
if (loadIndividualNodeDataFromBackendCache(localicedIndi,calcAlgContext)) { |
| 22553 |
localicedIndi->setNominalIndividualRepresentativeBackendDataLoaded(true); |
| 22554 |
initializeIndividualNodeWithBackendCache(localicedIndi, calcAlgContext); |
| 22555 |
expansionBlocked = tryEstablishExpansionBlockingWithBackendCacheSynchronisation(localicedIndi,calcAlgContext); |
| 22556 |
} |
| 22557 |
|
| 22558 |
if (!expansionBlocked) { |
| 22559 |
addIndividualToProcessingQueue(localicedIndi,calcAlgContext); |
| 22560 |
} |
| 22561 |
} else { |
| 22562 |
localicedIndi->setAssertionConceptLinker(individual->getAssertionConceptLinker()); |
| 22563 |
localicedIndi->setIncrementalExpansionID(calcAlgContext->getProcessingDataBox()->getIncrementalExpansionID()); |
| 22564 |
localicedIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFINCREMENTALEXPANDING); |
| 22565 |
|
| 22566 |
CIndividualNodeIncrementalExpansionData* expData = localicedIndi->getIncrementalExpansionData(true); |
| 22567 |
expData->setExpansionID(calcAlgContext->getProcessingDataBox()->getNextIncrementalIndividualExpansionID(true)); |
| 22568 |
|
| 22569 |
} |
| 22570 |
|
| 22571 |
upToDateIndi = localicedIndi; |
| 22572 |
|
| 22573 |
} |
| 22574 |
} |
| 22575 |
} |
| 22576 |
} |
| 22577 |
return upToDateIndi; |
| 22578 |
} |
| 22579 |
|
| 22580 |
|
| 22581 |
|
| 22582 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::tryEstablishExpansionBlockingWithBackendCacheSynchronisation(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22583 |
|
| 22584 |
bool expansionBlocked = false; |
| 22585 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 22586 |
if (backendSyncData) { |
| 22587 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 22588 |
if (assocData) { |
| 22589 |
bool backendExpBlocking = assocData->isCompletelyHandled() && !assocData->hasRepresentativeSameIndividualMerging(); |
| 22590 |
if (backendExpBlocking && assocData->getDeterministicMergedSameConsideredLabelCacheEntry() != assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL)) { |
| 22591 |
backendExpBlocking = false; |
| 22592 |
} |
| 22593 |
if (backendExpBlocking && testIndividualNodeBackendCacheConceptsSynchronization(indiNode, calcAlgContext)) { |
| 22594 |
if (!indiNode->hasProcessingRestrictionFlags(CIndividualProcessNode::PRFINVALIDBLOCKINGORCACHING) && mConfAllowBackendSuccessorExpansionBlocking) { |
| 22595 |
indiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKEND | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED | CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDINDIRECTNOMINALEXPANSIONBLOCKED); |
| 22596 |
} |
| 22597 |
expansionBlocked = true; |
| 22598 |
} |
| 22599 |
if (mConfAllowBackendNeighbourExpansionBlocking) { |
| 22600 |
indiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDNEIGHBOUREXPANSIONBLOCKED | CIndividualProcessNode::PRFRETESTBACKENDSYNCHRONIZATIONDUEDIRECTMODIFIED); |
| 22601 |
} |
| 22602 |
} |
| 22603 |
} |
| 22604 |
|
| 22605 |
return expansionBlocked; |
| 22606 |
} |
| 22607 |
|
| 22608 |
|
| 22609 |
|
| 22610 |
|
| 22611 |
|
| 22612 |
|
| 22613 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::loadIndividualNodeDataFromBackendCache(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22614 |
CIndividual* individual = indiNode->getNominalIndividual(); |
| 22615 |
if (mConfIndividualsBackendCacheLoading && mBackendCacheHandler && individual) { |
| 22616 |
|
| 22617 |
|
| 22618 |
if (!indiNode->getIndividualBackendCacheSynchronisationData(false)) { |
| 22619 |
|
| 22620 |
|
| 22621 |
bool scheduled = false; |
| 22622 |
CSatisfiableTaskRepresentativeBackendUpdatingAdapter* repBackUpdAdapter = calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableRepresentativeBackendCacheUpdatingAdapter(); |
| 22623 |
if (repBackUpdAdapter) { |
| 22624 |
CIndividualPrecomputationCoordinationHash* indiCompCoordHash = repBackUpdAdapter->getIndividualComputationCoordinationHash(); |
| 22625 |
if (indiCompCoordHash) { |
| 22626 |
CBackendIndividualRetrievalComputationUpdateCoordinationHashData* coordData = indiCompCoordHash->value(individual->getIndividualID()); |
| 22627 |
if (coordData && !coordData->isComputationIntegrated()) { |
| 22628 |
coordData->setComputationIntegrated(true); |
| 22629 |
scheduled = true; |
| 22630 |
} |
| 22631 |
} |
| 22632 |
} |
| 22633 |
|
| 22634 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* indiAssData = mBackendCacheHandler->getIndividualAssociationData(individual, calcAlgContext); |
| 22635 |
if (indiAssData) { |
| 22636 |
|
| 22637 |
|
| 22638 |
|
| 22639 |
CXLinker<CIndividualProcessNode*>* lastBackendCacheIntegratedIndividualNodeLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 22640 |
lastBackendCacheIntegratedIndividualNodeLinker->initLinker(indiNode); |
| 22641 |
calcAlgContext->getProcessingDataBox()->addLastBackendCacheIntegratedIndividualNodeLinker(lastBackendCacheIntegratedIndividualNodeLinker); |
| 22642 |
|
| 22643 |
if (indiAssData->hasRepresentativeSameIndividualMerging()) { |
| 22644 |
calcAlgContext->getProcessingDataBox()->incBackendCacheIntegratedSameIndividualNodeCount(); |
| 22645 |
} |
| 22646 |
|
| 22647 |
//if (CIRIName::getRecentIRIName(individual->getIndividualNameLinker()) == "http://www.Department0.University0.edu/StudentWhoLikesTennisAndBasketBallAndBaseBallAndShouldHaveManyHobbies") { |
| 22648 |
// bool debug = true; |
| 22649 |
//} |
| 22650 |
//cint64 currentExpansionCount = mProcessingDataBox->getBackendCacheIntegratedIndividualNodeCount(); |
| 22651 |
//if (currentExpansionCount > 1000) { |
| 22652 |
// bool debug = true; |
| 22653 |
//} |
| 22654 |
//cint64 currExpSameCount = mProcessingDataBox->getBackendCacheIntegratedSameIndividualNodeCount(); |
| 22655 |
//if (currentExpansionCount > debugExpansionCount) { |
| 22656 |
// bool debug = true; |
| 22657 |
//} |
| 22658 |
//if (currentExpansionCount - currExpSameCount > debugExpansionCount) { |
| 22659 |
// bool debug = true; |
| 22660 |
//} |
| 22661 |
//bool writeCache = false; |
| 22662 |
//if (writeCache) { |
| 22663 |
// mBackendCacheHandler->getCache()->writeStringifiedRepresentativeCacheToFile(); |
| 22664 |
//} |
| 22665 |
//bool writeCompletionGraph = false; |
| 22666 |
//if (writeCompletionGraph) { |
| 22667 |
// QString fileName = QString("Debugging/CompletionTasks/expansion.txt"); |
| 22668 |
// mEndTaskDebugIndiModelString = writeGeneratedExtendedDebugIndiModelStringList(fileName, calcAlgContext); |
| 22669 |
//} |
| 22670 |
|
| 22671 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = CObjectParameterizingAllocator< CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData, CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 22672 |
backendSyncData->initSynchronisationData(indiAssData); |
| 22673 |
backendSyncData->setBackendCacheSynchron(true); |
| 22674 |
indiNode->setIndividualBackendCacheSynchronisationData(backendSyncData); |
| 22675 |
backendSyncData->setScheduledIndividual(scheduled); |
| 22676 |
|
| 22677 |
return true; |
| 22678 |
} else { |
| 22679 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = CObjectParameterizingAllocator< CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData, CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 22680 |
backendSyncData->initSynchronisationData((CBackendRepresentativeMemoryCacheIndividualAssociationData*)nullptr); |
| 22681 |
backendSyncData->setBackendCacheSynchron(false); |
| 22682 |
indiNode->setIndividualBackendCacheSynchronisationData(backendSyncData); |
| 22683 |
backendSyncData->setScheduledIndividual(scheduled); |
| 22684 |
return true; |
| 22685 |
} |
| 22686 |
} else { |
| 22687 |
return true; |
| 22688 |
} |
| 22689 |
} |
| 22690 |
return false; |
| 22691 |
} |
| 22692 |
|
| 22693 |
|
| 22694 |
|
| 22695 |
|
| 22696 |
|
| 22697 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::initializeIndividualNodeWithBackendCache(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22698 |
CIndividual* individual = indiNode->getNominalIndividual(); |
| 22699 |
|
| 22700 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 22701 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 22702 |
if (backendSyncData) { |
| 22703 |
if (!locBackendSyncData) { |
| 22704 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 22705 |
} |
| 22706 |
|
| 22707 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* indiAssData = locBackendSyncData->getAssocitaionData(); |
| 22708 |
if (indiAssData) { |
| 22709 |
|
| 22710 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 22711 |
|
| 22712 |
CBackendRepresentativeMemoryLabelCacheItem* conceptSetLabelItem = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 22713 |
|
| 22714 |
mBackendCacheHandler->visitConceptsOfAssociatedFullConceptSetLabel(indiAssData, conceptSetLabelItem, [&](CConcept* concept, bool conNegation, bool deterministic)->bool { |
| 22715 |
addConceptToIndividualSkipANDProcessing(concept, conNegation, indiNode, depTrackPoint, true, false, false, calcAlgContext); |
| 22716 |
validateBackendSynchronisationContinued(indiNode, backendSyncData, concept, conNegation, calcAlgContext); |
| 22717 |
return true; |
| 22718 |
}, true, false, calcAlgContext); |
| 22719 |
|
| 22720 |
for (CConceptAssertionLinker* conAssLinkerIt = individual->getAssertionConceptLinker(); conAssLinkerIt; conAssLinkerIt = conAssLinkerIt->getNext()) { |
| 22721 |
CConcept* concept = conAssLinkerIt->getData(); |
| 22722 |
bool negation = conAssLinkerIt->isNegated(); |
| 22723 |
if (concept->getOperatorCode() == CCNOMINAL && (concept->getNominalIndividual() == individual || negation)) { |
| 22724 |
addConceptToIndividualSkipANDProcessing(concept, negation, indiNode, depTrackPoint, true, false, false, calcAlgContext); |
| 22725 |
} |
| 22726 |
} |
| 22727 |
|
| 22728 |
CIndividual* nominalIndi = indiNode->getNominalIndividual(); |
| 22729 |
if (nominalIndi) { |
| 22730 |
CConcept* nominalConcept = nominalIndi->getIndividualNominalConcept(); |
| 22731 |
if (nominalConcept) { |
| 22732 |
addConceptToIndividualSkipANDProcessing(nominalConcept, false, indiNode, depTrackPoint, true, true, false, calcAlgContext); |
| 22733 |
} |
| 22734 |
} |
| 22735 |
|
| 22736 |
locBackendSyncData->setBackendConceptSetInitialized(true); |
| 22737 |
|
| 22738 |
if (indiAssData->isCompletelyHandled()) { |
| 22739 |
bool hasReuseableElements = false; |
| 22740 |
if (!hasReuseableElements) { |
| 22741 |
CBackendRepresentativeMemoryLabelCacheItem* conLabel = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 22742 |
if (conLabel->hasNondeterministicElements()) { |
| 22743 |
hasReuseableElements = true; |
| 22744 |
} |
| 22745 |
} |
| 22746 |
if (!hasReuseableElements) { |
| 22747 |
CBackendRepresentativeMemoryLabelCacheItem* roleNighLabel = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL); |
| 22748 |
if (roleNighLabel) { |
| 22749 |
hasReuseableElements = true; |
| 22750 |
} |
| 22751 |
} |
| 22752 |
if (!hasReuseableElements) { |
| 22753 |
CBackendRepresentativeMemoryLabelCacheItem* sameIndiLabel = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 22754 |
if (sameIndiLabel) { |
| 22755 |
hasReuseableElements = true; |
| 22756 |
} |
| 22757 |
} |
| 22758 |
if (!hasReuseableElements) { |
| 22759 |
CBackendRepresentativeMemoryLabelCacheItem* diffIndiLabel = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_DIFFRENT_INDIVIDUAL_SET_LABEL); |
| 22760 |
if (diffIndiLabel) { |
| 22761 |
hasReuseableElements = true; |
| 22762 |
} |
| 22763 |
} |
| 22764 |
|
| 22765 |
bool reuse = mOptBackendExpansionReuse; |
| 22766 |
if (hasReuseableElements && !reuse && mConfBackendExpansionLateDynamicReuseActivation && mConfBackendExpansionNeighbourIndividualCountReuseActivation > 0) { |
| 22767 |
CBackendRepresentativeMemoryLabelCacheItem* detSameIndiLabel = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 22768 |
CBackendRepresentativeMemoryLabelCacheItem* nonDetSameIndiLabel = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 22769 |
cint64 sameCount = 0; |
| 22770 |
if (detSameIndiLabel) { |
| 22771 |
sameCount += detSameIndiLabel->getCacheValueCount(); |
| 22772 |
} |
| 22773 |
if (nonDetSameIndiLabel) { |
| 22774 |
sameCount += nonDetSameIndiLabel->getCacheValueCount(); |
| 22775 |
} |
| 22776 |
if (sameCount > mConfBackendExpansionNeighbourIndividualCountReuseActivation) { |
| 22777 |
reuse = true; |
| 22778 |
} |
| 22779 |
} |
| 22780 |
if (hasReuseableElements && !reuse && mConfBackendExpansionLateDynamicReuseActivation && mConfBackendExpansionSameIndividualCountReuseActivation > 0) { |
| 22781 |
CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* neighbourRoleSetArray = indiAssData->getRoleSetNeighbourArray(); |
| 22782 |
cint64 neighbourCount = 0; |
| 22783 |
if (neighbourRoleSetArray) { |
| 22784 |
CBackendRepresentativeMemoryLabelCacheItemIndividualRoleSetNeighbourArrayIndexExtensionData* neighbourRoleSetArrayIndexData = neighbourRoleSetArray->getIndexData(); |
| 22785 |
for (cint64 i = 0; i < neighbourRoleSetArrayIndexData->getArraySize(); ++i) { |
| 22786 |
neighbourCount += neighbourRoleSetArray->at(i).getIndividualCount(); |
| 22787 |
} |
| 22788 |
} |
| 22789 |
if (neighbourCount > mConfBackendExpansionSameIndividualCountReuseActivation) { |
| 22790 |
reuse = true; |
| 22791 |
} |
| 22792 |
} |
| 22793 |
if (reuse && hasReuseableElements) { |
| 22794 |
if (!mOptBackendExpansionReuse) { |
| 22795 |
calcAlgContext->getProcessingDataBox()->setBackendIndividualLateReuseExpansionActivated(true); |
| 22796 |
} |
| 22797 |
addIndividualToBackendReuseExpansionQueue(indiNode, calcAlgContext); |
| 22798 |
} |
| 22799 |
} |
| 22800 |
|
| 22801 |
addIndividualToBackendIndirectCompatibilityExpansionQueue(indiNode, calcAlgContext); |
| 22802 |
|
| 22803 |
registerProcessedIndividualForBackendConceptSetLabel(indiNode, locBackendSyncData, indiAssData, calcAlgContext); |
| 22804 |
|
| 22805 |
return true; |
| 22806 |
} |
| 22807 |
} |
| 22808 |
return false; |
| 22809 |
} |
| 22810 |
|
| 22811 |
|
| 22812 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher CCalculationTableauCompletionTaskHandleAlgorithm::getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(CBackendRepresentativeMemoryCacheIndividualAssociationData* indiAssData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22813 |
CBackendRepresentativeMemoryLabelCacheItem* conceptSetLabelItem = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 22814 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetCombinationLabelItem = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NEIGHBOUR_INSTANTIATED_ROLE_SET_COMBINATION_LABEL); |
| 22815 |
// TODO: also consider outgoing data property set labels to hasher |
| 22816 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher hasher(conceptSetLabelItem, neighbourRoleSetCombinationLabelItem); |
| 22817 |
return hasher; |
| 22818 |
} |
| 22819 |
|
| 22820 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher CCalculationTableauCompletionTaskHandleAlgorithm::getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22821 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 22822 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* indiAssData = backendSyncData->getAssocitaionData(); |
| 22823 |
return getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(indiAssData, calcAlgContext); |
| 22824 |
} |
| 22825 |
|
| 22826 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::markIndividualNodeBackendNonConceptSetRelatedProcessing(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22827 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 22828 |
if (backendSyncData && !backendSyncData->hasNonConceptSetBackendLabelRelatedProcessing() && backendSyncData->getAssocitaionData()) { |
| 22829 |
|
| 22830 |
CIndividualProcessNode* locIndiNode = getLocalizedIndividual(indiNode, false, calcAlgContext); |
| 22831 |
|
| 22832 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(locIndiNode, calcAlgContext); |
| 22833 |
locBackendSyncData->setNonConceptSetBackendLabelRelatedProcessing(true); |
| 22834 |
|
| 22835 |
if (mOptDelayedBackendInitializiation) { |
| 22836 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHash* useBackendConceptSetLabelProcessingHash = calcAlgContext->getProcessingDataBox()->getBackendCacheConceptSetLabelProcessingHash(true); |
| 22837 |
|
| 22838 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher hasher = getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(indiNode, calcAlgContext); |
| 22839 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingData& processingData = (*useBackendConceptSetLabelProcessingHash)[hasher]; |
| 22840 |
processingData.decOnlyConceptSetProcessedCount(1); |
| 22841 |
|
| 22842 |
if (processingData.getOnlyConceptSetProcessedCount() <= 0) { |
| 22843 |
CIndividualDelayedBackendInitializationProcessingQueue* delayedBackendInitProcessingQueue = calcAlgContext->getProcessingDataBox()->getDelayedBackendConceptSetLabelProcessingInitializationQueue(true); |
| 22844 |
|
| 22845 |
CXLinker<CIndividualProcessNode*>* branchQueryingNodeLinker = processingData.getBranchQueuingNodeLinker(); |
| 22846 |
CIndividualRepresentativeBackendCacheConceptSetLabelNodeQueuingLinker* rootQueringNodeLinker = processingData.getRootQueuingNodeLinker(); |
| 22847 |
while ((rootQueringNodeLinker || branchQueryingNodeLinker) && processingData.getQueuedNodeInitializingCount() <= 0) { |
| 22848 |
if (rootQueringNodeLinker) { |
| 22849 |
if (!rootQueringNodeLinker->isQueued()) { |
| 22850 |
CIndividualProcessNode* queuingIndiNode = rootQueringNodeLinker->getIndividualProcessNode(); |
| 22851 |
queuingIndiNode = getUpToDateIndividual(queuingIndiNode, calcAlgContext); |
| 22852 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* queuingIndiNodeBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)queuingIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 22853 |
if (queuingIndiNodeBackendSyncData && queuingIndiNodeBackendSyncData->isBackendConceptSetInitialized()) { |
| 22854 |
rootQueringNodeLinker = rootQueringNodeLinker->getNext(); |
| 22855 |
processingData.setRootQueuingNodeLinker(rootQueringNodeLinker); |
| 22856 |
} else { |
| 22857 |
if (!queuingIndiNodeBackendSyncData->isBackendConceptSetInitializationQueued() && !queuingIndiNodeBackendSyncData->isBackendConceptSetInitialized()) { |
| 22858 |
if (delayedBackendInitProcessingQueue->addIndividualNodeQueuingLinker(rootQueringNodeLinker)) { |
| 22859 |
queuingIndiNode = getLocalizedIndividual(queuingIndiNode, true, calcAlgContext); |
| 22860 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(queuingIndiNode, calcAlgContext); |
| 22861 |
locBackendSyncData->setBackendConceptSetInitializationQueued(true); |
| 22862 |
rootQueringNodeLinker->setQueued(true); |
| 22863 |
processingData.incQueuedNodeInitializingCount(1); |
| 22864 |
rootQueringNodeLinker = rootQueringNodeLinker->getNext(); |
| 22865 |
processingData.setRootQueuingNodeLinker(rootQueringNodeLinker); |
| 22866 |
} |
| 22867 |
} |
| 22868 |
} |
| 22869 |
} else { |
| 22870 |
CIndividualProcessNode* queuingIndiNode = rootQueringNodeLinker->getIndividualProcessNode(); |
| 22871 |
queuingIndiNode = getUpToDateIndividual(queuingIndiNode, calcAlgContext); |
| 22872 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* queuingIndiNodeBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)queuingIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 22873 |
if (queuingIndiNodeBackendSyncData && !queuingIndiNodeBackendSyncData->isBackendConceptSetInitialized() && !queuingIndiNodeBackendSyncData->isBackendConceptSetInitializationQueued()) { |
| 22874 |
processingData.incQueuedNodeInitializingCount(1); |
| 22875 |
queuingIndiNode = getLocalizedIndividual(queuingIndiNode, true, calcAlgContext); |
| 22876 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(queuingIndiNode, calcAlgContext); |
| 22877 |
locBackendSyncData->setBackendConceptSetInitializationQueued(true); |
| 22878 |
} |
| 22879 |
rootQueringNodeLinker = rootQueringNodeLinker->getNext(); |
| 22880 |
processingData.setRootQueuingNodeLinker(rootQueringNodeLinker); |
| 22881 |
|
| 22882 |
} |
| 22883 |
} else { |
| 22884 |
CIndividualProcessNode* queuingIndiNode = branchQueryingNodeLinker->getData(); |
| 22885 |
queuingIndiNode = getUpToDateIndividual(queuingIndiNode, calcAlgContext); |
| 22886 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* queuingIndiNodeBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)queuingIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 22887 |
if (!queuingIndiNodeBackendSyncData->isBackendConceptSetInitializationQueued() && !queuingIndiNodeBackendSyncData->isBackendConceptSetInitialized()) { |
| 22888 |
//processingData.mLastInitScheduledIndiNodeId = queuingIndiNode->getIndividualNodeID(); |
| 22889 |
queuingIndiNode = getLocalizedIndividual(queuingIndiNode, true, calcAlgContext); |
| 22890 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(queuingIndiNode, calcAlgContext); |
| 22891 |
locBackendSyncData->setBackendConceptSetInitializationQueued(true); |
| 22892 |
processingData.incQueuedNodeInitializingCount(1); |
| 22893 |
delayedBackendInitProcessingQueue->insertIndiviudalProcessNode(queuingIndiNode); |
| 22894 |
} |
| 22895 |
branchQueryingNodeLinker = branchQueryingNodeLinker->getNext(); |
| 22896 |
processingData.setBranchQueuingNodeLinker(branchQueryingNodeLinker); |
| 22897 |
} |
| 22898 |
} |
| 22899 |
} |
| 22900 |
} |
| 22901 |
return true; |
| 22902 |
} |
| 22903 |
return false; |
| 22904 |
} |
| 22905 |
|
| 22906 |
|
| 22907 |
|
| 22908 |
|
| 22909 |
|
| 22910 |
|
| 22911 |
|
| 22912 |
|
| 22913 |
|
| 22914 |
|
| 22915 |
|
| 22916 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::tryDelayIndividualNodeInitializationWithBackendConceptSetLabel(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22917 |
CIndividual* individual = indiNode->getNominalIndividual(); |
| 22918 |
|
| 22919 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 22920 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* indiAssData = backendSyncData->getAssocitaionData(); |
| 22921 |
if (indiAssData->hasIndirectlyConnectedIndividualIntegration()) { |
| 22922 |
return false; |
| 22923 |
} |
| 22924 |
|
| 22925 |
CBackendRepresentativeMemoryLabelCacheItem* conSetLabelItem = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 22926 |
CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData* cardExtData = (CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData*)conSetLabelItem->getExtensionData(CBackendRepresentativeMemoryLabelCacheItemExtensionData::CARDINALITY_HASH); |
| 22927 |
if (cardExtData) { |
| 22928 |
return false; |
| 22929 |
} |
| 22930 |
|
| 22931 |
if (!backendSyncData->isBackendConceptSetInitializationDelayingRegistered()) { |
| 22932 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 22933 |
locBackendSyncData->setBackendConceptSetInitializationDelayingRegistered(true); |
| 22934 |
|
| 22935 |
|
| 22936 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHash* useBackendConceptSetLabelProcessingHash = calcAlgContext->getProcessingDataBox()->getBackendCacheConceptSetLabelProcessingHash(true); |
| 22937 |
|
| 22938 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher hasher = getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(indiNode, calcAlgContext); |
| 22939 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingData& processingData = (*useBackendConceptSetLabelProcessingHash)[hasher]; |
| 22940 |
|
| 22941 |
if (processingData.getOnlyConceptSetProcessedCount() <= 0 && processingData.getQueuedNodeInitializingCount() <= 0) { |
| 22942 |
return false; |
| 22943 |
} else { |
| 22944 |
// queuing, make sure queue is initialized so the same atomic pointer is used |
| 22945 |
CIndividualDelayedBackendInitializationProcessingQueue* delayedBackendInitProcessingQueue = calcAlgContext->getProcessingDataBox()->getDelayedBackendConceptSetLabelProcessingInitializationQueue(true); |
| 22946 |
if (mOptDelayedBackendInitializiationWithRootLinkers && delayedBackendInitProcessingQueue->isRoot()) { |
| 22947 |
CIndividualRepresentativeBackendCacheConceptSetLabelNodeQueuingLinker* queuingNodeLinker = CObjectAllocator< CIndividualRepresentativeBackendCacheConceptSetLabelNodeQueuingLinker >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 22948 |
queuingNodeLinker->setIndividualProcessNode(indiNode); |
| 22949 |
processingData.appendRootQueuingNodeLinker(queuingNodeLinker); |
| 22950 |
} else { |
| 22951 |
CXLinker<CIndividualProcessNode*>* indiNodeLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 22952 |
indiNodeLinker->initLinker(indiNode); |
| 22953 |
processingData.appendBranchQueuingNodeLinker(indiNodeLinker); |
| 22954 |
} |
| 22955 |
|
| 22956 |
return true; |
| 22957 |
} |
| 22958 |
} |
| 22959 |
return false; |
| 22960 |
|
| 22961 |
} |
| 22962 |
|
| 22963 |
|
| 22964 |
|
| 22965 |
|
| 22966 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::registerProcessedIndividualForBackendConceptSetLabel(CIndividualProcessNode* individual, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData, CBackendRepresentativeMemoryCacheIndividualAssociationData* indiAssData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22967 |
if (mOptDelayedBackendInitializiation) { |
| 22968 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHash* useBackendConceptSetLabelProcessingHash = calcAlgContext->getProcessingDataBox()->getBackendCacheConceptSetLabelProcessingHash(true); |
| 22969 |
|
| 22970 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher hasher = getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(individual, calcAlgContext); |
| 22971 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingData& processingData = (*useBackendConceptSetLabelProcessingHash)[hasher]; |
| 22972 |
CXLinker<CIndividualProcessNode*>* individualNodeLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 22973 |
individualNodeLinker->initLinker(individual); |
| 22974 |
locBackendSyncData->setConceptSetLabelProcessedNodeLinker(individualNodeLinker); |
| 22975 |
processingData.appendInitializedNodeLinker(individualNodeLinker); |
| 22976 |
processingData.incOnlyConceptSetProcessedCount(); |
| 22977 |
} |
| 22978 |
return true; |
| 22979 |
} |
| 22980 |
|
| 22981 |
|
| 22982 |
|
| 22983 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::visitIndividualsRelevantBackendSynchronisationDataIndividuals(CIndividualProcessNode* indiNode, bool localize, function<bool(CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)> visitFunc, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 22984 |
bool visited = false; |
| 22985 |
bool continueVisiting = true; |
| 22986 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 22987 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 22988 |
if (backendSyncData) { |
| 22989 |
continueVisiting = visitFunc(indiNode, indiNode, depTrackPoint); |
| 22990 |
visited = true; |
| 22991 |
} |
| 22992 |
cint64 baseIndiId = indiNode->getNominalIndividual()->getIndividualID(); |
| 22993 |
CIndividualMergingHash* mergingHash = indiNode->getIndividualMergingHash(false); |
| 22994 |
if (mergingHash) { |
| 22995 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 22996 |
CBackendRepresentativeMemoryLabelCacheItem* detSameIndiSetLabel = nullptr; |
| 22997 |
if (assocData) { |
| 22998 |
//detSameIndiSetLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 22999 |
detSameIndiSetLabel = assocData->getDeterministicMergedSameConsideredLabelCacheEntry(); |
| 23000 |
} |
| 23001 |
for (CIndividualMergingHash::const_iterator it = mergingHash->constBegin(), itEnd = mergingHash->constEnd(); it != itEnd && continueVisiting; ++it) { |
| 23002 |
cint64 mergedIndiId = it.key(); |
| 23003 |
if (baseIndiId != mergedIndiId && it.value().isMergedWithIndividual() && !mBackendCacheHandler->hasIndividualIdsInAssociatedIndividualSetLabel(assocData, detSameIndiSetLabel, mergedIndiId)) { |
| 23004 |
CIndividualMergingHashData mergingData = it.value(); |
| 23005 |
CDependencyTrackPoint* backSyncDepTrackPoint = mergingData.getDependencyTrackPoint(); |
| 23006 |
|
| 23007 |
CIndividualProcessNode* backendSyncDataIndiNode = getUpToDateIndividual(-mergedIndiId, calcAlgContext); |
| 23008 |
if (backendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false)) { |
| 23009 |
CIndividualProcessNode* locBackendSyncDataIndiNode = backendSyncDataIndiNode; |
| 23010 |
if (localize) { |
| 23011 |
locBackendSyncDataIndiNode = getLocalizedIndividual(backendSyncDataIndiNode, false, calcAlgContext); |
| 23012 |
} |
| 23013 |
continueVisiting = visitFunc(indiNode, locBackendSyncDataIndiNode, backSyncDepTrackPoint); |
| 23014 |
visited = true; |
| 23015 |
} |
| 23016 |
} |
| 23017 |
} |
| 23018 |
} |
| 23019 |
return visited; |
| 23020 |
} |
| 23021 |
|
| 23022 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::hasNondeterministicDependency(CDependencyTrackPoint* dependencyTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23023 |
bool nondeterministically = true; |
| 23024 |
if (dependencyTrackPoint && dependencyTrackPoint->getBranchingTag() <= calcAlgContext->getProcessingDataBox()->getMaximumDeterministicBranchTag()) { |
| 23025 |
nondeterministically = false; |
| 23026 |
} |
| 23027 |
return nondeterministically; |
| 23028 |
} |
| 23029 |
|
| 23030 |
|
| 23031 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::visitIndividualsRelevantMergingsBackendSynchronisationDataIndividuals(CIndividualProcessNode* indiNode, CXLinker<cint64>* mergedIndiLinker, CXLinker<cint64>* lastProcessedMergedIndiLinker, bool localize, function<bool(CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)> visitFunc, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23032 |
bool visited = false; |
| 23033 |
bool continueVisiting = true; |
| 23034 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 23035 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23036 |
cint64 baseIndiId = indiNode->getNominalIndividual()->getIndividualID(); |
| 23037 |
CIndividualMergingHash* mergingHash = indiNode->getIndividualMergingHash(false); |
| 23038 |
if (mergingHash && mergedIndiLinker != lastProcessedMergedIndiLinker) { |
| 23039 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 23040 |
CBackendRepresentativeMemoryLabelCacheItem* detSameIndiSetLabel = nullptr; |
| 23041 |
CBackendRepresentativeMemoryLabelCacheItem* nondetSameIndiSetLabel = nullptr; |
| 23042 |
if (assocData) { |
| 23043 |
//detSameIndiSetLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 23044 |
detSameIndiSetLabel = assocData->getDeterministicMergedSameConsideredLabelCacheEntry(); |
| 23045 |
if (assocData->isCompletelyHandled()) { |
| 23046 |
nondetSameIndiSetLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 23047 |
} |
| 23048 |
} |
| 23049 |
for (CXLinker<cint64>* mergedIndiLinkerIt = mergedIndiLinker; mergedIndiLinkerIt && mergedIndiLinkerIt != lastProcessedMergedIndiLinker; mergedIndiLinkerIt = mergedIndiLinkerIt->getNext()) { |
| 23050 |
cint64 mergedIndiId = mergedIndiLinkerIt->getData(); |
| 23051 |
const CIndividualMergingHashData& mergingData = mergingHash->value(mergedIndiId); |
| 23052 |
if (baseIndiId != mergedIndiId && mergingData.isMergedWithIndividual()) { |
| 23053 |
bool nondeterministically = hasNondeterministicDependency(mergingData.getDependencyTrackPoint(), calcAlgContext); |
| 23054 |
if (nondeterministically && !backendSyncData->hasNonDeterministicallyMergedIndividuals()) { |
| 23055 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23056 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23057 |
locBackendSyncData->setNonDeterministicallyMergedIndividuals(true); |
| 23058 |
backendSyncData = locBackendSyncData; |
| 23059 |
} |
| 23060 |
|
| 23061 |
if (!nondeterministically && !mBackendCacheHandler->hasIndividualIdsInAssociatedIndividualSetLabel(assocData, detSameIndiSetLabel, mergedIndiId) || nondeterministically && !mBackendCacheHandler->hasIndividualIdsInAssociatedIndividualSetLabel(assocData, nondetSameIndiSetLabel, mergedIndiId)) { |
| 23062 |
CDependencyTrackPoint* backSyncDepTrackPoint = mergingData.getDependencyTrackPoint(); |
| 23063 |
|
| 23064 |
CIndividualProcessNode* backendSyncDataIndiNode = getUpToDateIndividual(-mergedIndiId, calcAlgContext); |
| 23065 |
if (backendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false)) { |
| 23066 |
CIndividualProcessNode* locBackendSyncDataIndiNode = backendSyncDataIndiNode; |
| 23067 |
if (localize) { |
| 23068 |
locBackendSyncDataIndiNode = getLocalizedIndividual(backendSyncDataIndiNode, false, calcAlgContext); |
| 23069 |
} |
| 23070 |
continueVisiting = visitFunc(indiNode, locBackendSyncDataIndiNode, backSyncDepTrackPoint); |
| 23071 |
visited = true; |
| 23072 |
} |
| 23073 |
} |
| 23074 |
} |
| 23075 |
} |
| 23076 |
} |
| 23077 |
return visited; |
| 23078 |
} |
| 23079 |
|
| 23080 |
|
| 23081 |
|
| 23082 |
|
| 23083 |
|
| 23084 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::visitNewlyMergedIndividualsBackendSynchronisationData(CIndividualProcessNode* indiNode, CPROCESSHASH<CIndividualProcessNode*, CDependencyTrackPoint*>* newIndiMergedHash, bool visitBaseIndividual, function<bool(CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)> visitFunc, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23085 |
bool visited = false; |
| 23086 |
bool continueVisiting = true; |
| 23087 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 23088 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23089 |
if (backendSyncData && visitBaseIndividual) { |
| 23090 |
continueVisiting = visitFunc(indiNode, indiNode, depTrackPoint); |
| 23091 |
visited = true; |
| 23092 |
} |
| 23093 |
if (newIndiMergedHash) { |
| 23094 |
for (CPROCESSHASH<CIndividualProcessNode*, CDependencyTrackPoint*>::const_iterator it = newIndiMergedHash->constBegin(), itEnd = newIndiMergedHash->constEnd(); it != itEnd && continueVisiting; ++it) { |
| 23095 |
CIndividualProcessNode* backendSyncDataIndiNode = it.key(); |
| 23096 |
CDependencyTrackPoint* backSyncDepTrackPoint = it.value(); |
| 23097 |
|
| 23098 |
if (backendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false)) { |
| 23099 |
continueVisiting = visitFunc(indiNode, backendSyncDataIndiNode, backSyncDepTrackPoint); |
| 23100 |
visited = true; |
| 23101 |
} |
| 23102 |
} |
| 23103 |
} |
| 23104 |
return visited; |
| 23105 |
} |
| 23106 |
|
| 23107 |
|
| 23108 |
|
| 23109 |
|
| 23110 |
|
| 23111 |
|
| 23112 |
|
| 23113 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::visitNewlyMergedIndividualsBackendSynchronisationData(CIndividualProcessNode* indiNode, CXLinker<CIndividualProcessNode*>* newIndiMergedLinker, CXLinker<CIndividualProcessNode*>* prevIndiMergedLinker, bool visitBaseIndividual, function<bool(CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)> visitFunc, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23114 |
bool visited = false; |
| 23115 |
bool continueVisiting = true; |
| 23116 |
CDependencyTrackPoint* depTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 23117 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23118 |
if (backendSyncData && visitBaseIndividual) { |
| 23119 |
continueVisiting = visitFunc(indiNode, indiNode, depTrackPoint); |
| 23120 |
visited = true; |
| 23121 |
} |
| 23122 |
if (newIndiMergedLinker != prevIndiMergedLinker) { |
| 23123 |
CIndividualMergingHash* mergingHash = indiNode->getIndividualMergingHash(false); |
| 23124 |
for (CXLinker<CIndividualProcessNode*>* newIndiMergedLinkerIt = newIndiMergedLinker; newIndiMergedLinkerIt && newIndiMergedLinkerIt != prevIndiMergedLinker && continueVisiting; newIndiMergedLinkerIt = newIndiMergedLinkerIt->getNext()) { |
| 23125 |
CIndividualProcessNode* backendSyncDataIndiNode = newIndiMergedLinkerIt->getData(); |
| 23126 |
backendSyncDataIndiNode = getUpToDateIndividual(backendSyncDataIndiNode, calcAlgContext); |
| 23127 |
CIndividualMergingHashData mergingData = mergingHash->value(backendSyncDataIndiNode->getNominalIndividual()->getIndividualID()); |
| 23128 |
CDependencyTrackPoint* backSyncDepTrackPoint = mergingData.getDependencyTrackPoint(); |
| 23129 |
|
| 23130 |
if (backendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false)) { |
| 23131 |
continueVisiting = visitFunc(indiNode, backendSyncDataIndiNode, backSyncDepTrackPoint); |
| 23132 |
visited = true; |
| 23133 |
} |
| 23134 |
} |
| 23135 |
} |
| 23136 |
return visited; |
| 23137 |
} |
| 23138 |
|
| 23139 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(CIndividualProcessNode* indiNode, CXLinker<CIndividualProcessNode*>* newIndiMergedLinker, CXLinker<CIndividualProcessNode*>* prevIndiMergedLinker, bool visitBaseIndividual, function<bool(CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)> visitFunc, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23140 |
return visitNewlyMergedIndividualsBackendSynchronisationData(indiNode, newIndiMergedLinker, prevIndiMergedLinker, visitBaseIndividual, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 23141 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* mergedBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23142 |
if (mConfOnlyDeterministicRepresentativeBackendIndividualDataConsideration && mergedBackendSyncData) { |
| 23143 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* mergedAssocData = mergedBackendSyncData->getAssocitaionData(); |
| 23144 |
if (mergedAssocData && mergedAssocData->hasDeterministicSameIndividualMerging()) { |
| 23145 |
return true; |
| 23146 |
} |
| 23147 |
} |
| 23148 |
return visitFunc(baseIndiNode, locBackendSyncDataIndiNode, backSyncDepTrackPoint); |
| 23149 |
}, calcAlgContext); |
| 23150 |
} |
| 23151 |
|
| 23152 |
|
| 23153 |
|
| 23154 |
cint64 CCalculationTableauCompletionTaskHandleAlgorithm::getBackendCacheRoleRepresentativeNeighbourCount(CIndividualProcessNode* indiNode, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData, CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23155 |
cint64 linkCount = 0; |
| 23156 |
CPROCESSHASH< CRole*, cint64 >* roleRepresentativeNeighbourCountHash = backendSyncData->getRoleRepresentativeNeighbourCountHash(false); |
| 23157 |
if (roleRepresentativeNeighbourCountHash && roleRepresentativeNeighbourCountHash->contains(role)) { |
| 23158 |
linkCount = roleRepresentativeNeighbourCountHash->value(role); |
| 23159 |
} else { |
| 23160 |
|
| 23161 |
linkCount = mBackendCacheHandler->getNeighbourCountForRole(assocData, role, calcAlgContext); |
| 23162 |
if (!mConfCardinalityNeighbourExpansionRepresentativeCounting || linkCount <= 1) { |
| 23163 |
return linkCount; |
| 23164 |
} else { |
| 23165 |
CPROCESSHASH< CRole*, cint64 >* roleRepresentativeNeighbourCountHash = backendSyncData->getRoleRepresentativeNeighbourCountHash(false); |
| 23166 |
if (!roleRepresentativeNeighbourCountHash || !roleRepresentativeNeighbourCountHash->contains(role)) { |
| 23167 |
cint64 repNeighbourLinkCount = 0; |
| 23168 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23169 |
roleRepresentativeNeighbourCountHash = locBackendSyncData->getRoleRepresentativeNeighbourCountHash(true); |
| 23170 |
mBackendCacheHandler->visitNeighbourIndividualIdsForRole(assocData, role, [&](cint64 neighbourIndiId, CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel, bool deterministic)->bool { |
| 23171 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* detNeighbourAssData = mBackendCacheHandler->getIndividualAssociationData(neighbourIndiId, false, calcAlgContext); |
| 23172 |
if (!detNeighbourAssData || !detNeighbourAssData->hasDeterministicSameIndividualMerging()) { |
| 23173 |
repNeighbourLinkCount++; |
| 23174 |
} |
| 23175 |
return true; |
| 23176 |
}, false, calcAlgContext); |
| 23177 |
roleRepresentativeNeighbourCountHash->insert(role, repNeighbourLinkCount); |
| 23178 |
if (linkCount != repNeighbourLinkCount) { |
| 23179 |
linkCount = repNeighbourLinkCount; |
| 23180 |
} |
| 23181 |
|
| 23182 |
} else { |
| 23183 |
linkCount = roleRepresentativeNeighbourCountHash->value(role); |
| 23184 |
} |
| 23185 |
} |
| 23186 |
} |
| 23187 |
return linkCount; |
| 23188 |
} |
| 23189 |
|
| 23190 |
|
| 23191 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::testIndividualNodeBackendCacheExpansionBlockingCriticalCardinality(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23192 |
|
| 23193 |
bool expansionBlockingCritical = false; |
| 23194 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23195 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23196 |
|
| 23197 |
if (backendSyncData) { |
| 23198 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 23199 |
if (!backendSyncData->isCriticalCardinalityExpansionBlocking() && assocData) { |
| 23200 |
|
| 23201 |
|
| 23202 |
|
| 23203 |
testIndividualNodeBackendCacheNewMergings(indiNode, calcAlgContext); |
| 23204 |
backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23205 |
|
| 23206 |
if (backendSyncData->getMergedIndividualNodeLinker() != backendSyncData->getLastCriticalNeighboursTestedMergedNodeLinker()) { |
| 23207 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastCriticalNeighboursTestedMergedNodeLinker(), false, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 23208 |
expansionBlockingCritical = true; |
| 23209 |
return false; |
| 23210 |
}, calcAlgContext); |
| 23211 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23212 |
locBackendSyncData->setLastCriticalNeighboursTestedMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 23213 |
} |
| 23214 |
|
| 23215 |
|
| 23216 |
|
| 23217 |
CBackendRepresentativeMemoryLabelCacheItem* fullConSetLabelCacheItem = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 23218 |
if (fullConSetLabelCacheItem && !expansionBlockingCritical) { |
| 23219 |
CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData* cardExtensionData = (CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData*)fullConSetLabelCacheItem->getExtensionData(CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData::CARDINALITY_HASH); |
| 23220 |
|
| 23221 |
CReapplyRoleSuccessorHash* roleSuccHash = indiNode->getReapplyRoleSuccessorHash(false); |
| 23222 |
if (roleSuccHash && cardExtensionData) { |
| 23223 |
CIndividualLinkEdge* lastAddedLinkEdge = indiNode->getLastAddedRoleLink(); |
| 23224 |
CIndividualLinkEdge* lastTestedLinkEdge = backendSyncData->getLastCriticalCardinalityLinkEdge(); |
| 23225 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 23226 |
|
| 23227 |
|
| 23228 |
if (lastTestedLinkEdge != lastAddedLinkEdge || !assocData->isCompletelyHandled() && !backendSyncData->hasCriticalCardinalityInitiallyChecked()) { |
| 23229 |
|
| 23230 |
|
| 23231 |
CRoleVector* roleVector = calcAlgContext->getProcessingDataBox()->getOntology()->getRBox()->getRoleVector(); |
| 23232 |
for (CCACHINGHASH<cint64, CBackendRepresentativeMemoryLabelCacheItemCardinalityData*>::const_iterator it = cardExtensionData->getRoleCardinalityDataHash()->constBegin(), itEnd = cardExtensionData->getRoleCardinalityDataHash()->constEnd(); it != itEnd && !expansionBlockingCritical; ++it) { |
| 23233 |
CRole* role = roleVector->getData(it.key()); |
| 23234 |
CBackendRepresentativeMemoryLabelCacheItemCardinalityData* cardData = it.value(); |
| 23235 |
|
| 23236 |
cint64 linkCount = roleSuccHash->getRoleSuccessorCount(role); |
| 23237 |
if (indiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED)) { |
| 23238 |
linkCount += cardData->getExistentialMaxUsedCardinality(); |
| 23239 |
} |
| 23240 |
if (!backendSyncData->hasAllNeighbourForcedExpansion()) { |
| 23241 |
linkCount += getBackendCacheRoleRepresentativeNeighbourCount(indiNode, backendSyncData, assocData, role, calcAlgContext); |
| 23242 |
} |
| 23243 |
|
| 23244 |
cint64 minCard = cardData->getMinimumRestrictingCardinality(); |
| 23245 |
if (linkCount > minCard) { |
| 23246 |
expansionBlockingCritical = true; |
| 23247 |
} |
| 23248 |
} |
| 23249 |
|
| 23250 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23251 |
locBackendSyncData->setLastCriticalCardinalityLinkEdge(lastAddedLinkEdge); |
| 23252 |
locBackendSyncData->setCriticalCardinalityInitiallyChecked(true); |
| 23253 |
|
| 23254 |
|
| 23255 |
} |
| 23256 |
} |
| 23257 |
} |
| 23258 |
|
| 23259 |
|
| 23260 |
if (expansionBlockingCritical) { |
| 23261 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23262 |
locBackendSyncData->setCriticalCardinalityExpansionBlocking(expansionBlockingCritical); |
| 23263 |
} |
| 23264 |
} else { |
| 23265 |
expansionBlockingCritical = true; |
| 23266 |
} |
| 23267 |
} |
| 23268 |
|
| 23269 |
|
| 23270 |
return expansionBlockingCritical; |
| 23271 |
} |
| 23272 |
|
| 23273 |
|
| 23274 |
|
| 23275 |
|
| 23276 |
|
| 23277 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandIndirectCompatibleRequiredIndividualNeighbourNodesFromBackendCache(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23278 |
// TODO: try non-deterministic reusing first |
| 23279 |
|
| 23280 |
|
| 23281 |
|
| 23282 |
//CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23283 |
//CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23284 |
|
| 23285 |
|
| 23286 |
|
| 23287 |
//locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23288 |
|
| 23289 |
testIndividualNodeBackendCacheNewMergings(indiNode, calcAlgContext); |
| 23290 |
|
| 23291 |
//if (backendSyncData->getMergedIndividualNodeLinker() != backendSyncData->getLastIndirectCompatibilityExpansionHandledMergedNodeLinker()) { |
| 23292 |
|
| 23293 |
// markIndividualNodeBackendNonConceptSetRelatedProcessing(indiNode, calcAlgContext); |
| 23294 |
|
| 23295 |
// CPROCESSSET<cint64>* remCheckingIndiSet = locBackendSyncData->getRemainingIndirectCompatibilityMergedIndividualCheckingSet(true); |
| 23296 |
|
| 23297 |
|
| 23298 |
// visitNewlyMergedIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastIndirectCompatibilityExpansionHandledMergedNodeLinker(), !backendSyncData->hasMergedIndirectlyConnectedNominalIndividuals(), [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* mergedLocBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 23299 |
// remCheckingIndiSet->insert(mergedLocBackendSyncDataIndiNode->getIndividualNodeID); |
| 23300 |
// }, calcAlgContext); |
| 23301 |
|
| 23302 |
// locBackendSyncData->setLastIndirectCompatibilityExpansionHandledMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 23303 |
//} |
| 23304 |
|
| 23305 |
|
| 23306 |
//CPROCESSSET<cint64>* remCheckingIndiSet = locBackendSyncData->getRemainingIndirectCompatibilityMergedIndividualCheckingSet(true); |
| 23307 |
//if (remCheckingIndiSet) { |
| 23308 |
// for (CPROCESSSET<cint64>::iterator it = remCheckingIndiSet->begin(), itEnd = remCheckingIndiSet->end(); it != itEnd; ) { |
| 23309 |
// cint64 mergedIndNodeiId(*it); |
| 23310 |
// CIndividualProcessNode* backendSyncDataIndiNode = getUpToDateIndividual(mergedIndNodeiId, calcAlgContext); |
| 23311 |
// if (expandIndirectCompatibleRequiredIndividualNeighbourNodesFromBackendCache(indiNode, backendSyncDataIndiNode, calcAlgContext)) { |
| 23312 |
// ++it; |
| 23313 |
// } else { |
| 23314 |
// it = remCheckingIndiSet->erase(it); |
| 23315 |
// } |
| 23316 |
// } |
| 23317 |
//} |
| 23318 |
expandIndirectCompatibleRequiredIndividualNeighbourNodesFromBackendCache(indiNode, indiNode, calcAlgContext); |
| 23319 |
|
| 23320 |
expandIndirectlyConnectedIndividuals(indiNode, true, calcAlgContext); |
| 23321 |
|
| 23322 |
return true; |
| 23323 |
} |
| 23324 |
|
| 23325 |
|
| 23326 |
|
| 23327 |
|
| 23328 |
|
| 23329 |
|
| 23330 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandIndirectCompatibleRequiredIndividualNeighbourNodesFromBackendCache(CIndividualProcessNode* indiNode, CIndividualProcessNode* checkingBackendSyncDataIndiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23331 |
|
| 23332 |
bool requiredCheckingContinuation = false; |
| 23333 |
|
| 23334 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)checkingBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23335 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)checkingBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23336 |
|
| 23337 |
|
| 23338 |
CDependencyTrackPoint* backSyncDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 23339 |
|
| 23340 |
CIndividualMergingHash* mergingHash = indiNode->getIndividualMergingHash(false); |
| 23341 |
if (mergingHash && indiNode->getIndividualNodeID() != checkingBackendSyncDataIndiNode->getIndividualNodeID()) { |
| 23342 |
CIndividualMergingHashData mergingData = mergingHash->value(checkingBackendSyncDataIndiNode->getNominalIndividual()->getIndividualID()); |
| 23343 |
backSyncDepTrackPoint = mergingData.getDependencyTrackPoint(); |
| 23344 |
} |
| 23345 |
|
| 23346 |
|
| 23347 |
|
| 23348 |
// neighbours have to be integrated if |
| 23349 |
// - there is a non-deterministic concept in the cache that is not in the current label |
| 23350 |
// - there is a non-deterministic link in the cache to a neighbour node that is not in the completion graph |
| 23351 |
// - there is a non-deterministic different/same individual reference that does not exist in the current completion graph |
| 23352 |
|
| 23353 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 23354 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 23355 |
bool requiredAllNeighbourExpansion = backendSyncData->hasAllNeighbourExpansionScheduled(); |
| 23356 |
bool requiredAllNeighbourForcedExpansion = backendSyncData->hasAllNeighbourForcedExpansionScheduled(); |
| 23357 |
bool nonDeterministicConsequencesMissing = true; |
| 23358 |
|
| 23359 |
function<void(CBackendRepresentativeMemoryLabelCacheItem* conSetLabel)> nonDetConTestingFunction = [&](CBackendRepresentativeMemoryLabelCacheItem* conSetLabel) { |
| 23360 |
if (!requiredAllNeighbourExpansion && conSetLabel && conSetLabel->hasNondeterministicElements()) { |
| 23361 |
mBackendCacheHandler->visitConceptsOfAssociatedFullConceptSetLabel(assocData, conSetLabel, [&](CConcept* concept, bool negation, bool nondeterministic)->bool { |
| 23362 |
if (!conSet->containsConcept(concept, negation)) { |
| 23363 |
// only expand to those neighbours that are completely handled |
| 23364 |
requiredAllNeighbourExpansion = true; |
| 23365 |
nonDeterministicConsequencesMissing = true; |
| 23366 |
return false; |
| 23367 |
} |
| 23368 |
return true; |
| 23369 |
}, false, true, calcAlgContext); |
| 23370 |
} |
| 23371 |
}; |
| 23372 |
|
| 23373 |
if (!requiredAllNeighbourExpansion && assocData) { |
| 23374 |
nonDetConTestingFunction(assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL)); |
| 23375 |
} |
| 23376 |
|
| 23377 |
|
| 23378 |
|
| 23379 |
|
| 23380 |
// TODO: optimize by only expand to those neighbours that have cardinality restrictions |
| 23381 |
function<void(CBackendRepresentativeMemoryLabelCacheItem* conSetLabel)> nonDetSameTestingFunction = [&](CBackendRepresentativeMemoryLabelCacheItem* indiSetLabel) { |
| 23382 |
if (!requiredAllNeighbourForcedExpansion && indiSetLabel) { |
| 23383 |
mBackendCacheHandler->visitIndividualIdsOfAssociatedIndividualSetLabel(assocData, indiSetLabel, [&](cint64 indiId)->bool { |
| 23384 |
if (indiId != indiNode->getNominalIndividual()->getIndividualID()) { |
| 23385 |
if (!mergingHash || !mergingHash->contains(indiId)) { |
| 23386 |
requiredAllNeighbourExpansion = true; |
| 23387 |
requiredAllNeighbourForcedExpansion = true; |
| 23388 |
nonDeterministicConsequencesMissing = true; |
| 23389 |
return false; |
| 23390 |
} |
| 23391 |
} |
| 23392 |
return true; |
| 23393 |
}, calcAlgContext); |
| 23394 |
} |
| 23395 |
}; |
| 23396 |
|
| 23397 |
if (!requiredAllNeighbourForcedExpansion && assocData) { |
| 23398 |
nonDetSameTestingFunction(assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL)); |
| 23399 |
} |
| 23400 |
|
| 23401 |
|
| 23402 |
|
| 23403 |
|
| 23404 |
|
| 23405 |
// TODO: optimize by only expand to those neighbours that have cardinality restrictions |
| 23406 |
function<void(CBackendRepresentativeMemoryLabelCacheItem* conSetLabel)> nonDetDiffTestingFunction = [&](CBackendRepresentativeMemoryLabelCacheItem* diffSetLabel) { |
| 23407 |
if (!requiredAllNeighbourForcedExpansion && diffSetLabel) { |
| 23408 |
CDistinctHash* distinctHash = indiNode->getDistinctHash(false); |
| 23409 |
mBackendCacheHandler->visitIndividualIdsOfAssociatedIndividualSetLabel(assocData, diffSetLabel, [&](cint64 indiId)->bool { |
| 23410 |
if (indiId != indiNode->getNominalIndividual()->getIndividualID()) { |
| 23411 |
if (!distinctHash || !distinctHash->contains(indiId)) { |
| 23412 |
requiredAllNeighbourExpansion = true; |
| 23413 |
requiredAllNeighbourForcedExpansion = true; |
| 23414 |
nonDeterministicConsequencesMissing = true; |
| 23415 |
return false; |
| 23416 |
} |
| 23417 |
} |
| 23418 |
return true; |
| 23419 |
}, calcAlgContext); |
| 23420 |
} |
| 23421 |
}; |
| 23422 |
|
| 23423 |
if (!requiredAllNeighbourForcedExpansion && assocData) { |
| 23424 |
nonDetDiffTestingFunction(assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_DIFFRENT_INDIVIDUAL_SET_LABEL)); |
| 23425 |
} |
| 23426 |
|
| 23427 |
|
| 23428 |
if (!requiredAllNeighbourExpansion && assocData) { |
| 23429 |
// for non-deterministically merged nodes, it is anyway required to expand all neighbours, so this check is not executed |
| 23430 |
if (assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NEIGHBOUR_INSTANTIATED_ROLE_SET_COMBINATION_LABEL)->hasNondeterministicElements()) { |
| 23431 |
|
| 23432 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(checkingBackendSyncDataIndiNode, calcAlgContext); |
| 23433 |
|
| 23434 |
requiredCheckingContinuation = true; |
| 23435 |
|
| 23436 |
|
| 23437 |
CRole* topRole = calcAlgContext->getProcessingDataBox()->getOntology()->getRBox()->getTopObjectRole(); |
| 23438 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 23439 |
CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* neighbourRoleSetArray = assocData->getRoleSetNeighbourArray(); |
| 23440 |
if (neighbourRoleSetArray) { |
| 23441 |
CBackendRepresentativeMemoryLabelCacheItemIndividualRoleSetNeighbourArrayIndexExtensionData* neighbourRoleSetArrayIndexData = neighbourRoleSetArray->getIndexData(); |
| 23442 |
for (cint64 i = 0; i < neighbourRoleSetArrayIndexData->getArraySize(); ++i) { |
| 23443 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel = neighbourRoleSetArrayIndexData->getNeighbourRoleSetLabel(i); |
| 23444 |
bool nondeterministic = neighbourRoleSetLabel->hasNondeterministicElements(); |
| 23445 |
if (nondeterministic && (neighbourRoleSetLabel->getCacheValueCount() >= 1 || neighbourRoleSetLabel->getCacheValueLinker()->getCacheValue().getTag() != topRole->getRoleTag())) { |
| 23446 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 23447 |
initializeNeighbourExpansionWithPropagation(indiNode, checkingBackendSyncDataIndiNode, locBackendSyncData, backSyncDepTrackPoint, i, nullptr, false, true, nullptr, true, false, true, calcAlgContext); |
| 23448 |
} |
| 23449 |
} |
| 23450 |
} |
| 23451 |
|
| 23452 |
|
| 23453 |
|
| 23454 |
//CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 23455 |
//CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* neighbourRoleSetArray = assocData->getRoleSetNeighbourArray(); |
| 23456 |
//if (neighbourRoleSetArray) { |
| 23457 |
// CBackendRepresentativeMemoryLabelCacheItemIndividualRoleSetNeighbourArrayIndexExtensionData* neighbourRoleSetArrayIndexData = neighbourRoleSetArray->getIndexData(); |
| 23458 |
// for (cint64 i = 0; i < neighbourRoleSetArrayIndexData->getArraySize(); ++i) { |
| 23459 |
// CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetlabel = neighbourRoleSetArrayIndexData->getNeighbourRoleSetLabel(i); |
| 23460 |
|
| 23461 |
// //check whether neighbour role label has non-deterministic role |
| 23462 |
// //TODO: make check more efficient with label extension data |
| 23463 |
|
| 23464 |
// mBackendCacheHandler->visitRolesOfAssociatedNeigbourRoleSetLabel(assocData, neighbourRoleSetlabel, [&](CRole* role, bool inversed, bool assertionLinkBase, bool nominalLinkBase, bool nondeterministic)->bool { |
| 23465 |
// if (nondeterministic) { |
| 23466 |
|
| 23467 |
// markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 23468 |
// neighbourRoleSetArray->at(i).visitNeighbourIndividualIds([&](cint64 neighbourIndiId)->bool { |
| 23469 |
|
| 23470 |
// CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[neighbourIndiId]; |
| 23471 |
// if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 23472 |
|
| 23473 |
// bool requiredNeighbourExpansion = false; |
| 23474 |
|
| 23475 |
// // check whether non-deterministic role link is present in completion graph |
| 23476 |
// if (!isNominalIndividualNodeAvailable(-neighbourIndiId, calcAlgContext)) { |
| 23477 |
// requiredNeighbourExpansion = true; |
| 23478 |
// } else { |
| 23479 |
// CIndividualProcessNode* neighbourNode = getCorrectedNominalIndividualNode(-neighbourIndiId, calcAlgContext); |
| 23480 |
|
| 23481 |
// if (!neighbourNode) { |
| 23482 |
// requiredNeighbourExpansion = true; |
| 23483 |
// } else { |
| 23484 |
// if (!inversed) { |
| 23485 |
// if (!indiNode->getRoleSuccessorToIndividualLink(role, neighbourNode, true)) { |
| 23486 |
// requiredNeighbourExpansion = true; |
| 23487 |
// } |
| 23488 |
// } else { |
| 23489 |
// CRole* inverseRole = role->getInverseRole(); |
| 23490 |
// if (inverseRole) { |
| 23491 |
// if (!indiNode->getRoleSuccessorToIndividualLink(inverseRole, neighbourNode, true)) { |
| 23492 |
// requiredNeighbourExpansion = true; |
| 23493 |
// } |
| 23494 |
// } else { |
| 23495 |
// if (!neighbourNode->getRoleSuccessorToIndividualLink(role, indiNode, false)) { |
| 23496 |
// requiredNeighbourExpansion = true; |
| 23497 |
// } |
| 23498 |
// } |
| 23499 |
// } |
| 23500 |
// } |
| 23501 |
// } |
| 23502 |
|
| 23503 |
// |
| 23504 |
// if (requiredNeighbourExpansion) { |
| 23505 |
// expandIndividualNeighbourNodeFromBackendCache(indiNode, assocData, neighbourIndiId, neighbourExpansionData, false, false, nullptr, backSyncDepTrackPoint, calcAlgContext); |
| 23506 |
// } |
| 23507 |
// } |
| 23508 |
|
| 23509 |
// return true; |
| 23510 |
// }); |
| 23511 |
|
| 23512 |
// } |
| 23513 |
// return true; |
| 23514 |
// }); |
| 23515 |
|
| 23516 |
// |
| 23517 |
// } |
| 23518 |
//} |
| 23519 |
} |
| 23520 |
} |
| 23521 |
|
| 23522 |
//if (!requiredAllNeighbourExpansion) { |
| 23523 |
// // check whether there are new links to neighbours, e.g., due to merging |
| 23524 |
// CIndividualLinkEdge* lastAddedLinkEdge = indiNode->getLastAddedRoleLink(); |
| 23525 |
|
| 23526 |
// CIndividualLinkEdge* lastTestedLinkEdge = backendSyncData->getLastNewNeighbourLinkEdge(); |
| 23527 |
|
| 23528 |
// CBackendRepresentativeMemoryCacheIndividualNeighbourRoleSetHash* assoNeighbourRoleSetHash = assocData->getNeighbourRoleSetHash(); |
| 23529 |
// CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 23530 |
// if (lastTestedLinkEdge != lastAddedLinkEdge) { |
| 23531 |
|
| 23532 |
// CIndividualLinkEdge* linkEdgeIt = lastAddedLinkEdge; |
| 23533 |
// while (linkEdgeIt != lastTestedLinkEdge) { |
| 23534 |
|
| 23535 |
|
| 23536 |
// CRole* role = linkEdgeIt->getLinkRole(); |
| 23537 |
// CIndividualProcessNode* succNode = getSuccessorIndividual(indiNode, linkEdgeIt, calcAlgContext); |
| 23538 |
// CIndividual* neighbourIndi = succNode->getNominalIndividual(); |
| 23539 |
// bool deterministicRole = true; |
| 23540 |
// bool roleAssertion = true; |
| 23541 |
// CDependencyTrackPoint* linkDepTrackPoint = linkEdgeIt->getDependencyTrackPoint(); |
| 23542 |
// if (!linkDepTrackPoint || linkDepTrackPoint->getDependencyNode()->getDependencyType() != CDependencyNode::DNTROLEASSERTIONDEPENDENCY) { |
| 23543 |
// roleAssertion = false; |
| 23544 |
// } |
| 23545 |
// if (!linkDepTrackPoint || linkDepTrackPoint->getBranchingTag() > calcAlgContext->getProcessingDataBox()->getMaximumDeterministicBranchTag()) { |
| 23546 |
// deterministicRole = false; |
| 23547 |
// } |
| 23548 |
// if (neighbourIndi) { |
| 23549 |
// cint64 neighbourIndiId = neighbourIndi->getIndividualID(); |
| 23550 |
|
| 23551 |
// CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[neighbourIndiId]; |
| 23552 |
// if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 23553 |
|
| 23554 |
// bool requiredNeighbourExpansion = false; |
| 23555 |
// if (!assoNeighbourRoleSetHash) { |
| 23556 |
// requiredNeighbourExpansion = true; |
| 23557 |
// } else { |
| 23558 |
// CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel = assoNeighbourRoleSetHash->getNeighbourRoleSetLabel(neighbourIndiId); |
| 23559 |
// if (!neighbourRoleSetLabel) { |
| 23560 |
// requiredNeighbourExpansion = true; |
| 23561 |
// } else if (!mBackendCacheHandler->hasRoleInAssociatedNeigbourRoleSetLabel(assocData, neighbourRoleSetLabel, role, false, deterministicRole)) { |
| 23562 |
// requiredNeighbourExpansion = true; |
| 23563 |
// } |
| 23564 |
// } |
| 23565 |
|
| 23566 |
// if (requiredNeighbourExpansion) { |
| 23567 |
// expandIndividualNeighbourNodeFromBackendCache(indiNode, assocData, neighbourIndiId, neighbourExpansionData, false, nullptr, backSyncDepTrackPoint, calcAlgContext); |
| 23568 |
// } |
| 23569 |
|
| 23570 |
// } |
| 23571 |
|
| 23572 |
// } |
| 23573 |
|
| 23574 |
// linkEdgeIt = linkEdgeIt->getNext(); |
| 23575 |
// } |
| 23576 |
|
| 23577 |
// locBackendSyncData->setLastNewNeighbourLinkEdge(lastAddedLinkEdge); |
| 23578 |
// } |
| 23579 |
//} |
| 23580 |
|
| 23581 |
|
| 23582 |
|
| 23583 |
if (requiredAllNeighbourExpansion && !backendSyncData->hasAllNeighbourExpansionScheduled() || requiredAllNeighbourForcedExpansion && !backendSyncData->hasAllNeighbourForcedExpansionScheduled()) { |
| 23584 |
expandIndividualAllNeighboursFromBackendCache(indiNode, checkingBackendSyncDataIndiNode, requiredAllNeighbourForcedExpansion, nonDeterministicConsequencesMissing, backSyncDepTrackPoint, calcAlgContext); |
| 23585 |
|
| 23586 |
} |
| 23587 |
|
| 23588 |
return requiredCheckingContinuation; |
| 23589 |
|
| 23590 |
} |
| 23591 |
|
| 23592 |
|
| 23593 |
|
| 23594 |
|
| 23595 |
|
| 23596 |
|
| 23597 |
|
| 23598 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandIndividualInferringNeighboursFromBackendCache(CIndividualProcessNode* indiNode, CIndividualProcessNode* backendSyncDataIndiNode, bool forceExpansion, CDependencyTrackPoint* backSyncDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23599 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* indiBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23600 |
indiBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23601 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = indiBackendSyncData->getAssocitaionData(); |
| 23602 |
|
| 23603 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = indiBackendSyncData->getNeighbourExpansionDataHash(true); |
| 23604 |
|
| 23605 |
CIndividualProcessNodeVector* indiNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 23606 |
|
| 23607 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* mergedAssocData = ((CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)backendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false))->getAssocitaionData(); |
| 23608 |
if (mergedAssocData) { |
| 23609 |
CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* neighbourRoleSetArray = mergedAssocData->getRoleSetNeighbourArray(); |
| 23610 |
if (neighbourRoleSetArray) { |
| 23611 |
CBackendRepresentativeMemoryLabelCacheItemIndividualRoleSetNeighbourArrayIndexExtensionData* neighbourRoleSetArrayIndexData = neighbourRoleSetArray->getIndexData(); |
| 23612 |
for (cint64 i = 0; i < neighbourRoleSetArrayIndexData->getArraySize(); ++i) { |
| 23613 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetlabel = neighbourRoleSetArrayIndexData->getNeighbourRoleSetLabel(i); |
| 23614 |
neighbourRoleSetArray->at(i).visitNeighbourIndividualIds([&](cint64 neighbourIndiId)->bool { |
| 23615 |
bool neighbourPotentiallyInfluenced = false; |
| 23616 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[neighbourIndiId]; |
| 23617 |
if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 23618 |
if (isNominalIndividualNodeAvailable(-neighbourIndiId, calcAlgContext)) { |
| 23619 |
neighbourPotentiallyInfluenced = true; |
| 23620 |
} |
| 23621 |
if (!neighbourExpansionData.getRoleSetLabel()) { |
| 23622 |
neighbourExpansionData.setRoleSetLabel(neighbourRoleSetlabel); |
| 23623 |
} else if (neighbourExpansionData.getRoleSetLabel() != neighbourRoleSetlabel) { |
| 23624 |
neighbourPotentiallyInfluenced = true; |
| 23625 |
} |
| 23626 |
|
| 23627 |
if (neighbourPotentiallyInfluenced) { |
| 23628 |
|
| 23629 |
visitIndividualsRelevantBackendSynchronisationDataIndividuals(indiNode, true, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* mergedLocBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 23630 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* mergedSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)mergedLocBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23631 |
//expandIndividualNeighbourNodeFromBackendCache(indiNode, mergedSyncData->getAssocitaionData(), neighbourIndiId, neighbourExpansionData, true, nullptr, mergedBackSyncDepTrackPoint, calcAlgContext); |
| 23632 |
|
| 23633 |
expandIndividualNeighbourNodeFromBackendCache(indiNode, mergedSyncData->getAssocitaionData(), neighbourIndiId, neighbourExpansionData, true, false, nullptr, mergedBackSyncDepTrackPoint, calcAlgContext); |
| 23634 |
|
| 23635 |
return true; |
| 23636 |
}, calcAlgContext); |
| 23637 |
} |
| 23638 |
|
| 23639 |
} else { |
| 23640 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* mergedLocBackendSyncDataIndiNode = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)backendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23641 |
mergedLocBackendSyncDataIndiNode = getLocalizedIndividualBackendCacheSnychronisationData(backendSyncDataIndiNode, calcAlgContext); |
| 23642 |
expandIndividualNeighbourNodeFromBackendCache(indiNode, mergedLocBackendSyncDataIndiNode->getAssocitaionData(), neighbourIndiId, neighbourExpansionData, true, false, nullptr, backSyncDepTrackPoint, calcAlgContext); |
| 23643 |
} |
| 23644 |
return true; |
| 23645 |
}); |
| 23646 |
|
| 23647 |
} |
| 23648 |
} |
| 23649 |
} |
| 23650 |
|
| 23651 |
return true; |
| 23652 |
} |
| 23653 |
|
| 23654 |
|
| 23655 |
|
| 23656 |
|
| 23657 |
|
| 23658 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandIndividualAllNeighboursFromBackendCache(CIndividualProcessNode* indiNode, CIndividualProcessNode* backendSyncDataIndiNode, bool forceExpansion, bool nonDeterministicConsequencesMissingExpansion, CDependencyTrackPoint* backSyncDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23659 |
|
| 23660 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)backendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23661 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(backendSyncDataIndiNode, calcAlgContext); |
| 23662 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = locBackendSyncData->getAssocitaionData(); |
| 23663 |
locBackendSyncData->setAllNeighbourExpansionScheduled(true); |
| 23664 |
if (forceExpansion) { |
| 23665 |
locBackendSyncData->setAllNeighbourForcedExpansionScheduled(true); |
| 23666 |
} |
| 23667 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 23668 |
|
| 23669 |
//QString indiName = CIRIName::getRecentIRIName(indiNode->getNominalIndividual()->getIndividualNameLinker()); |
| 23670 |
//if (indiName.contains("#Baseball") || indiName.contains("#BasketBall") || indiName.contains("#Tennis")) { |
| 23671 |
// bool debug = true; |
| 23672 |
//} |
| 23673 |
|
| 23674 |
|
| 23675 |
if (assocData) { |
| 23676 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 23677 |
|
| 23678 |
CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* neighbourRoleSetArray = assocData->getRoleSetNeighbourArray(); |
| 23679 |
if (neighbourRoleSetArray) { |
| 23680 |
CBackendRepresentativeMemoryLabelCacheItemIndividualRoleSetNeighbourArrayIndexExtensionData* neighbourRoleSetArrayIndexData = neighbourRoleSetArray->getIndexData(); |
| 23681 |
for (cint64 i = 0; i < neighbourRoleSetArrayIndexData->getArraySize(); ++i) { |
| 23682 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetlabel = neighbourRoleSetArrayIndexData->getNeighbourRoleSetLabel(i); |
| 23683 |
|
| 23684 |
initializeNeighbourExpansionWithPropagation(indiNode, backendSyncDataIndiNode, locBackendSyncData, backSyncDepTrackPoint, i, nullptr, false, false, nullptr, forceExpansion, false, nonDeterministicConsequencesMissingExpansion, calcAlgContext); |
| 23685 |
|
| 23686 |
} |
| 23687 |
} |
| 23688 |
|
| 23689 |
|
| 23690 |
|
| 23691 |
function<void(CBackendRepresentativeMemoryLabelCacheItem* indiSetLabel)> expandRelatedIndividualFunction = [&](CBackendRepresentativeMemoryLabelCacheItem* indiSetLabel) { |
| 23692 |
if (indiSetLabel) { |
| 23693 |
mBackendCacheHandler->visitIndividualIdsOfAssociatedIndividualSetLabel(assocData, indiSetLabel, [&](cint64 neighbourIndiId)->bool { |
| 23694 |
if (neighbourIndiId != indiNode->getNominalIndividual()->getIndividualID()) { |
| 23695 |
CIndividualProcessNode* neighbourNode = getCorrectedNominalIndividualNode(-neighbourIndiId, calcAlgContext); |
| 23696 |
if (neighbourNode != indiNode) { |
| 23697 |
CIndividualProcessNode* locNominalIndi = getLocalizedIndividual(neighbourNode, false, calcAlgContext); |
| 23698 |
if (locNominalIndi->hasProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED)) { |
| 23699 |
locNominalIndi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED); |
| 23700 |
addIndividualToProcessingQueue(locNominalIndi, calcAlgContext); |
| 23701 |
} |
| 23702 |
} |
| 23703 |
} |
| 23704 |
return true; |
| 23705 |
}, calcAlgContext); |
| 23706 |
} |
| 23707 |
}; |
| 23708 |
|
| 23709 |
expandRelatedIndividualFunction(assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL)); |
| 23710 |
expandRelatedIndividualFunction(assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_DIFFRENT_INDIVIDUAL_SET_LABEL)); |
| 23711 |
} |
| 23712 |
|
| 23713 |
|
| 23714 |
if (indiNode->hasProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED)) { |
| 23715 |
indiNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED); |
| 23716 |
} |
| 23717 |
|
| 23718 |
if (!locBackendSyncData->getBackendNeighbourExpansionQueue(false) || !locBackendSyncData->getBackendNeighbourExpansionQueue(false)->hasQueuedNeighbourExpansions()) { |
| 23719 |
locBackendSyncData->setAllNeighbourExpansion(true); |
| 23720 |
if (forceExpansion) { |
| 23721 |
locBackendSyncData->setAllNeighbourForcedExpansion(true); |
| 23722 |
} |
| 23723 |
} |
| 23724 |
|
| 23725 |
return true; |
| 23726 |
} |
| 23727 |
|
| 23728 |
|
| 23729 |
|
| 23730 |
|
| 23731 |
|
| 23732 |
|
| 23733 |
CPROCESSHASH< QPair<CRole*, bool>, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationRoleNeighbourExpansionData >* CCalculationTableauCompletionTaskHandleAlgorithm::getBackendSynchronizationFilledRoleNeighbourExpansionDataHash(CIndividualProcessNode* indiNode, CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23734 |
CPROCESSHASH< QPair<CRole*, bool>, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationRoleNeighbourExpansionData >* roleNeighbourExpansionDataHash = locBackendSyncData->getRoleNeighbourExpansionDataHash(false); |
| 23735 |
if (!roleNeighbourExpansionDataHash) { |
| 23736 |
roleNeighbourExpansionDataHash = locBackendSyncData->getRoleNeighbourExpansionDataHash(true); |
| 23737 |
|
| 23738 |
|
| 23739 |
CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* neighbourRoleSetArray = assocData->getRoleSetNeighbourArray(); |
| 23740 |
if (neighbourRoleSetArray) { |
| 23741 |
CBackendRepresentativeMemoryLabelCacheItemIndividualRoleSetNeighbourArrayIndexExtensionData* neighbourRoleSetArrayIndexData = neighbourRoleSetArray->getIndexData(); |
| 23742 |
for (cint64 i = 0; i < neighbourRoleSetArrayIndexData->getArraySize(); ++i) { |
| 23743 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetlabel = neighbourRoleSetArrayIndexData->getNeighbourRoleSetLabel(i); |
| 23744 |
neighbourRoleSetArray->at(i).visitNeighbourIndividualIds([&](cint64 indiId)->bool { |
| 23745 |
|
| 23746 |
mBackendCacheHandler->visitRolesOfAssociatedNeigbourRoleSetLabel(assocData, neighbourRoleSetlabel, [&](CRole* role, bool inversed, bool aboxAsserted, bool nominalConnection, bool nondeterministic)->bool { |
| 23747 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationRoleNeighbourExpansionData& roleNeighourExpansionData = (*roleNeighbourExpansionDataHash)[QPair<CRole*, bool>(role, inversed)]; |
| 23748 |
|
| 23749 |
if (nondeterministic) { |
| 23750 |
roleNeighourExpansionData.setPossiblyNondeterministicallyInstantiated(true); |
| 23751 |
} |
| 23752 |
if (!inversed) { |
| 23753 |
CXLinker<cint64>* indiIdLinker = CObjectAllocator< CXLinker<cint64> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 23754 |
indiIdLinker->initLinker(indiId); |
| 23755 |
roleNeighourExpansionData.addIndividualIdLinker(indiIdLinker); |
| 23756 |
} |
| 23757 |
return true; |
| 23758 |
}); |
| 23759 |
|
| 23760 |
return true; |
| 23761 |
}); |
| 23762 |
} |
| 23763 |
} |
| 23764 |
} |
| 23765 |
return roleNeighbourExpansionDataHash; |
| 23766 |
|
| 23767 |
} |
| 23768 |
|
| 23769 |
|
| 23770 |
|
| 23771 |
|
| 23772 |
|
| 23773 |
|
| 23774 |
|
| 23775 |
|
| 23776 |
|
| 23777 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandIndividualNeighbourNodeFromBackendCache(CIndividualProcessNode* indiNode, cint64 neighbourIndiId, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23778 |
|
| 23779 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 23780 |
|
| 23781 |
testIndividualNodeBackendCacheNewMergings(indiNode, calcAlgContext); |
| 23782 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23783 |
bool expanded = false; |
| 23784 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = backendSyncData->getNeighbourExpansionDataHash(false); |
| 23785 |
|
| 23786 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), nullptr, true, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* mergedLocBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 23787 |
|
| 23788 |
|
| 23789 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* mergedBackendSyncData = ((CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)mergedLocBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false)); |
| 23790 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* mergedAssocData = mergedBackendSyncData->getAssocitaionData(); |
| 23791 |
if (mergedAssocData) { |
| 23792 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData neighbourExpansionData; |
| 23793 |
if (neighbourExpansionDataHash) { |
| 23794 |
neighbourExpansionData = neighbourExpansionDataHash->value(neighbourIndiId); |
| 23795 |
} |
| 23796 |
if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 23797 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23798 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& locNeighbourExpansionData = (*mergedBackendSyncData->getNeighbourExpansionDataHash(true))[neighbourIndiId]; |
| 23799 |
expanded |= expandIndividualNeighbourNodeFromBackendCache(indiNode, mergedAssocData, neighbourIndiId, locNeighbourExpansionData, true, true, nullptr, mergedBackSyncDepTrackPoint, calcAlgContext); |
| 23800 |
} |
| 23801 |
} |
| 23802 |
|
| 23803 |
return true; |
| 23804 |
}, calcAlgContext); |
| 23805 |
|
| 23806 |
return expanded; |
| 23807 |
} |
| 23808 |
|
| 23809 |
|
| 23810 |
|
| 23811 |
|
| 23812 |
|
| 23813 |
|
| 23814 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandIndividualNeighbourNodeFromBackendCache(CIndividualProcessNode* indiNode, CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData, cint64 neighbourIndiId, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData, bool forceExpansion, bool forceProcessing, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData** representativeLabelExpansionData, CDependencyTrackPoint* baseDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23815 |
// TODO: find a better strategy, e.g., only expand until to certain number of individuals, maybe also use representative cache updating adapter |
| 23816 |
|
| 23817 |
bool expanded = false; |
| 23818 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourAssData = mBackendCacheHandler->getIndividualAssociationData(neighbourIndiId, calcAlgContext); |
| 23819 |
if (!forceExpansion && !isNominalIndividualNodeAvailable(-neighbourIndiId, calcAlgContext)) { |
| 23820 |
if (!neighbourAssData || !neighbourAssData->isCompletelyHandled()) { |
| 23821 |
return false; |
| 23822 |
} |
| 23823 |
} |
| 23824 |
|
| 23825 |
cint64 repNeighbourIndiId = neighbourIndiId; |
| 23826 |
if (neighbourAssData) { |
| 23827 |
repNeighbourIndiId = neighbourAssData->getRepresentativeSameIndividualId(); |
| 23828 |
} |
| 23829 |
neighbourExpansionData.setNeighbourPossiblyInfluenced(true); |
| 23830 |
//add neighbour indi and directly create neighbouring role instantiations |
| 23831 |
if (!isNominalIndividualNodeAvailable(-repNeighbourIndiId, calcAlgContext)) { |
| 23832 |
expanded = true; |
| 23833 |
} |
| 23834 |
CIndividualProcessNode* locNominalIndi = getLocalizedForcedBackendInitializedNominalIndividualNode(repNeighbourIndiId, calcAlgContext); |
| 23835 |
|
| 23836 |
markIndividualNodeBackendNonConceptSetRelatedProcessing(locNominalIndi, calcAlgContext); |
| 23837 |
if (representativeLabelExpansionData) { |
| 23838 |
// install representative expansion feedback |
| 23839 |
|
| 23840 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* nominalBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locNominalIndi->getIndividualBackendCacheSynchronisationData(false); |
| 23841 |
if (!nominalBackendSyncData->hasNonConceptSetBackendNeighbourLabelRelatedProcessing()) { |
| 23842 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locNominalBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(locNominalIndi, calcAlgContext); |
| 23843 |
CXLinker<CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData*>* neighbourLabelRepresentativeExpansionLinker = CObjectAllocator< CXLinker<CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 23844 |
neighbourLabelRepresentativeExpansionLinker->initLinker(*representativeLabelExpansionData); |
| 23845 |
locNominalBackendSyncData->installNeighbourLabelRepresentativeExpansion(neighbourLabelRepresentativeExpansionLinker); |
| 23846 |
} else { |
| 23847 |
*representativeLabelExpansionData = nullptr; |
| 23848 |
} |
| 23849 |
} |
| 23850 |
|
| 23851 |
if (locNominalIndi->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 23852 |
return false; |
| 23853 |
} |
| 23854 |
|
| 23855 |
if (forceProcessing && locNominalIndi->hasProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED)) { |
| 23856 |
locNominalIndi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED); |
| 23857 |
addIndividualToProcessingQueue(locNominalIndi, calcAlgContext); |
| 23858 |
} |
| 23859 |
|
| 23860 |
CDependencyTrackPoint* nominalConDepTrackPoint = nullptr; |
| 23861 |
if (locNominalIndi->getNominalIndividual() && -repNeighbourIndiId != locNominalIndi->getIndividualNodeID() && repNeighbourIndiId != locNominalIndi->getNominalIndividual()->getIndividualID() && locNominalIndi->getIndividualMergingHash(false)) { |
| 23862 |
nominalConDepTrackPoint = locNominalIndi->getIndividualMergingHash(false)->value(repNeighbourIndiId).getDependencyTrackPoint(); |
| 23863 |
if (!nominalConDepTrackPoint || hasNondeterministicDependency(nominalConDepTrackPoint, calcAlgContext)) { |
| 23864 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData tmpNeighbourExpData; |
| 23865 |
expanded |= expandIndividualNeighbourNodeFromBackendCache(indiNode, assocData, locNominalIndi->getNominalIndividual()->getIndividualID(), tmpNeighbourExpData, forceExpansion, forceProcessing, nullptr, baseDepTrackPoint, calcAlgContext); |
| 23866 |
} |
| 23867 |
} |
| 23868 |
|
| 23869 |
bool nonDeterministicallyLinked = false; |
| 23870 |
mBackendCacheHandler->visitRolesToNeigbourInAssociatedNeighbourRoleSetLabel(assocData, neighbourIndiId, [&](CRole* role, bool inversed, bool aboxAsserted, bool nominalConnection, bool nondeterministic)->bool { |
| 23871 |
nonDeterministicallyLinked |= nondeterministic; |
| 23872 |
if (!nondeterministic && (aboxAsserted || nominalConnection)) { |
| 23873 |
if (!inversed) { |
| 23874 |
if (!hasIndividualsLink(indiNode, locNominalIndi, role, true, calcAlgContext)) { |
| 23875 |
// create dependency |
| 23876 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 23877 |
if (aboxAsserted) { |
| 23878 |
CROLEASSERTIONDependencyNode* roleAssDepNode = createROLEASSERTIONDependency(nextDepTrackPoint, indiNode, baseDepTrackPoint, nominalConDepTrackPoint, role, indiNode->getNominalIndividual(), calcAlgContext); |
| 23879 |
} else if (nominalConnection) { |
| 23880 |
// TODO: maybe create separate dependency |
| 23881 |
CVALUEDependencyNode* valueDepNode = createVALUEDependency(nextDepTrackPoint, indiNode, nullptr, baseDepTrackPoint, nominalConDepTrackPoint, calcAlgContext); |
| 23882 |
} |
| 23883 |
// create link |
| 23884 |
createNewIndividualsLinksReapplyed(indiNode, locNominalIndi, role->getIndirectSuperRoleList(), role, nextDepTrackPoint, true, calcAlgContext); |
| 23885 |
|
| 23886 |
propagateIndividualNodeModified(locNominalIndi, calcAlgContext); |
| 23887 |
addIndividualToProcessingQueue(locNominalIndi, calcAlgContext); |
| 23888 |
expanded = true; |
| 23889 |
} |
| 23890 |
} else { |
| 23891 |
if (!hasIndividualsLink(locNominalIndi, indiNode, role, true, calcAlgContext)) { |
| 23892 |
// create dependency |
| 23893 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 23894 |
if (aboxAsserted) { |
| 23895 |
CROLEASSERTIONDependencyNode* roleAssDepNode = createROLEASSERTIONDependency(nextDepTrackPoint, indiNode, baseDepTrackPoint, nominalConDepTrackPoint, role, locNominalIndi->getNominalIndividual(), calcAlgContext); |
| 23896 |
} else if (nominalConnection) { |
| 23897 |
// TODO: maybe create separate dependency |
| 23898 |
CVALUEDependencyNode* valueDepNode = createVALUEDependency(nextDepTrackPoint, indiNode, nullptr, baseDepTrackPoint, nominalConDepTrackPoint, calcAlgContext); |
| 23899 |
} |
| 23900 |
|
| 23901 |
// create link |
| 23902 |
createNewIndividualsLinksReapplyed(locNominalIndi, indiNode, role->getIndirectSuperRoleList(), role, nextDepTrackPoint, true, calcAlgContext); |
| 23903 |
|
| 23904 |
propagateIndividualNodeModified(locNominalIndi, calcAlgContext); |
| 23905 |
addIndividualToProcessingQueue(locNominalIndi, calcAlgContext); |
| 23906 |
expanded = true; |
| 23907 |
} |
| 23908 |
} |
| 23909 |
|
| 23910 |
|
| 23911 |
} |
| 23912 |
return true; |
| 23913 |
}, calcAlgContext); |
| 23914 |
|
| 23915 |
if (nonDeterministicallyLinked && locNominalIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSINGINDIVIDUAL) && !locNominalIndi->isBackendIndirectCompatibilityExpansionQueued()) { |
| 23916 |
addIndividualToBackendIndirectCompatibilityExpansionQueue(locNominalIndi, calcAlgContext); |
| 23917 |
} |
| 23918 |
|
| 23919 |
|
| 23920 |
return expanded; |
| 23921 |
} |
| 23922 |
|
| 23923 |
|
| 23924 |
|
| 23925 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandIndirectlyConnectedIndividuals(CIndividualProcessNode* indiNode, bool checkExpansionRequired, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23926 |
// activate indirectly nominal connected indis from cache if there is a cardinality restriction to a newly generated nominal node or concept label has changed/is nondeterministic |
| 23927 |
bool expanded = false; |
| 23928 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23929 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23930 |
|
| 23931 |
|
| 23932 |
bool requiredIndirectConnectedIndividualExpansion = !checkExpansionRequired || testIndividualNodeBackendCacheNominalIndirectConnectionBlockingCritical(indiNode, calcAlgContext); |
| 23933 |
|
| 23934 |
if (requiredIndirectConnectedIndividualExpansion) { |
| 23935 |
testIndividualNodeBackendCacheNewMergings(indiNode, calcAlgContext); |
| 23936 |
backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23937 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23938 |
locBackendSyncData->setNominalIndirectConnectionIndividualExpanded(true); |
| 23939 |
|
| 23940 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastIndirectlyConnectedNominalIndividualsHandledMergedNodeLinker(), !backendSyncData->hasNominalIndirectConnectionIndividualExpanded(), [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 23941 |
|
| 23942 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23943 |
if (!backendSyncData->hasNominalIndirectConnectionIndividualExpanded()) { |
| 23944 |
locBackendSyncDataIndiNode = getLocalizedIndividual(locBackendSyncDataIndiNode, true, calcAlgContext); |
| 23945 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23946 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 23947 |
mBackendCacheHandler->visitNominalIndirectlyConnectedIndividualIds(locBackendSyncData->getAssocitaionData(), locBackendSyncDataIndiNode->getNominalIndividual()->getIndividualID(), [&](cint64 connIndiId)->bool { |
| 23948 |
|
| 23949 |
expanded = true; |
| 23950 |
CIndividualProcessNode* locIndirectlyConnIndiNode = getLocalizedForcedBackendInitializedNominalIndividualNode(connIndiId, calcAlgContext); |
| 23951 |
|
| 23952 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(locIndirectlyConnIndiNode, calcAlgContext); |
| 23953 |
|
| 23954 |
if (locIndirectlyConnIndiNode->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED)) { |
| 23955 |
locIndirectlyConnIndiNode->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED); |
| 23956 |
addIndividualToProcessingQueue(locIndirectlyConnIndiNode, calcAlgContext); |
| 23957 |
} |
| 23958 |
|
| 23959 |
return true; |
| 23960 |
}, calcAlgContext); |
| 23961 |
|
| 23962 |
locBackendSyncData->setNominalIndirectConnectionIndividualExpanded(true); |
| 23963 |
} |
| 23964 |
return true; |
| 23965 |
|
| 23966 |
}, calcAlgContext); |
| 23967 |
|
| 23968 |
locBackendSyncData->setLastIndirectlyConnectedNominalIndividualsHandledMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 23969 |
|
| 23970 |
} |
| 23971 |
return expanded; |
| 23972 |
} |
| 23973 |
|
| 23974 |
|
| 23975 |
|
| 23976 |
|
| 23977 |
|
| 23978 |
|
| 23979 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* CCalculationTableauCompletionTaskHandleAlgorithm::getLocalizedIndividualBackendCacheSnychronisationData(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23980 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 23981 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 23982 |
if (!locBackendSyncData) { |
| 23983 |
locBackendSyncData = CObjectParameterizingAllocator< CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData, CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 23984 |
locBackendSyncData->initSynchronisationData(backendSyncData); |
| 23985 |
indiNode->setIndividualBackendCacheSynchronisationData(locBackendSyncData); |
| 23986 |
} |
| 23987 |
return locBackendSyncData; |
| 23988 |
} |
| 23989 |
|
| 23990 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandDirectlyInfluencedIndividualNeighbourNodesFromBackendCache(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 23991 |
|
| 23992 |
bool lazyNeighboursExpansionSucceded = true; |
| 23993 |
if (indiNode->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 23994 |
return false; |
| 23995 |
} |
| 23996 |
|
| 23997 |
|
| 23998 |
//QString indiName = CIRIName::getRecentIRIName(indiNode->getNominalIndividual()->getIndividualNameLinker()); |
| 23999 |
//if (indiName.contains("/StudentWhoLikesTennisAndBasketBallAndBaseBallAndShouldHaveManyHobbies")) { |
| 24000 |
// bool debug = true; |
| 24001 |
//} |
| 24002 |
//cint64 indiId = indiNode->getNominalIndividual()->getIndividualID(); |
| 24003 |
//if (mPropCuttedIndiIds.contains(indiId)) { |
| 24004 |
// bool debug = true; |
| 24005 |
// if (!mPropCuttedExpandedIndiIds.contains(indiId)) { |
| 24006 |
// mPropCuttedExpandedIndiIds.insert(indiId); |
| 24007 |
// } |
| 24008 |
//} |
| 24009 |
|
| 24010 |
|
| 24011 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 24012 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 24013 |
|
| 24014 |
|
| 24015 |
|
| 24016 |
testIndividualNodeBackendCacheNewMergings(indiNode, calcAlgContext); |
| 24017 |
backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 24018 |
|
| 24019 |
CXLinker<CIndividualProcessNode*>* checkingMergingsLinker = nullptr; |
| 24020 |
|
| 24021 |
visitNewlyMergedIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastDirectExpansionHandledMergedNodeLinker(), !backendSyncData->hasDeterministicSameIndividualMerged(), [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 24022 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 24023 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = nullptr; |
| 24024 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 24025 |
|
| 24026 |
if (!backendSyncData->hasDeterministicSameIndividualMerged() && assocData) { |
| 24027 |
locBackendSyncDataIndiNode = getLocalizedIndividual(locBackendSyncDataIndiNode, true, calcAlgContext); |
| 24028 |
|
| 24029 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(locBackendSyncDataIndiNode, calcAlgContext); |
| 24030 |
CBackendRepresentativeMemoryLabelCacheItem* detSameIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 24031 |
if (detSameIndiLabel) { |
| 24032 |
// merge all deterministic same individuals |
| 24033 |
|
| 24034 |
cint64 mergingIntoId = assocData->getRepresentativeSameIndividualId(); |
| 24035 |
CIndividualProcessNode* currIndiNode = getCorrectedMergedIntoIndividualNode(indiNode, calcAlgContext); |
| 24036 |
cint64 indiId = currIndiNode->getNominalIndividual()->getIndividualID(); |
| 24037 |
mergingIntoId = qMin(mergingIntoId, indiId); |
| 24038 |
|
| 24039 |
|
| 24040 |
mBackendCacheHandler->visitIndividualIdsOfAssociatedIndividualSetLabel(assocData, detSameIndiLabel, [&](cint64 sameIndiId)->bool { |
| 24041 |
|
| 24042 |
if (sameIndiId != mergingIntoId) { |
| 24043 |
|
| 24044 |
CIndividualProcessNode* locMergingIntoIndiNode = getLocalizedForcedBackendInitializedNominalIndividualNode(mergingIntoId, calcAlgContext); |
| 24045 |
|
| 24046 |
CIndividualMergingHash* mergedHash = locMergingIntoIndiNode->getIndividualMergingHash(false); |
| 24047 |
if (!mergedHash || !mergedHash->contains(sameIndiId)) { |
| 24048 |
|
| 24049 |
CIndividualProcessNode* locMergingSameIndiNode = getLocalizedForcedBackendInitializedNominalIndividualNode(sameIndiId, calcAlgContext); |
| 24050 |
|
| 24051 |
mergedHash = locMergingIntoIndiNode->getIndividualMergingHash(false); |
| 24052 |
if (!mergedHash || !mergedHash->contains(sameIndiId)) { |
| 24053 |
|
| 24054 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 24055 |
if (isIndividualNodesMergeable(locMergingIntoIndiNode, locMergingSameIndiNode, clashDescriptors, calcAlgContext)) { |
| 24056 |
|
| 24057 |
CDependencyTrackPoint* mergingSameIndiDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 24058 |
if (-sameIndiId != locMergingSameIndiNode->getIndividualNodeID()) { |
| 24059 |
mergingSameIndiDepTrackPoint = locMergingSameIndiNode->getIndividualMergingHash(true)->value(sameIndiId).getDependencyTrackPoint(); |
| 24060 |
} |
| 24061 |
|
| 24062 |
// create dependency |
| 24063 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 24064 |
CSAMEINDIVIDUALSMERGEDependencyNode* mergingSameExpansionDependencyNode = createSAMEINDIVIDUALMERGEDependency(nextDepTrackPoint, locMergingIntoIndiNode, backSyncDepTrackPoint, mergingSameIndiDepTrackPoint, calcAlgContext); |
| 24065 |
|
| 24066 |
locMergingIntoIndiNode = getMergedIndividualNodes(locMergingIntoIndiNode, locMergingSameIndiNode, nextDepTrackPoint, calcAlgContext); |
| 24067 |
} else { |
| 24068 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, locBackendSyncDataIndiNode, nullptr, backSyncDepTrackPoint, calcAlgContext); |
| 24069 |
if (-mergingIntoId != locMergingIntoIndiNode->getIndividualNodeID()) { |
| 24070 |
CDependencyTrackPoint* depTrackPoint = locMergingIntoIndiNode->getIndividualMergingHash(true)->value(mergingIntoId).getDependencyTrackPoint(); |
| 24071 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, locMergingIntoIndiNode, nullptr, depTrackPoint, calcAlgContext); |
| 24072 |
} |
| 24073 |
if (-sameIndiId != locMergingSameIndiNode->getIndividualNodeID()) { |
| 24074 |
CDependencyTrackPoint* depTrackPoint = locMergingSameIndiNode->getIndividualMergingHash(true)->value(sameIndiId).getDependencyTrackPoint(); |
| 24075 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, locMergingSameIndiNode, nullptr, depTrackPoint, calcAlgContext); |
| 24076 |
} |
| 24077 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 24078 |
} |
| 24079 |
} |
| 24080 |
} |
| 24081 |
} |
| 24082 |
return true; |
| 24083 |
}, calcAlgContext); |
| 24084 |
|
| 24085 |
} |
| 24086 |
|
| 24087 |
locBackendSyncData->setDeterministicSameIndividualMerged(true); |
| 24088 |
} |
| 24089 |
return true; |
| 24090 |
}, calcAlgContext); |
| 24091 |
|
| 24092 |
|
| 24093 |
if (indiNode->hasPurgedBlockedProcessingRestrictionFlags()) { |
| 24094 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 24095 |
locBackendSyncData->setLastDirectExpansionHandledMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 24096 |
return false; |
| 24097 |
} |
| 24098 |
|
| 24099 |
bool newMergingsHandled = false; |
| 24100 |
bool nonDeterministicMerged = backendSyncData->hasNonDeterministicallyMergedIndividuals(); |
| 24101 |
if (mConfAllowBackendNeighbourExpansionBlocking && mConfNewMergingsOnlyInferringExpansion && !nonDeterministicMerged) { |
| 24102 |
checkingMergingsLinker = backendSyncData->getLastInferringExpansionHandledMergedNodeLinker(); |
| 24103 |
newMergingsHandled = true; |
| 24104 |
if (backendSyncData->getMergedIndividualNodeLinker() != backendSyncData->getLastInferringExpansionHandledMergedNodeLinker()) { |
| 24105 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 24106 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 24107 |
|
| 24108 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastInferringExpansionHandledMergedNodeLinker(), !backendSyncData->getLastInferringExpansionHandledMergedNodeLinker(), [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* mergedLocBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 24109 |
mergedLocBackendSyncDataIndiNode = getLocalizedIndividual(mergedLocBackendSyncDataIndiNode, false, calcAlgContext); |
| 24110 |
expandIndividualInferringNeighboursFromBackendCache(indiNode, mergedLocBackendSyncDataIndiNode, true, mergedBackSyncDepTrackPoint, calcAlgContext); |
| 24111 |
return true; |
| 24112 |
}, calcAlgContext); |
| 24113 |
locBackendSyncData->setNewlyMergedInferringNeighbourExpansion(true); |
| 24114 |
locBackendSyncData->setNewlyMergedIndividuals(true); |
| 24115 |
} |
| 24116 |
} |
| 24117 |
if (!newMergingsHandled && (!mConfAllowBackendNeighbourExpansionBlocking || backendSyncData->getMergedIndividualNodeLinker() != backendSyncData->getLastDirectExpansionHandledMergedNodeLinker())) { |
| 24118 |
checkingMergingsLinker = backendSyncData->getLastDirectExpansionHandledMergedNodeLinker(); |
| 24119 |
newMergingsHandled = true; |
| 24120 |
|
| 24121 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 24122 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 24123 |
|
| 24124 |
//CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 24125 |
//visitNewlyMergedIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastDirectExpansionHandledMergedNodeLinker(), !backendSyncData->getLastDirectExpansionHandledMergedNodeLinker(), [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* mergedLocBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 24126 |
|
| 24127 |
// might be incorrect if a node a1 is merged with a2 and b1 with b2 and the link from a1 to b1 has a disjoint role to the link from a2 to b2 |
| 24128 |
//CBackendRepresentativeMemoryCacheIndividualAssociationData* mergedAssocData = ((CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false))->getAssocitaionData(); |
| 24129 |
//if (mergedAssocData) { |
| 24130 |
// CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* neighbourRoleSetArray = mergedAssocData->getRoleSetNeighbourArray(); |
| 24131 |
// if (neighbourRoleSetArray) { |
| 24132 |
// CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArrayIndexData* neighbourRoleSetArrayIndexData = neighbourRoleSetArray->getIndexData(); |
| 24133 |
// for (cint64 i = 0; i < neighbourRoleSetArrayIndexData->getArraySize(); ++i) { |
| 24134 |
// CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetlabel = neighbourRoleSetArrayIndexData->getNeighbourRoleSetLabel(i); |
| 24135 |
// neighbourRoleSetArray->at(i).visitNeighbourIndividualIds([&](cint64 neighbourIndiId)->bool { |
| 24136 |
// bool neighbourPotentiallyInfluenced = false; |
| 24137 |
// CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[neighbourIndiId]; |
| 24138 |
// if (!neighbourExpansionData.getRoleSetLabel()) { |
| 24139 |
// neighbourExpansionData.setRoleSetLabel(neighbourRoleSetlabel); |
| 24140 |
// } else if (neighbourExpansionData.getRoleSetLabel() != neighbourRoleSetlabel) { |
| 24141 |
// neighbourPotentiallyInfluenced = true; |
| 24142 |
// } |
| 24143 |
|
| 24144 |
// if (neighbourPotentiallyInfluenced) { |
| 24145 |
|
| 24146 |
// visitIndividualsRelevantBackendSynchronisationDataIndividuals(indiNode, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* mergedLocBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 24147 |
// CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* mergedSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)mergedLocBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 24148 |
// expandIndividualNeighbourNodeFromBackendCache(indiNode, mergedSyncData->getAssocitaionData(), neighbourIndiId, neighbourExpansionData, true, nullptr, mergedBackSyncDepTrackPoint, calcAlgContext); |
| 24149 |
// return true; |
| 24150 |
// }, calcAlgContext); |
| 24151 |
// } |
| 24152 |
|
| 24153 |
// return true; |
| 24154 |
// }); |
| 24155 |
|
| 24156 |
// } |
| 24157 |
// } |
| 24158 |
//} |
| 24159 |
//return true; |
| 24160 |
|
| 24161 |
|
| 24162 |
|
| 24163 |
|
| 24164 |
//CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* mergedSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)mergedLocBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 24165 |
//CBackendRepresentativeMemoryCacheIndividualAssociationData* mergedAssocData = mergedSyncData->getAssocitaionData(); |
| 24166 |
|
| 24167 |
//CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locMergedSyncData = getLocalizedIndividualBackendCacheSnychronisationData(mergedLocBackendSyncDataIndiNode, calcAlgContext); |
| 24168 |
//CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* mergedNeighbourExpansionDataHash = locMergedSyncData->getNeighbourExpansionDataHash(true); |
| 24169 |
|
| 24170 |
//if (mergedAssocData) { |
| 24171 |
// CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* neighbourRoleSetArray = mergedAssocData->getRoleSetNeighbourArray(); |
| 24172 |
// if (neighbourRoleSetArray) { |
| 24173 |
// CBackendRepresentativeMemoryLabelCacheItemIndividualRoleSetNeighbourArrayIndexExtensionData* neighbourRoleSetArrayIndexData = neighbourRoleSetArray->getIndexData(); |
| 24174 |
// for (cint64 i = 0; i < neighbourRoleSetArrayIndexData->getArraySize(); ++i) { |
| 24175 |
// CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetlabel = neighbourRoleSetArrayIndexData->getNeighbourRoleSetLabel(i); |
| 24176 |
// neighbourRoleSetArray->at(i).visitNeighbourIndividualIds([&](cint64 neighbourIndiId)->bool { |
| 24177 |
// bool neighbourPotentiallyInfluenced = true; |
| 24178 |
// CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& mergedNeighbourExpansionData = (*mergedNeighbourExpansionDataHash)[neighbourIndiId]; |
| 24179 |
// if (!mergedNeighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 24180 |
// CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[neighbourIndiId]; |
| 24181 |
// if (!neighbourExpansionData.isNeighbourPossiblyInfluenced() || neighbourExpansionData.getRoleSetLabel() != neighbourRoleSetlabel) { |
| 24182 |
// if (!neighbourExpansionData.getRoleSetLabel()) { |
| 24183 |
// neighbourExpansionData.setRoleSetLabel(neighbourRoleSetlabel); |
| 24184 |
// } |
| 24185 |
// expandIndividualNeighbourNodeFromBackendCache(indiNode, mergedSyncData->getAssocitaionData(), neighbourIndiId, neighbourExpansionData, true, true, nullptr, mergedBackSyncDepTrackPoint, calcAlgContext); |
| 24186 |
// } |
| 24187 |
// mergedNeighbourExpansionData.setNeighbourPossiblyInfluenced(true); |
| 24188 |
// } |
| 24189 |
// return true; |
| 24190 |
// }); |
| 24191 |
// } |
| 24192 |
// } |
| 24193 |
|
| 24194 |
//} |
| 24195 |
|
| 24196 |
// return true; |
| 24197 |
//}, calcAlgContext); |
| 24198 |
|
| 24199 |
|
| 24200 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastDirectExpansionHandledMergedNodeLinker(), !backendSyncData->getLastDirectExpansionHandledMergedNodeLinker(), [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* mergedLocBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 24201 |
|
| 24202 |
mergedLocBackendSyncDataIndiNode = getLocalizedIndividual(mergedLocBackendSyncDataIndiNode, false, calcAlgContext); |
| 24203 |
expandIndividualAllNeighboursFromBackendCache(indiNode, mergedLocBackendSyncDataIndiNode, true, false, mergedBackSyncDepTrackPoint, calcAlgContext); |
| 24204 |
|
| 24205 |
return true; |
| 24206 |
}, calcAlgContext); |
| 24207 |
|
| 24208 |
locBackendSyncData->setNewlyMergedAllNeighbourExpansion(true); |
| 24209 |
locBackendSyncData->setMergedIndividualsAllNeighbourExpanded(true); |
| 24210 |
locBackendSyncData->setAllNeighbourExpansionScheduled(true); |
| 24211 |
locBackendSyncData->setAllNeighbourForcedExpansionScheduled(true); |
| 24212 |
locBackendSyncData->setNewlyMergedIndividuals(true); |
| 24213 |
|
| 24214 |
|
| 24215 |
//CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 24216 |
//CBackendRepresentativeMemoryLabelCacheItem* detSameIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 24217 |
//CBackendRepresentativeMemoryLabelCacheItem* nonDetSameIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 24218 |
|
| 24219 |
//bool hasNewMergings = backendSyncData->hasNewlyMergedIndividuals(); |
| 24220 |
//bool hadNewMergings = hasNewMergings; |
| 24221 |
//if (!hasNewMergings) { |
| 24222 |
// visitNewlyMergedIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastNewlyMergedExpansionRequiringCheckingMergedNodeLinker(), false, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* mergedLocBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 24223 |
// cint64 mergedIndiId = mergedLocBackendSyncDataIndiNode->getNominalIndividual()->getIndividualID(); |
| 24224 |
// if (!mBackendCacheHandler->hasIndividualIdsInAssociatedIndividualSetLabel(assocData, detSameIndiLabel, mergedIndiId) && !mBackendCacheHandler->hasIndividualIdsInAssociatedIndividualSetLabel(assocData, nonDetSameIndiLabel, mergedIndiId)) { |
| 24225 |
// hasNewMergings = true; |
| 24226 |
// return false; |
| 24227 |
// } |
| 24228 |
// return true; |
| 24229 |
// }, calcAlgContext); |
| 24230 |
//} |
| 24231 |
|
| 24232 |
|
| 24233 |
//if (hasNewMergings) { |
| 24234 |
// CXLinker<CIndividualProcessNode*>* checkMergedNodleLinker = backendSyncData->getLastNewlyMergedExpansionRequiringCheckingMergedNodeLinker(); |
| 24235 |
// if (!hadNewMergings) { |
| 24236 |
// checkMergedNodleLinker = nullptr; |
| 24237 |
// } |
| 24238 |
// visitNewlyMergedIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), checkMergedNodleLinker, !hadNewMergings, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* mergedLocBackendSyncDataIndiNode, CDependencyTrackPoint* mergedBackSyncDepTrackPoint)->bool { |
| 24239 |
|
| 24240 |
// mergedLocBackendSyncDataIndiNode = getLocalizedIndividual(mergedLocBackendSyncDataIndiNode, false, calcAlgContext); |
| 24241 |
// expandIndividualAllNeighboursFromBackendCache(indiNode, mergedLocBackendSyncDataIndiNode, true, mergedBackSyncDepTrackPoint, calcAlgContext); |
| 24242 |
|
| 24243 |
// return true; |
| 24244 |
// }, calcAlgContext); |
| 24245 |
|
| 24246 |
// locBackendSyncData->setMergedIndividualsAllNeighbourExpanded(true); |
| 24247 |
// locBackendSyncData->setAllNeighbourExpansionScheduled(true); |
| 24248 |
// locBackendSyncData->setAllNeighbourForcedExpansionScheduled(true); |
| 24249 |
//} |
| 24250 |
//locBackendSyncData->setNewlyMergedIndividuals(hasNewMergings); |
| 24251 |
//locBackendSyncData->setLastNewlyMergedExpansionRequiringCheckingMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 24252 |
} |
| 24253 |
|
| 24254 |
|
| 24255 |
|
| 24256 |
|
| 24257 |
|
| 24258 |
|
| 24259 |
|
| 24260 |
|
| 24261 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), checkingMergingsLinker, !backendSyncData->hasDeterministicDifferentIndividualDifferentiated(), [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 24262 |
|
| 24263 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 24264 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = nullptr; |
| 24265 |
|
| 24266 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 24267 |
|
| 24268 |
if (!backendSyncData->hasDeterministicDifferentIndividualDifferentiated() && assocData) { |
| 24269 |
locBackendSyncDataIndiNode = getLocalizedIndividual(locBackendSyncDataIndiNode, false, calcAlgContext); |
| 24270 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(locBackendSyncDataIndiNode, calcAlgContext); |
| 24271 |
CBackendRepresentativeMemoryLabelCacheItem* detDiffIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_DIFFRENT_INDIVIDUAL_SET_LABEL); |
| 24272 |
CBackendRepresentativeMemoryLabelCacheItem* detSameIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 24273 |
if (detDiffIndiLabel) { |
| 24274 |
// add distinct links for all deterministic different individuals |
| 24275 |
cint64 locBackendSyncIndiId = locBackendSyncDataIndiNode->getNominalIndividual()->getIndividualID(); |
| 24276 |
|
| 24277 |
mBackendCacheHandler->visitIndividualIdsOfAssociatedIndividualSetLabel(assocData, detDiffIndiLabel, [&](cint64 diffIndiId)->bool { |
| 24278 |
|
| 24279 |
if (diffIndiId != locBackendSyncIndiId && !mBackendCacheHandler->hasIndividualIdsInAssociatedIndividualSetLabel(assocData, detSameIndiLabel, diffIndiId)) { |
| 24280 |
|
| 24281 |
CIndividualMergingHash* mergedHash = indiNode->getIndividualMergingHash(false); |
| 24282 |
if (mergedHash && mergedHash->hasMergedIndividual(diffIndiId)) { |
| 24283 |
// clash |
| 24284 |
|
| 24285 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 24286 |
CDependencyTrackPoint* depTrackPoint = mergedHash->value(diffIndiId).getDependencyTrackPoint(); |
| 24287 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, locBackendSyncDataIndiNode, nullptr, backSyncDepTrackPoint, calcAlgContext); |
| 24288 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, indiNode, nullptr, depTrackPoint, calcAlgContext); |
| 24289 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 24290 |
|
| 24291 |
} else { |
| 24292 |
|
| 24293 |
CIndividualProcessNode* locDifferentIndiNode = getLocalizedForcedBackendInitializedNominalIndividualNode(diffIndiId, calcAlgContext); |
| 24294 |
|
| 24295 |
createIndividualsDistinct(indiNode, locDifferentIndiNode, backSyncDepTrackPoint, calcAlgContext); |
| 24296 |
} |
| 24297 |
} |
| 24298 |
return true; |
| 24299 |
}, calcAlgContext); |
| 24300 |
|
| 24301 |
} |
| 24302 |
|
| 24303 |
locBackendSyncData->setDeterministicDifferentIndividualDifferentiated(true); |
| 24304 |
} |
| 24305 |
return true; |
| 24306 |
}, calcAlgContext); |
| 24307 |
|
| 24308 |
|
| 24309 |
|
| 24310 |
|
| 24311 |
|
| 24312 |
|
| 24313 |
|
| 24314 |
|
| 24315 |
|
| 24316 |
|
| 24317 |
|
| 24318 |
|
| 24319 |
|
| 24320 |
|
| 24321 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), checkingMergingsLinker, !backendSyncData->hasPrioritziedPropagationLinksEstablished(), [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 24322 |
|
| 24323 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 24324 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = nullptr; |
| 24325 |
|
| 24326 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 24327 |
|
| 24328 |
if (!backendSyncData->hasPrioritziedPropagationLinksEstablished() && assocData) { |
| 24329 |
locBackendSyncDataIndiNode = getLocalizedIndividual(locBackendSyncDataIndiNode, false, calcAlgContext); |
| 24330 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(locBackendSyncDataIndiNode, calcAlgContext); |
| 24331 |
|
| 24332 |
CBackendRepresentativeMemoryLabelCacheItem* neighRoleSetCompIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NEIGHBOUR_INSTANTIATED_ROLE_SET_COMBINATION_LABEL); |
| 24333 |
if (neighRoleSetCompIndiLabel) { |
| 24334 |
|
| 24335 |
CRole* topRole = calcAlgContext->getProcessingDataBox()->getOntology()->getRBox()->getTopObjectRole(); |
| 24336 |
mBackendCacheHandler->visitNeighbourArrayIdsForRole(assocData, topRole, [&](cint64 neighbourArrayId, CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel, bool nondeterministic)->bool { |
| 24337 |
if (nondeterministic && neighbourRoleSetLabel->getCacheValueCount() == 1) { |
| 24338 |
// directly create links to all neighbours since it is a propagation cut |
| 24339 |
initializeNeighbourExpansionWithPropagation(indiNode, locBackendSyncDataIndiNode, locBackendSyncData, backSyncDepTrackPoint, neighbourArrayId, nullptr, false, true, nullptr, true, true, false, calcAlgContext); |
| 24340 |
} |
| 24341 |
return true; |
| 24342 |
}, false, calcAlgContext); |
| 24343 |
|
| 24344 |
} |
| 24345 |
|
| 24346 |
locBackendSyncData->setPrioritziedPropagationLinksEstablished(true); |
| 24347 |
} |
| 24348 |
return true; |
| 24349 |
}, calcAlgContext); |
| 24350 |
|
| 24351 |
|
| 24352 |
//if (CIRIName::getRecentIRIName(indiNode->getNominalIndividual()->getIndividualNameLinker()) == "http://semantics.crl.ibm.com/univ-bench-dl.owl#Baseball") { |
| 24353 |
// bool debug = true; |
| 24354 |
//} |
| 24355 |
|
| 24356 |
|
| 24357 |
if (!backendSyncData->hasAllNeighbourExpansionScheduled()) { |
| 24358 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), checkingMergingsLinker, true, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 24359 |
|
| 24360 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locSyncBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 24361 |
locSyncBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(locBackendSyncDataIndiNode, calcAlgContext); |
| 24362 |
|
| 24363 |
if (backendSyncData && mBackendCacheHandler && locSyncBackendSyncData->getAssocitaionData()) { |
| 24364 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = locSyncBackendSyncData->getAssocitaionData(); |
| 24365 |
|
| 24366 |
bool cardBlockCrit = testIndividualNodeBackendCacheExpansionBlockingCriticalCardinality(indiNode, calcAlgContext); |
| 24367 |
if (cardBlockCrit || testIndividualNodeBackendCacheNeighbourExpansionBlockingCritical(indiNode, calcAlgContext)) { |
| 24368 |
CConceptDescriptor* lastTestedConDes = locSyncBackendSyncData->getLastNeighbourInfluenceTestedConceptDescriptor(); |
| 24369 |
CConceptDescriptor* lastNeighbourCriticalConDes = locSyncBackendSyncData->getLastCriticalNeighbourExpansionTestedConceptDescriptor(); |
| 24370 |
if (cardBlockCrit && !locSyncBackendSyncData->hasNeighbourInfluenceTestingCriticalCardinalityReset()) { |
| 24371 |
lastNeighbourCriticalConDes = nullptr; |
| 24372 |
lastTestedConDes = nullptr; |
| 24373 |
} |
| 24374 |
if (indiNode->getIndividualNodeID() != locBackendSyncDataIndiNode->getIndividualNodeID()) { |
| 24375 |
if (indiNode->getIndividualNodeID() != locSyncBackendSyncData->getLastMergedIntoIndividualTestingCriticalCardinalityReset()) { |
| 24376 |
lastNeighbourCriticalConDes = nullptr; |
| 24377 |
lastTestedConDes = nullptr; |
| 24378 |
} |
| 24379 |
} |
| 24380 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 24381 |
if (conSet) { |
| 24382 |
CConceptDescriptor* conDesLinker = conSet->getAddingSortedConceptDescriptionLinker(); |
| 24383 |
if (conDesLinker != lastTestedConDes) { |
| 24384 |
CConceptDescriptor* conDesIt = conDesLinker; |
| 24385 |
//locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 24386 |
|
| 24387 |
while (conDesIt && conDesIt != lastTestedConDes && conDesIt != lastNeighbourCriticalConDes) { |
| 24388 |
CConcept* concept = conDesIt->getConcept(); |
| 24389 |
bool conNegation = conDesIt->getNegation(); |
| 24390 |
|
| 24391 |
bool nondeterministic = hasNondeterministicDependency(conDesIt->getDependencyTrackPoint(), calcAlgContext) || hasNondeterministicDependency(backSyncDepTrackPoint, calcAlgContext); |
| 24392 |
|
| 24393 |
expandDirectlyInfluencedNeighboursWithPropagation(concept, conNegation, nondeterministic, baseIndiNode, assocData, locBackendSyncDataIndiNode, locSyncBackendSyncData, backSyncDepTrackPoint, calcAlgContext); |
| 24394 |
|
| 24395 |
conDesIt = conDesIt->getNext(); |
| 24396 |
} |
| 24397 |
|
| 24398 |
locSyncBackendSyncData->setLastNeighbourInfluenceTestedConceptDescriptor(conDesLinker); |
| 24399 |
locSyncBackendSyncData->hasNeighbourInfluenceTestingCriticalCardinalityReset(cardBlockCrit); |
| 24400 |
locSyncBackendSyncData->setLastMergedIntoIndividualTestingCriticalCardinalityReset(indiNode->getIndividualNodeID()); |
| 24401 |
} |
| 24402 |
} |
| 24403 |
} |
| 24404 |
} |
| 24405 |
return true; |
| 24406 |
}, calcAlgContext); |
| 24407 |
} |
| 24408 |
|
| 24409 |
|
| 24410 |
|
| 24411 |
|
| 24412 |
|
| 24413 |
if (backendSyncData->getMergedIndividualNodeLinker() != checkingMergingsLinker) { |
| 24414 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 24415 |
if (backendSyncData->getLastDirectExpansionHandledMergedNodeLinker() == checkingMergingsLinker) { |
| 24416 |
locBackendSyncData->setLastDirectExpansionHandledMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 24417 |
} else { |
| 24418 |
locBackendSyncData->setLastInferringExpansionHandledMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 24419 |
} |
| 24420 |
} |
| 24421 |
|
| 24422 |
|
| 24423 |
|
| 24424 |
|
| 24425 |
expandIndirectlyConnectedIndividuals(indiNode, true, calcAlgContext); |
| 24426 |
|
| 24427 |
|
| 24428 |
|
| 24429 |
|
| 24430 |
|
| 24431 |
|
| 24432 |
return lazyNeighboursExpansionSucceded; |
| 24433 |
} |
| 24434 |
|
| 24435 |
|
| 24436 |
|
| 24437 |
|
| 24438 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::queuedIndividualBackendNeighbourExpansion(CIndividualProcessNode*& baseIndiNode, CBackendNeighbourExpansionControllingData* expContData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24439 |
CIndividualProcessNode* indiProcNode = nullptr; |
| 24440 |
|
| 24441 |
baseIndiNode = getLocalizedIndividual(baseIndiNode, true, calcAlgContext); |
| 24442 |
CIndividualProcessNode* mergedIntoBaseIndiNode = getCorrectedMergedIntoIndividualNode(baseIndiNode, calcAlgContext); |
| 24443 |
mergedIntoBaseIndiNode = getLocalizedIndividual(mergedIntoBaseIndiNode, true, calcAlgContext); |
| 24444 |
|
| 24445 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(baseIndiNode, calcAlgContext); |
| 24446 |
CBackendNeighbourExpansionQueue* indiNeighbourExpansionQueue = locBackendSyncData->getBackendNeighbourExpansionQueue(true); |
| 24447 |
|
| 24448 |
cint64 diffNeighExpCount = 0; |
| 24449 |
bool propagationCut = false; |
| 24450 |
|
| 24451 |
while (!propagationCut && indiNeighbourExpansionQueue->hasQueuedNeighbourExpansions() && (diffNeighExpCount++ <= mOptQueuedBackendNeighbourExpansionRolesBatchCount || mOptQueuedBackendNeighbourExpansionRolesBatchCount < 0)) { |
| 24452 |
|
| 24453 |
CBackendNeighbourExpansionQueueDataLinker* backendNeighbourExpDataLinker = indiNeighbourExpansionQueue->takeNextNeighbourExpansionQueueDataLinker(); |
| 24454 |
CBackendNeighbourExpansionQueueDataLinker* newBackendNeighbourExpDataLinker = CObjectParameterizingAllocator<CBackendNeighbourExpansionQueueDataLinker, CProcessContext*>::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 24455 |
newBackendNeighbourExpDataLinker->initQueueData(backendNeighbourExpDataLinker); |
| 24456 |
|
| 24457 |
CIndividualProcessNode* backendSyncDataIndiNode = newBackendNeighbourExpDataLinker->getBackendSyncDataIndividualNode(); |
| 24458 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locHandlingBackendSyncData = locBackendSyncData; |
| 24459 |
if (backendSyncDataIndiNode->getIndividualNodeID() != baseIndiNode->getIndividualNodeID()) { |
| 24460 |
backendSyncDataIndiNode = getLocalizedIndividual(backendSyncDataIndiNode, true, calcAlgContext); |
| 24461 |
locHandlingBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(backendSyncDataIndiNode, calcAlgContext); |
| 24462 |
} |
| 24463 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = locHandlingBackendSyncData->getAssocitaionData(); |
| 24464 |
CDependencyTrackPoint* backSyncDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 24465 |
// TODO/FIX: update dependency track point |
| 24466 |
|
| 24467 |
if (backendSyncDataIndiNode->getIndividualNodeID() != mergedIntoBaseIndiNode->getIndividualNodeID()) { |
| 24468 |
backSyncDepTrackPoint = mergedIntoBaseIndiNode->getIndividualMergingHash(true)->value(-backendSyncDataIndiNode->getIndividualNodeID()).getDependencyTrackPoint(); |
| 24469 |
} |
| 24470 |
|
| 24471 |
|
| 24472 |
cint64 expansionCount = 0; |
| 24473 |
cint64 newCursor = 0; |
| 24474 |
cint64 lastCursor = 0; |
| 24475 |
cint64 newLastExpandedNeighbourId = -1; |
| 24476 |
|
| 24477 |
cint64 currentNeighbourExpansionCount = 0; |
| 24478 |
bool maxDirectNeighbourExpansionReached = false; |
| 24479 |
cint64 deterministicFoundSkippedNeighbourNodeCount = 0; |
| 24480 |
|
| 24481 |
bool oneExpanded = false; |
| 24482 |
bool finished = true; |
| 24483 |
bool forceReadding = false; |
| 24484 |
|
| 24485 |
|
| 24486 |
CPROCESSHASH< CBackendRepresentativeMemoryLabelCacheItem*, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData >* labelNeighbourExpDelayDataHash = nullptr; |
| 24487 |
if (mOptNeighbourLabelRepresentativeExpansionDelaying) { |
| 24488 |
labelNeighbourExpDelayDataHash = locBackendSyncData->getNeighbourLabelExpansionDataHash(newBackendNeighbourExpDataLinker->getNeighbourArrayId(), true); |
| 24489 |
} |
| 24490 |
|
| 24491 |
|
| 24492 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 24493 |
mBackendCacheHandler->visitNeighbourIndividualIdsForNeighbourArrayIdFromCursor(assocData, newBackendNeighbourExpDataLinker->getNeighbourArrayId(), [&](cint64 neighbourIndiId, CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel, bool nondeterministic, cint64 nextCursor)->bool { |
| 24494 |
|
| 24495 |
bool expanded = false; |
| 24496 |
if (canExpansionPotentiallyInfluenceNeighbourWithPotentialPropagation(mergedIntoBaseIndiNode, newBackendNeighbourExpDataLinker->getConcept(), newBackendNeighbourExpDataLinker->getConceptNegation(), newBackendNeighbourExpDataLinker->getConceptNondeterministic(), assocData, neighbourIndiId, calcAlgContext)) { |
| 24497 |
|
| 24498 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[neighbourIndiId]; |
| 24499 |
if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 24500 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourAssData = mBackendCacheHandler->getIndividualAssociationData(neighbourIndiId, calcAlgContext); |
| 24501 |
|
| 24502 |
if (mProcessingDataBox->getBackendCacheIntegratedIndividualNodeCount() >= mOptMaxBackendNeighbourTotalExpansionCount && mOptMaxBackendNeighbourTotalExpansionCount > 0 && (!neighbourAssData || !neighbourAssData->hasProblematicLevel())) { |
| 24503 |
maxDirectNeighbourExpansionReached = true; |
| 24504 |
} |
| 24505 |
|
| 24506 |
|
| 24507 |
if (!maxDirectNeighbourExpansionReached) { |
| 24508 |
newLastExpandedNeighbourId = neighbourIndiId; |
| 24509 |
newCursor = nextCursor; |
| 24510 |
|
| 24511 |
bool representativeExpansion = mOptNeighbourLabelRepresentativeExpansionDelaying; |
| 24512 |
bool delaying = false; |
| 24513 |
bool expandable = true; |
| 24514 |
bool forceExpansion = newBackendNeighbourExpDataLinker->isForceExpansion(); |
| 24515 |
if (newBackendNeighbourExpDataLinker->getConcept()) { |
| 24516 |
expandable = canExpandDirectlyInfluencedNeighbourWithPropagation(mergedIntoBaseIndiNode, locHandlingBackendSyncData, backSyncDepTrackPoint, newBackendNeighbourExpDataLinker->getConcept(), newBackendNeighbourExpDataLinker->getConceptNegation(), newBackendNeighbourExpDataLinker->getConceptNondeterministic(), assocData, neighbourExpansionData, neighbourIndiId, neighbourAssData, calcAlgContext); |
| 24517 |
forceExpansion = true; |
| 24518 |
} |
| 24519 |
bool nonDeterministicConsequencesMissingExpansion = newBackendNeighbourExpDataLinker->isMissingNondeterministicExpansionPropagation(); |
| 24520 |
if (nonDeterministicConsequencesMissingExpansion) { |
| 24521 |
expandable = false; |
| 24522 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourConSetLabel = neighbourAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 24523 |
CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData* cardExtData = (CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData*)neighbourConSetLabel->getExtensionData(CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData::CARDINALITY_HASH); |
| 24524 |
if (cardExtData || neighbourConSetLabel->hasNondeterministicElements()) { |
| 24525 |
expandable = true; |
| 24526 |
} |
| 24527 |
} |
| 24528 |
if (expandable) { |
| 24529 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData* delayingLabelNeighbourExpansionData = nullptr; |
| 24530 |
canDelayRepresentativeNeighbourExpansion(baseIndiNode, newBackendNeighbourExpDataLinker, labelNeighbourExpDelayDataHash, newBackendNeighbourExpDataLinker->getExpandingLabel(), neighbourAssData, newBackendNeighbourExpDataLinker->getNeighbourArrayId(), lastCursor, neighbourIndiId, delayingLabelNeighbourExpansionData, delaying, representativeExpansion, calcAlgContext); |
| 24531 |
|
| 24532 |
if (!delaying) { |
| 24533 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData* representativeLabelNeighbourExpansionData = delayingLabelNeighbourExpansionData; |
| 24534 |
if (!representativeExpansion) { |
| 24535 |
representativeLabelNeighbourExpansionData = nullptr; |
| 24536 |
} |
| 24537 |
if (mergedIntoBaseIndiNode != baseIndiNode && (!backSyncDepTrackPoint || hasNondeterministicDependency(backSyncDepTrackPoint, calcAlgContext))) { |
| 24538 |
expanded |= ensureBaseLinkExpansion(mergedIntoBaseIndiNode, mergedIntoBaseIndiNode, neighbourIndiId, calcAlgContext); |
| 24539 |
} |
| 24540 |
expanded |= expandIndividualNeighbourNodeFromBackendCache(mergedIntoBaseIndiNode, assocData, neighbourIndiId, neighbourExpansionData, forceExpansion, forceExpansion, &representativeLabelNeighbourExpansionData, backSyncDepTrackPoint, calcAlgContext); |
| 24541 |
if (!representativeLabelNeighbourExpansionData) { |
| 24542 |
representativeExpansion = false; |
| 24543 |
} |
| 24544 |
} |
| 24545 |
|
| 24546 |
delayingRepresentativeNeighbourExpansion(locBackendSyncData, delaying, representativeExpansion, delayingLabelNeighbourExpansionData, lastCursor, neighbourIndiId, calcAlgContext); |
| 24547 |
} |
| 24548 |
lastCursor = nextCursor; |
| 24549 |
|
| 24550 |
|
| 24551 |
if (expanded) { |
| 24552 |
// maybe set mIndiNodeFromQueueType |
| 24553 |
currentNeighbourExpansionCount++; |
| 24554 |
oneExpanded = expanded; |
| 24555 |
if (mOptQueuedBackendNeighbourExpansionIndisBatchSize > 0 && currentNeighbourExpansionCount >= mOptQueuedBackendNeighbourExpansionIndisBatchSize) { |
| 24556 |
finished = false; |
| 24557 |
return false; |
| 24558 |
} else { |
| 24559 |
return true; |
| 24560 |
} |
| 24561 |
} else { |
| 24562 |
return true; |
| 24563 |
} |
| 24564 |
} else { |
| 24565 |
propagationCut = true; |
| 24566 |
calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableRepresentativeBackendCacheUpdatingAdapter()->setExpansionLimitReached(); |
| 24567 |
CXLinker<CIndividualProcessNode*>* indiLinker = CObjectAllocator<CXLinker<CIndividualProcessNode*>>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 24568 |
indiLinker->initLinker(backendSyncDataIndiNode); |
| 24569 |
expContData->addCutBackendNeighbourExpansionIndividualLinker(indiLinker); |
| 24570 |
forceReadding = true; |
| 24571 |
finished = false; |
| 24572 |
return false; |
| 24573 |
} |
| 24574 |
} else { |
| 24575 |
lastCursor = nextCursor; |
| 24576 |
newLastExpandedNeighbourId = neighbourIndiId; |
| 24577 |
newCursor = nextCursor; |
| 24578 |
return true; |
| 24579 |
} |
| 24580 |
} else { |
| 24581 |
lastCursor = nextCursor; |
| 24582 |
newLastExpandedNeighbourId = neighbourIndiId; |
| 24583 |
newCursor = nextCursor; |
| 24584 |
deterministicFoundSkippedNeighbourNodeCount++; |
| 24585 |
return true; |
| 24586 |
} |
| 24587 |
|
| 24588 |
}, newBackendNeighbourExpDataLinker->getNeighbourVisitingCursor(), false, calcAlgContext); |
| 24589 |
|
| 24590 |
if (oneExpanded) { |
| 24591 |
indiProcNode = mergedIntoBaseIndiNode; |
| 24592 |
|
| 24593 |
} |
| 24594 |
if (!finished && (newCursor || forceReadding)) { |
| 24595 |
newBackendNeighbourExpDataLinker->updateNeighbourExpansionCursor(newLastExpandedNeighbourId, newCursor); |
| 24596 |
indiNeighbourExpansionQueue->addNeighbourExpansionQueueDataLinker(newBackendNeighbourExpDataLinker, false); |
| 24597 |
} |
| 24598 |
|
| 24599 |
if (propagationCut && newBackendNeighbourExpDataLinker->isPropagationCutExpansion()) { |
| 24600 |
indiNeighbourExpansionQueue->setCuttedPropagationCutPropagation(true); |
| 24601 |
} |
| 24602 |
} |
| 24603 |
|
| 24604 |
|
| 24605 |
|
| 24606 |
if (!indiNeighbourExpansionQueue->hasQueuedNeighbourExpansions() && !locBackendSyncData->hasNeighbourLabelRepresentativeExpansion()) { |
| 24607 |
if (locBackendSyncData->hasAllNeighbourExpansionScheduled()) { |
| 24608 |
locBackendSyncData->setAllNeighbourExpansion(true); |
| 24609 |
} |
| 24610 |
if (locBackendSyncData->hasAllNeighbourForcedExpansionScheduled()) { |
| 24611 |
locBackendSyncData->setAllNeighbourForcedExpansion(true); |
| 24612 |
} |
| 24613 |
} |
| 24614 |
|
| 24615 |
|
| 24616 |
if (propagationCut || !indiNeighbourExpansionQueue->hasQueuedNeighbourExpansions()) { |
| 24617 |
baseIndiNode->setBackendNeighbourExpansionQueued(false); |
| 24618 |
} else { |
| 24619 |
if (mProcessingDataBox->getBackendCacheIntegratedIndividualNodeCount() >= mOptCriticalBackendNeighbourTotalExpansionCount) { |
| 24620 |
mBackendLateNeighbourExpansionQueue = mProcessingDataBox->getBackendLateIndividualNeighbourExpansionQueue(true); |
| 24621 |
mBackendLateNeighbourExpansionQueue->insertIndiviudalProcessNode(baseIndiNode); |
| 24622 |
} else { |
| 24623 |
mBackendNeighbourExpansionQueue->insertIndiviudalProcessNode(baseIndiNode); |
| 24624 |
} |
| 24625 |
} |
| 24626 |
return indiProcNode; |
| 24627 |
} |
| 24628 |
|
| 24629 |
|
| 24630 |
|
| 24631 |
|
| 24632 |
|
| 24633 |
|
| 24634 |
|
| 24635 |
|
| 24636 |
|
| 24637 |
|
| 24638 |
|
| 24639 |
|
| 24640 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::canDelayRepresentativeNeighbourExpansion(CIndividualProcessNode* expIndiNode, CBackendNeighbourExpansionQueueDataLinker* backendNeighbourExpDataLinker, CPROCESSHASH<CBackendRepresentativeMemoryLabelCacheItem *, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData>* labelNeighbourExpDelayDataHash, CBackendRepresentativeMemoryLabelCacheItem* expandingLabel, CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourAssData, cint64 arrayPos, cint64 lastCursor, cint64 neighbourIndiId, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData*& delayingLabelNeighbourExpansionData, bool& expansionDelaying, bool& representativeExpansion, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24641 |
if (labelNeighbourExpDelayDataHash) { |
| 24642 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourConSetLabel = neighbourAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 24643 |
if (!expandingLabel || expandingLabel == neighbourConSetLabel) { |
| 24644 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData& labelNeighbourExpansionData = (*labelNeighbourExpDelayDataHash)[neighbourConSetLabel]; |
| 24645 |
delayingLabelNeighbourExpansionData = &labelNeighbourExpansionData; |
| 24646 |
if (labelNeighbourExpansionData.getNeighbourExpansionArrayId() < 0) { |
| 24647 |
labelNeighbourExpansionData.setNeighbourExpansionArrayId(arrayPos); |
| 24648 |
labelNeighbourExpansionData.setConceptSetLabel(neighbourConSetLabel); |
| 24649 |
labelNeighbourExpansionData.setExpandingIndividiaulNode(expIndiNode); |
| 24650 |
labelNeighbourExpansionData.setExpandingQueueData(backendNeighbourExpDataLinker); |
| 24651 |
} |
| 24652 |
if (isNominalIndividualNodeAvailable(-neighbourIndiId, calcAlgContext)) { |
| 24653 |
expansionDelaying = false; |
| 24654 |
representativeExpansion = false; |
| 24655 |
++mStatRepresentativeExpansionAlreadyExistingNeighbourIndividualCount; |
| 24656 |
} else if (labelNeighbourExpansionData.isNeighbourLabelDelayedRepresentativeExpansion()) { |
| 24657 |
expansionDelaying = true; |
| 24658 |
representativeExpansion = false; |
| 24659 |
++mStatRepresentativeDelayedNeighbourIndividualExpansionCount; |
| 24660 |
} else if (!labelNeighbourExpansionData.hasAllLabelNeighbourExpansionScheduled()) { |
| 24661 |
expansionDelaying = false; |
| 24662 |
representativeExpansion = true; |
| 24663 |
++mStatRepresentativeExpansionTryingNeighbourIndividualCount; |
| 24664 |
} else { |
| 24665 |
expansionDelaying = false; |
| 24666 |
representativeExpansion = false; |
| 24667 |
} |
| 24668 |
} else { |
| 24669 |
expansionDelaying = true; |
| 24670 |
representativeExpansion = false; |
| 24671 |
} |
| 24672 |
} |
| 24673 |
return true; |
| 24674 |
} |
| 24675 |
|
| 24676 |
|
| 24677 |
|
| 24678 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::delayingRepresentativeNeighbourExpansion(CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData, bool expansionDelaying, bool representativeExpansion, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData* labelNeighbourExpansionData, cint64 lastCursor, cint64 neighbourIndiId, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24679 |
if (labelNeighbourExpansionData) { |
| 24680 |
if (representativeExpansion) { |
| 24681 |
++mStatRepresentativeExpandedNeighbourIndividualCount; |
| 24682 |
if (!labelNeighbourExpansionData->isNeighbourLabelDelayedRepresentativeExpansion()) { |
| 24683 |
labelNeighbourExpansionData->setNeighbourLabelDelayedRepresentativeExpansion(true); |
| 24684 |
labelNeighbourExpansionData->setRepresentativeExpandedIndividual(neighbourIndiId); |
| 24685 |
locBackendSyncData->setNeighbourLabelRepresentativeExpansion(true); |
| 24686 |
} |
| 24687 |
} |
| 24688 |
if (expansionDelaying) { |
| 24689 |
if (labelNeighbourExpansionData->getNextLabelNeighbourExpansionIteratorCursor() < 0) { |
| 24690 |
labelNeighbourExpansionData->setNextLabelNeighbourExpansionIteratorCursor(lastCursor); |
| 24691 |
} |
| 24692 |
} |
| 24693 |
} |
| 24694 |
return false; |
| 24695 |
} |
| 24696 |
|
| 24697 |
|
| 24698 |
|
| 24699 |
|
| 24700 |
|
| 24701 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24702 |
bool marked = false; |
| 24703 |
marked |= markIndividualNodeBackendNonConceptSetRelatedProcessing(indiNode, calcAlgContext); |
| 24704 |
marked |= markIndividualNodeBackendNonConceptSetNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 24705 |
return marked; |
| 24706 |
} |
| 24707 |
|
| 24708 |
|
| 24709 |
|
| 24710 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessingForDisjointRoles(CIndividualProcessNode* indiNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24711 |
for (CSortedNegLinker<CRole*>* supRoleIt = role->getIndirectSuperRoleList(); supRoleIt; supRoleIt = supRoleIt->getNext()) { |
| 24712 |
if (supRoleIt->getData()->hasDisjointRoles()) { |
| 24713 |
bool marked = false; |
| 24714 |
marked |= markIndividualNodeBackendNonConceptSetRelatedProcessing(indiNode, calcAlgContext); |
| 24715 |
marked |= markIndividualNodeBackendNonConceptSetNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 24716 |
return marked; |
| 24717 |
} |
| 24718 |
} |
| 24719 |
return false; |
| 24720 |
} |
| 24721 |
|
| 24722 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::markIndividualNodeBackendNonConceptSetRelatedProcessingForDisjointRoles(CIndividualProcessNode* indiNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24723 |
for (CSortedNegLinker<CRole*>* supRoleIt = role->getIndirectSuperRoleList(); supRoleIt; supRoleIt = supRoleIt->getNext()) { |
| 24724 |
if (supRoleIt->getData()->hasDisjointRoles()) { |
| 24725 |
return markIndividualNodeBackendNonConceptSetRelatedProcessing(indiNode, calcAlgContext); |
| 24726 |
} |
| 24727 |
} |
| 24728 |
return false; |
| 24729 |
} |
| 24730 |
|
| 24731 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::markIndividualNodeBackendNonConceptSetNeighbourLabelRelatedProcessingForDisjointRoles(CIndividualProcessNode* indiNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24732 |
for (CSortedNegLinker<CRole*>* supRoleIt = role->getIndirectSuperRoleList(); supRoleIt; supRoleIt = supRoleIt->getNext()) { |
| 24733 |
if (supRoleIt->getData()->hasDisjointRoles()) { |
| 24734 |
return markIndividualNodeBackendNonConceptSetNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 24735 |
} |
| 24736 |
} |
| 24737 |
return false; |
| 24738 |
} |
| 24739 |
|
| 24740 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::markIndividualNodeBackendNonConceptSetNeighbourLabelRelatedProcessing(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24741 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 24742 |
if (backendSyncData && !backendSyncData->hasNonConceptSetBackendLabelRelatedProcessing() && backendSyncData->getAssocitaionData()) { |
| 24743 |
|
| 24744 |
CIndividualProcessNode* locIndiNode = getLocalizedIndividual(indiNode, false, calcAlgContext); |
| 24745 |
|
| 24746 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(locIndiNode, calcAlgContext); |
| 24747 |
locBackendSyncData->setNonConceptSetBackendNeighbourLabelRelatedProcessing(true); |
| 24748 |
|
| 24749 |
if (locBackendSyncData->hasNeighbourLabelRepresentativeExpansionInstalled()) { |
| 24750 |
|
| 24751 |
CXLinker<CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData*>* neighbourLabelRepresentativeExpansionLinker = locBackendSyncData->getNeighbourLabelRepresentativeExpansionLinker(); |
| 24752 |
for (CXLinker<CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData*>* neighbourLabelRepresentativeExpansionLinkerIt = neighbourLabelRepresentativeExpansionLinker; neighbourLabelRepresentativeExpansionLinkerIt; neighbourLabelRepresentativeExpansionLinkerIt = neighbourLabelRepresentativeExpansionLinkerIt->getNext()) { |
| 24753 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData* expData = neighbourLabelRepresentativeExpansionLinkerIt->getData(); |
| 24754 |
CIndividualProcessNode* expBaseIndiNode = expData->getExpandingIndividiaulNode(); |
| 24755 |
CBackendNeighbourExpansionQueueDataLinker* expQueuData = expData->getExpandingQueueData(); |
| 24756 |
|
| 24757 |
|
| 24758 |
CBackendNeighbourExpansionQueueDataLinker* newBackendNeighbourExpDataLinker = CObjectParameterizingAllocator<CBackendNeighbourExpansionQueueDataLinker, CProcessContext*>::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 24759 |
newBackendNeighbourExpDataLinker->initQueueData(expQueuData); |
| 24760 |
newBackendNeighbourExpDataLinker->setExpandingLabel(expData->getConceptSetLabel()); |
| 24761 |
newBackendNeighbourExpDataLinker->updateNeighbourExpansionCursor(expData->getRepresentativeExpandedIndividual(), expData->getNextLabelNeighbourExpansionIteratorCursor()); |
| 24762 |
|
| 24763 |
|
| 24764 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* expLocBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(expBaseIndiNode, calcAlgContext); |
| 24765 |
CBackendNeighbourExpansionQueue* indiNeighbourExpansionQueue = expLocBackendSyncData->getBackendNeighbourExpansionQueue(true); |
| 24766 |
|
| 24767 |
CPROCESSHASH< CBackendRepresentativeMemoryLabelCacheItem*, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData >* labelNeighbourExpDelayDataHash = expLocBackendSyncData->getNeighbourLabelExpansionDataHash(expData->getNeighbourExpansionArrayId(), true); |
| 24768 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationLabelNeighbourExpansionData& expHashData = (*labelNeighbourExpDelayDataHash)[expData->getConceptSetLabel()]; |
| 24769 |
expHashData.setAllLabelNeighbourExpansionScheduled(true); |
| 24770 |
|
| 24771 |
|
| 24772 |
indiNeighbourExpansionQueue->addNeighbourExpansionQueueDataLinker(newBackendNeighbourExpDataLinker, false); |
| 24773 |
|
| 24774 |
if (indiNeighbourExpansionQueue->hasQueuedNeighbourExpansions() && !expBaseIndiNode->isBackendNeighbourExpansionQueued()) { |
| 24775 |
if (mProcessingDataBox->getBackendCacheIntegratedIndividualNodeCount() >= mOptCriticalBackendNeighbourTotalExpansionCount) { |
| 24776 |
CIndividualUnsortedProcessingQueue* backendNeighbourExpansionQueue = calcAlgContext->getUsedProcessingDataBox()->getBackendLateIndividualNeighbourExpansionQueue(true); |
| 24777 |
backendNeighbourExpansionQueue->insertIndiviudalProcessNode(expBaseIndiNode); |
| 24778 |
} else { |
| 24779 |
CIndividualLinkerRotationProcessingQueue* backendNeighbourExpansionQueue = calcAlgContext->getUsedProcessingDataBox()->getBackendIndividualNeighbourExpansionQueue(true); |
| 24780 |
backendNeighbourExpansionQueue->insertIndiviudalProcessNode(expBaseIndiNode); |
| 24781 |
} |
| 24782 |
} |
| 24783 |
|
| 24784 |
} |
| 24785 |
|
| 24786 |
locBackendSyncData->clearNeighbourLabelRepresentativeExpansionLinker(); |
| 24787 |
|
| 24788 |
|
| 24789 |
} |
| 24790 |
} |
| 24791 |
return false; |
| 24792 |
} |
| 24793 |
|
| 24794 |
|
| 24795 |
|
| 24796 |
|
| 24797 |
|
| 24798 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::prepareBackendExpansionReuseBranching(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24799 |
CBackendNeighbourExpansionControllingData* expContData = calcAlgContext->getUsedProcessingDataBox()->getBackendNeighbourExpansionControllingData(true); |
| 24800 |
CREUSEBACKENDEXPANSIONMODESDependencyNode* reuseModesDepNode = expContData->getReuseModesDependencyNode(); |
| 24801 |
if (!reuseModesDepNode) { |
| 24802 |
|
| 24803 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 24804 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 24805 |
|
| 24806 |
|
| 24807 |
CREUSEBACKENDEXPANSIONMODESDependencyNode* reuseDepNode = createREUSEBACKENDEXPANSIONMODESDependency(nullptr, calcAlgContext); |
| 24808 |
|
| 24809 |
processingDataBox->getBackendNeighbourExpansionControllingData(true)->setReuseModesDependencyNode(reuseDepNode); |
| 24810 |
|
| 24811 |
|
| 24812 |
CSatisfiableTaskRepresentativeBackendUpdatingAdapter* repBackCacheUpAdapter = calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableRepresentativeBackendCacheUpdatingAdapter(); |
| 24813 |
if (repBackCacheUpAdapter && !repBackCacheUpAdapter->hasExpansionLimitReached()) { |
| 24814 |
CBackendNeighbourExpansionControllingData* backendExpControllingData = processingDataBox->getBackendNeighbourExpansionControllingData(true); |
| 24815 |
backendExpControllingData->setPrioritizedReuseExpansionMode(true); |
| 24816 |
return true; |
| 24817 |
} else { |
| 24818 |
|
| 24819 |
cint64 taskCreationCount = 2; |
| 24820 |
CSatisfiableCalculationTask* newTaskList = createDependendBranchingTaskList(taskCreationCount, calcAlgContext); |
| 24821 |
|
| 24822 |
CSatisfiableCalculationTask* newTaskIt = newTaskList; |
| 24823 |
|
| 24824 |
|
| 24825 |
for (cint64 i = 0; i < taskCreationCount; ++i) { |
| 24826 |
|
| 24827 |
CSatisfiableCalculationTask* newSatCalcTask = newTaskIt; |
| 24828 |
|
| 24829 |
bool fixedReusingAlternative = i == 0; |
| 24830 |
|
| 24831 |
|
| 24832 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 24833 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext, newProcessContext, newSatCalcTask); |
| 24834 |
CMemoryAllocationManager* newAllocMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 24835 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 24836 |
CBackendNeighbourExpansionControllingData* newBackendExpControllingData = newProcessingDataBox->getBackendNeighbourExpansionControllingData(true); |
| 24837 |
|
| 24838 |
CNonDeterministicDependencyTrackPoint* newDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseDepNode, false, newCalcAlgContext); |
| 24839 |
if (fixedReusingAlternative) { |
| 24840 |
reuseDepNode->setFixedReuseDependencyTrackPoint(newDependencyTrackPoint); |
| 24841 |
} else { |
| 24842 |
reuseDepNode->setPriorizedReuseDependencyTrackPoint(newDependencyTrackPoint); |
| 24843 |
} |
| 24844 |
|
| 24845 |
newBackendExpControllingData->setReuseContinuingDependencyTrackPoint(newDependencyTrackPoint); |
| 24846 |
|
| 24847 |
if (fixedReusingAlternative) { |
| 24848 |
|
| 24849 |
newBackendExpControllingData->setFixedReuseExpansionMode(true); |
| 24850 |
|
| 24851 |
CProcessTagger* newProcessTagger = newCalcAlgContext->getUsedProcessTagger(); |
| 24852 |
newProcessTagger->incBranchingTag(); |
| 24853 |
newProcessTagger->incLocalizationTag(); |
| 24854 |
|
| 24855 |
} else { |
| 24856 |
newBackendExpControllingData->setPrioritizedReuseExpansionMode(true); |
| 24857 |
} |
| 24858 |
|
| 24859 |
// set new task priority |
| 24860 |
double newTaskPriority = calcAlgContext->getUsedTaskPriorityStrategy()->getPriorityForTaskReusing(newSatCalcTask, calcAlgContext->getUsedSatisfiableCalculationTask(), fixedReusingAlternative); |
| 24861 |
newSatCalcTask->setTaskPriority(newTaskPriority); |
| 24862 |
|
| 24863 |
newTaskIt = (CSatisfiableCalculationTask*)newTaskIt->getNext(); |
| 24864 |
|
| 24865 |
} |
| 24866 |
|
| 24867 |
|
| 24868 |
processorContext->getTaskProcessorCommunicator()->communicateTaskCreation(newTaskList); |
| 24869 |
|
| 24870 |
throw CCalculationStopProcessingException(true); |
| 24871 |
} |
| 24872 |
|
| 24873 |
|
| 24874 |
} |
| 24875 |
return false; |
| 24876 |
} |
| 24877 |
|
| 24878 |
|
| 24879 |
|
| 24880 |
|
| 24881 |
|
| 24882 |
|
| 24883 |
|
| 24884 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::prepareBackendIndividualFixedReuseExpansion(CIndividualProcessNode*& indiProcNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24885 |
CBackendNeighbourExpansionControllingData* expContData = calcAlgContext->getUsedProcessingDataBox()->getBackendNeighbourExpansionControllingData(true); |
| 24886 |
CREUSEBACKENDEXPANSIONMODESDependencyNode* reuseModesDepNode = expContData->getReuseModesDependencyNode(); |
| 24887 |
if (reuseModesDepNode) { |
| 24888 |
|
| 24889 |
|
| 24890 |
CNonDeterministicDependencyNode* reuseDepNode = createREUSEBACKENDFIXEDINDIVIDUALEXPANSIONDependency(indiProcNode, expContData->getReuseContinuingDependencyTrackPoint(), calcAlgContext); |
| 24891 |
|
| 24892 |
|
| 24893 |
CNonDeterministicDependencyTrackPoint* newDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseDepNode, true, calcAlgContext); |
| 24894 |
|
| 24895 |
CIndividualProcessNode* newIndiProcNode = getLocalizedIndividual(indiProcNode, false, calcAlgContext); |
| 24896 |
newIndiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSINGINDIVIDUAL); |
| 24897 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(newIndiProcNode, calcAlgContext); |
| 24898 |
locBackendSyncData->setBackendExpansionReuseDependencyTrackPoint(newDependencyTrackPoint); |
| 24899 |
|
| 24900 |
// directly do reuse expansion here, clashes are not problematic |
| 24901 |
|
| 24902 |
|
| 24903 |
return true; |
| 24904 |
|
| 24905 |
|
| 24906 |
} |
| 24907 |
return false; |
| 24908 |
} |
| 24909 |
|
| 24910 |
|
| 24911 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::prepareBackendIndividualPrioritizedReuseExpansion(CIndividualProcessNode*& indiProcNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 24912 |
CBackendNeighbourExpansionControllingData* expContData = calcAlgContext->getUsedProcessingDataBox()->getBackendNeighbourExpansionControllingData(true); |
| 24913 |
CREUSEBACKENDEXPANSIONMODESDependencyNode* reuseModesDepNode = expContData->getReuseModesDependencyNode(); |
| 24914 |
if (reuseModesDepNode) { |
| 24915 |
|
| 24916 |
CTaskProcessorContext* processorContext = calcAlgContext->getUsedTaskProcessorContext(); |
| 24917 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 24918 |
|
| 24919 |
cint64 taskCreationCount = 2; |
| 24920 |
CSatisfiableCalculationTask* newTaskList = createDependendBranchingTaskList(taskCreationCount, calcAlgContext); |
| 24921 |
|
| 24922 |
CSatisfiableCalculationTask* newTaskIt = newTaskList; |
| 24923 |
|
| 24924 |
CNonDeterministicDependencyNode* reuseDepNode = createREUSEBACKENDPRIORITIZEDINDIVIDUALEXPANSIONDependency(indiProcNode, expContData->getReuseContinuingDependencyTrackPoint(), calcAlgContext); |
| 24925 |
|
| 24926 |
|
| 24927 |
for (cint64 i = 0; i < taskCreationCount; ++i) { |
| 24928 |
|
| 24929 |
CSatisfiableCalculationTask* newSatCalcTask = newTaskIt; |
| 24930 |
|
| 24931 |
bool fixedReusingAlternative = i == 0; |
| 24932 |
|
| 24933 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 24934 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext, newProcessContext, newSatCalcTask); |
| 24935 |
CMemoryAllocationManager* newAllocMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 24936 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 24937 |
|
| 24938 |
if (fixedReusingAlternative) { |
| 24939 |
|
| 24940 |
CNonDeterministicDependencyTrackPoint* newDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseDepNode, false, newCalcAlgContext); |
| 24941 |
|
| 24942 |
|
| 24943 |
CProcessingDataBox* newProcessingDataBox = newSatCalcTask->getProcessingDataBox(); |
| 24944 |
|
| 24945 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 24946 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext, newProcessContext, newSatCalcTask); |
| 24947 |
CMemoryAllocationManager* newAllocMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 24948 |
|
| 24949 |
CProcessTagger* newProcessTagger = newCalcAlgContext->getUsedProcessTagger(); |
| 24950 |
newProcessTagger->incBranchingTag(); |
| 24951 |
newProcessTagger->incLocalizationTag(); |
| 24952 |
|
| 24953 |
|
| 24954 |
CIndividualProcessNode* newIndiProcNode = getLocalizedIndividual(indiProcNode, false, newCalcAlgContext); |
| 24955 |
newIndiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSINGINDIVIDUAL); |
| 24956 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(newIndiProcNode, calcAlgContext); |
| 24957 |
locBackendSyncData->setBackendExpansionReuseDependencyTrackPoint(newDependencyTrackPoint); |
| 24958 |
|
| 24959 |
// add to reuse queue, don't do reuse expansion here in case of clashes |
| 24960 |
newProcessingDataBox->getBackendIndividualReuseExpansionQueue(true)->insertIndiviudalProcessNode(newIndiProcNode); |
| 24961 |
|
| 24962 |
prepareBranchedTaskProcessing(newIndiProcNode, newSatCalcTask, newCalcAlgContext); |
| 24963 |
|
| 24964 |
|
| 24965 |
} else { |
| 24966 |
|
| 24967 |
CNonDeterministicDependencyTrackPoint* newDependencyTrackPoint = createNonDeterministicDependencyTrackPointBranch(reuseDepNode, false, newCalcAlgContext); |
| 24968 |
|
| 24969 |
CProcessContext* newProcessContext = newSatCalcTask->getProcessContext(processorContext); |
| 24970 |
CCalculationAlgorithmContextBase* newCalcAlgContext = createCalculationAlgorithmContext(processorContext, newProcessContext, newSatCalcTask); |
| 24971 |
CMemoryAllocationManager* newAllocMemMan = newCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 24972 |
|
| 24973 |
CIndividualProcessNode* newIndiProcNode = getLocalizedIndividual(indiProcNode, false, newCalcAlgContext); |
| 24974 |
// set flag to deactivate reuse |
| 24975 |
newIndiProcNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSEDISCARDED); |
| 24976 |
// add to indirect compatibility checking queue to ensure further expansion is correctly handled |
| 24977 |
newProcessingDataBox->getBackendIndirectCompatibilityExpansionQueue(true)->insertIndiviudalProcessNode(newIndiProcNode); |
| 24978 |
prepareBranchedTaskProcessing(newIndiProcNode, newSatCalcTask, newCalcAlgContext); |
| 24979 |
|
| 24980 |
} |
| 24981 |
|
| 24982 |
// set new task priority |
| 24983 |
double newTaskPriority = calcAlgContext->getUsedTaskPriorityStrategy()->getPriorityForTaskReusing(newSatCalcTask, calcAlgContext->getUsedSatisfiableCalculationTask(), fixedReusingAlternative); |
| 24984 |
newSatCalcTask->setTaskPriority(newTaskPriority); |
| 24985 |
|
| 24986 |
newTaskIt = (CSatisfiableCalculationTask*)newTaskIt->getNext(); |
| 24987 |
|
| 24988 |
} |
| 24989 |
|
| 24990 |
|
| 24991 |
processorContext->getTaskProcessorCommunicator()->communicateTaskCreation(newTaskList); |
| 24992 |
|
| 24993 |
throw CCalculationStopProcessingException(true); |
| 24994 |
|
| 24995 |
|
| 24996 |
} |
| 24997 |
return false; |
| 24998 |
} |
| 24999 |
|
| 25000 |
|
| 25001 |
|
| 25002 |
|
| 25003 |
|
| 25004 |
|
| 25005 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::checkIndividualBackendExpansionReuseable(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25006 |
bool reusable = true; |
| 25007 |
|
| 25008 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 25009 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 25010 |
if (assocData) { |
| 25011 |
CDependencyTrackPoint* reuseExpDepTrackPoint = backendSyncData->getBackendExpansionReuseDependencyTrackPoint(); |
| 25012 |
CBackendRepresentativeMemoryLabelCacheItem* conLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 25013 |
if (conLabel && conLabel->hasNondeterministicElements()) { |
| 25014 |
// check whether non-deterministic concepts from backend cache can be added |
| 25015 |
|
| 25016 |
CReapplyConceptLabelSet* conSetLabel = indiNode->getReapplyConceptLabelSet(false); |
| 25017 |
if (conSetLabel) { |
| 25018 |
mBackendCacheHandler->visitConceptsOfAssociatedFullConceptSetLabel(assocData, conLabel, [&](CConcept* concept, bool negation, bool deterministic)->bool { |
| 25019 |
if (!deterministic) { |
| 25020 |
CConceptDescriptor* conDes = nullptr; |
| 25021 |
CDependencyTrackPoint* depTrackPoint = nullptr; |
| 25022 |
if (conSetLabel->getConceptDescriptor(concept, conDes, depTrackPoint)) { |
| 25023 |
if (conDes->isNegated() != negation) { |
| 25024 |
// negation of concept is already present, reuse not possible |
| 25025 |
// disable reuse only if dependency is deterministic in order to ensure that problematic/involved individuals are correctly reported |
| 25026 |
bool nondeterministically = hasNondeterministicDependency(depTrackPoint, calcAlgContext); |
| 25027 |
if (!nondeterministically) { |
| 25028 |
reusable = false; |
| 25029 |
return false; |
| 25030 |
} |
| 25031 |
} |
| 25032 |
} |
| 25033 |
if (conSetLabel->hasConcept(concept, !negation)) { |
| 25034 |
reusable = false; |
| 25035 |
return false; |
| 25036 |
} |
| 25037 |
} |
| 25038 |
return true; |
| 25039 |
|
| 25040 |
}, false, true, calcAlgContext); |
| 25041 |
} |
| 25042 |
} |
| 25043 |
|
| 25044 |
|
| 25045 |
|
| 25046 |
|
| 25047 |
CBackendRepresentativeMemoryLabelCacheItem* nonDetDiffIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_DIFFRENT_INDIVIDUAL_SET_LABEL); |
| 25048 |
CBackendRepresentativeMemoryLabelCacheItem* detSameIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 25049 |
if (nonDetDiffIndiLabel) { |
| 25050 |
// check whether some merging is possible |
| 25051 |
CIndividualMergingHash* mergedHash = indiNode->getIndividualMergingHash(false); |
| 25052 |
|
| 25053 |
if (mergedHash) { |
| 25054 |
mBackendCacheHandler->visitIndividualIdsOfAssociatedIndividualSetLabel(assocData, nonDetDiffIndiLabel, [&](cint64 diffIndiId)->bool { |
| 25055 |
CIndividualMergingHashData mergingData = mergedHash->value(diffIndiId); |
| 25056 |
if (diffIndiId != indiNode->getNominalIndividual()->getIndividualID() && !mBackendCacheHandler->hasIndividualIdsInAssociatedIndividualSetLabel(assocData, detSameIndiLabel, diffIndiId) && mergingData.isMergedWithIndividual()) { |
| 25057 |
CDependencyTrackPoint* depTrackPoint = mergingData.getDependencyTrackPoint(); |
| 25058 |
// disable reuse only if dependency is deterministic in order to ensure that problematic/involved individuals are correctly reported |
| 25059 |
bool nondeterministically = hasNondeterministicDependency(depTrackPoint, calcAlgContext); |
| 25060 |
if (!nondeterministically) { |
| 25061 |
reusable = false; |
| 25062 |
return false; |
| 25063 |
} |
| 25064 |
} |
| 25065 |
return true; |
| 25066 |
|
| 25067 |
}, calcAlgContext); |
| 25068 |
} |
| 25069 |
} |
| 25070 |
|
| 25071 |
|
| 25072 |
|
| 25073 |
} |
| 25074 |
|
| 25075 |
if (!reusable) { |
| 25076 |
indiNode->addProcessingRestrictionFlags(CIndividualProcessNode::PRFBACKENDEXPANSIONREUSEDISCARDED); |
| 25077 |
} |
| 25078 |
|
| 25079 |
|
| 25080 |
return reusable; |
| 25081 |
} |
| 25082 |
|
| 25083 |
|
| 25084 |
|
| 25085 |
|
| 25086 |
|
| 25087 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::reuseIndividualBackendExpansion(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25088 |
|
| 25089 |
bool lazyNeighboursExpansionSucceded = true; |
| 25090 |
|
| 25091 |
|
| 25092 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 25093 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = locBackendSyncData; |
| 25094 |
|
| 25095 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 25096 |
|
| 25097 |
|
| 25098 |
|
| 25099 |
if (!backendSyncData->hasReuseNonDeterministicSameIndividualMerged() && assocData) { |
| 25100 |
CDependencyTrackPoint* reuseExpDepTrackPoint = backendSyncData->getBackendExpansionReuseDependencyTrackPoint(); |
| 25101 |
CBackendRepresentativeMemoryLabelCacheItem* nonDetSameIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 25102 |
if (nonDetSameIndiLabel) { |
| 25103 |
// merge all nondeterministic possibly same individuals |
| 25104 |
|
| 25105 |
cint64 mergingIntoId = assocData->getRepresentativeSameIndividualId(); |
| 25106 |
mBackendCacheHandler->visitIndividualIdsOfAssociatedIndividualSetLabel(assocData, nonDetSameIndiLabel, [&](cint64 sameIndiId)->bool { |
| 25107 |
if (sameIndiId < mergingIntoId) { |
| 25108 |
mergingIntoId = sameIndiId; |
| 25109 |
} |
| 25110 |
return true; |
| 25111 |
}, calcAlgContext); |
| 25112 |
|
| 25113 |
|
| 25114 |
mBackendCacheHandler->visitIndividualIdsOfAssociatedIndividualSetLabel(assocData, nonDetSameIndiLabel, [&](cint64 sameIndiId)->bool { |
| 25115 |
|
| 25116 |
if (sameIndiId != mergingIntoId) { |
| 25117 |
|
| 25118 |
CIndividualProcessNode* locMergingIntoIndiNode = getLocalizedForcedBackendInitializedNominalIndividualNode(mergingIntoId, calcAlgContext); |
| 25119 |
|
| 25120 |
CIndividualMergingHash* mergedHash = locMergingIntoIndiNode->getIndividualMergingHash(false); |
| 25121 |
if (!mergedHash || !mergedHash->contains(sameIndiId)) { |
| 25122 |
|
| 25123 |
CIndividualProcessNode* locMergingSameIndiNode = getLocalizedForcedBackendInitializedNominalIndividualNode(sameIndiId, calcAlgContext); |
| 25124 |
|
| 25125 |
mergedHash = locMergingIntoIndiNode->getIndividualMergingHash(false); |
| 25126 |
if (!mergedHash || !mergedHash->contains(sameIndiId)) { |
| 25127 |
|
| 25128 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 25129 |
if (isIndividualNodesMergeable(locMergingIntoIndiNode, locMergingSameIndiNode, clashDescriptors, calcAlgContext)) { |
| 25130 |
|
| 25131 |
CDependencyTrackPoint* mergingSameIndiDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 25132 |
if (-sameIndiId != locMergingSameIndiNode->getIndividualNodeID()) { |
| 25133 |
mergingSameIndiDepTrackPoint = locMergingSameIndiNode->getIndividualMergingHash(true)->value(sameIndiId).getDependencyTrackPoint(); |
| 25134 |
} |
| 25135 |
|
| 25136 |
// create dependency |
| 25137 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 25138 |
CSAMEINDIVIDUALSMERGEDependencyNode* mergingSameExpansionDependencyNode = createSAMEINDIVIDUALMERGEDependency(nextDepTrackPoint, locMergingIntoIndiNode, reuseExpDepTrackPoint, mergingSameIndiDepTrackPoint, calcAlgContext); |
| 25139 |
|
| 25140 |
locMergingIntoIndiNode = getMergedIndividualNodes(locMergingIntoIndiNode, locMergingSameIndiNode, nextDepTrackPoint, calcAlgContext); |
| 25141 |
} else { |
| 25142 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, indiNode, nullptr, reuseExpDepTrackPoint, calcAlgContext); |
| 25143 |
if (-mergingIntoId != locMergingIntoIndiNode->getIndividualNodeID()) { |
| 25144 |
CDependencyTrackPoint* depTrackPoint = locMergingIntoIndiNode->getIndividualMergingHash(true)->value(mergingIntoId).getDependencyTrackPoint(); |
| 25145 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, locMergingIntoIndiNode, nullptr, depTrackPoint, calcAlgContext); |
| 25146 |
} |
| 25147 |
if (-sameIndiId != locMergingSameIndiNode->getIndividualNodeID()) { |
| 25148 |
CDependencyTrackPoint* depTrackPoint = locMergingSameIndiNode->getIndividualMergingHash(true)->value(sameIndiId).getDependencyTrackPoint(); |
| 25149 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, locMergingSameIndiNode, nullptr, depTrackPoint, calcAlgContext); |
| 25150 |
} |
| 25151 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 25152 |
} |
| 25153 |
} |
| 25154 |
} |
| 25155 |
} |
| 25156 |
return true; |
| 25157 |
}, calcAlgContext); |
| 25158 |
|
| 25159 |
} |
| 25160 |
|
| 25161 |
locBackendSyncData->setReuseNonDeterministicSameIndividualMerged(true); |
| 25162 |
} |
| 25163 |
|
| 25164 |
|
| 25165 |
|
| 25166 |
CIndividualProcessNode* modifingIndiNode = getCorrectedMergedIntoIndividualNode(indiNode, calcAlgContext); |
| 25167 |
|
| 25168 |
|
| 25169 |
if (!backendSyncData->hasReuseNonDeterministicConceptsAdded() && assocData) { |
| 25170 |
CDependencyTrackPoint* reuseExpDepTrackPoint = backendSyncData->getBackendExpansionReuseDependencyTrackPoint(); |
| 25171 |
CBackendRepresentativeMemoryLabelCacheItem* conLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 25172 |
if (conLabel && conLabel->hasNondeterministicElements()) { |
| 25173 |
// add non-deterministic concepts from backend cache |
| 25174 |
|
| 25175 |
CDependencyTrackPoint* reuseExpDepTrackPoint = backendSyncData->getBackendExpansionReuseDependencyTrackPoint(); |
| 25176 |
mBackendCacheHandler->visitConceptsOfAssociatedFullConceptSetLabel(assocData, conLabel, [&](CConcept* concept, bool negation, bool deterministic)->bool { |
| 25177 |
|
| 25178 |
if (!deterministic) { |
| 25179 |
addConceptToIndividual(concept, negation, modifingIndiNode, reuseExpDepTrackPoint, false, false, calcAlgContext); |
| 25180 |
} |
| 25181 |
return true; |
| 25182 |
|
| 25183 |
}, false, true, calcAlgContext); |
| 25184 |
} |
| 25185 |
|
| 25186 |
locBackendSyncData->setReuseNonDeterministicConceptsAdded(true); |
| 25187 |
} |
| 25188 |
|
| 25189 |
|
| 25190 |
|
| 25191 |
|
| 25192 |
|
| 25193 |
if (assocData && assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL)) { |
| 25194 |
|
| 25195 |
CDependencyTrackPoint* reuseExpDepTrackPoint = backendSyncData->getBackendExpansionReuseDependencyTrackPoint(); |
| 25196 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 25197 |
CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* neighbourRoleSetArray = assocData->getRoleSetNeighbourArray(); |
| 25198 |
if (neighbourRoleSetArray) { |
| 25199 |
CBackendRepresentativeMemoryLabelCacheItemIndividualRoleSetNeighbourArrayIndexExtensionData* neighbourRoleSetArrayIndexData = neighbourRoleSetArray->getIndexData(); |
| 25200 |
for (cint64 i = 0; i < neighbourRoleSetArrayIndexData->getArraySize(); ++i) { |
| 25201 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetlabel = neighbourRoleSetArrayIndexData->getNeighbourRoleSetLabel(i); |
| 25202 |
|
| 25203 |
// check whether neighbour role label has non-deterministic role |
| 25204 |
// TODO: make check more efficient with label extension data |
| 25205 |
mBackendCacheHandler->visitRolesOfAssociatedNeigbourRoleSetLabel(assocData, neighbourRoleSetlabel, [&](CRole* role, bool inversed, bool assertionLinkBase, bool nominalLinkBase, bool nondeterministic)->bool { |
| 25206 |
if (nondeterministic && role && role->getRoleTag() > 1) { |
| 25207 |
|
| 25208 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(modifingIndiNode, calcAlgContext); |
| 25209 |
neighbourRoleSetArray->at(i).visitNeighbourIndividualIds([&](cint64 neighbourIndiId)->bool { |
| 25210 |
|
| 25211 |
if (isNominalIndividualNodeAvailable(-neighbourIndiId, calcAlgContext)) { |
| 25212 |
bool requireLinkCreation = false; |
| 25213 |
CIndividualProcessNode* neighbourNode = getCorrectedNominalIndividualNode(-neighbourIndiId, calcAlgContext); |
| 25214 |
if (!neighbourNode) { |
| 25215 |
requireLinkCreation = true; |
| 25216 |
} else { |
| 25217 |
if (!inversed) { |
| 25218 |
if (!modifingIndiNode->getRoleSuccessorToIndividualLink(role, neighbourNode, true)) { |
| 25219 |
requireLinkCreation = true; |
| 25220 |
} |
| 25221 |
} else { |
| 25222 |
CRole* inverseRole = role->getInverseRole(); |
| 25223 |
if (inverseRole) { |
| 25224 |
if (!modifingIndiNode->getRoleSuccessorToIndividualLink(inverseRole, neighbourNode, true)) { |
| 25225 |
requireLinkCreation = true; |
| 25226 |
} |
| 25227 |
} else { |
| 25228 |
if (!neighbourNode->getRoleSuccessorToIndividualLink(inverseRole, modifingIndiNode, false)) { |
| 25229 |
requireLinkCreation = true; |
| 25230 |
} |
| 25231 |
} |
| 25232 |
} |
| 25233 |
} |
| 25234 |
|
| 25235 |
|
| 25236 |
if (requireLinkCreation) { |
| 25237 |
// first ensure creation of deterministic links |
| 25238 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[neighbourIndiId]; |
| 25239 |
if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 25240 |
CDependencyTrackPoint* backDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 25241 |
|
| 25242 |
if (indiNode != modifingIndiNode) { |
| 25243 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* modLocBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(modifingIndiNode, calcAlgContext); |
| 25244 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* modNeighbourExpansionDataHash = modLocBackendSyncData->getNeighbourExpansionDataHash(true); |
| 25245 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& modNeighbourExpansionData = (*modNeighbourExpansionDataHash)[neighbourIndiId]; |
| 25246 |
|
| 25247 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* modAssocData = modLocBackendSyncData->getAssocitaionData(); |
| 25248 |
if (!modNeighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 25249 |
expandIndividualNeighbourNodeFromBackendCache(modifingIndiNode, modAssocData, neighbourIndiId, modNeighbourExpansionData, true, false, nullptr, backDepTrackPoint, calcAlgContext); |
| 25250 |
} |
| 25251 |
} |
| 25252 |
|
| 25253 |
expandIndividualNeighbourNodeFromBackendCache(modifingIndiNode, assocData, neighbourIndiId, neighbourExpansionData, true, false, nullptr, backDepTrackPoint, calcAlgContext); |
| 25254 |
} |
| 25255 |
if (-neighbourIndiId != neighbourNode->getIndividualNodeID()) { |
| 25256 |
cint64 mergedIntoNeighbourIndiId = neighbourNode->getNominalIndividual()->getIndividualID(); |
| 25257 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[mergedIntoNeighbourIndiId]; |
| 25258 |
if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 25259 |
CDependencyTrackPoint* backDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 25260 |
|
| 25261 |
if (indiNode != modifingIndiNode) { |
| 25262 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* modLocBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(modifingIndiNode, calcAlgContext); |
| 25263 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* modNeighbourExpansionDataHash = modLocBackendSyncData->getNeighbourExpansionDataHash(true); |
| 25264 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& modNeighbourExpansionData = (*modNeighbourExpansionDataHash)[mergedIntoNeighbourIndiId]; |
| 25265 |
|
| 25266 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* modAssocData = modLocBackendSyncData->getAssocitaionData(); |
| 25267 |
if (!modNeighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 25268 |
expandIndividualNeighbourNodeFromBackendCache(modifingIndiNode, modAssocData, mergedIntoNeighbourIndiId, modNeighbourExpansionData, true, false, nullptr, backDepTrackPoint, calcAlgContext); |
| 25269 |
} |
| 25270 |
} |
| 25271 |
|
| 25272 |
expandIndividualNeighbourNodeFromBackendCache(modifingIndiNode, assocData, mergedIntoNeighbourIndiId, neighbourExpansionData, true, false, nullptr, backDepTrackPoint, calcAlgContext); |
| 25273 |
} |
| 25274 |
} |
| 25275 |
|
| 25276 |
CIndividualProcessNode* locNeighbourNode = getLocalizedIndividual(neighbourNode, true, calcAlgContext); |
| 25277 |
CDependencyTrackPoint* nominalConDepTrackPoint = nullptr; |
| 25278 |
if (-neighbourIndiId != locNeighbourNode->getIndividualNodeID() && locNeighbourNode->getIndividualMergingHash(false)) { |
| 25279 |
nominalConDepTrackPoint = locNeighbourNode->getIndividualMergingHash(false)->value(neighbourIndiId).getDependencyTrackPoint(); |
| 25280 |
} |
| 25281 |
|
| 25282 |
|
| 25283 |
if (!inversed) { |
| 25284 |
// create dependency |
| 25285 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 25286 |
|
| 25287 |
if (nominalLinkBase) { |
| 25288 |
CVALUEDependencyNode* valueDepNode = createVALUEDependency(nextDepTrackPoint, modifingIndiNode, nullptr, reuseExpDepTrackPoint, nominalConDepTrackPoint, calcAlgContext); |
| 25289 |
} else { |
| 25290 |
CREUSEBACKENDVALUEDependencyNode* valueDepNode = createREUSEBACKENDVALUEDependency(nextDepTrackPoint, modifingIndiNode, nullptr, reuseExpDepTrackPoint, nominalConDepTrackPoint, calcAlgContext); |
| 25291 |
} |
| 25292 |
// create link |
| 25293 |
createNewIndividualsLinksReapplyed(modifingIndiNode, locNeighbourNode, role->getIndirectSuperRoleList(), role, nextDepTrackPoint, true, calcAlgContext); |
| 25294 |
} else { |
| 25295 |
// create dependency |
| 25296 |
CDependencyTrackPoint* nextDepTrackPoint = nullptr; |
| 25297 |
if (nominalLinkBase) { |
| 25298 |
CVALUEDependencyNode* valueDepNode = createVALUEDependency(nextDepTrackPoint, modifingIndiNode, nullptr, reuseExpDepTrackPoint, nominalConDepTrackPoint, calcAlgContext); |
| 25299 |
} else { |
| 25300 |
CREUSEBACKENDVALUEDependencyNode* valueDepNode = createREUSEBACKENDVALUEDependency(nextDepTrackPoint, modifingIndiNode, nullptr, reuseExpDepTrackPoint, nominalConDepTrackPoint, calcAlgContext); |
| 25301 |
} |
| 25302 |
|
| 25303 |
// create link |
| 25304 |
createNewIndividualsLinksReapplyed(locNeighbourNode, modifingIndiNode, role->getIndirectSuperRoleList(), role, nextDepTrackPoint, true, calcAlgContext); |
| 25305 |
} |
| 25306 |
propagateIndividualNodeModified(locNeighbourNode, calcAlgContext); |
| 25307 |
addIndividualToProcessingQueue(locNeighbourNode, calcAlgContext); |
| 25308 |
} |
| 25309 |
} |
| 25310 |
|
| 25311 |
return true; |
| 25312 |
}); |
| 25313 |
} |
| 25314 |
return true; |
| 25315 |
}); |
| 25316 |
|
| 25317 |
|
| 25318 |
} |
| 25319 |
} |
| 25320 |
} |
| 25321 |
|
| 25322 |
|
| 25323 |
|
| 25324 |
|
| 25325 |
|
| 25326 |
if (!backendSyncData->hasReuseNonDeterministicDifferentIndividualStated() && assocData) { |
| 25327 |
CDependencyTrackPoint* reuseExpDepTrackPoint = backendSyncData->getBackendExpansionReuseDependencyTrackPoint(); |
| 25328 |
CBackendRepresentativeMemoryLabelCacheItem* nonDetDiffIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_DIFFRENT_INDIVIDUAL_SET_LABEL); |
| 25329 |
CBackendRepresentativeMemoryLabelCacheItem* detSameIndiLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 25330 |
if (nonDetDiffIndiLabel) { |
| 25331 |
// add distinct links for all non-deterministic different individuals |
| 25332 |
|
| 25333 |
mBackendCacheHandler->visitIndividualIdsOfAssociatedIndividualSetLabel(assocData, nonDetDiffIndiLabel, [&](cint64 diffIndiId)->bool { |
| 25334 |
|
| 25335 |
if (diffIndiId != indiNode->getNominalIndividual()->getIndividualID() && !mBackendCacheHandler->hasIndividualIdsInAssociatedIndividualSetLabel(assocData, detSameIndiLabel, diffIndiId)) { |
| 25336 |
CIndividualProcessNode* locDifferentIndiNode = getLocalizedForcedBackendInitializedNominalIndividualNode(diffIndiId, calcAlgContext); |
| 25337 |
|
| 25338 |
CIndividualProcessNode* corrIndiNode = getCorrectedMergedIntoIndividualNode(modifingIndiNode, calcAlgContext); |
| 25339 |
CIndividualMergingHash* mergedHash = corrIndiNode->getIndividualMergingHash(false); |
| 25340 |
if (mergedHash && mergedHash->hasMergedIndividual(diffIndiId)) { |
| 25341 |
// clash |
| 25342 |
|
| 25343 |
CClashedDependencyDescriptor* clashDescriptors = nullptr; |
| 25344 |
CDependencyTrackPoint* depTrackPoint = mergedHash->value(diffIndiId).getDependencyTrackPoint(); |
| 25345 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, locDifferentIndiNode, nullptr, reuseExpDepTrackPoint, calcAlgContext); |
| 25346 |
clashDescriptors = createClashedConceptDescriptor(clashDescriptors, corrIndiNode, nullptr, depTrackPoint, calcAlgContext); |
| 25347 |
throw CCalculationClashProcessingException(clashDescriptors); |
| 25348 |
|
| 25349 |
} else { |
| 25350 |
createIndividualsDistinct(corrIndiNode, locDifferentIndiNode, reuseExpDepTrackPoint, calcAlgContext); |
| 25351 |
} |
| 25352 |
} |
| 25353 |
return true; |
| 25354 |
|
| 25355 |
}, calcAlgContext); |
| 25356 |
} |
| 25357 |
|
| 25358 |
locBackendSyncData->setReuseNonDeterministicDifferentIndividualStated(true); |
| 25359 |
} |
| 25360 |
|
| 25361 |
|
| 25362 |
|
| 25363 |
|
| 25364 |
|
| 25365 |
|
| 25366 |
|
| 25367 |
return lazyNeighboursExpansionSucceded; |
| 25368 |
} |
| 25369 |
|
| 25370 |
|
| 25371 |
|
| 25372 |
|
| 25373 |
|
| 25374 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::ensurePropagationCutLinksToExpandedIndividual(CIndividualProcessNode* propCutIndiNode, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locPropCutIndiBackendSyncData, CBackendNeighbourExpansionQueueDataLinker* backendNeighbourExpDataLinker, cint64 neighbourIndiId, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25375 |
bool expanded = false; |
| 25376 |
CIndividualProcessNode* baseIndiNode = propCutIndiNode; |
| 25377 |
baseIndiNode = getLocalizedIndividual(baseIndiNode, true, calcAlgContext); |
| 25378 |
CIndividualProcessNode* mergedIntoBaseIndiNode = getCorrectedMergedIntoIndividualNode(baseIndiNode, calcAlgContext); |
| 25379 |
mergedIntoBaseIndiNode = getLocalizedIndividual(mergedIntoBaseIndiNode, true, calcAlgContext); |
| 25380 |
|
| 25381 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = locPropCutIndiBackendSyncData; |
| 25382 |
|
| 25383 |
CIndividualProcessNode* backendSyncDataIndiNode = propCutIndiNode; |
| 25384 |
if (backendNeighbourExpDataLinker) { |
| 25385 |
backendSyncDataIndiNode = backendNeighbourExpDataLinker->getBackendSyncDataIndividualNode(); |
| 25386 |
} |
| 25387 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locHandlingBackendSyncData = locBackendSyncData; |
| 25388 |
if (backendSyncDataIndiNode->getIndividualNodeID() != baseIndiNode->getIndividualNodeID()) { |
| 25389 |
backendSyncDataIndiNode = getLocalizedIndividual(backendSyncDataIndiNode, true, calcAlgContext); |
| 25390 |
locHandlingBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(backendSyncDataIndiNode, calcAlgContext); |
| 25391 |
} |
| 25392 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = locHandlingBackendSyncData->getAssocitaionData(); |
| 25393 |
CDependencyTrackPoint* backSyncDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 25394 |
// TODO/FIX: update dependency track point |
| 25395 |
|
| 25396 |
|
| 25397 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 25398 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[neighbourIndiId]; |
| 25399 |
if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 25400 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourAssData = mBackendCacheHandler->getIndividualAssociationData(neighbourIndiId, calcAlgContext); |
| 25401 |
|
| 25402 |
|
| 25403 |
bool expandable = true; |
| 25404 |
bool forceExpansion = true; |
| 25405 |
if (backendNeighbourExpDataLinker) { |
| 25406 |
forceExpansion = backendNeighbourExpDataLinker->isForceExpansion(); |
| 25407 |
} |
| 25408 |
if (backendNeighbourExpDataLinker && backendNeighbourExpDataLinker->getConcept()) { |
| 25409 |
expandable = canExpandDirectlyInfluencedNeighbourWithPropagation(mergedIntoBaseIndiNode, locHandlingBackendSyncData, backSyncDepTrackPoint, backendNeighbourExpDataLinker->getConcept(), backendNeighbourExpDataLinker->getConceptNegation(), backendNeighbourExpDataLinker->getConceptNondeterministic(), assocData, neighbourExpansionData, neighbourIndiId, neighbourAssData, calcAlgContext); |
| 25410 |
forceExpansion = true; |
| 25411 |
} |
| 25412 |
if (expandable) { |
| 25413 |
expanded = expandIndividualNeighbourNodeFromBackendCache(mergedIntoBaseIndiNode, assocData, neighbourIndiId, neighbourExpansionData, forceExpansion, forceExpansion, nullptr, backSyncDepTrackPoint, calcAlgContext); |
| 25414 |
} |
| 25415 |
} |
| 25416 |
|
| 25417 |
if (expanded) { |
| 25418 |
addIndividualToProcessingQueue(mergedIntoBaseIndiNode, calcAlgContext); |
| 25419 |
} |
| 25420 |
|
| 25421 |
return expanded; |
| 25422 |
} |
| 25423 |
|
| 25424 |
|
| 25425 |
|
| 25426 |
|
| 25427 |
|
| 25428 |
|
| 25429 |
|
| 25430 |
|
| 25431 |
|
| 25432 |
|
| 25433 |
|
| 25434 |
|
| 25435 |
|
| 25436 |
|
| 25437 |
|
| 25438 |
|
| 25439 |
|
| 25440 |
|
| 25441 |
|
| 25442 |
|
| 25443 |
|
| 25444 |
|
| 25445 |
|
| 25446 |
|
| 25447 |
|
| 25448 |
|
| 25449 |
|
| 25450 |
|
| 25451 |
|
| 25452 |
|
| 25453 |
|
| 25454 |
|
| 25455 |
|
| 25456 |
|
| 25457 |
|
| 25458 |
|
| 25459 |
|
| 25460 |
|
| 25461 |
|
| 25462 |
|
| 25463 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getLocalizedForcedBackendInitializedNominalIndividualNode(cint64 nominalId, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25464 |
CIndividualProcessNode* differentIndiNode = getCorrectedNominalIndividualNode(-nominalId, calcAlgContext); |
| 25465 |
return getLocalizedForcedBackendInitializedNominalIndividualNode(differentIndiNode, calcAlgContext); |
| 25466 |
} |
| 25467 |
|
| 25468 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getLocalizedForcedBackendInitializedNominalIndividualNode(CIndividualProcessNode* indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25469 |
CIndividualProcessNode* locIndi = getLocalizedIndividual(indi, false, calcAlgContext); |
| 25470 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locIndi->getIndividualBackendCacheSynchronisationData(false); |
| 25471 |
if (backendSyncData && !backendSyncData->isBackendConceptSetInitializationRequired() && locIndi->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENPROCESSINGDELAYING)) { |
| 25472 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indi, calcAlgContext); |
| 25473 |
locBackendSyncData->setBackendConceptSetInitializationRequired(true); |
| 25474 |
if (locBackendSyncData->isBackendConceptSetInitializationQueued()) { |
| 25475 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHash* useBackendConceptSetLabelProcessingHash = calcAlgContext->getProcessingDataBox()->getBackendCacheConceptSetLabelProcessingHash(true); |
| 25476 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher hasher = getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(indi, calcAlgContext); |
| 25477 |
CIndividualRepresentativeBackendCacheConceptSetLabelProcessingData& processingData = (*useBackendConceptSetLabelProcessingHash)[hasher]; |
| 25478 |
processingData.decQueuedNodeInitializingCount(); |
| 25479 |
} |
| 25480 |
} |
| 25481 |
if (!backendSyncData || !backendSyncData->isBackendConceptSetInitialized() || indi != locIndi) { |
| 25482 |
locIndi = getForcedInitializedNominalIndividualNode(locIndi, calcAlgContext); |
| 25483 |
} |
| 25484 |
return locIndi; |
| 25485 |
} |
| 25486 |
|
| 25487 |
|
| 25488 |
|
| 25489 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getForcedInitializedNominalIndividualNode(CIndividualProcessNode* indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25490 |
++mCurrentRecProcDepth; |
| 25491 |
CIndividualProcessNode* nominalIndividual = indi; |
| 25492 |
initialNodeInitialize(nominalIndividual, false, calcAlgContext); |
| 25493 |
--mCurrentRecProcDepth; |
| 25494 |
return nominalIndividual; |
| 25495 |
} |
| 25496 |
|
| 25497 |
|
| 25498 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::expandDirectlyInfluencedNeighboursWithPropagation(CConcept* concept, bool conNegation, bool nondeterministic, CIndividualProcessNode* indiNode, CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData, CIndividualProcessNode* locBackendSyncDataIndiNode, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData, CDependencyTrackPoint* backSyncDepTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25499 |
|
| 25500 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 25501 |
CRole* role = concept->getRole(); |
| 25502 |
|
| 25503 |
cint64 opCode = concept->getOperatorCode(); |
| 25504 |
CSortedNegLinker<CConcept*>* opConcepts = concept->getOperandList(); |
| 25505 |
if (mConfSpecializedAutomateRules && (opCode == CCAQAND || opCode == CCIMPLAQAND || opCode == CCBRANCHAQAND)) { |
| 25506 |
while (opConcepts) { |
| 25507 |
CConcept* opCon = opConcepts->getData(); |
| 25508 |
bool opConNeg = opConcepts->isNegated(); |
| 25509 |
expandDirectlyInfluencedNeighboursWithPropagation(opCon, opConNeg, nondeterministic, indiNode, assocData, locBackendSyncDataIndiNode, locBackendSyncData, backSyncDepTrackPoint, calcAlgContext); |
| 25510 |
opConcepts = opConcepts->getNext(); |
| 25511 |
} |
| 25512 |
return true; |
| 25513 |
} else if (!conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCF_ATMOST) || conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_SOME_TYPE | CConceptOperator::CCF_ATLEAST)) { |
| 25514 |
// TODO: verify cardinality is indeed critical |
| 25515 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST) || |
| 25516 |
mBackendCacheHandler->hasRoleInAssociatedCombinedNeigbourRoleSetLabel(assocData, assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL), role, false) || |
| 25517 |
mBackendCacheHandler->hasRoleInAssociatedCombinedNeigbourRoleSetLabel(assocData, assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL), role, false)) { |
| 25518 |
|
| 25519 |
if (role) { |
| 25520 |
mBackendCacheHandler->visitNeighbourArrayIdsForRole(assocData, role, [&](cint64 neighbourArrayId, CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel, bool nondeterministic)->bool { |
| 25521 |
|
| 25522 |
initializeNeighbourExpansionWithPropagation(indiNode, locBackendSyncDataIndiNode, locBackendSyncData, backSyncDepTrackPoint, neighbourArrayId, concept, conNegation, nondeterministic, role, true, false, false, calcAlgContext); |
| 25523 |
return true; |
| 25524 |
|
| 25525 |
}, false, calcAlgContext); |
| 25526 |
|
| 25527 |
|
| 25528 |
} |
| 25529 |
} |
| 25530 |
return true; |
| 25531 |
} |
| 25532 |
|
| 25533 |
return false; |
| 25534 |
} |
| 25535 |
|
| 25536 |
|
| 25537 |
|
| 25538 |
|
| 25539 |
|
| 25540 |
|
| 25541 |
|
| 25542 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::ensureBaseLinkExpansion(CIndividualProcessNode* expIndiNode, CIndividualProcessNode* indiNode, cint64 neighbourNodeId, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25543 |
bool expanded = false; |
| 25544 |
CDependencyTrackPoint* baseDepTrackPoint = calcAlgContext->getBaseDependencyNode()->getContinueDependencyTrackPoint(); |
| 25545 |
|
| 25546 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* indiNodeBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 25547 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* indiNodeAssocData = indiNodeBackendSyncData->getAssocitaionData(); |
| 25548 |
if (indiNodeAssocData) { |
| 25549 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourLabel = nullptr; |
| 25550 |
CBackendRepresentativeMemoryCacheIndividualNeighbourRoleSetHash* indiNodeHash = indiNodeAssocData->getNeighbourRoleSetHash(); |
| 25551 |
if (indiNodeHash) { |
| 25552 |
neighbourLabel = indiNodeHash->getNeighbourRoleSetLabel(neighbourNodeId); |
| 25553 |
} |
| 25554 |
|
| 25555 |
if (neighbourLabel) { |
| 25556 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData tmpExpansionData; |
| 25557 |
expanded = expandIndividualNeighbourNodeFromBackendCache(indiNode, indiNodeAssocData, neighbourNodeId, tmpExpansionData, true, false, nullptr, baseDepTrackPoint, calcAlgContext); |
| 25558 |
} else { |
| 25559 |
CIndividualProcessNode* neighbourIndiNode = getLocalizedIndividual(-neighbourNodeId, calcAlgContext); |
| 25560 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* neighbourIndiNodeBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(neighbourIndiNode, calcAlgContext); |
| 25561 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourIndiNodeAssocData = neighbourIndiNodeBackendSyncData->getAssocitaionData(); |
| 25562 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData tmpExpansionData; |
| 25563 |
expanded = expandIndividualNeighbourNodeFromBackendCache(neighbourIndiNode, neighbourIndiNodeAssocData, expIndiNode->getNominalIndividual()->getIndividualID(), tmpExpansionData, true, false, nullptr, baseDepTrackPoint, calcAlgContext); |
| 25564 |
} |
| 25565 |
} |
| 25566 |
|
| 25567 |
return expanded; |
| 25568 |
} |
| 25569 |
|
| 25570 |
|
| 25571 |
|
| 25572 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::initializeNeighbourExpansionWithPropagation(CIndividualProcessNode* indiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData, CDependencyTrackPoint* backSyncDepTrackPoint, cint64 arrayId, CConcept* concept, bool conNegation, bool nondeterministic, CRole* role, bool forceExpansion, bool propCutExpansion, bool nonDeterministicConsequencesMissingExpansion, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25573 |
markIndividualNodeBackendNonConceptSetRelatedAndNeighbourLabelRelatedProcessing(indiNode, calcAlgContext); |
| 25574 |
cint64 currentDirectNeighbourExpansionCount = 0; |
| 25575 |
bool maxDirectNeighbourExpansionReached = false; |
| 25576 |
cint64 lastExpansionVisitedNeighbourNode = -1; |
| 25577 |
cint64 checkedNeighbourNodeCount = 0; |
| 25578 |
cint64 iteratedNeighbourNodeCount = 0; |
| 25579 |
cint64 deterministicFoundSkippedNeighbourNodeCount = 0; |
| 25580 |
cint64 lastCursor = 0; |
| 25581 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = locBackendSyncData->getAssocitaionData(); |
| 25582 |
|
| 25583 |
bool forceAllDirectExpansion = false; |
| 25584 |
|
| 25585 |
if (mConfAtmostAllDirectBackendNeighbourExpansion && concept) { |
| 25586 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 25587 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST)) { |
| 25588 |
forceAllDirectExpansion = true; |
| 25589 |
} |
| 25590 |
} |
| 25591 |
|
| 25592 |
|
| 25593 |
|
| 25594 |
//QString indiName = CIRIName::getRecentIRIName(indiNode->getNominalIndividual()->getIndividualNameLinker()); |
| 25595 |
//if (indiName.contains("#Baseball") || indiName.contains("#BasketBall") || indiName.contains("#Tennis")) { |
| 25596 |
// bool debug = true; |
| 25597 |
//} |
| 25598 |
bool queuedExpansion = false; |
| 25599 |
|
| 25600 |
|
| 25601 |
cint64 minBackendNeighbourDirectExpansionCount = mOptMinBackendNeighbourDirectExpansionCount; |
| 25602 |
cint64 expandedCount = calcAlgContext->getUsedProcessingDataBox()->getBackendCacheIntegratedIndividualNodeCount(); |
| 25603 |
if (expandedCount > mOptCriticalBackendNeighbourTotalExpansionCount) { |
| 25604 |
if (mOptMinDirectNeighbourExpansionOverCriticalReductionSize > 0) { |
| 25605 |
cint64 reductionCount = (expandedCount - mOptCriticalBackendNeighbourTotalExpansionCount) / mOptMinDirectNeighbourExpansionOverCriticalReductionSize; |
| 25606 |
minBackendNeighbourDirectExpansionCount = qMax(minBackendNeighbourDirectExpansionCount - reductionCount, (cint64)0); |
| 25607 |
} else if (mOptMinDirectNeighbourExpansionOverCriticalReductionSize < 0) { |
| 25608 |
minBackendNeighbourDirectExpansionCount = 0; |
| 25609 |
} |
| 25610 |
} |
| 25611 |
|
| 25612 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 25613 |
mBackendCacheHandler->visitNeighbourIndividualIdsForNeighbourArrayIdFromCursor(assocData, arrayId, [&](cint64 neighbourIndiId, CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel, bool nondeterministic, cint64 nextCursor)->bool { |
| 25614 |
|
| 25615 |
++iteratedNeighbourNodeCount; |
| 25616 |
|
| 25617 |
if (canExpansionPotentiallyInfluenceNeighbourWithPotentialPropagation(indiNode, concept, conNegation, nondeterministic, assocData, neighbourIndiId, calcAlgContext)) { |
| 25618 |
|
| 25619 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData = (*neighbourExpansionDataHash)[neighbourIndiId]; |
| 25620 |
if (!neighbourExpansionData.isNeighbourPossiblyInfluenced()) { |
| 25621 |
|
| 25622 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourAssData = mBackendCacheHandler->getIndividualAssociationData(neighbourIndiId, calcAlgContext); |
| 25623 |
|
| 25624 |
checkedNeighbourNodeCount++; |
| 25625 |
|
| 25626 |
if (!forceAllDirectExpansion && mOptLimitBackendNeighbourExpansion && currentDirectNeighbourExpansionCount >= minBackendNeighbourDirectExpansionCount) { |
| 25627 |
if (!mConfAllProblematicBackendNeighbourDirectExpansion || !neighbourAssData || !neighbourAssData->hasProblematicLevel()) { |
| 25628 |
maxDirectNeighbourExpansionReached = true; |
| 25629 |
} |
| 25630 |
} |
| 25631 |
|
| 25632 |
|
| 25633 |
if (!maxDirectNeighbourExpansionReached) { |
| 25634 |
lastExpansionVisitedNeighbourNode = neighbourIndiId; |
| 25635 |
lastCursor = nextCursor; |
| 25636 |
|
| 25637 |
|
| 25638 |
|
| 25639 |
bool expanded = false; |
| 25640 |
bool expandable = true; |
| 25641 |
if (concept) { |
| 25642 |
expandable = canExpandDirectlyInfluencedNeighbourWithPropagation(indiNode, locBackendSyncData, backSyncDepTrackPoint, concept, conNegation, nondeterministic, assocData, neighbourExpansionData, neighbourIndiId, neighbourAssData, calcAlgContext); |
| 25643 |
} |
| 25644 |
if (nonDeterministicConsequencesMissingExpansion) { |
| 25645 |
expandable = false; |
| 25646 |
CBackendRepresentativeMemoryLabelCacheItem* neighbourConSetLabel = neighbourAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 25647 |
CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData* cardExtData = (CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData*)neighbourConSetLabel->getExtensionData(CBackendRepresentativeMemoryLabelCacheItemCardinalityExtensionData::CARDINALITY_HASH); |
| 25648 |
if (cardExtData || neighbourConSetLabel->hasNondeterministicElements()) { |
| 25649 |
expandable = true; |
| 25650 |
} |
| 25651 |
} |
| 25652 |
if (expandable) { |
| 25653 |
bool redExpCons = false; |
| 25654 |
bool redExp = false; |
| 25655 |
if (indiNode != locBackendSyncDataIndiNode && (!backSyncDepTrackPoint || hasNondeterministicDependency(backSyncDepTrackPoint, calcAlgContext))) { |
| 25656 |
redExpCons = ensureBaseLinkExpansion(indiNode, indiNode, neighbourIndiId, calcAlgContext); |
| 25657 |
expanded |= redExpCons; |
| 25658 |
} |
| 25659 |
expanded |= expandIndividualNeighbourNodeFromBackendCache(indiNode, assocData, neighbourIndiId, neighbourExpansionData, forceExpansion, forceExpansion, nullptr, backSyncDepTrackPoint, calcAlgContext); |
| 25660 |
} |
| 25661 |
|
| 25662 |
|
| 25663 |
if (expanded) { |
| 25664 |
CBackendNeighbourExpansionControllingData* backendNeighbourExpansionControllingData = calcAlgContext->getUsedProcessingDataBox()->getBackendNeighbourExpansionControllingData(true); |
| 25665 |
backendNeighbourExpansionControllingData->incExpandedNeighbourLinkCount(); |
| 25666 |
++currentDirectNeighbourExpansionCount; |
| 25667 |
} |
| 25668 |
|
| 25669 |
return true; |
| 25670 |
|
| 25671 |
} else { |
| 25672 |
// store in a expansion-queue to be better able to manage a further expansion |
| 25673 |
CBackendNeighbourExpansionQueueDataLinker* expQueueData = CObjectParameterizingAllocator<CBackendNeighbourExpansionQueueDataLinker, CProcessContext*>::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 25674 |
expQueueData->initQueueData(arrayId, role, concept, conNegation, nondeterministic, forceExpansion, indiNode, locBackendSyncDataIndiNode, lastExpansionVisitedNeighbourNode, lastCursor, propCutExpansion, nonDeterministicConsequencesMissingExpansion); |
| 25675 |
locBackendSyncData->getBackendNeighbourExpansionQueue(true)->addNeighbourExpansionQueueDataLinker(expQueueData, false); |
| 25676 |
addIndividualToBackendNeighbourExpansionQueue(locBackendSyncDataIndiNode, calcAlgContext); |
| 25677 |
|
| 25678 |
queuedExpansion = true; |
| 25679 |
|
| 25680 |
return false; |
| 25681 |
} |
| 25682 |
} else { |
| 25683 |
lastExpansionVisitedNeighbourNode = neighbourIndiId; |
| 25684 |
lastCursor = nextCursor; |
| 25685 |
return true; |
| 25686 |
} |
| 25687 |
} else { |
| 25688 |
lastExpansionVisitedNeighbourNode = neighbourIndiId; |
| 25689 |
lastCursor = nextCursor; |
| 25690 |
deterministicFoundSkippedNeighbourNodeCount++; |
| 25691 |
return true; |
| 25692 |
} |
| 25693 |
|
| 25694 |
}, lastCursor, false, calcAlgContext); |
| 25695 |
|
| 25696 |
return true; |
| 25697 |
} |
| 25698 |
|
| 25699 |
|
| 25700 |
|
| 25701 |
|
| 25702 |
CAnsweringPropagationSteeringController* CCalculationTableauCompletionTaskHandleAlgorithm::getPropagationSteeringController(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25703 |
CSatisfiableTaskAnswererBindingPropagationAdapter* answererMessageAdapter = calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableAnswererBindingPropagationAdapter(); |
| 25704 |
if (answererMessageAdapter) { |
| 25705 |
CAnsweringPropagationSteeringController* propagationSteeringController = answererMessageAdapter->getAnswererPropagationSteeringController(); |
| 25706 |
if (propagationSteeringController) { |
| 25707 |
return propagationSteeringController; |
| 25708 |
} |
| 25709 |
} |
| 25710 |
CSatisfiableTaskAnswererInstancePropagationMessageAdapter* answererPropMessageAdapter = calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableAnswererInstancePropagationMessageAdapter(); |
| 25711 |
if (answererPropMessageAdapter) { |
| 25712 |
CAnsweringPropagationSteeringController* propagationSteeringController = answererPropMessageAdapter->getAnswererPropagationSteeringController(); |
| 25713 |
if (propagationSteeringController) { |
| 25714 |
return propagationSteeringController; |
| 25715 |
} |
| 25716 |
} |
| 25717 |
return nullptr; |
| 25718 |
} |
| 25719 |
|
| 25720 |
|
| 25721 |
|
| 25722 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isNeighbourExpansionWithPropagationAllowed(CIndividualProcessNode* indiNode, CConcept* concept, bool conNegation, cint64 neighbourIndiId, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25723 |
if (mConfVariableBindingSteeringBackendNeighbourExpansion && concept->getVariable()) { |
| 25724 |
CAnsweringPropagationSteeringController* propagationSteeringController = getPropagationSteeringController(calcAlgContext); |
| 25725 |
if (propagationSteeringController) { |
| 25726 |
CVariable* destVar = concept->getVariable(); |
| 25727 |
bool allowProp = propagationSteeringController->isPreparationBindingAllIndividuals(destVar); |
| 25728 |
if (!allowProp) { |
| 25729 |
allowProp = propagationSteeringController->isPreparationBindingNominalIndividual(destVar, neighbourIndiId); |
| 25730 |
} |
| 25731 |
if (!allowProp) { |
| 25732 |
return false; |
| 25733 |
} |
| 25734 |
} |
| 25735 |
} |
| 25736 |
return true; |
| 25737 |
} |
| 25738 |
|
| 25739 |
|
| 25740 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::canExpansionPotentiallyInfluenceNeighbourWithPotentialPropagation(CIndividualProcessNode* indiNode, CConcept* concept, bool conNegation, bool nondeterministic, CBackendRepresentativeMemoryCacheIndividualAssociationData* assData, cint64 neighbourIndiId, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25741 |
|
| 25742 |
if (!concept) { |
| 25743 |
return true; |
| 25744 |
} |
| 25745 |
|
| 25746 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 25747 |
|
| 25748 |
if (isNeighbourExpansionWithPropagationAllowed(indiNode, concept, conNegation, neighbourIndiId, calcAlgContext)) { |
| 25749 |
bool neighbourPotentiallyInfluenced = false; |
| 25750 |
|
| 25751 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourAssData = mBackendCacheHandler->getIndividualAssociationData(neighbourIndiId, false, calcAlgContext); |
| 25752 |
if (!neighbourAssData) { |
| 25753 |
neighbourPotentiallyInfluenced = true; |
| 25754 |
|
| 25755 |
// mConfExpandDeterministicMergedHandledNeighbours must be true, otherwise cache may be incomplete since incompletely handled is only if there are changes despite a non matching update id |
| 25756 |
} else if (mConfExpandDeterministicMergedHandledNeighbours || !neighbourAssData->hasDeterministicSameIndividualMerging()) { |
| 25757 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 25758 |
if (conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_VALUE)) { |
| 25759 |
neighbourPotentiallyInfluenced = true; |
| 25760 |
} |
| 25761 |
if (!neighbourPotentiallyInfluenced && !opConLinker && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST)) { |
| 25762 |
neighbourPotentiallyInfluenced = true; |
| 25763 |
} |
| 25764 |
if (!neighbourPotentiallyInfluenced && opConLinker && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST | CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCFS_SOME_TYPE)) { |
| 25765 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = opConLinker; opConLinkerIt && !neighbourPotentiallyInfluenced; opConLinkerIt = opConLinkerIt->getNext()) { |
| 25766 |
CConcept* opConcept = opConLinkerIt->getData(); |
| 25767 |
bool opConceptNegation = opConLinkerIt->isNegated(); |
| 25768 |
bool opConceptTestingNegation = opConceptNegation; |
| 25769 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST)) { |
| 25770 |
opConceptTestingNegation = !opConceptTestingNegation; |
| 25771 |
} |
| 25772 |
if (conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCFS_SOME_TYPE)) { |
| 25773 |
opConceptTestingNegation = !opConceptTestingNegation; |
| 25774 |
} |
| 25775 |
if (!mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(neighbourAssData, neighbourAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), opConcept, opConceptTestingNegation, true, calcAlgContext)) { |
| 25776 |
neighbourPotentiallyInfluenced = true; |
| 25777 |
} |
| 25778 |
} |
| 25779 |
} |
| 25780 |
if (!neighbourPotentiallyInfluenced && !opConLinker && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST)) { |
| 25781 |
neighbourPotentiallyInfluenced = true; |
| 25782 |
} |
| 25783 |
} |
| 25784 |
|
| 25785 |
if (neighbourPotentiallyInfluenced) { |
| 25786 |
return true; |
| 25787 |
} |
| 25788 |
} |
| 25789 |
return false; |
| 25790 |
|
| 25791 |
|
| 25792 |
} |
| 25793 |
|
| 25794 |
|
| 25795 |
|
| 25796 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::canExpandDirectlyInfluencedNeighbourWithPropagation(CIndividualProcessNode* indiNode, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData, CDependencyTrackPoint* backSyncDepTrackPoint, CConcept* concept, bool conNegation, bool nondeterministic, CBackendRepresentativeMemoryCacheIndividualAssociationData* assData, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData& neighbourExpansionData, cint64 neighbourIndiId, CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourAssData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25797 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 25798 |
|
| 25799 |
if (isNeighbourExpansionWithPropagationAllowed(indiNode, concept, conNegation, neighbourIndiId, calcAlgContext)) { |
| 25800 |
bool neighbourPotentiallyInfluenced = false; |
| 25801 |
|
| 25802 |
if (!neighbourAssData) { |
| 25803 |
neighbourPotentiallyInfluenced = true; |
| 25804 |
} else { |
| 25805 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 25806 |
if (conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_VALUE)) { |
| 25807 |
neighbourPotentiallyInfluenced = true; |
| 25808 |
} |
| 25809 |
if (!neighbourPotentiallyInfluenced && !opConLinker && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST)) { |
| 25810 |
neighbourPotentiallyInfluenced = true; |
| 25811 |
} |
| 25812 |
if (!neighbourPotentiallyInfluenced && opConLinker && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST | CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCFS_SOME_TYPE)) { |
| 25813 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = opConLinker; opConLinkerIt && !neighbourPotentiallyInfluenced; opConLinkerIt = opConLinkerIt->getNext()) { |
| 25814 |
CConcept* opConcept = opConLinkerIt->getData(); |
| 25815 |
bool opConceptNegation = opConLinkerIt->isNegated(); |
| 25816 |
bool opConceptTestingNegation = opConceptNegation; |
| 25817 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST)) { |
| 25818 |
opConceptTestingNegation = !opConceptTestingNegation; |
| 25819 |
} |
| 25820 |
if (conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCFS_SOME_TYPE)) { |
| 25821 |
opConceptTestingNegation = !opConceptTestingNegation; |
| 25822 |
} |
| 25823 |
if (!mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(neighbourAssData, neighbourAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), opConcept, opConceptTestingNegation, true, calcAlgContext) |
| 25824 |
|| nondeterministic && !mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(neighbourAssData, neighbourAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), opConcept, opConceptTestingNegation, false, calcAlgContext)) { |
| 25825 |
|
| 25826 |
neighbourPotentiallyInfluenced = true; |
| 25827 |
} |
| 25828 |
} |
| 25829 |
} |
| 25830 |
if (!neighbourPotentiallyInfluenced && !opConLinker && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST)) { |
| 25831 |
neighbourPotentiallyInfluenced = true; |
| 25832 |
} |
| 25833 |
} |
| 25834 |
|
| 25835 |
if (neighbourPotentiallyInfluenced) { |
| 25836 |
return true; |
| 25837 |
} |
| 25838 |
} |
| 25839 |
return false; |
| 25840 |
} |
| 25841 |
|
| 25842 |
|
| 25843 |
|
| 25844 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::testIndividualNodeBackendCacheNewMergings(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25845 |
|
| 25846 |
CIndividualMergingHash* mergingHash = indiNode->getIndividualMergingHash(false); |
| 25847 |
bool hasNewMergedIndividuals = false; |
| 25848 |
|
| 25849 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 25850 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 25851 |
|
| 25852 |
if (mergingHash) { |
| 25853 |
if (backendSyncData->getLastMergedIndividualCount() != mergingHash->getMergedIndividualCount()) { |
| 25854 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 25855 |
locBackendSyncData->setLastMergedIndividualCount(mergingHash->getMergedIndividualCount()); |
| 25856 |
|
| 25857 |
CXLinker<cint64>* mergedIndiLinker = mergingHash->getMergedIndividualLinker(); |
| 25858 |
CXLinker<cint64>* lastProcessedMergedIndiLinker = backendSyncData->getLastProcessedMergedIndividualLinker(); |
| 25859 |
|
| 25860 |
CPROCESSSET<cint64>* mergedIntegratedIndividualSet = locBackendSyncData->getIntegratedMergedIndividualIdSet(true); |
| 25861 |
|
| 25862 |
visitIndividualsRelevantMergingsBackendSynchronisationDataIndividuals(indiNode, mergedIndiLinker, lastProcessedMergedIndiLinker, false, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 25863 |
|
| 25864 |
if (locBackendSyncDataIndiNode != baseIndiNode) { |
| 25865 |
if (!mergedIntegratedIndividualSet->contains(locBackendSyncDataIndiNode->getNominalIndividual()->getIndividualID())) { |
| 25866 |
mergedIntegratedIndividualSet->insert(locBackendSyncDataIndiNode->getNominalIndividual()->getIndividualID()); |
| 25867 |
locBackendSyncDataIndiNode = getLocalizedIndividual(locBackendSyncDataIndiNode, false, calcAlgContext); |
| 25868 |
|
| 25869 |
CXLinker<CIndividualProcessNode*>* mergedIndiNodeLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 25870 |
mergedIndiNodeLinker->initLinker(locBackendSyncDataIndiNode); |
| 25871 |
locBackendSyncData->addMergedIndividualNodeLinker(mergedIndiNodeLinker); |
| 25872 |
hasNewMergedIndividuals = true; |
| 25873 |
} |
| 25874 |
} |
| 25875 |
return true; |
| 25876 |
}, calcAlgContext); |
| 25877 |
|
| 25878 |
locBackendSyncData->setLastProcessedMergedIndividualLinker(mergedIndiLinker); |
| 25879 |
} |
| 25880 |
} |
| 25881 |
|
| 25882 |
return hasNewMergedIndividuals; |
| 25883 |
} |
| 25884 |
|
| 25885 |
|
| 25886 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::testIndividualNodeBackendCacheNominalIndirectConnectionBlockingCritical(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 25887 |
bool nominalIndirectExpansionBlockingCritical = false; |
| 25888 |
|
| 25889 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 25890 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 25891 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 25892 |
|
| 25893 |
if (backendSyncData) { |
| 25894 |
if (!backendSyncData->isCriticalIndirectConnectionIndividualExpansionBlocking() && assocData) { |
| 25895 |
bool requiredIndirectConnectedIndividualExpansion = false; |
| 25896 |
|
| 25897 |
testIndividualNodeBackendCacheNewMergings(indiNode, calcAlgContext); |
| 25898 |
backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 25899 |
|
| 25900 |
|
| 25901 |
bool indirectlyConnectedNominalIndividual = assocData && assocData->isIndirectlyConnectedNominalIndividual() || backendSyncData->hasMergedIndirectlyConnectedNominalIndividuals(); |
| 25902 |
|
| 25903 |
if (backendSyncData->getMergedIndividualNodeLinker() != backendSyncData->getLastIndirectlyConnectedNominalIndividualsTestedMergedNodeLinker()) { |
| 25904 |
CBackendRepresentativeMemoryLabelCacheItem* nondetSameIndiSetLabel = nullptr; |
| 25905 |
if (assocData) { |
| 25906 |
nondetSameIndiSetLabel = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL); |
| 25907 |
} |
| 25908 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastIndirectlyConnectedNominalIndividualsTestedMergedNodeLinker(), false, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 25909 |
|
| 25910 |
|
| 25911 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* mergedBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 25912 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* mergedAssocData = mergedBackendSyncData->getAssocitaionData(); |
| 25913 |
if (mergedAssocData->isIndirectlyConnectedNominalIndividual()) { |
| 25914 |
indirectlyConnectedNominalIndividual = true; |
| 25915 |
} |
| 25916 |
|
| 25917 |
|
| 25918 |
if (!mBackendCacheHandler->hasIndividualIdsInAssociatedIndividualSetLabel(assocData, nondetSameIndiSetLabel, locBackendSyncDataIndiNode->getNominalIndividual()->getIndividualID())) { |
| 25919 |
requiredIndirectConnectedIndividualExpansion = true; |
| 25920 |
return false; |
| 25921 |
} |
| 25922 |
return true; |
| 25923 |
}, calcAlgContext); |
| 25924 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 25925 |
locBackendSyncData->setLastIndirectlyConnectedNominalIndividualsTestedMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 25926 |
if (indirectlyConnectedNominalIndividual) { |
| 25927 |
locBackendSyncData->setMergedIndirectlyConnectedNominalIndividuals(true); |
| 25928 |
} |
| 25929 |
} |
| 25930 |
|
| 25931 |
|
| 25932 |
if (indirectlyConnectedNominalIndividual && !requiredIndirectConnectedIndividualExpansion) { |
| 25933 |
|
| 25934 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 25935 |
if (conSet) { |
| 25936 |
CConceptDescriptor* conDesLinker = conSet->getAddingSortedConceptDescriptionLinker(); |
| 25937 |
CIndividualLinkEdge* lastAddedLinkEdge = indiNode->getLastAddedRoleLink(); |
| 25938 |
|
| 25939 |
visitIndividualsRelevantBackendSynchronisationDataIndividuals(indiNode, false, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 25940 |
|
| 25941 |
|
| 25942 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 25943 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 25944 |
if (assocData && assocData->isIndirectlyConnectedNominalIndividual()) { |
| 25945 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(true); |
| 25946 |
CConceptDescriptor* lastTestedConDes = backendSyncData->getLastIndirectConnectedIndividualExpansionTestedConceptDescriptor(); |
| 25947 |
|
| 25948 |
CIndividualLinkEdge* lastTestedLinkEdge = backendSyncData->getLastIndirectConnectedIndividualExpansionTestedLinkEdge(); |
| 25949 |
if (lastAddedLinkEdge != lastTestedLinkEdge) { |
| 25950 |
lastTestedConDes = nullptr; |
| 25951 |
} |
| 25952 |
|
| 25953 |
if (assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL)->hasNondeterministicElements() || !testIndividualNodeBackendCacheConceptsSynchronization(indiNode, calcAlgContext)) { |
| 25954 |
requiredIndirectConnectedIndividualExpansion = true; |
| 25955 |
} else { |
| 25956 |
for (CConceptDescriptor* conDesLinkerIt = conDesLinker; conDesLinkerIt && conDesLinkerIt != lastTestedConDes && !requiredIndirectConnectedIndividualExpansion; conDesLinkerIt = conDesLinkerIt->getNext()) { |
| 25957 |
|
| 25958 |
CConcept* concept = conDesLinkerIt->getConcept(); |
| 25959 |
bool conNegation = conDesLinkerIt->getNegation(); |
| 25960 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 25961 |
CRole* role = concept->getRole(); |
| 25962 |
if (!conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST) || conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATLEAST)) { |
| 25963 |
CRoleSuccessorLinkIterator roleSuccLinkIt = indiNode->getRoleSuccessorLinkIterator(role); |
| 25964 |
while (roleSuccLinkIt.hasNext() && !requiredIndirectConnectedIndividualExpansion) { |
| 25965 |
CIndividualLinkEdge* succLink = roleSuccLinkIt.next(true); |
| 25966 |
CIndividualProcessNode* succIndiNode = getSuccessorIndividual(indiNode, succLink, calcAlgContext); |
| 25967 |
if (succIndiNode->isNominalIndividualNode() && succIndiNode->getIndividualNominalLevelOrAncestorDepth() > 0 && !succIndiNode->getNominalIndividual()) { |
| 25968 |
requiredIndirectConnectedIndividualExpansion = true; |
| 25969 |
} |
| 25970 |
} |
| 25971 |
} |
| 25972 |
} |
| 25973 |
} |
| 25974 |
|
| 25975 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 25976 |
backendSyncData->setLastIndirectConnectedIndividualExpansionTestedLinkEdge(lastAddedLinkEdge); |
| 25977 |
backendSyncData->setLastIndirectConnectedIndividualExpansionTestedConceptDescriptor(conDesLinker); |
| 25978 |
} |
| 25979 |
return !requiredIndirectConnectedIndividualExpansion; |
| 25980 |
}, calcAlgContext); |
| 25981 |
|
| 25982 |
} |
| 25983 |
} |
| 25984 |
if (indirectlyConnectedNominalIndividual && requiredIndirectConnectedIndividualExpansion) { |
| 25985 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 25986 |
locBackendSyncData->setCriticalIndirectConnectionIndividualExpansionBlocking(true); |
| 25987 |
nominalIndirectExpansionBlockingCritical = true; |
| 25988 |
} |
| 25989 |
|
| 25990 |
} else { |
| 25991 |
nominalIndirectExpansionBlockingCritical = true; |
| 25992 |
} |
| 25993 |
} |
| 25994 |
|
| 25995 |
return nominalIndirectExpansionBlockingCritical; |
| 25996 |
} |
| 25997 |
|
| 25998 |
|
| 25999 |
|
| 26000 |
|
| 26001 |
|
| 26002 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::testIndividualNodeBackendCacheSameMergedBlockingCritical(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26003 |
|
| 26004 |
|
| 26005 |
bool expansionBlockingCritical = false; |
| 26006 |
|
| 26007 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 26008 |
|
| 26009 |
if (backendSyncData) { |
| 26010 |
|
| 26011 |
testIndividualNodeBackendCacheNewMergings(indiNode, calcAlgContext); |
| 26012 |
backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 26013 |
|
| 26014 |
|
| 26015 |
if (backendSyncData->getMergedIndividualNodeLinker()) { |
| 26016 |
expansionBlockingCritical = true; |
| 26017 |
} else { |
| 26018 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 26019 |
if (assocData && assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_SAME_INDIVIDUAL_SET_LABEL)) { |
| 26020 |
expansionBlockingCritical = true; |
| 26021 |
} |
| 26022 |
} |
| 26023 |
|
| 26024 |
} |
| 26025 |
|
| 26026 |
return expansionBlockingCritical; |
| 26027 |
} |
| 26028 |
|
| 26029 |
|
| 26030 |
|
| 26031 |
|
| 26032 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::testIndividualNodeBackendCacheNeighbourExpansionBlockingCritical(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26033 |
|
| 26034 |
|
| 26035 |
|
| 26036 |
bool expansionBlockingCritical = false; |
| 26037 |
|
| 26038 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 26039 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 26040 |
|
| 26041 |
if (backendSyncData) { |
| 26042 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 26043 |
if (assocData && !backendSyncData->isCriticalNeighbourExpansionBlocking()) { |
| 26044 |
|
| 26045 |
|
| 26046 |
//CConceptDescriptor* propConDesLinker = nullptr; |
| 26047 |
|
| 26048 |
|
| 26049 |
//if (indiNode->getNominalIndividual() && CIRIName::getRecentIRIName(indiNode->getNominalIndividual()->getIndividualNameLinker()).startsWith("http://www.festo.com/edrive#HHM00")) { |
| 26050 |
// CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 26051 |
|
| 26052 |
// CConceptDescriptor* conDesLinker = conSet->getAddingSortedConceptDescriptionLinker(); |
| 26053 |
// CConceptDescriptor* conDesIt = conDesLinker; |
| 26054 |
// while (conDesIt) { |
| 26055 |
// CConcept* concept = conDesIt->getConcept(); |
| 26056 |
// bool conNegation = conDesIt->getNegation(); |
| 26057 |
|
| 26058 |
// if (debugCheckDirectlyInfluencedNeighbourWithPropagationPossible(concept, conNegation, indiNode, assocData, locBackendSyncData, calcAlgContext)) { |
| 26059 |
// bool debug = true; |
| 26060 |
// propConDesLinker = conDesIt; |
| 26061 |
|
| 26062 |
// if (!testIndividualNodeConceptBackendCacheNeighbourExpansionBlockingCritical(concept, conNegation, assocData, calcAlgContext)) { |
| 26063 |
// bool debug = true; |
| 26064 |
// debugCheckDirectlyInfluencedNeighbourWithPropagationPossible(concept, conNegation, indiNode, assocData, locBackendSyncData, calcAlgContext); |
| 26065 |
// testIndividualNodeConceptBackendCacheNeighbourExpansionBlockingCritical(concept, conNegation, assocData, calcAlgContext); |
| 26066 |
// debugCheckDirectlyInfluencedNeighbourWithPropagationPossible(concept, conNegation, indiNode, assocData, locBackendSyncData, calcAlgContext); |
| 26067 |
// testIndividualNodeConceptBackendCacheNeighbourExpansionBlockingCritical(concept, conNegation, assocData, calcAlgContext); |
| 26068 |
// } |
| 26069 |
// testIndividualNodeConceptBackendCacheNeighbourExpansionBlockingCritical(concept, conNegation, assocData, calcAlgContext); |
| 26070 |
|
| 26071 |
// conDesIt = nullptr; |
| 26072 |
// } else { |
| 26073 |
// conDesIt = conDesIt->getNext(); |
| 26074 |
// } |
| 26075 |
// } |
| 26076 |
//} |
| 26077 |
|
| 26078 |
|
| 26079 |
testIndividualNodeBackendCacheNewMergings(indiNode, calcAlgContext); |
| 26080 |
backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 26081 |
|
| 26082 |
if (backendSyncData->getMergedIndividualNodeLinker() != backendSyncData->getLastCriticalNeighboursTestedMergedNodeLinker()) { |
| 26083 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastCriticalNeighboursTestedMergedNodeLinker(), false, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 26084 |
expansionBlockingCritical = true; |
| 26085 |
return false; |
| 26086 |
}, calcAlgContext); |
| 26087 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 26088 |
locBackendSyncData->setLastCriticalNeighboursTestedMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 26089 |
} |
| 26090 |
|
| 26091 |
|
| 26092 |
if (backendSyncData->getMergedIndividualNodeLinker()) { |
| 26093 |
expansionBlockingCritical = true; |
| 26094 |
} else { |
| 26095 |
if (!testIndividualNodeBackendCacheConceptsSynchronization(indiNode, calcAlgContext)) { |
| 26096 |
CConceptDescriptor* lastTestedConDes = backendSyncData->getLastCriticalNeighbourExpansionTestedConceptDescriptor(); |
| 26097 |
CConceptDescriptor* lastSynchedConDes = backendSyncData->getLastSynchedConceptDescriptor(); |
| 26098 |
if (!assocData->isCompletelyPropagated()) { |
| 26099 |
lastSynchedConDes = nullptr; |
| 26100 |
} |
| 26101 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 26102 |
if (conSet) { |
| 26103 |
CConceptDescriptor* conDesLinker = conSet->getAddingSortedConceptDescriptionLinker(); |
| 26104 |
CConceptDescriptor* newLastTestedConDes = conDesLinker; |
| 26105 |
if (conDesLinker != lastTestedConDes) { |
| 26106 |
CConceptDescriptor* conDesIt = conDesLinker; |
| 26107 |
|
| 26108 |
bool conceptExpansionBlockingCritical = false; |
| 26109 |
while (conDesIt && conDesIt != lastTestedConDes && conDesIt != lastSynchedConDes) { |
| 26110 |
CConcept* concept = conDesIt->getConcept(); |
| 26111 |
bool conNegation = conDesIt->getNegation(); |
| 26112 |
|
| 26113 |
//if (conDesIt == propConDesLinker) { |
| 26114 |
// bool debug = true; |
| 26115 |
//} |
| 26116 |
bool nondeterministic = hasNondeterministicDependency(conDesIt->getDependencyTrackPoint(), calcAlgContext); |
| 26117 |
|
| 26118 |
if (assocData && testIndividualNodeConceptBackendCacheNeighbourExpansionBlockingCritical(concept, conNegation, nondeterministic, assocData, calcAlgContext)) { |
| 26119 |
conceptExpansionBlockingCritical = true; |
| 26120 |
newLastTestedConDes = conDesIt; |
| 26121 |
} |
| 26122 |
conDesIt = conDesIt->getNext(); |
| 26123 |
} |
| 26124 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 26125 |
if (conceptExpansionBlockingCritical && newLastTestedConDes) { |
| 26126 |
newLastTestedConDes = newLastTestedConDes->getNext(); |
| 26127 |
} |
| 26128 |
locBackendSyncData->setLastCriticalNeighbourExpansionTestedConceptDescriptor(newLastTestedConDes); |
| 26129 |
if (conceptExpansionBlockingCritical) { |
| 26130 |
expansionBlockingCritical = true; |
| 26131 |
} |
| 26132 |
|
| 26133 |
} |
| 26134 |
} |
| 26135 |
} |
| 26136 |
} |
| 26137 |
|
| 26138 |
if (expansionBlockingCritical) { |
| 26139 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 26140 |
locBackendSyncData->setCriticalNeighbourExpansionBlocking(expansionBlockingCritical); |
| 26141 |
} |
| 26142 |
/*else if (propConDesLinker) { |
| 26143 |
bool debug = true; |
| 26144 |
|
| 26145 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 26146 |
|
| 26147 |
CConceptDescriptor* conDesLinker = conSet->getAddingSortedConceptDescriptionLinker(); |
| 26148 |
CConceptDescriptor* conDesIt = conDesLinker; |
| 26149 |
while (conDesIt) { |
| 26150 |
CConcept* concept = conDesIt->getConcept(); |
| 26151 |
bool conNegation = conDesIt->getNegation(); |
| 26152 |
|
| 26153 |
|
| 26154 |
debugCheckDirectlyInfluencedNeighbourWithPropagationPossible(concept, conNegation, indiNode, assocData, locBackendSyncData, calcAlgContext); |
| 26155 |
conDesIt = conDesIt->getNext(); |
| 26156 |
} |
| 26157 |
|
| 26158 |
|
| 26159 |
}*/ |
| 26160 |
|
| 26161 |
|
| 26162 |
} else { |
| 26163 |
expansionBlockingCritical = true; |
| 26164 |
} |
| 26165 |
} |
| 26166 |
|
| 26167 |
return expansionBlockingCritical; |
| 26168 |
} |
| 26169 |
|
| 26170 |
|
| 26171 |
|
| 26172 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::testIndividualNodeConceptBackendCacheNeighbourExpansionBlockingCritical(CConcept* concept, bool conNegation, bool nondeterministic, CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26173 |
bool expansionBlockingCritical = false; |
| 26174 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 26175 |
cint64 opCode = concept->getOperatorCode(); |
| 26176 |
CSortedNegLinker<CConcept*>* opConcepts = concept->getOperandList(); |
| 26177 |
if (mConfSpecializedAutomateRules && (opCode == CCAQAND || opCode == CCIMPLAQAND || opCode == CCBRANCHAQAND)) { |
| 26178 |
while (opConcepts && !expansionBlockingCritical) { |
| 26179 |
CConcept* opCon = opConcepts->getData(); |
| 26180 |
bool opConNeg = opConcepts->isNegated(); |
| 26181 |
expansionBlockingCritical |= testIndividualNodeConceptBackendCacheNeighbourExpansionBlockingCritical(opCon, opConNeg, nondeterministic, assocData, calcAlgContext); |
| 26182 |
opConcepts = opConcepts->getNext(); |
| 26183 |
} |
| 26184 |
} else if (!conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCF_ATMOST) || conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_SOME_TYPE | CConceptOperator::CCF_ATLEAST | CConceptOperator::CCF_VALUE)) { |
| 26185 |
CRole* role = concept->getRole(); |
| 26186 |
if (assocData->isCompletelyPropagated()) { |
| 26187 |
if (!mBackendCacheHandler || !mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(assocData, assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), concept, conNegation, !nondeterministic, calcAlgContext)) { |
| 26188 |
expansionBlockingCritical = true; |
| 26189 |
} |
| 26190 |
} else { |
| 26191 |
if (!mBackendCacheHandler || mBackendCacheHandler->hasRoleInAssociatedCompinationRoleSetLabel(assocData, assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL), role, false) |
| 26192 |
|| mBackendCacheHandler->hasRoleInAssociatedCompinationRoleSetLabel(assocData, assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL), role, false)) { |
| 26193 |
expansionBlockingCritical = true; |
| 26194 |
} |
| 26195 |
} |
| 26196 |
} |
| 26197 |
return expansionBlockingCritical; |
| 26198 |
} |
| 26199 |
|
| 26200 |
|
| 26201 |
|
| 26202 |
|
| 26203 |
|
| 26204 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::debugCheckDirectlyInfluencedNeighbourWithPropagationPossible(CConcept* concept, bool conNegation, CIndividualProcessNode* indiNode, CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26205 |
|
| 26206 |
bool someNeighbourPotentiallyInfluenced = false; |
| 26207 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 26208 |
CRole* role = concept->getRole(); |
| 26209 |
|
| 26210 |
cint64 opCode = concept->getOperatorCode(); |
| 26211 |
CSortedNegLinker<CConcept*>* opConcepts = concept->getOperandList(); |
| 26212 |
if (mConfSpecializedAutomateRules && (opCode == CCAQAND || opCode == CCIMPLAQAND || opCode == CCBRANCHAQAND)) { |
| 26213 |
while (opConcepts) { |
| 26214 |
CConcept* opCon = opConcepts->getData(); |
| 26215 |
bool opConNeg = opConcepts->isNegated(); |
| 26216 |
someNeighbourPotentiallyInfluenced |= debugCheckDirectlyInfluencedNeighbourWithPropagationPossible(opCon, opConNeg, indiNode, assocData, locBackendSyncData, calcAlgContext); |
| 26217 |
opConcepts = opConcepts->getNext(); |
| 26218 |
} |
| 26219 |
} else if (!conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCF_ATMOST) || conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_SOME_TYPE | CConceptOperator::CCF_ATLEAST)) { |
| 26220 |
// TODO: verify cardinality is indeed critical |
| 26221 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST) || |
| 26222 |
mBackendCacheHandler->hasRoleInAssociatedCombinedNeigbourRoleSetLabel(assocData, assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL), role, false) || |
| 26223 |
mBackendCacheHandler->hasRoleInAssociatedCombinedNeigbourRoleSetLabel(assocData, assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::NONDETERMINISTIC_COMBINED_NEIGHBOUR_INSTANTIATED_ROLE_SET_LABEL), role, false)) { |
| 26224 |
|
| 26225 |
|
| 26226 |
if (role) { |
| 26227 |
|
| 26228 |
mBackendCacheHandler->visitNeighbourIndividualIdsForRole(assocData, role, [&](cint64 neighbourIndiId, CBackendRepresentativeMemoryLabelCacheItem* neighbourRoleSetLabel, bool nondeterministic)->bool { |
| 26229 |
|
| 26230 |
CPROCESSHASH< cint64, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationNeighbourExpansionData >* neighbourExpansionDataHash = locBackendSyncData->getNeighbourExpansionDataHash(true); |
| 26231 |
bool neighbourPotentiallyInfluenced = false; |
| 26232 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* neighbourAssData = mBackendCacheHandler->getIndividualAssociationData(neighbourIndiId, calcAlgContext); |
| 26233 |
if (!neighbourAssData) { |
| 26234 |
neighbourPotentiallyInfluenced = true; |
| 26235 |
} else { |
| 26236 |
CSortedNegLinker<CConcept*>* opConLinker = concept->getOperandList(); |
| 26237 |
if (conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_VALUE)) { |
| 26238 |
neighbourPotentiallyInfluenced = true; |
| 26239 |
} |
| 26240 |
if (!neighbourPotentiallyInfluenced && !opConLinker && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST)) { |
| 26241 |
neighbourPotentiallyInfluenced = true; |
| 26242 |
} |
| 26243 |
if (!neighbourPotentiallyInfluenced && opConLinker && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST | CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCFS_SOME_TYPE)) { |
| 26244 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = opConLinker; opConLinkerIt && !neighbourPotentiallyInfluenced; opConLinkerIt = opConLinkerIt->getNext()) { |
| 26245 |
CConcept* opConcept = opConLinkerIt->getData(); |
| 26246 |
bool opConceptNegation = opConLinkerIt->isNegated(); |
| 26247 |
bool opConceptTestingNegation = opConceptNegation; |
| 26248 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCF_ATMOST | CConceptOperator::CCF_ATLEAST)) { |
| 26249 |
opConceptTestingNegation = !opConceptTestingNegation; |
| 26250 |
} |
| 26251 |
if (conNegation && conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE | CConceptOperator::CCFS_SOME_TYPE)) { |
| 26252 |
opConceptTestingNegation = !opConceptTestingNegation; |
| 26253 |
} |
| 26254 |
if (!mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(neighbourAssData, neighbourAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), opConcept, opConceptTestingNegation, true, calcAlgContext)) { |
| 26255 |
neighbourPotentiallyInfluenced = true; |
| 26256 |
} |
| 26257 |
} |
| 26258 |
} |
| 26259 |
} |
| 26260 |
|
| 26261 |
if (neighbourPotentiallyInfluenced) { |
| 26262 |
someNeighbourPotentiallyInfluenced = true; |
| 26263 |
return false; |
| 26264 |
} |
| 26265 |
return true; |
| 26266 |
}, false, calcAlgContext); |
| 26267 |
|
| 26268 |
} |
| 26269 |
} |
| 26270 |
} |
| 26271 |
|
| 26272 |
return someNeighbourPotentiallyInfluenced; |
| 26273 |
} |
| 26274 |
|
| 26275 |
|
| 26276 |
|
| 26277 |
|
| 26278 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::testIndividualNodeBackendCacheConceptsSynchronization(CIndividualProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26279 |
bool backendSynched = true; |
| 26280 |
|
| 26281 |
|
| 26282 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 26283 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* locBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(true); |
| 26284 |
|
| 26285 |
if (backendSyncData && backendSyncData->isBackendCacheSynchron()) { |
| 26286 |
|
| 26287 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 26288 |
|
| 26289 |
if (!assocData || !assocData->isCompletelyHandled()) { |
| 26290 |
backendSynched = false; |
| 26291 |
} else { |
| 26292 |
|
| 26293 |
CBackendRepresentativeMemoryLabelCacheItem* conceptLabelItem = assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 26294 |
testIndividualNodeBackendCacheNewMergings(indiNode, calcAlgContext); |
| 26295 |
backendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)indiNode->getIndividualBackendCacheSynchronisationData(false); |
| 26296 |
|
| 26297 |
if (backendSyncData->getMergedIndividualNodeLinker() != backendSyncData->getLastSynchronizedConceptsTestedMergedNodeLinker()) { |
| 26298 |
|
| 26299 |
visitNewlyMergedOnlyDeterministicRepresentativeIndividualsBackendSynchronisationData(indiNode, backendSyncData->getMergedIndividualNodeLinker(), backendSyncData->getLastSynchronizedConceptsTestedMergedNodeLinker(), false, [&](CIndividualProcessNode* baseIndiNode, CIndividualProcessNode* locBackendSyncDataIndiNode, CDependencyTrackPoint* backSyncDepTrackPoint)->bool { |
| 26300 |
|
| 26301 |
CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* mergedBackendSyncData = (CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData*)locBackendSyncDataIndiNode->getIndividualBackendCacheSynchronisationData(false); |
| 26302 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* mergedAssocData = mergedBackendSyncData->getAssocitaionData(); |
| 26303 |
if (mergedAssocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL) != conceptLabelItem) { |
| 26304 |
backendSynched = false; |
| 26305 |
} |
| 26306 |
|
| 26307 |
return false; |
| 26308 |
}, calcAlgContext); |
| 26309 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 26310 |
locBackendSyncData->setLastSynchronizedConceptsTestedMergedNodeLinker(backendSyncData->getMergedIndividualNodeLinker()); |
| 26311 |
} |
| 26312 |
|
| 26313 |
|
| 26314 |
CConceptDescriptor* lastTestedConDes = backendSyncData->getLastSynchronizationTestedConceptDescriptor(); |
| 26315 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 26316 |
if (conSet && backendSynched) { |
| 26317 |
CConceptDescriptor* conDesLinker = conSet->getAddingSortedConceptDescriptionLinker(); |
| 26318 |
if (conDesLinker != lastTestedConDes) { |
| 26319 |
CConceptDescriptor* conDesIt = conDesLinker; |
| 26320 |
CConceptDescriptor* lastSyncConDes = lastTestedConDes; |
| 26321 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 26322 |
|
| 26323 |
CConcept* nominalConcept = indiNode->getNominalIndividual()->getIndividualNominalConcept(); |
| 26324 |
while (conDesIt && conDesIt != lastTestedConDes && conDesIt) { |
| 26325 |
if (conDesIt->getConcept() != nominalConcept || conDesIt->isNegated()) { |
| 26326 |
bool nondeterministic = hasNondeterministicDependency(conDesIt->getDependencyTrackPoint(), calcAlgContext); |
| 26327 |
if (!mBackendCacheHandler || !mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(assocData, conceptLabelItem, conDesIt->getConcept(), conDesIt->isNegated(), !nondeterministic, calcAlgContext)) { |
| 26328 |
backendSynched = false; |
| 26329 |
lastSyncConDes = conDesIt; |
| 26330 |
} |
| 26331 |
} |
| 26332 |
conDesIt = conDesIt->getNext(); |
| 26333 |
} |
| 26334 |
if (!backendSynched && lastSyncConDes) { |
| 26335 |
lastSyncConDes = lastSyncConDes->getNext(); |
| 26336 |
} |
| 26337 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 26338 |
locBackendSyncData->setLastSynchronizationTestedConceptDescriptor(conDesLinker); |
| 26339 |
locBackendSyncData->setLastSynchedConceptDescriptor(lastSyncConDes); |
| 26340 |
} |
| 26341 |
} else { |
| 26342 |
backendSynched = false; |
| 26343 |
} |
| 26344 |
} |
| 26345 |
|
| 26346 |
if (!backendSynched) { |
| 26347 |
locBackendSyncData = getLocalizedIndividualBackendCacheSnychronisationData(indiNode, calcAlgContext); |
| 26348 |
locBackendSyncData->setBackendCacheSynchron(backendSynched); |
| 26349 |
} |
| 26350 |
|
| 26351 |
} else { |
| 26352 |
backendSynched = false; |
| 26353 |
} |
| 26354 |
return backendSynched; |
| 26355 |
|
| 26356 |
return backendSynched; |
| 26357 |
} |
| 26358 |
|
| 26359 |
|
| 26360 |
|
| 26361 |
|
| 26362 |
|
| 26363 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::validateBackendSynchronisationContinued(CIndividualProcessNode* indi, CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData* backendSyncData, CConcept* addedConcept, bool addedConceptNegation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26364 |
bool backendSynched = true; |
| 26365 |
|
| 26366 |
if (backendSyncData && backendSyncData->isBackendCacheSynchron()) { |
| 26367 |
CConceptDescriptor* lastTestedConDes = backendSyncData->getLastSynchronizationTestedConceptDescriptor(); |
| 26368 |
CReapplyConceptLabelSet* conSet = indi->getReapplyConceptLabelSet(false); |
| 26369 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* assocData = backendSyncData->getAssocitaionData(); |
| 26370 |
if (conSet && assocData) { |
| 26371 |
CConceptDescriptor* conDesLinker = conSet->getAddingSortedConceptDescriptionLinker(); |
| 26372 |
CConceptDescriptor* conDesIt = conDesLinker; |
| 26373 |
|
| 26374 |
if (addedConcept && conDesIt != lastTestedConDes) { |
| 26375 |
if (conDesIt->getConcept() == addedConcept || conDesIt->isNegated() == addedConceptNegation) { |
| 26376 |
conDesIt = conDesIt->getNext(); |
| 26377 |
} |
| 26378 |
} |
| 26379 |
CConcept* nominalConcept = indi->getNominalIndividual()->getIndividualNominalConcept(); |
| 26380 |
while (conDesIt != lastTestedConDes && backendSynched && conDesIt) { |
| 26381 |
if (conDesIt->getConcept() != nominalConcept || conDesIt->isNegated()) { |
| 26382 |
bool nondeterministic = hasNondeterministicDependency(conDesIt->getDependencyTrackPoint(), calcAlgContext); |
| 26383 |
if (!mBackendCacheHandler || !mBackendCacheHandler->hasConceptInAssociatedFullConceptSetLabel(assocData, assocData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), conDesIt->getConcept(),conDesIt->isNegated(), !nondeterministic, calcAlgContext)) { |
| 26384 |
backendSynched = false; |
| 26385 |
} |
| 26386 |
} |
| 26387 |
if (backendSynched) { |
| 26388 |
backendSyncData->setLastSynchedConceptDescriptor(conDesIt); |
| 26389 |
} |
| 26390 |
conDesIt = conDesIt->getNext(); |
| 26391 |
} |
| 26392 |
backendSyncData->setLastSynchronizationTestedConceptDescriptor(conDesLinker); |
| 26393 |
} else { |
| 26394 |
backendSynched = false; |
| 26395 |
} |
| 26396 |
|
| 26397 |
backendSyncData->setBackendCacheSynchron(backendSynched); |
| 26398 |
} else { |
| 26399 |
backendSynched = false; |
| 26400 |
} |
| 26401 |
return backendSynched; |
| 26402 |
} |
| 26403 |
|
| 26404 |
|
| 26405 |
|
| 26406 |
|
| 26407 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getLocalizedIndividual(cint64 indiID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26408 |
return getLocalizedIndividual(getUpToDateIndividual(indiID,calcAlgContext),false,calcAlgContext); |
| 26409 |
} |
| 26410 |
|
| 26411 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getLocalizedIndividual(CIndividualProcessNode* indi, bool updateIndividual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26412 |
if (!indi->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger()->getCurrentLocalizationTag())) { |
| 26413 |
if (updateIndividual) { |
| 26414 |
indi = getUpToDateIndividual(indi,calcAlgContext); |
| 26415 |
} |
| 26416 |
if (!indi->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger()->getCurrentLocalizationTag())) { |
| 26417 |
STATINC(INDINODELOCALIZEDLOADCOUNT,calcAlgContext); |
| 26418 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26419 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26420 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 26421 |
CIndividualProcessNode* localicedIndi = CObjectParameterizingAllocator< CIndividualProcessNode,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 26422 |
localicedIndi->initIndividualProcessNode(indi); |
| 26423 |
indiProcNodeVec->setLocalData(localicedIndi->getIndividualNodeID(),localicedIndi); |
| 26424 |
|
| 26425 |
if (calcAlgContext->hasCompletionGraphCachedIndividualNodes() && mConfCompletionGraphCaching) { |
| 26426 |
if (localicedIndi->getIndividualNodeID() <= calcAlgContext->getMaxCompletionGraphCachedIndividualNodeID()) { |
| 26427 |
if (indi->getLocalizationTag() <= calcAlgContext->getCompletionGraphCachedLocalizationTag()) { |
| 26428 |
trackIndividualReferredDependence(indi->getIndividualNodeID(),calcAlgContext); |
| 26429 |
localicedIndi->clearProcessingQueued(); |
| 26430 |
localicedIndi->clearProcessingRestrictionFlags(CIndividualProcessNode::PRFCACHEDCOMPUTEDTYPESADDED); |
| 26431 |
localicedIndi->addProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED); |
| 26432 |
} |
| 26433 |
} |
| 26434 |
} |
| 26435 |
return localicedIndi; |
| 26436 |
} |
| 26437 |
} |
| 26438 |
return indi; |
| 26439 |
} |
| 26440 |
|
| 26441 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getSuccessorIndividual(CIndividualProcessNode*& indi, CIndividualLinkEdge* link, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26442 |
CIndividualProcessNode* succIndi = nullptr; |
| 26443 |
|
| 26444 |
if (link->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger()->getCurrentLocalizationTag())) { |
| 26445 |
succIndi = link->getOppositeIndividual(indi); |
| 26446 |
} else { |
| 26447 |
STATINC(INDINODEUPDATELOADCOUNT,calcAlgContext); |
| 26448 |
succIndi = link->getOppositeIndividual(indi); |
| 26449 |
if (!succIndi->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger()->getCurrentLocalizationTag()) && succIndi->isRelocalized()) { |
| 26450 |
cint64 succIndiId = link->getOppositeIndividualID(indi); |
| 26451 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 26452 |
succIndi = indiProcNodeVec->getData(succIndiId); |
| 26453 |
} |
| 26454 |
} |
| 26455 |
return succIndi; |
| 26456 |
} |
| 26457 |
|
| 26458 |
|
| 26459 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getLocalizedSuccessorIndividual(CIndividualProcessNode*& indi, CIndividualLinkEdge* link, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26460 |
CIndividualProcessNode* succIndi = nullptr; |
| 26461 |
|
| 26462 |
if (link->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger()->getCurrentLocalizationTag())) { |
| 26463 |
succIndi = link->getOppositeIndividual(indi); |
| 26464 |
} else { |
| 26465 |
STATINC(INDINODEUPDATELOADCOUNT,calcAlgContext); |
| 26466 |
cint64 succIndiId = link->getOppositeIndividualID(indi); |
| 26467 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 26468 |
succIndi = indiProcNodeVec->getData(succIndiId); |
| 26469 |
succIndi = getLocalizedIndividual(succIndi,false,calcAlgContext); |
| 26470 |
} |
| 26471 |
return succIndi; |
| 26472 |
} |
| 26473 |
|
| 26474 |
|
| 26475 |
CIndividualProcessNode* CCalculationTableauCompletionTaskHandleAlgorithm::getAncestorIndividual(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26476 |
CIndividualProcessNode* ancIndi = nullptr; |
| 26477 |
|
| 26478 |
CIndividualLinkEdge* ancLink = indi->getAncestorLink(); |
| 26479 |
if (ancLink) { |
| 26480 |
ancIndi = getSuccessorIndividual(indi,ancLink,calcAlgContext); |
| 26481 |
} |
| 26482 |
return ancIndi; |
| 26483 |
} |
| 26484 |
|
| 26485 |
|
| 26486 |
|
| 26487 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyExtendedReapplyConceptDescriptor(CIndividualProcessNode*& processIndi, CConcept* concept, bool negation, CCondensedReapplyConceptDescriptor* reapplyConceptDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26488 |
CExtendedCondensedReapplyConceptDescriptor* extendedReapplyConceptDes = (CExtendedCondensedReapplyConceptDescriptor*)reapplyConceptDes; |
| 26489 |
if (extendedReapplyConceptDes->getExtentionType() == REAPPLYCONCEPTDESCRIPTOREXTENSIONTYPEATMOST) { |
| 26490 |
CExtendedCondensedReapplyConceptDescriptorATMOSTReactivation* atmostReapplyConDes = (CExtendedCondensedReapplyConceptDescriptorATMOSTReactivation*)extendedReapplyConceptDes; |
| 26491 |
CIndividualProcessNode* reapplicationIndiNode = atmostReapplyConDes->getReapplicationIndividualNode(); |
| 26492 |
CIndividualLinkEdge* indiLinkEdge = atmostReapplyConDes->getIndividualLink(); |
| 26493 |
CIndividualProcessNode* locReapplicationIndiNode = getLocalizedIndividual(reapplicationIndiNode,true,calcAlgContext); |
| 26494 |
|
| 26495 |
if (!locReapplicationIndiNode->hasProcessingRestrictionFlags(CIndividualProcessNode::PRFPURGEDBLOCKED)) { |
| 26496 |
|
| 26497 |
CSuccessorIndividualATMOSTReactivationData* succIndiATMOSTReactivationData = locReapplicationIndiNode->getSuccessorIndividualATMOSTReactivationData(true); |
| 26498 |
CConceptDescriptor* atmostConDes = atmostReapplyConDes->getConceptDescriptor(); |
| 26499 |
succIndiATMOSTReactivationData->addReactivationSuccessorIndividualLink(atmostConDes,indiLinkEdge); |
| 26500 |
|
| 26501 |
CRole* role = atmostConDes->getConcept()->getRole(); |
| 26502 |
CReapplyQueueIterator roleReapplyQueueIt = locReapplicationIndiNode->getRoleReapplyIterator(role,false); |
| 26503 |
bool roleQueueReapplied = false; |
| 26504 |
while (roleReapplyQueueIt.hasNext() && !roleQueueReapplied) { |
| 26505 |
CReapplyConceptDescriptor* roleReapplyConceptDes = roleReapplyQueueIt.next(); |
| 26506 |
if (roleReapplyConceptDes->getConceptDescriptor() == atmostConDes) { |
| 26507 |
applyReapplyQueueConcepts(locReapplicationIndiNode,role,calcAlgContext); |
| 26508 |
roleQueueReapplied = true; |
| 26509 |
} |
| 26510 |
} |
| 26511 |
} |
| 26512 |
|
| 26513 |
} |
| 26514 |
} |
| 26515 |
|
| 26516 |
|
| 26517 |
|
| 26518 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyReapplyQueueConcepts(CIndividualProcessNode*& processIndi, CConcept* concept, bool negation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26519 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26520 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26521 |
CCondensedReapplyQueueIterator reapplyQueueIt = processIndi->getConceptReapplyIterator(concept,negation,true); |
| 26522 |
CConceptProcessingQueue* conProQueue = nullptr; |
| 26523 |
CProcessingRestrictionSpecification* procRest = nullptr; |
| 26524 |
while (reapplyQueueIt.hasNext()) { |
| 26525 |
STATINC(REAPPLIEDCONCEPTSCOUNT,calcAlgContext); |
| 26526 |
CCondensedReapplyConceptDescriptor* reapplyConceptDes = reapplyQueueIt.next(); |
| 26527 |
CConceptDescriptor* conDes = reapplyConceptDes->getConceptDescriptor(); |
| 26528 |
CDependencyTrackPoint* depTrackPoint = reapplyConceptDes->getDependencyTrackPoint(); |
| 26529 |
procRest = reapplyConceptDes->getReapplyProcessingRestriction(); |
| 26530 |
if (reapplyConceptDes->isExtended()) { |
| 26531 |
applyExtendedReapplyConceptDescriptor(processIndi,concept,negation,reapplyConceptDes,calcAlgContext); |
| 26532 |
} else { |
| 26533 |
if (!conProQueue) { |
| 26534 |
conProQueue = processIndi->getConceptProcessingQueue(true); |
| 26535 |
} |
| 26536 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,conProQueue,processIndi,reapplyConceptDes->isStaticDescriptor(),procRest,calcAlgContext); |
| 26537 |
} |
| 26538 |
} |
| 26539 |
if (conProQueue) { |
| 26540 |
addIndividualToProcessingQueue(processIndi,calcAlgContext); |
| 26541 |
} |
| 26542 |
} |
| 26543 |
|
| 26544 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyReapplyQueueConcepts(CIndividualProcessNode*& processIndi, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26545 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26546 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26547 |
CReapplyQueueIterator reapplyQueueIt = processIndi->getRoleReapplyIterator(role,true); |
| 26548 |
CConceptProcessingQueue* conProQueue = nullptr; |
| 26549 |
CProcessingRestrictionSpecification* procRest = nullptr; |
| 26550 |
while (reapplyQueueIt.hasNext()) { |
| 26551 |
STATINC(REAPPLIEDCONCEPTSCOUNT,calcAlgContext); |
| 26552 |
CReapplyConceptDescriptor* reapplyConceptDes = reapplyQueueIt.next(); |
| 26553 |
CConceptDescriptor* conDes = reapplyConceptDes->getConceptDescriptor(); |
| 26554 |
CDependencyTrackPoint* depTrackPoint = reapplyConceptDes->getDependencyTrackPoint(); |
| 26555 |
procRest = reapplyConceptDes->getReapplyProcessingRestriction(); |
| 26556 |
if (!conProQueue) { |
| 26557 |
conProQueue = processIndi->getConceptProcessingQueue(true); |
| 26558 |
} |
| 26559 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,conProQueue,processIndi,reapplyConceptDes->isStaticDescriptor(),procRest,calcAlgContext); |
| 26560 |
} |
| 26561 |
if (conProQueue) { |
| 26562 |
addIndividualToProcessingQueue(processIndi,calcAlgContext); |
| 26563 |
} |
| 26564 |
} |
| 26565 |
|
| 26566 |
|
| 26567 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyReapplyQueueConceptsRestricted(CIndividualProcessNode*& processIndi, CReapplyQueueIterator* reapplyQueueIt, CIndividualLinkEdge* restrictedLink, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26568 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26569 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26570 |
CConceptProcessingQueue* conProQueue = nullptr; |
| 26571 |
CLinkProcessingRestrictionSpecification* linkProcRest = nullptr; |
| 26572 |
CProcessingRestrictionSpecification* procRest = nullptr; |
| 26573 |
while (reapplyQueueIt->hasNext()) { |
| 26574 |
STATINC(REAPPLIEDCONCEPTSCOUNT,calcAlgContext); |
| 26575 |
CReapplyConceptDescriptor* reapplyConceptDes = reapplyQueueIt->next(); |
| 26576 |
CConceptDescriptor* conDes = reapplyConceptDes->getConceptDescriptor(); |
| 26577 |
CDependencyTrackPoint* depTrackPoint = reapplyConceptDes->getDependencyTrackPoint(); |
| 26578 |
procRest = reapplyConceptDes->getReapplyProcessingRestriction(); |
| 26579 |
if (!conProQueue) { |
| 26580 |
conProQueue = processIndi->getConceptProcessingQueue(true); |
| 26581 |
} |
| 26582 |
if (!procRest) { |
| 26583 |
if (!linkProcRest) { |
| 26584 |
linkProcRest = CObjectAllocator< CLinkProcessingRestrictionSpecification >::allocateAndConstruct(taskMemMan); |
| 26585 |
linkProcRest->initLinkRestriction(restrictedLink); |
| 26586 |
} |
| 26587 |
procRest = linkProcRest; |
| 26588 |
} |
| 26589 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,conProQueue,processIndi,reapplyConceptDes->isStaticDescriptor(),procRest,calcAlgContext); |
| 26590 |
} |
| 26591 |
if (conProQueue) { |
| 26592 |
addIndividualToProcessingQueue(processIndi,calcAlgContext); |
| 26593 |
} |
| 26594 |
} |
| 26595 |
|
| 26596 |
|
| 26597 |
void CCalculationTableauCompletionTaskHandleAlgorithm::applyReapplyQueueConcepts(CIndividualProcessNode*& processIndi, CCondensedReapplyQueueIterator* reapplyQueueIt, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26598 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26599 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26600 |
CConceptProcessingQueue* conProQueue = nullptr; |
| 26601 |
CProcessingRestrictionSpecification* procRest = nullptr; |
| 26602 |
while (reapplyQueueIt->hasNext()) { |
| 26603 |
STATINC(REAPPLIEDCONCEPTSCOUNT,calcAlgContext); |
| 26604 |
CReapplyConceptDescriptor* reapplyConceptDes = reapplyQueueIt->next(); |
| 26605 |
CConceptDescriptor* conDes = reapplyConceptDes->getConceptDescriptor(); |
| 26606 |
CDependencyTrackPoint* depTrackPoint = reapplyConceptDes->getDependencyTrackPoint(); |
| 26607 |
procRest = reapplyConceptDes->getReapplyProcessingRestriction(); |
| 26608 |
if (!conProQueue) { |
| 26609 |
conProQueue = processIndi->getConceptProcessingQueue(true); |
| 26610 |
} |
| 26611 |
addConceptRestrictedToProcessingQueue(conDes,depTrackPoint,conProQueue,processIndi,reapplyConceptDes->isStaticDescriptor(),procRest,calcAlgContext); |
| 26612 |
} |
| 26613 |
if (conProQueue) { |
| 26614 |
addIndividualToProcessingQueue(processIndi,calcAlgContext); |
| 26615 |
} |
| 26616 |
} |
| 26617 |
|
| 26618 |
|
| 26619 |
|
| 26620 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToReapplyQueue(CConceptDescriptor *conceptDescriptor, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* dependencyTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26621 |
CConcept* concept = conceptDescriptor->getConcept(); |
| 26622 |
CRole* role = concept->getRole(); |
| 26623 |
return addConceptToReapplyQueue(conceptDescriptor,role,processIndi,true,dependencyTrackPoint,calcAlgContext); |
| 26624 |
} |
| 26625 |
|
| 26626 |
|
| 26627 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToReapplyQueue(CConceptDescriptor *conceptDescriptor, CRole* role, CIndividualProcessNode*& processIndi, bool isStaticDes, CDependencyTrackPoint* dependencyTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26628 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26629 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26630 |
STATINC(INSERTCONCEPTREAPPLICATIONSCOUNT,calcAlgContext); |
| 26631 |
CReapplyQueue* reapplyQueue = processIndi->getRoleReapplyQueue(role,true); |
| 26632 |
CReapplyConceptDescriptor* reapplyConDes = CObjectAllocator<CReapplyConceptDescriptor>::allocateAndConstruct(taskMemMan); |
| 26633 |
reapplyConDes->initReapllyDescriptor(conceptDescriptor,dependencyTrackPoint,isStaticDes); |
| 26634 |
reapplyQueue->addReapplyConceptDescriptor(reapplyConDes); |
| 26635 |
} |
| 26636 |
|
| 26637 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToReapplyQueue(CConceptDescriptor *conceptDescriptor, CConcept* concept, bool negation, CIndividualProcessNode*& processIndi, bool isStaticDes, CDependencyTrackPoint* dependencyTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26638 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26639 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26640 |
STATINC(INSERTCONCEPTREAPPLICATIONSCOUNT,calcAlgContext); |
| 26641 |
CCondensedReapplyQueue* reapplyQueue = processIndi->getConceptReapplyQueue(concept,negation,true); |
| 26642 |
CCondensedReapplyConceptDescriptor* reapplyConDes = CObjectAllocator<CCondensedReapplyConceptDescriptor>::allocateAndConstruct(taskMemMan); |
| 26643 |
reapplyConDes->initReapllyDescriptor(conceptDescriptor,dependencyTrackPoint,!negation); |
| 26644 |
reapplyQueue->addReapplyConceptDescriptor(reapplyConDes); |
| 26645 |
} |
| 26646 |
|
| 26647 |
|
| 26648 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToReapplyQueue(CConceptDescriptor *conceptDescriptor, CRole* role, CIndividualProcessNode*& processIndi, CProcessingRestrictionSpecification* procRest, CDependencyTrackPoint* dependencyTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26649 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26650 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26651 |
STATINC(INSERTCONCEPTREAPPLICATIONSCOUNT,calcAlgContext); |
| 26652 |
CReapplyQueue* reapplyQueue = processIndi->getRoleReapplyQueue(role,true); |
| 26653 |
CReapplyConceptDescriptor* reapplyConDes = CObjectAllocator<CReapplyConceptDescriptor>::allocateAndConstruct(taskMemMan); |
| 26654 |
reapplyConDes->initReapllyDescriptor(conceptDescriptor,dependencyTrackPoint,procRest); |
| 26655 |
reapplyQueue->addReapplyConceptDescriptor(reapplyConDes); |
| 26656 |
} |
| 26657 |
|
| 26658 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToReapplyQueue(CConceptDescriptor *conceptDescriptor, CConcept* concept, bool negation, CIndividualProcessNode*& processIndi, CProcessingRestrictionSpecification* procRest, CDependencyTrackPoint* dependencyTrackPoint, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26659 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26660 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26661 |
STATINC(INSERTCONCEPTREAPPLICATIONSCOUNT,calcAlgContext); |
| 26662 |
CCondensedReapplyQueue* reapplyQueue = processIndi->getConceptReapplyQueue(concept,negation,true); |
| 26663 |
CCondensedReapplyConceptDescriptor* reapplyConDes = CObjectAllocator<CCondensedReapplyConceptDescriptor>::allocateAndConstruct(taskMemMan); |
| 26664 |
reapplyConDes->initReapllyDescriptor(conceptDescriptor,dependencyTrackPoint,!negation,procRest); |
| 26665 |
reapplyQueue->addReapplyConceptDescriptor(reapplyConDes); |
| 26666 |
} |
| 26667 |
|
| 26668 |
|
| 26669 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isConceptInReapplyQueue(CConceptDescriptor* conceptDescriptor, CConcept* concept, bool negation, CIndividualProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26670 |
CCondensedReapplyQueue* reapplyQueue = processIndi->getConceptReapplyQueue(concept,negation,false); |
| 26671 |
if (reapplyQueue) { |
| 26672 |
return reapplyQueue->hasConceptDescriptor(conceptDescriptor); |
| 26673 |
} |
| 26674 |
return false; |
| 26675 |
} |
| 26676 |
|
| 26677 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isConceptInReapplyQueue(CConceptDescriptor* conceptDescriptor, CRole* role, CIndividualProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26678 |
CReapplyQueue* reapplyQueue = processIndi->getRoleReapplyQueue(role,false); |
| 26679 |
if (reapplyQueue) { |
| 26680 |
return reapplyQueue->hasConceptDescriptor(conceptDescriptor); |
| 26681 |
} |
| 26682 |
return false; |
| 26683 |
} |
| 26684 |
|
| 26685 |
|
| 26686 |
|
| 26687 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToIndividualSkipANDProcessing(CConcept* addingConcept, bool negate, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* dependencyTrackPoint, bool allowPreprocessing, bool allowInitalization, bool markModification, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26688 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26689 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26690 |
|
| 26691 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 26692 |
CReapplyConceptLabelSet* conLabelSet = processIndi->getReapplyConceptLabelSet(true); |
| 26693 |
|
| 26694 |
KONCLUDE_ASSERT_X(dependencyTrackPoint,"adding concept to individual","dependency track point missing"); |
| 26695 |
KONCLUDE_ASSERT_X(addingConcept,"adding concept to individual","concept missing"); |
| 26696 |
|
| 26697 |
CConceptDescriptor* conceptDescriptor = createConceptDescriptor(calcAlgContext); |
| 26698 |
conceptDescriptor->initConceptDescriptor(addingConcept,negate,dependencyTrackPoint); |
| 26699 |
CCondensedReapplyQueueIterator reapplyIt; |
| 26700 |
bool contained = insertConceptsToIndividualConceptSet(conceptDescriptor,dependencyTrackPoint,processIndi,conLabelSet,&reapplyIt,allowInitalization,calcAlgContext); |
| 26701 |
if (!contained) { |
| 26702 |
++mStatConDesInsertionCount; |
| 26703 |
STATINC(CONCEPTSADDEDINDINODELABELSETCOUNT,calcAlgContext); |
| 26704 |
addBlockingCoreConcept(conceptDescriptor,processIndi,conLabelSet,calcAlgContext); |
| 26705 |
if (markModification) { |
| 26706 |
setIndividualNodeConceptLabelSetModified(processIndi, calcAlgContext); |
| 26707 |
} |
| 26708 |
addConceptPreprocessedToProcessingQueue(conceptDescriptor,dependencyTrackPoint,conProQueue,processIndi,allowPreprocessing,calcAlgContext,&CCalculationTableauCompletionTaskHandleAlgorithm::applyANDRule); |
| 26709 |
if (reapplyIt.hasNext()) { |
| 26710 |
// reapply reapplying concept |
| 26711 |
applyReapplyQueueConcepts(processIndi,&reapplyIt,calcAlgContext); |
| 26712 |
} |
| 26713 |
} else { |
| 26714 |
++mStatConDesContainedCount; |
| 26715 |
releaseConceptDescriptor(conceptDescriptor,calcAlgContext); |
| 26716 |
} |
| 26717 |
} |
| 26718 |
|
| 26719 |
|
| 26720 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToIndividual(CConcept* addingConcept, bool negate, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* dependencyTrackPoint, bool allowPreprocessing, bool allowInitalization, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26721 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26722 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26723 |
|
| 26724 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 26725 |
CReapplyConceptLabelSet* conLabelSet = processIndi->getReapplyConceptLabelSet(true); |
| 26726 |
|
| 26727 |
KONCLUDE_ASSERT_X(dependencyTrackPoint,"adding concept to individual","dependency track point missing"); |
| 26728 |
KONCLUDE_ASSERT_X(addingConcept,"adding concept to individual","concept missing"); |
| 26729 |
|
| 26730 |
CConceptDescriptor* conceptDescriptor = createConceptDescriptor(calcAlgContext); |
| 26731 |
conceptDescriptor->initConceptDescriptor(addingConcept,negate,dependencyTrackPoint); |
| 26732 |
CCondensedReapplyQueueIterator reapplyIt; |
| 26733 |
bool contained = insertConceptsToIndividualConceptSet(conceptDescriptor,dependencyTrackPoint,processIndi,conLabelSet,&reapplyIt,allowInitalization,calcAlgContext); |
| 26734 |
if (!contained) { |
| 26735 |
STATINC(CONCEPTSADDEDINDINODELABELSETCOUNT,calcAlgContext); |
| 26736 |
++mStatConDesInsertionCount; |
| 26737 |
addBlockingCoreConcept(conceptDescriptor,processIndi,conLabelSet,calcAlgContext); |
| 26738 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 26739 |
addConceptPreprocessedToProcessingQueue(conceptDescriptor,dependencyTrackPoint,conProQueue,processIndi,allowPreprocessing,calcAlgContext); |
| 26740 |
if (reapplyIt.hasNext()) { |
| 26741 |
// reapply reapplying concept |
| 26742 |
applyReapplyQueueConcepts(processIndi,&reapplyIt,calcAlgContext); |
| 26743 |
} |
| 26744 |
} else { |
| 26745 |
++mStatConDesContainedCount; |
| 26746 |
releaseConceptDescriptor(conceptDescriptor,calcAlgContext); |
| 26747 |
} |
| 26748 |
} |
| 26749 |
|
| 26750 |
|
| 26751 |
|
| 26752 |
CConceptDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToIndividualReturnConceptDescriptor(CConcept* addingConcept, bool negate, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* dependencyTrackPoint, bool allowPreprocessing, bool allowInitalization, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26753 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26754 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26755 |
|
| 26756 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 26757 |
CReapplyConceptLabelSet* conLabelSet = processIndi->getReapplyConceptLabelSet(true); |
| 26758 |
|
| 26759 |
KONCLUDE_ASSERT_X(dependencyTrackPoint,"adding concept to individual","dependency track point missing"); |
| 26760 |
KONCLUDE_ASSERT_X(addingConcept,"adding concept to individual","concept missing"); |
| 26761 |
|
| 26762 |
CConceptDescriptor* conceptDescriptor = createConceptDescriptor(calcAlgContext); |
| 26763 |
conceptDescriptor->initConceptDescriptor(addingConcept,negate,dependencyTrackPoint); |
| 26764 |
CCondensedReapplyQueueIterator reapplyIt; |
| 26765 |
insertConceptsToIndividualConceptSet(conceptDescriptor,dependencyTrackPoint,processIndi,conLabelSet,&reapplyIt,allowInitalization,calcAlgContext); |
| 26766 |
++mStatConDesInsertionCount; |
| 26767 |
|
| 26768 |
STATINC(CONCEPTSADDEDINDINODELABELSETCOUNT,calcAlgContext); |
| 26769 |
addBlockingCoreConcept(conceptDescriptor,processIndi,conLabelSet,calcAlgContext); |
| 26770 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 26771 |
addConceptPreprocessedToProcessingQueue(conceptDescriptor,dependencyTrackPoint,conProQueue,processIndi,allowPreprocessing,calcAlgContext); |
| 26772 |
if (reapplyIt.hasNext()) { |
| 26773 |
// reapply reapplying concept |
| 26774 |
applyReapplyQueueConcepts(processIndi,&reapplyIt,calcAlgContext); |
| 26775 |
} |
| 26776 |
return conceptDescriptor; |
| 26777 |
} |
| 26778 |
|
| 26779 |
|
| 26780 |
|
| 26781 |
void CCalculationTableauCompletionTaskHandleAlgorithm::setIndividualNodeAncestorConnectionModified(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26782 |
propagateIndividualNodeModified(indi,calcAlgContext); |
| 26783 |
} |
| 26784 |
|
| 26785 |
void CCalculationTableauCompletionTaskHandleAlgorithm::setIndividualNodeConceptLabelSetModified(CIndividualProcessNode*& indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26786 |
CProcessTagger* processTagger = calcAlgContext->getUsedProcessTagger(); |
| 26787 |
processTagger->incConceptLabelSetModificationTag(); |
| 26788 |
indi->getReapplyConceptLabelSet(true)->updateConceptLabelSetModificationTag(processTagger); |
| 26789 |
calcAlgContext->setMinModificationIndividualCandidate(indi); |
| 26790 |
propagateIndividualNodeModified(indi,calcAlgContext); |
| 26791 |
} |
| 26792 |
|
| 26793 |
|
| 26794 |
|
| 26795 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isIndividualNodeConceptLabelSetModified(CIndividualProcessNode*& indi, cint64 modTag, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26796 |
return indi->getReapplyConceptLabelSet(false)->isConceptLabelSetModificationTagUpToDate(modTag); |
| 26797 |
} |
| 26798 |
|
| 26799 |
|
| 26800 |
|
| 26801 |
|
| 26802 |
|
| 26803 |
|
| 26804 |
CConceptDescriptor* CCalculationTableauCompletionTaskHandleAlgorithm::createConceptDescriptor(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26805 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 26806 |
CConceptDescriptor* conDes = processingDataBox->takeRemainingConceptDescriptor(); |
| 26807 |
if (!conDes) { |
| 26808 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26809 |
conDes = CObjectAllocator<CConceptDescriptor>::allocateAndConstruct(taskMemMan); |
| 26810 |
} |
| 26811 |
return conDes; |
| 26812 |
} |
| 26813 |
|
| 26814 |
|
| 26815 |
void CCalculationTableauCompletionTaskHandleAlgorithm::releaseConceptDescriptor(CConceptDescriptor* conDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26816 |
conDes->clearNext(); |
| 26817 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 26818 |
processingDataBox->addRemainingConceptDescriptor(conDes); |
| 26819 |
} |
| 26820 |
|
| 26821 |
|
| 26822 |
|
| 26823 |
|
| 26824 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptsToIndividual(CSortedNegLinker<CConcept*>* conceptAddLinkerIt, bool negate, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* dependencyTrackPoint, bool allowPreprocessing, bool allowInitalization, cint64* conceptCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26825 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 26826 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26827 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 26828 |
|
| 26829 |
KONCLUDE_ASSERT_X(dependencyTrackPoint,"adding concept to individual","dependency track point missing"); |
| 26830 |
|
| 26831 |
cint64 conCount = 0; |
| 26832 |
CReapplyConceptLabelSet* conLabelSet = processIndi->getReapplyConceptLabelSet(true); |
| 26833 |
while (conceptAddLinkerIt) { |
| 26834 |
CConcept* concept = conceptAddLinkerIt->getData(); |
| 26835 |
bool conNeg = conceptAddLinkerIt->isNegated()^negate; |
| 26836 |
|
| 26837 |
|
| 26838 |
KONCLUDE_ASSERT_X(concept,"adding concept to individual","concept missing"); |
| 26839 |
|
| 26840 |
CConceptDescriptor* conceptDescriptor = createConceptDescriptor(calcAlgContext); |
| 26841 |
conceptDescriptor->initConceptDescriptor(concept,conNeg,dependencyTrackPoint); |
| 26842 |
CCondensedReapplyQueueIterator reapplyIt; |
| 26843 |
bool contained = insertConceptsToIndividualConceptSet(conceptDescriptor,dependencyTrackPoint,processIndi,conLabelSet,&reapplyIt,allowInitalization,calcAlgContext); |
| 26844 |
if (!contained) { |
| 26845 |
++mStatConDesInsertionCount; |
| 26846 |
STATINC(CONCEPTSADDEDINDINODELABELSETCOUNT,calcAlgContext); |
| 26847 |
addBlockingCoreConcept(conceptDescriptor,processIndi,conLabelSet,calcAlgContext); |
| 26848 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 26849 |
addConceptPreprocessedToProcessingQueue(conceptDescriptor,dependencyTrackPoint,conProQueue,processIndi,allowPreprocessing,calcAlgContext); |
| 26850 |
if (reapplyIt.hasNext()) { |
| 26851 |
// reapply reapplying concept |
| 26852 |
applyReapplyQueueConcepts(processIndi,&reapplyIt,calcAlgContext); |
| 26853 |
} |
| 26854 |
} else { |
| 26855 |
++mStatConDesContainedCount; |
| 26856 |
releaseConceptDescriptor(conceptDescriptor,calcAlgContext); |
| 26857 |
} |
| 26858 |
++conCount; |
| 26859 |
conceptAddLinkerIt = conceptAddLinkerIt->getNext(); |
| 26860 |
} |
| 26861 |
if (conceptCount) { |
| 26862 |
*conceptCount = conCount; |
| 26863 |
} |
| 26864 |
} |
| 26865 |
|
| 26866 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addBlockingCoreConcept(CConceptDescriptor* conceptDescriptor, CIndividualProcessNode*& processIndi, CReapplyConceptLabelSet* conLabelSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26867 |
if (mConfSaveCoreBlockingConceptsCandidates) { |
| 26868 |
CConceptData* conData = conceptDescriptor->getConcept()->getConceptData(); |
| 26869 |
if (conData) { |
| 26870 |
CConceptProcessData* conProData = (CConceptProcessData*)conData; |
| 26871 |
if (conProData->isCoreBlockingConcept(conceptDescriptor->isNegated())) { |
| 26872 |
|
| 26873 |
if (!processIndi->isNominalIndividualNode()) { |
| 26874 |
STATINC(CORECONCEPTSADDEDINDINODELABELSETCOUNT,calcAlgContext); |
| 26875 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 26876 |
CCoreConceptDescriptor* coreConceptDescriptor = CObjectAllocator<CCoreConceptDescriptor>::allocateAndConstruct(taskMemMan); |
| 26877 |
coreConceptDescriptor->initCoreConceptDescriptor(conceptDescriptor); |
| 26878 |
conLabelSet->addCoreConceptDescriptor(coreConceptDescriptor); |
| 26879 |
|
| 26880 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 26881 |
CBlockingIndividualNodeLinkedCandidateHash* blockingCandHash = procDataBox->getBlockingIndividualNodeLinkedCandidateHash(true); |
| 26882 |
CBlockingIndividualNodeLinkedCandidateData* blockingCandData = blockingCandHash->getBlockingIndividualCandidateData(conceptDescriptor,true); |
| 26883 |
blockingCandData->addBlockingCandidateIndividualNode(processIndi); |
| 26884 |
} |
| 26885 |
|
| 26886 |
return true; |
| 26887 |
} |
| 26888 |
} |
| 26889 |
} |
| 26890 |
return false; |
| 26891 |
} |
| 26892 |
|
| 26893 |
|
| 26894 |
|
| 26895 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::isConceptUnsatisfiabilitySaturated(CConcept* concept, bool negation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26896 |
CConceptData* conceptData = concept->getConceptData(); |
| 26897 |
CIndividualSaturationProcessNode* saturationIndiNode = nullptr; |
| 26898 |
if (conceptData) { |
| 26899 |
CConceptProcessData* conProcData = (CConceptProcessData*)conceptData; |
| 26900 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 26901 |
if (conRefLinking) { |
| 26902 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 26903 |
CSaturationConceptReferenceLinking* satCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(negation); |
| 26904 |
if (satCalcRefLinkData) { |
| 26905 |
saturationIndiNode = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 26906 |
} |
| 26907 |
} |
| 26908 |
} |
| 26909 |
|
| 26910 |
if (saturationIndiNode) { |
| 26911 |
if (saturationIndiNode->getIndirectStatusFlags()->hasClashedFlag()) { |
| 26912 |
return true; |
| 26913 |
} |
| 26914 |
} |
| 26915 |
return false; |
| 26916 |
} |
| 26917 |
|
| 26918 |
|
| 26919 |
|
| 26920 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::insertConceptsToIndividualConceptSet(CConceptDescriptor* conceptDescriptor, CDependencyTrackPoint* dependencyTrackPoint, CIndividualProcessNode*& processIndi, CReapplyConceptLabelSet* conLabelSet, CCondensedReapplyQueueIterator* reapplyIt, bool allowInitalization, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 26921 |
CConceptDescriptor* clashedConceptDescriptor = nullptr; |
| 26922 |
CDependencyTrackPoint* clashedDependencyTrackPoint = nullptr; |
| 26923 |
|
| 26924 |
if (mConfConceptUnsatisfiabilitySaturatedTesting) { |
| 26925 |
if (isConceptUnsatisfiabilitySaturated(conceptDescriptor->getConcept(),conceptDescriptor->isNegated(),calcAlgContext)) { |
| 26926 |
CClashedDependencyDescriptor* clashConDesLinker = nullptr; |
| 26927 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conceptDescriptor,dependencyTrackPoint,calcAlgContext); |
| 26928 |
throw CCalculationClashProcessingException(clashConDesLinker); |
| 26929 |
} |
| 26930 |
} |
| 26931 |
|
| 26932 |
|
| 26933 |
bool contained = conLabelSet->insertConceptGetClash(conceptDescriptor,dependencyTrackPoint,reapplyIt,&clashedConceptDescriptor,&clashedDependencyTrackPoint); |
| 26934 |
if (!contained) { |
| 26935 |
if (allowInitalization) { |
| 26936 |
if (!processIndi->getIndividualInitializationConcept()) { |
| 26937 |
processIndi->setIndividualInitializationConcept(conceptDescriptor); |
| 26938 |
} |
| 26939 |
} |
| 26940 |
bool nondeterministically = hasNondeterministicDependency(dependencyTrackPoint, calcAlgContext); |
| 26941 |
if (conceptDescriptor->getConcept()->getOperatorCode() == CCMARKER) { |
| 26942 |
calcAlgContext->getProcessingDataBox()->getMarkerIndividualNodeHash(true)->addMarkerIndividualNode(conceptDescriptor->getConcept(),processIndi,nondeterministically); |
| 26943 |
} |
| 26944 |
|
| 26945 |
if (mConfOccurrenceStatisticsCollecting && mOptCollectOccurrenceStatistics) { |
| 26946 |
mOccStatsCacheHandler->incConceptInstanceOccurrencceStatistics(conceptDescriptor->getConcept(), nondeterministically, processIndi->getNominalIndividual() == nullptr); |
| 26947 |
} |
| 26948 |
} |
| 26949 |
if (contained && clashedConceptDescriptor) { |
| 26950 |
|
| 26951 |
//mClashedDebugIndiModelString = generateDebugIndiModelStringList(calcAlgContext); |
| 26952 |
|
| 26953 |
//QFile file = QString("model.txt"); |
| 26954 |
//if (file.open(QIODevice::WriteOnly)) { |
| 26955 |
// file.write(mClashedDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 26956 |
// file.close(); |
| 26957 |
//} |
| 26958 |
|
| 26959 |
CClashedDependencyDescriptor* clashConDesLinker = nullptr; |
| 26960 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,clashedConceptDescriptor,clashedDependencyTrackPoint,calcAlgContext); |
| 26961 |
clashConDesLinker = createClashedConceptDescriptor(clashConDesLinker,processIndi,conceptDescriptor,dependencyTrackPoint,calcAlgContext); |
| 26962 |
|
| 26963 |
|
| 26964 |
//mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 26965 |
//mEndTaskDebugIndiModelString = writeGeneratedExtendedDebugIndiModelStringList("./Debugging/CompletionTasks/concept-clash.txt", calcAlgContext); |
| 26966 |
//mBackendCacheHandler->getCache()->writeStringifiedRepresentativeCacheToFile(); |
| 26967 |
|
| 26968 |
|
| 26969 |
throw CCalculationClashProcessingException(clashConDesLinker); |
| 26970 |
} |
| 26971 |
|
| 26972 |
|
| 26973 |
|
| 26974 |
//CConceptDescriptor* conDes = processIndi->getReapplyConceptLabelSet(false)->getAddingSortedConceptDescriptionLinker(); |
| 26975 |
//bool amountSubstanceFound = false; |
| 26976 |
//for (CConceptDescriptor* conDesIt = conDes; conDesIt; conDesIt = conDesIt->getNext()) { |
| 26977 |
// CConcept* concept = conDesIt->getConcept(); |
| 26978 |
// if (concept->getOperatorCode() == CCIMPLALL) { |
| 26979 |
// if (CIRIName::getRecentIRIName(concept->getRole()->getPropertyNameLinker()) == "http://purl.org/biotop/biotop.owl#granularPartOf") { |
| 26980 |
// CConcept* orCocnept = concept->getOperandList()->getData(); |
| 26981 |
// if (orCocnept->getOperatorCode() == CCOR) { |
| 26982 |
// for (CSortedNegLinker<CConcept*>* opLinker = orCocnept->getOperandList(); opLinker; opLinker = opLinker->getNext()) { |
| 26983 |
// if (opLinker->getData()->getOperatorCode() == CCSUB && CIRIName::getRecentIRIName(opLinker->getData()->getClassNameLinker()) == "http://purl.org/imbi/dco/dco#AmountOfSubstance") { |
| 26984 |
// amountSubstanceFound = true; |
| 26985 |
// } |
| 26986 |
// } |
| 26987 |
// } |
| 26988 |
// } |
| 26989 |
// } |
| 26990 |
//} |
| 26991 |
//if (amountSubstanceFound) { |
| 26992 |
// bool base1Con = false; |
| 26993 |
// bool base2Con = false; |
| 26994 |
// for (CConceptDescriptor* conDesIt = conDes; conDesIt; conDesIt = conDesIt->getNext()) { |
| 26995 |
// if (CIRIName::getRecentIRIName(conDesIt->getData()->getClassNameLinker()) == "http://purl.org/biotop/biotop.owl#Atom") { |
| 26996 |
// base1Con = true; |
| 26997 |
// } |
| 26998 |
// if (CIRIName::getRecentIRIName(conDesIt->getData()->getClassNameLinker()) == "http://purl.org/biotop/biotop.owl#MonoMolecularEntity") { |
| 26999 |
// base2Con = true; |
| 27000 |
// } |
| 27001 |
// } |
| 27002 |
// if (!base2Con && !base1Con) { |
| 27003 |
// mEndTaskDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 27004 |
// QFile file(QString("caching-error.txt")); |
| 27005 |
// if (file.open(QIODevice::WriteOnly)) { |
| 27006 |
// file.write(mEndTaskDebugIndiModelString.replace("<br>","\r\n").toLocal8Bit()); |
| 27007 |
// file.close(); |
| 27008 |
// } |
| 27009 |
// bool bug = true; |
| 27010 |
// } |
| 27011 |
//} |
| 27012 |
|
| 27013 |
|
| 27014 |
return contained; |
| 27015 |
} |
| 27016 |
|
| 27017 |
|
| 27018 |
|
| 27019 |
|
| 27020 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptsToIndividual(CConceptAssertionLinker* conceptAddLinkerIt, bool negate, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* dependencyTrackPoint, bool allowPreprocessing, bool allowInitalization, cint64* conceptCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27021 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 27022 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27023 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 27024 |
|
| 27025 |
KONCLUDE_ASSERT_X(dependencyTrackPoint,"adding concept to individual","dependency track point missing"); |
| 27026 |
|
| 27027 |
cint64 conCount = 0; |
| 27028 |
CReapplyConceptLabelSet* conLabelSet = processIndi->getReapplyConceptLabelSet(true); |
| 27029 |
while (conceptAddLinkerIt) { |
| 27030 |
CConcept* concept = conceptAddLinkerIt->getData(); |
| 27031 |
bool conNeg = conceptAddLinkerIt->isNegated()^negate; |
| 27032 |
KONCLUDE_ASSERT_X(concept,"adding concept to individual","concept missing"); |
| 27033 |
|
| 27034 |
|
| 27035 |
CConceptDescriptor* conceptDescriptor = createConceptDescriptor(calcAlgContext); |
| 27036 |
conceptDescriptor->initConceptDescriptor(concept,conNeg,dependencyTrackPoint); |
| 27037 |
CCondensedReapplyQueueIterator reapplyIt; |
| 27038 |
bool contained = insertConceptsToIndividualConceptSet(conceptDescriptor,dependencyTrackPoint,processIndi,conLabelSet,&reapplyIt,allowInitalization,calcAlgContext); |
| 27039 |
if (!contained) { |
| 27040 |
++mStatConDesInsertionCount; |
| 27041 |
STATINC(CONCEPTSADDEDINDINODELABELSETCOUNT,calcAlgContext); |
| 27042 |
addBlockingCoreConcept(conceptDescriptor,processIndi,conLabelSet,calcAlgContext); |
| 27043 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 27044 |
addConceptPreprocessedToProcessingQueue(conceptDescriptor,dependencyTrackPoint,conProQueue,processIndi,allowPreprocessing,calcAlgContext); |
| 27045 |
if (reapplyIt.hasNext()) { |
| 27046 |
// reapply reapplying concept |
| 27047 |
applyReapplyQueueConcepts(processIndi,&reapplyIt,calcAlgContext); |
| 27048 |
} |
| 27049 |
} else { |
| 27050 |
++mStatConDesContainedCount; |
| 27051 |
releaseConceptDescriptor(conceptDescriptor,calcAlgContext); |
| 27052 |
} |
| 27053 |
conceptAddLinkerIt = conceptAddLinkerIt->getNext(); |
| 27054 |
} |
| 27055 |
if (conceptCount) { |
| 27056 |
*conceptCount = conCount; |
| 27057 |
} |
| 27058 |
} |
| 27059 |
|
| 27060 |
|
| 27061 |
|
| 27062 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptsToIndividual(CXNegLinker<CConcept*>* conceptAddLinkerIt, bool negate, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* dependencyTrackPoint, bool allowPreprocessing, bool allowInitalization, cint64* conceptCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27063 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 27064 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27065 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 27066 |
|
| 27067 |
KONCLUDE_ASSERT_X(dependencyTrackPoint,"adding concept to individual","dependency track point missing"); |
| 27068 |
|
| 27069 |
cint64 conCount = 0; |
| 27070 |
CReapplyConceptLabelSet* conLabelSet = processIndi->getReapplyConceptLabelSet(true); |
| 27071 |
while (conceptAddLinkerIt) { |
| 27072 |
CConcept* concept = conceptAddLinkerIt->getData(); |
| 27073 |
bool conNeg = conceptAddLinkerIt->isNegated()^negate; |
| 27074 |
KONCLUDE_ASSERT_X(concept,"adding concept to individual","concept missing"); |
| 27075 |
|
| 27076 |
|
| 27077 |
CConceptDescriptor* conceptDescriptor = createConceptDescriptor(calcAlgContext); |
| 27078 |
conceptDescriptor->initConceptDescriptor(concept,conNeg,dependencyTrackPoint); |
| 27079 |
CCondensedReapplyQueueIterator reapplyIt; |
| 27080 |
bool contained = insertConceptsToIndividualConceptSet(conceptDescriptor,dependencyTrackPoint,processIndi,conLabelSet,&reapplyIt,allowInitalization,calcAlgContext); |
| 27081 |
if (!contained) { |
| 27082 |
++mStatConDesInsertionCount; |
| 27083 |
STATINC(CONCEPTSADDEDINDINODELABELSETCOUNT,calcAlgContext); |
| 27084 |
addBlockingCoreConcept(conceptDescriptor,processIndi,conLabelSet,calcAlgContext); |
| 27085 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 27086 |
addConceptPreprocessedToProcessingQueue(conceptDescriptor,dependencyTrackPoint,conProQueue,processIndi,allowPreprocessing,calcAlgContext); |
| 27087 |
if (reapplyIt.hasNext()) { |
| 27088 |
// reapply reapplying concept |
| 27089 |
applyReapplyQueueConcepts(processIndi,&reapplyIt,calcAlgContext); |
| 27090 |
} |
| 27091 |
} else { |
| 27092 |
++mStatConDesContainedCount; |
| 27093 |
releaseConceptDescriptor(conceptDescriptor,calcAlgContext); |
| 27094 |
} |
| 27095 |
conceptAddLinkerIt = conceptAddLinkerIt->getNext(); |
| 27096 |
} |
| 27097 |
if (conceptCount) { |
| 27098 |
*conceptCount = conCount; |
| 27099 |
} |
| 27100 |
} |
| 27101 |
|
| 27102 |
|
| 27103 |
|
| 27104 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptsToIndividual(CXSortedNegLinker<CConcept*>* conceptAddLinkerIt, bool negate, CIndividualProcessNode*& processIndi, CDependencyTrackPoint* dependencyTrackPoint, bool allowPreprocessing, bool allowInitalization, cint64* conceptCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27105 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 27106 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27107 |
CConceptProcessingQueue* conProQueue = processIndi->getConceptProcessingQueue(true); |
| 27108 |
|
| 27109 |
KONCLUDE_ASSERT_X(dependencyTrackPoint,"adding concept to individual","dependency track point missing"); |
| 27110 |
|
| 27111 |
cint64 conCount = 0; |
| 27112 |
CReapplyConceptLabelSet* conLabelSet = processIndi->getReapplyConceptLabelSet(true); |
| 27113 |
while (conceptAddLinkerIt) { |
| 27114 |
CConcept* concept = conceptAddLinkerIt->getData(); |
| 27115 |
KONCLUDE_ASSERT_X(concept,"adding concept to individual","concept missing"); |
| 27116 |
bool conNeg = conceptAddLinkerIt->isNegated()^negate; |
| 27117 |
|
| 27118 |
|
| 27119 |
CConceptDescriptor* conceptDescriptor = createConceptDescriptor(calcAlgContext); |
| 27120 |
conceptDescriptor->initConceptDescriptor(concept,conNeg,dependencyTrackPoint); |
| 27121 |
CCondensedReapplyQueueIterator reapplyIt; |
| 27122 |
bool contained = insertConceptsToIndividualConceptSet(conceptDescriptor,dependencyTrackPoint,processIndi,conLabelSet,&reapplyIt,allowInitalization,calcAlgContext); |
| 27123 |
if (!contained) { |
| 27124 |
++mStatConDesInsertionCount; |
| 27125 |
STATINC(CONCEPTSADDEDINDINODELABELSETCOUNT,calcAlgContext); |
| 27126 |
addBlockingCoreConcept(conceptDescriptor,processIndi,conLabelSet,calcAlgContext); |
| 27127 |
setIndividualNodeConceptLabelSetModified(processIndi,calcAlgContext); |
| 27128 |
addConceptPreprocessedToProcessingQueue(conceptDescriptor,dependencyTrackPoint,conProQueue,processIndi,allowPreprocessing,calcAlgContext); |
| 27129 |
if (reapplyIt.hasNext()) { |
| 27130 |
// reapply reapplying concept |
| 27131 |
applyReapplyQueueConcepts(processIndi,&reapplyIt,calcAlgContext); |
| 27132 |
} |
| 27133 |
} else { |
| 27134 |
++mStatConDesContainedCount; |
| 27135 |
releaseConceptDescriptor(conceptDescriptor,calcAlgContext); |
| 27136 |
} |
| 27137 |
conceptAddLinkerIt = conceptAddLinkerIt->getNext(); |
| 27138 |
} |
| 27139 |
if (conceptCount) { |
| 27140 |
*conceptCount = conCount; |
| 27141 |
} |
| 27142 |
} |
| 27143 |
|
| 27144 |
|
| 27145 |
|
| 27146 |
void CCalculationTableauCompletionTaskHandleAlgorithm::insertConceptProcessDescriptorToProcessingQueue(CConceptProcessDescriptor* conProDes, CConceptProcessingQueue*& conceptProcessingQueue, CIndividualProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27147 |
|
| 27148 |
CConcept* concept = conProDes->getConceptDescriptor()->getConcept(); |
| 27149 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 27150 |
|
| 27151 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_PROPAGATION_TYPE)) { |
| 27152 |
CProcessingDataBox* procDataBox = calcAlgContext->getProcessingDataBox(); |
| 27153 |
CIndividualConceptBatchProcessingQueue* varBindConBatchProcQueue = procDataBox->getVariableBindingConceptBatchProcessingQueue(true); |
| 27154 |
varBindConBatchProcQueue->insertIndiviudalForConcept(concept,processIndi,conProDes); |
| 27155 |
} else { |
| 27156 |
conceptProcessingQueue->insertConceptProcessDescriptor(conProDes); |
| 27157 |
} |
| 27158 |
} |
| 27159 |
|
| 27160 |
void CCalculationTableauCompletionTaskHandleAlgorithm::insertConceptProcessDescriptorToProcessingQueue(CConceptProcessDescriptor* conProDes, CConceptProcessingQueue*& conceptProcessingQueue, cint64 bindingCount, CIndividualProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27161 |
|
| 27162 |
CConcept* concept = conProDes->getConceptDescriptor()->getConcept(); |
| 27163 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 27164 |
|
| 27165 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_PROPAGATION_ALL_TYPE | CConceptOperator::CCFS_PROPAGATION_AND_TYPE)) { |
| 27166 |
CProcessingDataBox* procDataBox = calcAlgContext->getProcessingDataBox(); |
| 27167 |
CIndividualConceptBatchProcessingQueue* varBindConBatchProcQueue = procDataBox->getVariableBindingConceptBatchProcessingQueue(true); |
| 27168 |
varBindConBatchProcQueue->insertIndiviudalForBindingCount(concept,bindingCount,processIndi,conProDes); |
| 27169 |
} else if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_PROPAGATION_TYPE)) { |
| 27170 |
CProcessingDataBox* procDataBox = calcAlgContext->getProcessingDataBox(); |
| 27171 |
CIndividualConceptBatchProcessingQueue* varBindConBatchProcQueue = procDataBox->getVariableBindingConceptBatchProcessingQueue(true); |
| 27172 |
varBindConBatchProcQueue->insertIndiviudalForConcept(concept,processIndi,conProDes); |
| 27173 |
} else { |
| 27174 |
conceptProcessingQueue->insertConceptProcessDescriptor(conProDes); |
| 27175 |
} |
| 27176 |
} |
| 27177 |
|
| 27178 |
|
| 27179 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToProcessingQueue(CConceptDescriptor *conceptDescriptor, CDependencyTrackPoint* depTrackPoint, CConceptProcessingQueue*& conceptProcessingQueue, CIndividualProcessNode*& processIndi, bool reapplied, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27180 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 27181 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27182 |
|
| 27183 |
if (needsProcessingForConcept(conceptDescriptor,depTrackPoint,processIndi,calcAlgContext)) { |
| 27184 |
|
| 27185 |
STATINC(CONCEPTSADDEDINDINODEPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27186 |
CConceptProcessDescriptor* conProDes = CObjectAllocator<CConceptProcessDescriptor>::allocateAndConstruct(taskMemMan); |
| 27187 |
CConceptProcessPriority conProPriority = calcAlgContext->getUsedConceptPriorityStrategy()->getPriorityForConcept(conceptDescriptor,processIndi); |
| 27188 |
conProDes->init(conceptDescriptor,conProPriority,reapplied,depTrackPoint); |
| 27189 |
|
| 27190 |
insertConceptProcessDescriptorToProcessingQueue(conProDes,conceptProcessingQueue,processIndi,calcAlgContext); |
| 27191 |
|
| 27192 |
//propagateIndividualUnprocessed(processIndi,calcAlgContext); |
| 27193 |
} |
| 27194 |
} |
| 27195 |
|
| 27196 |
|
| 27197 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::needsProcessingForConcept(CConceptDescriptor *conceptDescriptor, CDependencyTrackPoint* depTrackPoint, CIndividualProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27198 |
TableauRuleFunction func = nullptr; |
| 27199 |
cint64 opCode = conceptDescriptor->getConcept()->getOperatorCode(); |
| 27200 |
bool conNeg = conceptDescriptor->isNegated(); |
| 27201 |
if (conNeg) { |
| 27202 |
func = mNegJumpFuncVec[opCode]; |
| 27203 |
} else { |
| 27204 |
func = mPosJumpFuncVec[opCode]; |
| 27205 |
} |
| 27206 |
return func != nullptr; |
| 27207 |
} |
| 27208 |
|
| 27209 |
|
| 27210 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptPreprocessedToProcessingQueue(CConceptDescriptor *conceptDescriptor, CDependencyTrackPoint* depTrackPoint, CConceptProcessingQueue*& conceptProcessingQueue, CIndividualProcessNode*& processIndi, cint64 bindingCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27211 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27212 |
|
| 27213 |
STATINC(CONCEPTSADDEDINDINODEPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27214 |
CConceptProcessPriority conProPriority = calcAlgContext->getUsedConceptPriorityStrategy()->getPriorityForConcept(conceptDescriptor,processIndi); |
| 27215 |
|
| 27216 |
CConceptProcessDescriptor* conProDes = CObjectAllocator<CConceptProcessDescriptor>::allocateAndConstruct(taskMemMan); |
| 27217 |
conProDes->init(conceptDescriptor,conProPriority,false,depTrackPoint); |
| 27218 |
insertConceptProcessDescriptorToProcessingQueue(conProDes,conceptProcessingQueue,bindingCount,processIndi,calcAlgContext); |
| 27219 |
} |
| 27220 |
|
| 27221 |
|
| 27222 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptPreprocessedToProcessingQueue(CConceptDescriptor *conceptDescriptor, CDependencyTrackPoint* depTrackPoint, CConceptProcessingQueue*& conceptProcessingQueue, CIndividualProcessNode*& processIndi, bool allowPreprocessing, CCalculationAlgorithmContextBase* calcAlgContext, TableauRuleFunction skipFunction) { |
| 27223 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27224 |
|
| 27225 |
// TODO: check necessary |
| 27226 |
TableauRuleFunction func = nullptr; |
| 27227 |
cint64 opCode = conceptDescriptor->getConcept()->getOperatorCode(); |
| 27228 |
bool conNeg = conceptDescriptor->isNegated(); |
| 27229 |
if (conNeg) { |
| 27230 |
func = mNegJumpFuncVec[opCode]; |
| 27231 |
} else { |
| 27232 |
func = mPosJumpFuncVec[opCode]; |
| 27233 |
} |
| 27234 |
if (!func || func == skipFunction) { |
| 27235 |
return; |
| 27236 |
} |
| 27237 |
|
| 27238 |
|
| 27239 |
allowPreprocessing &= mConfDirectRulePreprocessing; |
| 27240 |
if (mCurrentRecProcDepth > mCurrentRecProcDepthLimit) { |
| 27241 |
allowPreprocessing = false; |
| 27242 |
} |
| 27243 |
|
| 27244 |
|
| 27245 |
CConcept* concept = conceptDescriptor->getConcept(); |
| 27246 |
CConceptOperator* conOperator = concept->getConceptOperator(); |
| 27247 |
|
| 27248 |
if (conOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_PROPAGATION_TYPE)) { |
| 27249 |
allowPreprocessing = false; |
| 27250 |
} |
| 27251 |
|
| 27252 |
|
| 27253 |
STATINC(CONCEPTSADDEDINDINODEPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27254 |
CConceptProcessPriority conProPriority = calcAlgContext->getUsedConceptPriorityStrategy()->getPriorityForConcept(conceptDescriptor,processIndi); |
| 27255 |
|
| 27256 |
|
| 27257 |
CConceptProcessDescriptor* conProDes = CObjectAllocator<CConceptProcessDescriptor>::allocateAndConstruct(taskMemMan); |
| 27258 |
conProDes->init(conceptDescriptor,conProPriority,false,depTrackPoint); |
| 27259 |
|
| 27260 |
if (allowPreprocessing && conProPriority.getPriority() >= mImmediatelyProcessPriority) { |
| 27261 |
STATINC(RULEAPPLICATIONCOUNT,calcAlgContext); |
| 27262 |
tableauRuleChoice(processIndi,conProDes,calcAlgContext); |
| 27263 |
} else { |
| 27264 |
insertConceptProcessDescriptorToProcessingQueue(conProDes,conceptProcessingQueue,processIndi,calcAlgContext); |
| 27265 |
//propagateIndividualUnprocessed(processIndi,calcAlgContext); |
| 27266 |
} |
| 27267 |
} |
| 27268 |
|
| 27269 |
|
| 27270 |
|
| 27271 |
|
| 27272 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptToProcessingQueue(CConceptProcessDescriptor* reinsertConProDes, CConceptProcessingQueue*& conceptProcessingQueue, CIndividualProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27273 |
STATINC(CONCEPTSADDEDINDINODEPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27274 |
conceptProcessingQueue->reinsertConceptProcessDescriptor(reinsertConProDes); |
| 27275 |
} |
| 27276 |
|
| 27277 |
|
| 27278 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addCopiedConceptToProcessingQueue(CConceptProcessDescriptor* copyConProDes, CIndividualProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27279 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 27280 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27281 |
|
| 27282 |
if (!processIndi->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger()->getCurrentLocalizationTag())) { |
| 27283 |
processIndi = getUpToDateIndividual(processIndi,calcAlgContext); |
| 27284 |
if (!processIndi->isLocalizationTagUpToDate(calcAlgContext->getUsedProcessTagger()->getCurrentLocalizationTag())) { |
| 27285 |
STATINC(INDINODELOCALIZEDLOADCOUNT,calcAlgContext); |
| 27286 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 27287 |
CIndividualProcessNodeVector* indiProcNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 27288 |
CIndividualProcessNode* localicedIndi = CObjectParameterizingAllocator< CIndividualProcessNode,CProcessContext* >::allocateAndConstructAndParameterize(taskMemMan,calcAlgContext->getUsedProcessContext()); |
| 27289 |
localicedIndi->initIndividualProcessNode(processIndi); |
| 27290 |
indiProcNodeVec->setLocalData(localicedIndi->getIndividualNodeID(),localicedIndi); |
| 27291 |
processIndi = localicedIndi; |
| 27292 |
calcAlgContext->getUsedProcessTagger()->incLocalizationTag(); |
| 27293 |
} |
| 27294 |
} |
| 27295 |
|
| 27296 |
CConceptProcessDescriptor* conProDes = CObjectAllocator<CConceptProcessDescriptor>::allocateAndConstruct(taskMemMan); |
| 27297 |
CConceptProcessPriority conProPriority = calcAlgContext->getUsedConceptPriorityStrategy()->getPriorityForConcept(copyConProDes->getConceptDescriptor(),processIndi); |
| 27298 |
conProDes->initCopy(copyConProDes); |
| 27299 |
CConceptProcessingQueue* conceptProcessingQueue = processIndi->getConceptProcessingQueue(true); |
| 27300 |
insertConceptProcessDescriptorToProcessingQueue(conProDes,conceptProcessingQueue,processIndi,calcAlgContext); |
| 27301 |
} |
| 27302 |
|
| 27303 |
|
| 27304 |
|
| 27305 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptRestrictedToProcessingQueue(CConceptDescriptor *conceptDescriptor, CDependencyTrackPoint* depTrackPoint, CConceptProcessingQueue*& conceptProcessingQueue, CIndividualProcessNode*& processIndi, bool reapplied, CProcessingRestrictionSpecification* procRestriction, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27306 |
|
| 27307 |
bool insertedWithPriorityOffset = false; |
| 27308 |
if (procRestriction) { |
| 27309 |
double priorityOffset = procRestriction->getPriorityOffset(); |
| 27310 |
insertedWithPriorityOffset = true; |
| 27311 |
addConceptRestrictedToProcessingQueue(conceptDescriptor,depTrackPoint,conceptProcessingQueue,processIndi,reapplied,procRestriction,priorityOffset,calcAlgContext); |
| 27312 |
} |
| 27313 |
if (!insertedWithPriorityOffset) { |
| 27314 |
addConceptRestrictedToProcessingQueue(conceptDescriptor,depTrackPoint,conceptProcessingQueue,processIndi,reapplied,procRestriction,0,calcAlgContext); |
| 27315 |
} |
| 27316 |
} |
| 27317 |
|
| 27318 |
|
| 27319 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptRestrictedToProcessingQueue(CConceptDescriptor *conceptDescriptor, CDependencyTrackPoint* depTrackPoint, CConceptProcessingQueue*& conceptProcessingQueue, CIndividualProcessNode*& processIndi, bool reapplied, CProcessingRestrictionSpecification* procRestriction, double priorityOffset, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27320 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 27321 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27322 |
|
| 27323 |
if (needsProcessingForConcept(conceptDescriptor,depTrackPoint,processIndi,calcAlgContext)) { |
| 27324 |
|
| 27325 |
STATINC(CONCEPTSADDEDINDINODEPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27326 |
CConceptProcessDescriptor* conProDes = CObjectAllocator<CConceptProcessDescriptor>::allocateAndConstruct(taskMemMan); |
| 27327 |
CConceptProcessPriority conProPriority = calcAlgContext->getUsedConceptPriorityStrategy()->getPriorityForConcept(conceptDescriptor,processIndi); |
| 27328 |
conProPriority.addPriorityOffset(priorityOffset); |
| 27329 |
conProDes->init(conceptDescriptor,conProPriority,reapplied,depTrackPoint,procRestriction); |
| 27330 |
insertConceptProcessDescriptorToProcessingQueue(conProDes,conceptProcessingQueue,processIndi,calcAlgContext); |
| 27331 |
|
| 27332 |
|
| 27333 |
//propagateIndividualUnprocessed(processIndi,calcAlgContext); |
| 27334 |
} |
| 27335 |
} |
| 27336 |
|
| 27337 |
|
| 27338 |
|
| 27339 |
void CCalculationTableauCompletionTaskHandleAlgorithm::addConceptRestrictedFixedPriorityToProcessingQueue(CConceptDescriptor *conceptDescriptor, CDependencyTrackPoint* depTrackPoint, CConceptProcessingQueue*& conceptProcessingQueue, CIndividualProcessNode*& processIndi, bool reapplied, CProcessingRestrictionSpecification* procRestriction, double priority, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27340 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 27341 |
taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27342 |
|
| 27343 |
STATINC(CONCEPTSADDEDINDINODEPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27344 |
CConceptProcessDescriptor* conProDes = CObjectAllocator<CConceptProcessDescriptor>::allocateAndConstruct(taskMemMan); |
| 27345 |
CConceptProcessPriority conProPriority(priority); |
| 27346 |
conProDes->init(conceptDescriptor,conProPriority,reapplied,depTrackPoint,procRestriction); |
| 27347 |
insertConceptProcessDescriptorToProcessingQueue(conProDes,conceptProcessingQueue,processIndi,calcAlgContext); |
| 27348 |
|
| 27349 |
//propagateIndividualUnprocessed(processIndi,calcAlgContext); |
| 27350 |
} |
| 27351 |
|
| 27352 |
|
| 27353 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToProcessingQueueBasedOnProcessingConcepts(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27354 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 27355 |
bool individualInserted = false; |
| 27356 |
CConceptProcessingQueue* conProQueue = individual->getConceptProcessingQueue(false); |
| 27357 |
if (!conProQueue || individual->getLastAssertedDataLiteralLinker() != individual->getAssertedDataLiteralLinker() || individual->getAssertionDataLinker() != individual->getLastProcessedAssertionDataLinker() || individual->getAdditionalDataAssertionsLinker() != individual->getLastProcessedAdditionalDataAssertionLinker()) { |
| 27358 |
if (!mConfCurrentIndividualQueuing && calcAlgContext->getCurrentIndividualNode() == individual) { |
| 27359 |
individualInserted = true; |
| 27360 |
} else if (!individual->isImmediatelyProcessingQueued()) { |
| 27361 |
individual->setImmediatelyProcessingQueued(true); |
| 27362 |
CIndividualUnsortedProcessingQueue* unPrQueue = processingDataBox->getIndividualImmediatelyProcessingQueue(true); |
| 27363 |
unPrQueue->insertIndiviudalProcessNode(individual); |
| 27364 |
individualInserted = true; |
| 27365 |
} |
| 27366 |
} else if (!conProQueue->isEmpty()) { |
| 27367 |
CConceptProcessPriority conProPri; |
| 27368 |
if (conProQueue->getNextConceptProcessPriority(&conProPri)) { |
| 27369 |
double priority = conProPri.getPriority(); |
| 27370 |
if (priority >= mImmediatelyProcessPriority) { |
| 27371 |
if (!mConfCurrentIndividualQueuing && calcAlgContext->getCurrentIndividualNode() == individual) { |
| 27372 |
individualInserted = true; |
| 27373 |
} else if (!individual->isImmediatelyProcessingQueued()) { |
| 27374 |
individual->setImmediatelyProcessingQueued(true); |
| 27375 |
CIndividualUnsortedProcessingQueue* unPrQueue = processingDataBox->getIndividualImmediatelyProcessingQueue(true); |
| 27376 |
unPrQueue->insertIndiviudalProcessNode(individual); |
| 27377 |
individualInserted = true; |
| 27378 |
} |
| 27379 |
} else if ((mOptDetExpPreporcessing || individual->isNominalIndividualNode() && individual->getIndividualNominalLevelOrAncestorDepth() <= 0) && priority >= mDeterministicProcessPriority) { |
| 27380 |
if (!individual->isDeterministicExpandingProcessingQueued()) { |
| 27381 |
individual->setDeterministicExpandingProcessingQueued(true); |
| 27382 |
CIndividualDepthProcessingQueue* unPrQueue = processingDataBox->getIndividualDepthDeterministicExpansionPreprocessingQueue(true); |
| 27383 |
unPrQueue->insertProcessIndiviudal(individual); |
| 27384 |
individualInserted = true; |
| 27385 |
} |
| 27386 |
} else { |
| 27387 |
if (!individual->isRegularDepthProcessingQueued()) { |
| 27388 |
individual->setRegularDepthProcessingQueued(true); |
| 27389 |
|
| 27390 |
if (individual->isNominalIndividualNode() && individual->getIndividualNominalLevelOrAncestorDepth() <= 0) { |
| 27391 |
if (!processingDataBox->hasNominalNonDeterministicProcessingNodesSorted()) { |
| 27392 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27393 |
CXLinker<CIndividualProcessNode*>* linker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(taskMemMan); |
| 27394 |
linker->initLinker(individual); |
| 27395 |
processingDataBox->addSortedNominalNonDeterministicProcessingNodeLinker(linker); |
| 27396 |
} else { |
| 27397 |
CIndividualDepthProcessingQueue* nominalProQueue = processingDataBox->getNominalProcessingQueue(true); |
| 27398 |
nominalProQueue->insertProcessIndiviudal(individual); |
| 27399 |
} |
| 27400 |
} else { |
| 27401 |
CIndividualDepthProcessingQueue* inDepthProQueue = processingDataBox->getIndividualDepthProcessingQueue(true); |
| 27402 |
inDepthProQueue->insertProcessIndiviudal(individual); |
| 27403 |
} |
| 27404 |
individualInserted = true; |
| 27405 |
} |
| 27406 |
} |
| 27407 |
} |
| 27408 |
} |
| 27409 |
return individualInserted; |
| 27410 |
} |
| 27411 |
|
| 27412 |
|
| 27413 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToProcessingQueue(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27414 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 27415 |
bool individualInserted = false; |
| 27416 |
|
| 27417 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 27418 |
|
| 27419 |
if (mConfDepthOrientatedProcessing && !individual->isNominalIndividualNode() && !individual->isExtendedQueueProcessing()) { |
| 27420 |
|
| 27421 |
if (!individual->isProcessingQueued()) { |
| 27422 |
bool deterministicPreprocessingQueued = false; |
| 27423 |
if (mOptDetExpPreporcessing) { |
| 27424 |
deterministicPreprocessingQueued = true; |
| 27425 |
CConceptProcessingQueue* conProQueue = individual->getConceptProcessingQueue(false); |
| 27426 |
if (!conProQueue) { |
| 27427 |
CConceptProcessPriority conProPri; |
| 27428 |
if (conProQueue->getNextConceptProcessPriority(&conProPri)) { |
| 27429 |
double priority = conProPri.getPriority(); |
| 27430 |
if (priority < mDeterministicProcessPriority) { |
| 27431 |
deterministicPreprocessingQueued = false; |
| 27432 |
} |
| 27433 |
} |
| 27434 |
} |
| 27435 |
} |
| 27436 |
if (deterministicPreprocessingQueued) { |
| 27437 |
CIndividualUnsortedProcessingQueue* unPrQueue = processingDataBox->getIndividualDepthFirstDeterministicExpansionProcessingQueue(true); |
| 27438 |
unPrQueue->insertIndiviudalProcessNode(individual); |
| 27439 |
} else { |
| 27440 |
CIndividualUnsortedProcessingQueue* depthProcessingQueue = processingDataBox->getIndividualDepthFirstProcessingQueue(true); |
| 27441 |
depthProcessingQueue->insertIndiviudalProcessNode(individual); |
| 27442 |
} |
| 27443 |
individual->setProcessingQueued(true); |
| 27444 |
individualInserted = true; |
| 27445 |
} |
| 27446 |
|
| 27447 |
} else { |
| 27448 |
|
| 27449 |
bool insertIndividual = true; |
| 27450 |
bool individualBlocked = false; |
| 27451 |
if (insertIndividual && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFDIRECTBLOCKED)) { |
| 27452 |
individualBlocked = true; |
| 27453 |
if (!individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEDIRECTMODIFIED | CIndividualProcessNode::PRFBLOCKINGRETESTDUEBLOCKERMODIFIED)) { |
| 27454 |
insertIndividual = false; |
| 27455 |
} |
| 27456 |
} |
| 27457 |
//if (insertIndividual && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSATISFIABLECACHED)) { |
| 27458 |
// individualBlocked = true; |
| 27459 |
// if (!individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSATISFIABLECACHEDDUEDIRECTMODIFIED)) { |
| 27460 |
// insertIndividual = false; |
| 27461 |
// } |
| 27462 |
//} |
| 27463 |
//if (insertIndividual && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSIGNATUREBLOCKINGCACHED)) { |
| 27464 |
// individualBlocked = true; |
| 27465 |
// if (!individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTSIGNATUREBLOCKINGCACHEDDUEDIRECTMODIFIED)) { |
| 27466 |
// insertIndividual = false; |
| 27467 |
// } |
| 27468 |
//} |
| 27469 |
if (insertIndividual && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHED)) { |
| 27470 |
individualBlocked = true; |
| 27471 |
if (!individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFRETESTCOMPLETIONGRAPHCACHEDDUEDIRECTMODIFIED | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALIDATED | CIndividualProcessNode::PRFCOMPLETIONGRAPHCACHINGINVALID)) { |
| 27472 |
insertIndividual = false; |
| 27473 |
} |
| 27474 |
} |
| 27475 |
|
| 27476 |
if (insertIndividual && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFINDIRECTBLOCKED)) { |
| 27477 |
individualBlocked = true; |
| 27478 |
if (!individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFBLOCKINGRETESTDUEINDIRECTBLOCKERLOSS)) { |
| 27479 |
insertIndividual = false; |
| 27480 |
} |
| 27481 |
} |
| 27482 |
if (insertIndividual && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHED)) { |
| 27483 |
individualBlocked = true; |
| 27484 |
if (!individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATISFIABLECACHEDABOLISHED)) { |
| 27485 |
insertIndividual = false; |
| 27486 |
} |
| 27487 |
} |
| 27488 |
if (insertIndividual && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHED)) { |
| 27489 |
individualBlocked = true; |
| 27490 |
if (!individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSIGNATUREBLOCKINGCACHEDABOLISHED)) { |
| 27491 |
insertIndividual = false; |
| 27492 |
} |
| 27493 |
} |
| 27494 |
if (insertIndividual && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHED)) { |
| 27495 |
individualBlocked = true; |
| 27496 |
if (!individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFANCESTORSATURATIONBLOCKINGCACHEDABOLISHED)) { |
| 27497 |
insertIndividual = false; |
| 27498 |
} |
| 27499 |
} |
| 27500 |
if (insertIndividual && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKEND) && individual->hasPartialProcessingRestrictionFlags(CIndividualProcessNode::PRFSYNCHRONIZEDBACKENDSUCCESSOREXPANSIONBLOCKED)) { |
| 27501 |
individualBlocked = true; |
| 27502 |
insertIndividual = false; |
| 27503 |
} |
| 27504 |
if (insertIndividual && individual->isDelayedNominalProcessingQueued()) { |
| 27505 |
individualBlocked = true; |
| 27506 |
insertIndividual = false; |
| 27507 |
} |
| 27508 |
|
| 27509 |
if (individualBlocked && insertIndividual) { |
| 27510 |
if (mConfLateBlockingResolving) { |
| 27511 |
if (!individual->isBlockedReactivationProcessingQueued()) { |
| 27512 |
individual->setBlockedReactivationProcessingQueued(true); |
| 27513 |
|
| 27514 |
CIndividualDepthProcessingQueue* blockReactProQueue = processingDataBox->getBlockedReactivationProcessingQueue(true); |
| 27515 |
blockReactProQueue->insertProcessIndiviudal(individual); |
| 27516 |
|
| 27517 |
//CXLinker<CIndividualProcessNode*>* indiNodeLinker = CObjectAllocator< CXLinker<CIndividualProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 27518 |
//indiNodeLinker->initLinker(individual); |
| 27519 |
//processingDataBox->addIndividualNodeBlockedResolveLinker(indiNodeLinker); |
| 27520 |
individualInserted = true; |
| 27521 |
} |
| 27522 |
} else { |
| 27523 |
individualInserted = addIndividualToProcessingQueueBasedOnProcessingConcepts(individual,calcAlgContext); |
| 27524 |
if (!individualInserted) { |
| 27525 |
if (!individual->isRegularDepthProcessingQueued()) { |
| 27526 |
individual->setRegularDepthProcessingQueued(true); |
| 27527 |
CIndividualDepthProcessingQueue* inDepthProQueue = processingDataBox->getIndividualDepthProcessingQueue(true); |
| 27528 |
inDepthProQueue->insertProcessIndiviudal(individual); |
| 27529 |
individualInserted = true; |
| 27530 |
} |
| 27531 |
} |
| 27532 |
} |
| 27533 |
} |
| 27534 |
|
| 27535 |
if (!individualBlocked) { |
| 27536 |
individualInserted = addIndividualToProcessingQueueBasedOnProcessingConcepts(individual,calcAlgContext); |
| 27537 |
} |
| 27538 |
|
| 27539 |
|
| 27540 |
} |
| 27541 |
if (individualInserted) { |
| 27542 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27543 |
} |
| 27544 |
return individualInserted; |
| 27545 |
} |
| 27546 |
|
| 27547 |
|
| 27548 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToIncrementalCompatibilityCheckingQueue(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27549 |
if (!individual->isIncrementalCompatibilityCheckingQueued() && individual->isNominalIndividualNode()) { |
| 27550 |
individual->setIncrementalCompatibilityCheckingQueued(true); |
| 27551 |
CIndividualDepthProcessingQueue* incCompCheckingQueue = calcAlgContext->getProcessingDataBox()->getIncrementalCompatibilityCheckingQueue(true); |
| 27552 |
incCompCheckingQueue->insertProcessIndiviudal(individual); |
| 27553 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27554 |
return true; |
| 27555 |
} |
| 27556 |
return false; |
| 27557 |
} |
| 27558 |
|
| 27559 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToIncrementalExpansionQueue(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27560 |
if (!individual->isIncrementalExpansionQueued()) { |
| 27561 |
CIndividualNodeIncrementalExpansionData* incExpData = individual->getIncrementalExpansionData(false); |
| 27562 |
if (!incExpData || !incExpData->isIncremetnalExpansionListInitialized()) { |
| 27563 |
individual->setIncrementalExpansionQueued(true); |
| 27564 |
CIndividualDepthProcessingQueue* incExpInitQueue = calcAlgContext->getProcessingDataBox()->getIncrementalExpansionInitializingProcessingQueue(true); |
| 27565 |
incExpInitQueue->insertProcessIndiviudal(individual); |
| 27566 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27567 |
return true; |
| 27568 |
} else if (incExpData->requiresFurtherIncrementalExpansion()) { |
| 27569 |
individual->setIncrementalExpansionQueued(true); |
| 27570 |
double nextExpPriority = incExpData->getNextIncrementalExpansionPriority(); |
| 27571 |
CIndividualCustomPriorityProcessingQueue* incExpQueue = calcAlgContext->getProcessingDataBox()->getIncrementalExpansionProcessingQueue(true); |
| 27572 |
incExpQueue->insertIndiviudal(nextExpPriority,individual); |
| 27573 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27574 |
return true; |
| 27575 |
} |
| 27576 |
} |
| 27577 |
return false; |
| 27578 |
} |
| 27579 |
|
| 27580 |
|
| 27581 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToBackendSynchronisationRetestQueue(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27582 |
if (!individual->isBackendSynchronRetestProcessingQueued()) { |
| 27583 |
individual->setBackendSynchronRetestProcessingQueued(true); |
| 27584 |
CIndividualUnsortedProcessingQueue* backendCacheSyncQueue = calcAlgContext->getProcessingDataBox()->getBackendCacheSynchronizationProcessingQueue(true); |
| 27585 |
backendCacheSyncQueue->insertIndiviudalProcessNode(individual); |
| 27586 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27587 |
return true; |
| 27588 |
} |
| 27589 |
return false; |
| 27590 |
} |
| 27591 |
|
| 27592 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToBackendDirectInfluenceExpansionQueue(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27593 |
if (!individual->isBackendDirectInfluenceExpansionQueued()) { |
| 27594 |
individual->setBackendDirectInfluenceExpansionQueued(true); |
| 27595 |
CIndividualUnsortedProcessingQueue* backendCacheSyncQueue = calcAlgContext->getProcessingDataBox()->getBackendDirectInfluenceExpansionQueue(true); |
| 27596 |
backendCacheSyncQueue->insertIndiviudalProcessNode(individual); |
| 27597 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT, calcAlgContext); |
| 27598 |
return true; |
| 27599 |
} |
| 27600 |
return false; |
| 27601 |
} |
| 27602 |
|
| 27603 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToBackendIndirectCompatibilityExpansionQueue(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27604 |
if (!individual->isBackendIndirectCompatibilityExpansionQueued()) { |
| 27605 |
individual->setBackendIndirectCompatibilityExpansionQueued(true); |
| 27606 |
CIndividualUnsortedProcessingQueue* backendCacheSyncQueue = calcAlgContext->getProcessingDataBox()->getBackendIndirectCompatibilityExpansionQueue(true); |
| 27607 |
backendCacheSyncQueue->insertIndiviudalProcessNode(individual); |
| 27608 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT, calcAlgContext); |
| 27609 |
return true; |
| 27610 |
} |
| 27611 |
return false; |
| 27612 |
} |
| 27613 |
|
| 27614 |
|
| 27615 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToBackendReuseExpansionQueue(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27616 |
if (!individual->isBackendReuseExpansionQueued()) { |
| 27617 |
individual->setBackendReuseExpansionQueued(true); |
| 27618 |
CIndividualUnsortedProcessingQueue* backendCacheSyncQueue = calcAlgContext->getProcessingDataBox()->getBackendIndividualReuseExpansionQueue(true); |
| 27619 |
backendCacheSyncQueue->insertIndiviudalProcessNode(individual); |
| 27620 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT, calcAlgContext); |
| 27621 |
return true; |
| 27622 |
} |
| 27623 |
return false; |
| 27624 |
} |
| 27625 |
|
| 27626 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToBackendNeighbourExpansionQueue(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27627 |
if (!individual->isBackendNeighbourExpansionQueued()) { |
| 27628 |
individual->setBackendNeighbourExpansionQueued(true); |
| 27629 |
CIndividualLinkerRotationProcessingQueue* backendCacheSyncQueue = calcAlgContext->getProcessingDataBox()->getBackendIndividualNeighbourExpansionQueue(true); |
| 27630 |
backendCacheSyncQueue->insertIndiviudalProcessNode(individual); |
| 27631 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT, calcAlgContext); |
| 27632 |
return true; |
| 27633 |
} |
| 27634 |
return false; |
| 27635 |
} |
| 27636 |
|
| 27637 |
bool CCalculationTableauCompletionTaskHandleAlgorithm::addIndividualToBlockingUpdateReviewProcessingQueue(CIndividualProcessNode* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 27638 |
CIndividualDepthProcessingQueue* sigBlockUpdProQueue = calcAlgContext->getProcessingDataBox()->getBlockingUpdateReviewProcessingQueue(true); |
| 27639 |
sigBlockUpdProQueue->insertProcessIndiviudal(individual); |
| 27640 |
STATINC(INDINODESADDEDPROCESSINGQUEUECOUNT,calcAlgContext); |
| 27641 |
return true; |
| 27642 |
} |
| 27643 |
|
| 27644 |
cint64 CCalculationTableauCompletionTaskHandleAlgorithm::getAppliedANDRuleCount() { |
| 27645 |
return mAppliedANDRuleCount; |
| 27646 |
} |
| 27647 |
|
| 27648 |
cint64 CCalculationTableauCompletionTaskHandleAlgorithm::getAppliedORRuleCount() { |
| 27649 |
return mAppliedORRuleCount; |
| 27650 |
} |
| 27651 |
|
| 27652 |
cint64 CCalculationTableauCompletionTaskHandleAlgorithm::getAppliedSOMERuleCount() { |
| 27653 |
return mAppliedSOMERuleCount; |
| 27654 |
} |
| 27655 |
|
| 27656 |
cint64 CCalculationTableauCompletionTaskHandleAlgorithm::getAppliedATLEASTRuleCount() { |
| 27657 |
return mAppliedATLEASTRuleCount; |
| 27658 |
} |
| 27659 |
|
| 27660 |
cint64 CCalculationTableauCompletionTaskHandleAlgorithm::getAppliedALLRuleCount() { |
| 27661 |
return mAppliedALLRuleCount; |
| 27662 |
} |
| 27663 |
|
| 27664 |
cint64 CCalculationTableauCompletionTaskHandleAlgorithm::getAppliedATMOSTRuleCount() { |
| 27665 |
return mAppliedATMOSTRuleCount; |
| 27666 |
} |
| 27667 |
|
| 27668 |
cint64 CCalculationTableauCompletionTaskHandleAlgorithm::getAppliedTotalRuleCount() { |
| 27669 |
return mAppliedTOTALRuleCount; |
| 27670 |
} |
| 27671 |
|
| 27672 |
|
| 27673 |
|
| 27674 |
}; // end namespace Algorithm |
| 27675 |
|
| 27676 |
}; // end namespace Kernel |
| 27677 |
|
| 27678 |
}; // end namespace Reasoner |
| 27679 |
|
| 27680 |
}; // end namespace Konclude |