Debian Codegraph @

Source/Reasoner/Realizer/COptimizedRepresentativeKPSetUnsortedIndividualRoleFillerItemIterator.h

raw
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 #ifndef KONCLUDE_REASONER_REALIZER_COPTIMIZEDREPRESENTATIVEKPSETUNSORTEDINDIVIDUALROLEFILLERITEMITERATOR_H
22 #define KONCLUDE_REASONER_REALIZER_COPTIMIZEDREPRESENTATIVEKPSETUNSORTEDINDIVIDUALROLEFILLERITEMITERATOR_H
23
24 // Libraries includes
25
26
27 // Namespace includes
28 #include "RealizerSettings.h"
29 #include "COptimizedKPSetRoleInstancesItem.h"
30 #include "COptimizedKPSetIndividualComplexRoleData.h"
31 #include "COptimizedKPSetIndividualInstantiatedItemMultiHash.h"
32
33
34 // Other includes
35 #include "Reasoner/Realization/CRealizationIndividualInstanceItemReferenceIterator.h"
36
37 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheReader.h"
38
39 // Logger includes
40 #include "Logger/CLogger.h"
41
42
43 namespace Konclude {
44
45 namespace Reasoner {
46
47 using namespace Kernel::Cache;
48 using namespace Realization;
49
50 namespace Realizer {
51
52
53 /*!
54 *
55 * \class COptimizedRepresentativeKPSetUnsortedIndividualRoleFillerItemIterator
56 * \author Andreas Steigmiller
57 * \version 0.1
58 * \brief TODO
59 *
60 */
61 class COptimizedRepresentativeKPSetUnsortedIndividualRoleFillerItemIterator : public CRealizationIndividualInstanceItemReferenceIterator {
62 // public methods
63 public:
64 //! Constructor
65 COptimizedRepresentativeKPSetUnsortedIndividualRoleFillerItemIterator(const CRealizationIndividualInstanceItemReference& indiInstItemRef, CBackendRepresentativeMemoryCacheReader* backendAssocCacheReader, COptimizedKPSetRoleInstancesItem* roleInstancesItem, bool inversed, COptimizedKPSetIndividualInstantiatedItemMultiHash* individualInstantiatedItemHash, CIndividualVector* individualVector, bool considerSameMergedIndis);
66
67
68 virtual bool requiresInitialization();
69 virtual bool begin();
70
71
72 virtual bool atEnd();
73 virtual CRealizationRemainingInstancesEstimation remainingInstancesEstimation();
74
75 virtual bool moveNext();
76 virtual bool moveTo(const CRealizationIndividualInstanceItemReference& indiInstItemRef, bool moveOver = true);
77
78 virtual CRealizationIndividualInstanceItemReference currentIndividualInstanceItemReference();
79 virtual bool isCurrentInstancePossible();
80 virtual bool isCurrentInstanceCertain();
81
82 virtual CRealizationIndividualInstanceItemReferenceIterator* getCopy();
83
84 virtual CRealizationIndividualSorting getSorting();
85
86
87
88 CRealizationIndividualInstanceItemReference getQueryingIndividualInstanceItemReference();
89 COptimizedKPSetRoleInstancesItem* getQueryingRoleInstancesItem();
90 bool getQueryingRoleInstancesItemInversion();
91
92
93 // protected methods
94 protected:
95 bool moveToNextPossiblePosition(bool forceNextPosition = false);
96
97 void initializePossibleInstanceDataIteration();
98
99 bool initializeComplexDataIteration();
100
101 void initializeNeighbourArrayIteration();
102
103 bool isSameIndividualsMerged(const CRealizationIndividualInstanceItemReference& indiInstItemRef);
104
105 // protected variables
106 protected:
107 CRealizationIndividualInstanceItemReference mIndiInstItemRef;
108 CBackendRepresentativeMemoryCacheReader* mBackendAssocCacheReader;
109 COptimizedKPSetRoleInstancesItem* mRoleInstancesItem;
110 bool mInversed;
111
112 COptimizedKPSetIndividualInstantiatedItemMultiHash* mIndividualInstantiatedItemHash;
113 CIndividualVector* mIndividualVector;
114
115
116 bool mNeighbourPossibleInstanceDataIteratorsInitialized;
117 bool mNeighbourPossibleInstanceDataIterationNewlyInitialized;
118 bool mNeighbourPossibleInstanceDataIteratorsFinished;
119 COptimizedKPSetRoleInstancesHash::const_iterator mNeighbourPossibleInstanceDataIt;
120 COptimizedKPSetRoleInstancesHash::const_iterator mNeighbourPossibleInstanceDataItEnd;
121
122
123 bool mNeighbourArrayIteratorsInitialized;
124 bool mNeighbourArrayIteratorsFinished;
125 CBackendRepresentativeMemoryCacheIndividualAssociationData* mIndiAssData;
126 QHash<CBackendRepresentativeMemoryLabelCacheItem*, COptimizedKPSetRoleInstancesSingleNeighbourRoleSetCacheLabelData*>::const_iterator mSingleNeighLabelDetDataHashIt;
127 QHash<CBackendRepresentativeMemoryLabelCacheItem*, COptimizedKPSetRoleInstancesSingleNeighbourRoleSetCacheLabelData*>::const_iterator mSingleNeighLabelDetDataHashItEnd;
128 //QHash<CBackendRepresentativeMemoryLabelCacheItem*, COptimizedKPSetRoleInstancesSingleNeighbourRoleSetCacheLabelData*>::const_iterator mSingleNeighLabelNonDetDataHashIt;
129 //QHash<CBackendRepresentativeMemoryLabelCacheItem*, COptimizedKPSetRoleInstancesSingleNeighbourRoleSetCacheLabelData*>::const_iterator mSingleNeighLabelNonDetDataHashItEnd;
130 cint64 mCurrentNeighbourArrayVisitingPositionCursor;
131
132
133 bool mNeighbourComplexDataIterationNewlyInitialized;
134 bool mNeighbourComplexDataIteratorsInitialized;
135 bool mNeighbourComplexDataIteratorsFinished;
136 COptimizedKPSetRoleInstancesHash::const_iterator mNeighbourComplexInstanceDataIt;
137 COptimizedKPSetRoleInstancesHash::const_iterator mNeighbourComplexInstanceDataItEnd;
138
139
140 bool mAllowPossibleFillers;
141
142
143 COptimizedKPSetIndividualComplexRoleData** mComplexRoleDataPointer;
144 bool mInitializationRequired;
145
146 cint64 mCurrentIndiId;
147 bool mHasCurrentIndiId;
148 CRealizationIndividualInstanceItemReference mCurrentIndiInstItemRef;
149 bool mCurrentIndiInstanceOnlyPossible;
150
151 bool mConsiderSameMergedIndis;
152 bool mSameMergedIndisInCache;
153
154
155 cint64 mNeighbourArrayIndiVisitedCount;
156 cint64 mNeighbourArrayIndiMergedCount;
157 cint64 mNeighbourArrayVisistedCount;
158 cint64 mNeighbourArrayCount;
159 cint64 mNeighbourArrayVisitedPosIndiCount;
160
161
162 // private methods
163 private:
164
165 // private variables
166 private:
167
168 };
169
170 }; // end namespace Realizer
171
172 }; // end namespace Reasoner
173
174 }; // end namespace Konclude
175
176 #endif // KONCLUDE_REASONER_REALIZER_COPTIMIZEDREPRESENTATIVEKPSETUNSORTEDINDIVIDUALROLEFILLERITEMITERATOR_H