| 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_ANSWERER_COPTIMIZEDCOMPLEXVARIABLEINDIVIDUALMAPPINGS_H |
| 22 |
#define KONCLUDE_REASONER_ANSWERER_COPTIMIZEDCOMPLEXVARIABLEINDIVIDUALMAPPINGS_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
|
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
#include "AnswererSettings.h" |
| 29 |
#include "COptimizedComplexVariableIndividualBindings.h" |
| 30 |
#include "COptimizedComplexVariableIndividualBindingsHasher.h" |
| 31 |
#include "COptimizedComplexVariableIndividualBindingsCardinalityLinker.h" |
| 32 |
#include "COptimizedComplexVariableIndividualUpdateCardinalityLinker.h" |
| 33 |
#include "COptimizedComplexVariableIndividualBindingsCardinalityBatchLinker.h" |
| 34 |
|
| 35 |
|
| 36 |
// Other includes |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
// Logger includes |
| 41 |
#include "Logger/CLogger.h" |
| 42 |
|
| 43 |
|
| 44 |
namespace Konclude { |
| 45 |
|
| 46 |
namespace Reasoner { |
| 47 |
|
| 48 |
namespace Answerer { |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
/*! |
| 53 |
* |
| 54 |
* \class COptimizedComplexVariableIndividualMappings |
| 55 |
* \author Andreas Steigmiller |
| 56 |
* \version 0.1 |
| 57 |
* \brief TODO |
| 58 |
* |
| 59 |
*/ |
| 60 |
class COptimizedComplexVariableIndividualMappings { |
| 61 |
// public methods |
| 62 |
public: |
| 63 |
//! Constructor |
| 64 |
COptimizedComplexVariableIndividualMappings(cint64 bindingSize); |
| 65 |
virtual ~COptimizedComplexVariableIndividualMappings(); |
| 66 |
|
| 67 |
|
| 68 |
enum VARIABLE_TYPE { |
| 69 |
INDIVIDUAL_VARIABLE, DATA_LITERAL_VARIABLE, CLASS_VARIABLE, PROPERTY_VARIABLE |
| 70 |
}; |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
VARIABLE_TYPE getBindingMapping(cint64 idx); |
| 75 |
COptimizedComplexVariableIndividualMappings* setBindingMapping(cint64 idx, VARIABLE_TYPE varType); |
| 76 |
|
| 77 |
cint64 getBindingSize(); |
| 78 |
cint64 getBindingCount(); |
| 79 |
cint64 getMaximumCardinalitySameIndividualsJointlyConsidered(); |
| 80 |
cint64 getMaximumCardinalitySameIndividualsSeparatelyConsidered(); |
| 81 |
|
| 82 |
COptimizedComplexVariableIndividualBindingsCardinalityLinker* getLastAddedBindingsCardinalityLinker(); |
| 83 |
COptimizedComplexVariableIndividualMappings* addLastAddedBindingsCardinalityLinker(COptimizedComplexVariableIndividualBindingsCardinalityLinker* linker); |
| 84 |
|
| 85 |
|
| 86 |
COptimizedComplexVariableIndividualMappings* addLastUpdatedCardinalityLinker(COptimizedComplexVariableIndividualUpdateCardinalityLinker* linker); |
| 87 |
COptimizedComplexVariableIndividualUpdateCardinalityLinker* getLastUpdatedCardinalityLinker(); |
| 88 |
|
| 89 |
COptimizedComplexVariableIndividualMappings* setCurrentUpdateId(cint64 currUpdateId); |
| 90 |
cint64 getCurrentUpdateId(); |
| 91 |
|
| 92 |
virtual COptimizedComplexVariableIndividualMappings* incCurrentUpdateId(cint64 incUpdateCount = 1); |
| 93 |
|
| 94 |
|
| 95 |
virtual COptimizedComplexVariableIndividualBindingsCardinalityLinker* takeBindingsCardinalityLinker() = 0; |
| 96 |
|
| 97 |
|
| 98 |
virtual bool addBindingsCardinalities(COptimizedComplexVariableIndividualBindings* bindings, COptimizedComplexVariableIndividualBindingsCardinality* addedCardinalites) = 0; |
| 99 |
virtual bool addInsertingBindingsCardinalityLinker(COptimizedComplexVariableIndividualBindingsCardinalityLinker* linker, bool addCardinalitiesIfAlreadyPresent) = 0; |
| 100 |
|
| 101 |
|
| 102 |
COptimizedComplexVariableIndividualBindingsCardinalityBatchLinker* getLastAddedBindingsCardinalityBatchLinker(); |
| 103 |
COptimizedComplexVariableIndividualBindingsCardinalityBatchLinker* getFirstAddedBindingsCardinalityBatchLinker(); |
| 104 |
|
| 105 |
virtual COptimizedComplexVariableIndividualMappings* clearComputedMappings(); |
| 106 |
|
| 107 |
|
| 108 |
cint64 getBindingsMemoryUsage(); |
| 109 |
COptimizedComplexVariableIndividualMappings* setBindingsMemoryUsage(cint64 usage); |
| 110 |
COptimizedComplexVariableIndividualMappings* incBindingsMemoryUsage(cint64 usageInc); |
| 111 |
|
| 112 |
|
| 113 |
virtual CMemoryAllocationManager* getBindingsMemoryAllocationManager() = 0; |
| 114 |
virtual COptimizedComplexVariableIndividualMappings* updateBindingsMemoryConsumption() = 0; |
| 115 |
|
| 116 |
|
| 117 |
double getComputationCost(); |
| 118 |
COptimizedComplexVariableIndividualMappings* setComputationCost(double cost); |
| 119 |
|
| 120 |
// protected methods |
| 121 |
protected: |
| 122 |
COptimizedComplexVariableIndividualMappings* extendAddedBindingsCardinalityBatchLinker(COptimizedComplexVariableIndividualBindingsCardinalityLinker* linker); |
| 123 |
|
| 124 |
// protected variables |
| 125 |
protected: |
| 126 |
cint64 mBindingSize; |
| 127 |
VARIABLE_TYPE* mBindingMapping; |
| 128 |
cint64 mBindingCount; |
| 129 |
cint64 mMaximumCardinalitySameIndividualsJointlyConsidered; |
| 130 |
cint64 mMaximumCardinalitySameIndividualsSeparatelyConsidered; |
| 131 |
|
| 132 |
COptimizedComplexVariableIndividualBindingsCardinalityLinker* mLastAddedBindingsCardinalityLinker; |
| 133 |
|
| 134 |
COptimizedComplexVariableIndividualBindingsCardinalityBatchLinker* mLastAddedBindingsCardinalityBatchLinker; |
| 135 |
COptimizedComplexVariableIndividualBindingsCardinalityBatchLinker* mFirstAddedBindingsCardinalityBatchLinker; |
| 136 |
cint64 mLastAddedBindingsCardinalityBatchLinkerUpdateId; |
| 137 |
|
| 138 |
COptimizedComplexVariableIndividualUpdateCardinalityLinker* mLastUpdateCardinalityLinker; |
| 139 |
cint64 mCurrentUpdateId; |
| 140 |
|
| 141 |
|
| 142 |
cint64 mCurrentLinkerBatchingSize; |
| 143 |
double mLinkerBatchingSizeIncreasingFactor; |
| 144 |
|
| 145 |
|
| 146 |
cint64 mBindingsMemoryUsage; |
| 147 |
|
| 148 |
double mComputationCost; |
| 149 |
|
| 150 |
|
| 151 |
// private methods |
| 152 |
private: |
| 153 |
|
| 154 |
// private variables |
| 155 |
private: |
| 156 |
|
| 157 |
}; |
| 158 |
|
| 159 |
}; // end namespace Answerer |
| 160 |
|
| 161 |
}; // end namespace Reasoner |
| 162 |
|
| 163 |
}; // end namespace Konclude |
| 164 |
|
| 165 |
#endif // KONCLUDE_REASONER_ANSWERER_COPTIMIZEDCOMPLEXVARIABLEINDIVIDUALMAPPINGS_H |