Debian Codegraph @

Source/Reasoner/Kernel/Strategy/CEqualDepthTaskProcessingPriorityStrategy.cpp

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 #include "CEqualDepthTaskProcessingPriorityStrategy.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Strategy {
31
32 CEqualDepthTaskProcessingPriorityStrategy::CEqualDepthTaskProcessingPriorityStrategy() {
33 }
34
35 CEqualDepthTaskProcessingPriorityStrategy::~CEqualDepthTaskProcessingPriorityStrategy() {
36 }
37
38 double CEqualDepthTaskProcessingPriorityStrategy::getPriorityForTaskBranching(CSatisfiableCalculationTask* branchingTask, CSatisfiableCalculationTask* parentTask, CIndividualProcessNode* indiProcessNode, CConceptDescriptor* branchingConcept, CSortedNegLinker<CConcept*>* branchedConcept, cint64 branchNumber, CDisjunctBranchingStatistics* branchStats) {
39 double parentDepth = parentTask->getTaskDepth();
40 double priority = 0.;
41 double maxBranchCount = branchingConcept->getConcept()->getOperandCount();
42 double parentPriority = parentTask->getTaskPriority();
43 //priority = parentDepth + 1. + (0.1 - branchNumber / ((1+parentDepth) * 10 * maxBranchCount));
44 priority = parentDepth + 1. + (0.1 - branchNumber / (10 * maxBranchCount));
45 return priority;
46 }
47
48
49 double CEqualDepthTaskProcessingPriorityStrategy::getPriorityForTaskQualifing(CSatisfiableCalculationTask* branchingTask, CSatisfiableCalculationTask* parentTask, bool qualifingNegated) {
50 double parentDepth = parentTask->getTaskDepth();
51 double priority = 0.;
52 double parentPriority = parentTask->getTaskPriority();
53 priority = parentDepth + 1.;
54 if (qualifingNegated) {
55 priority += 0.1;
56 }
57 return priority;
58 }
59
60 double CEqualDepthTaskProcessingPriorityStrategy::getPriorityForTaskMerging(CSatisfiableCalculationTask* branchingTask, CSatisfiableCalculationTask* parentTask) {
61 double parentDepth = parentTask->getTaskDepth();
62 double priority = 0.;
63 double parentPriority = parentTask->getTaskPriority();
64 priority = parentDepth + 1.;
65 return priority;
66 }
67
68 double CEqualDepthTaskProcessingPriorityStrategy::getPriorityForTaskReusing(CSatisfiableCalculationTask* branchingTask, CSatisfiableCalculationTask* parentTask, bool reusingAlternative) {
69 double parentDepth = parentTask->getTaskDepth();
70 double priority = 0.;
71 double parentPriority = parentTask->getTaskPriority();
72 priority = parentDepth + 1.;
73 if (reusingAlternative) {
74 priority += 0.1;
75 }
76 return priority;
77 }
78
79 }; // end namespace Strategy
80
81 }; // end namespace Kernel
82
83 }; // end namespace Reasoner
84
85 }; // end namespace Konclude