| 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 "CExperimentalReasonerManager.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Kernel { |
| 29 |
|
| 30 |
namespace Manager { |
| 31 |
|
| 32 |
|
| 33 |
CExperimentalReasonerManager::CExperimentalReasonerManager(CWatchDog *threadWatchDog) : CAnalyseReasonerManager(threadWatchDog) { |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
CExperimentalReasonerManager::~CExperimentalReasonerManager() { |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
void CExperimentalReasonerManager::threadStarted() { |
| 42 |
CIntervalThread::threadStarted(); |
| 43 |
// generate worker framework |
| 44 |
LOG(WARNING,"::Konclude::Reasoner::Kernel::ExperimentalReasonerManager",logTr("Initializing EXPERIMENTAL Reasoner."),this); |
| 45 |
|
| 46 |
if (mConfgAdaptThreadPoolToWorkerCount) { |
| 47 |
QThreadPool::globalInstance()->setMaxThreadCount(mWorkControllerCount); |
| 48 |
} |
| 49 |
if (mBlockThreadPoolThreadCount > 0) { |
| 50 |
for (cint64 i = 0; i < mBlockThreadPoolThreadCount; ++i) { |
| 51 |
QtConcurrent::run(QThreadPool::globalInstance(), [&]() { |
| 52 |
mBlockThreadPoolThreadsBlockingSemaphore.acquire(1); |
| 53 |
mBlockThreadPoolThreadsReleasingSemaphore.release(1); |
| 54 |
}); |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
unsatCache = new COccurrenceUnsatisfiableCache(mWorkControllerCount+2); |
| 59 |
mSatExpCache = new CSignatureSatisfiableExpanderCache(configProvider->getCurrentConfiguration()); |
| 60 |
mReuseCompGraphCache = new CReuseCompletionGraphCache(); |
| 61 |
mSatNodeExpCache = new CSaturationNodeAssociatedExpansionCache(configProvider->getCurrentConfiguration()); |
| 62 |
mCompConsCache = new CComputedConsequencesCache(configProvider->getCurrentConfiguration()); |
| 63 |
mBackendAssCache = new CBackendRepresentativeMemoryCache(configProvider->getCurrentConfiguration()); |
| 64 |
mOccStatsCache = new COccurrenceStatisticsCache(configProvider->getCurrentConfiguration()); |
| 65 |
|
| 66 |
CConfigDependedCalculationFactory* calcFactory = new CConfigDependedCalculationFactory(this); |
| 67 |
CCalculationManager* calculationManager = calcFactory->createCalculationManager(configProvider); |
| 68 |
calcFactory->initializeManager(calculationManager,configProvider); |
| 69 |
mCalculationManager = calculationManager; |
| 70 |
|
| 71 |
cint64 workExecuterPerControllerCount = 1; |
| 72 |
|
| 73 |
LOG(INFO,"::Konclude::Reasoner::Kernel::ExperimentalReasonerManager",logTr("Reasoner initialized with %1 processing unit(s).").arg(mWorkControllerCount),this); |
| 74 |
|
| 75 |
|
| 76 |
startTimerWithInterval(PROGRESSQUERYTIMER,10000); |
| 77 |
} |
| 78 |
|
| 79 |
}; // end namespace Manager |
| 80 |
|
| 81 |
}; // end namespace Kernel |
| 82 |
|
| 83 |
}; // end namespace Reasoner |
| 84 |
|
| 85 |
}; // end namespace Konclude |