diff options
author | 2020-05-17 20:53:49 +0200 | |
---|---|---|
committer | 2020-05-17 20:53:49 +0200 | |
commit | 3c8c3c84b7160b26ceb6e9daf0d6638c5ec3fecb (patch) | |
tree | 270c3f29b7d0445f9129539bb7586690767a5f6f /Solvers | |
parent | detailed runtimes + counting defined objects only (diff) | |
download | VIATRA-Generator-3c8c3c84b7160b26ceb6e9daf0d6638c5ec3fecb.tar.gz VIATRA-Generator-3c8c3c84b7160b26ceb6e9daf0d6638c5ec3fecb.tar.zst VIATRA-Generator-3c8c3c84b7160b26ceb6e9daf0d6638c5ec3fecb.zip |
TransformationExecutionTime + weights can be controlled from config
Diffstat (limited to 'Solvers')
4 files changed, 55 insertions, 14 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend index 5df28edd..df3ccee5 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend | |||
@@ -82,7 +82,8 @@ class ViatraReasoner extends LogicReasoner{ | |||
82 | dse.addObjective(new ModelGenerationCompositeObjective( | 82 | dse.addObjective(new ModelGenerationCompositeObjective( |
83 | new ScopeObjective, | 83 | new ScopeObjective, |
84 | method.unfinishedMultiplicities.map[new UnfinishedMultiplicityObjective(it)], | 84 | method.unfinishedMultiplicities.map[new UnfinishedMultiplicityObjective(it)], |
85 | new UnfinishedWFObjective(method.unfinishedWF) | 85 | new UnfinishedWFObjective(method.unfinishedWF), |
86 | viatraConfig | ||
86 | )) | 87 | )) |
87 | 88 | ||
88 | dse.addGlobalConstraint(wf2ObjectiveConverter.createInvalidationObjective(method.invalidWF)) | 89 | dse.addGlobalConstraint(wf2ObjectiveConverter.createInvalidationObjective(method.invalidWF)) |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend index 24578e7b..7369344c 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend | |||
@@ -44,9 +44,15 @@ class ViatraReasonerConfiguration extends LogicSolverConfiguration{ | |||
44 | /** | 44 | /** |
45 | * Configuration for cutting search space. | 45 | * Configuration for cutting search space. |
46 | */ | 46 | */ |
47 | public var SearchSpaceConstraint searchSpaceConstraints = new SearchSpaceConstraint | 47 | public var SearchSpaceConstraint searchSpaceConstraints = new SearchSpaceConstraint |
48 | 48 | ||
49 | public var runIntermediateNumericalConsistencyChecks = true | 49 | public var runIntermediateNumericalConsistencyChecks = true |
50 | |||
51 | public var punishSize = true | ||
52 | public var scopeWeight = 1 | ||
53 | public var conaintmentWeight = 2 | ||
54 | public var nonContainmentWeight = 1 | ||
55 | public var unfinishedWFWeight = 1 | ||
50 | } | 56 | } |
51 | 57 | ||
52 | public class DiversityDescriptor { | 58 | public class DiversityDescriptor { |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java index 710996a9..5869889d 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java | |||
@@ -308,7 +308,8 @@ public class BestFirstStrategyForModelGeneration implements IStrategy { | |||
308 | long numericalSolverSolving = this.numericSolver.getSolverSolvingProblem()/1000000; | 308 | long numericalSolverSolving = this.numericSolver.getSolverSolvingProblem()/1000000; |
309 | long numericalSolverInterpreting = this.numericSolver.getSolverSolution()/1000000; | 309 | long numericalSolverInterpreting = this.numericSolver.getSolverSolution()/1000000; |
310 | this.times.add( | 310 | this.times.add( |
311 | "(StateCoderTime:"+statecoderTime+ | 311 | "(TransformationExecutionTime"+method.getStatistics().transformationExecutionTime+ |
312 | "|StateCoderTime:"+statecoderTime+ | ||
312 | "|SolutionCopyTime:"+solutionCopy+ | 313 | "|SolutionCopyTime:"+solutionCopy+ |
313 | "|ActivationSelectionTime:"+activationSelection+ | 314 | "|ActivationSelectionTime:"+activationSelection+ |
314 | "|NumericalSolverSumTime:"+numericalSolverSumTime+ | 315 | "|NumericalSolverSumTime:"+numericalSolverSumTime+ |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend index 2a4294ad..a10530c7 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend | |||
@@ -7,6 +7,7 @@ import org.eclipse.viatra.dse.objectives.Comparators | |||
7 | import org.eclipse.viatra.dse.objectives.IObjective | 7 | import org.eclipse.viatra.dse.objectives.IObjective |
8 | import org.eclipse.viatra.dse.objectives.impl.BaseObjective | 8 | import org.eclipse.viatra.dse.objectives.impl.BaseObjective |
9 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | 9 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation |
10 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration | ||
10 | 11 | ||
11 | //class ViatraReasonerNumbers { | 12 | //class ViatraReasonerNumbers { |
12 | // public static val scopePriority = 2 | 13 | // public static val scopePriority = 2 |
@@ -28,15 +29,43 @@ class ModelGenerationCompositeObjective implements IObjective{ | |||
28 | val List<UnfinishedMultiplicityObjective> unfinishedMultiplicityObjectives | 29 | val List<UnfinishedMultiplicityObjective> unfinishedMultiplicityObjectives |
29 | val UnfinishedWFObjective unfinishedWFObjective | 30 | val UnfinishedWFObjective unfinishedWFObjective |
30 | var PartialInterpretation model=null; | 31 | var PartialInterpretation model=null; |
32 | val boolean punishSize | ||
33 | val int scopeWeight | ||
34 | val int conaintmentWeight | ||
35 | val int nonContainmentWeight | ||
36 | val int unfinishedWFWeight | ||
31 | 37 | ||
32 | public new( | 38 | new( |
33 | ScopeObjective scopeObjective, | 39 | ScopeObjective scopeObjective, |
34 | List<UnfinishedMultiplicityObjective> unfinishedMultiplicityObjectives, | 40 | List<UnfinishedMultiplicityObjective> unfinishedMultiplicityObjectives, |
35 | UnfinishedWFObjective unfinishedWFObjective) | 41 | UnfinishedWFObjective unfinishedWFObjective, |
42 | ViatraReasonerConfiguration configuration) | ||
36 | { | 43 | { |
37 | this.scopeObjective = scopeObjective | 44 | this.scopeObjective = scopeObjective |
38 | this.unfinishedMultiplicityObjectives = unfinishedMultiplicityObjectives | 45 | this.unfinishedMultiplicityObjectives = unfinishedMultiplicityObjectives |
39 | this.unfinishedWFObjective = unfinishedWFObjective | 46 | this.unfinishedWFObjective = unfinishedWFObjective |
47 | |||
48 | this.punishSize = configuration.punishSize | ||
49 | this.scopeWeight = configuration.scopeWeight | ||
50 | this.conaintmentWeight = configuration.conaintmentWeight | ||
51 | this.nonContainmentWeight = configuration.nonContainmentWeight | ||
52 | this.unfinishedWFWeight = configuration.unfinishedWFWeight | ||
53 | } | ||
54 | new( | ||
55 | ScopeObjective scopeObjective, | ||
56 | List<UnfinishedMultiplicityObjective> unfinishedMultiplicityObjectives, | ||
57 | UnfinishedWFObjective unfinishedWFObjective, | ||
58 | boolean punishSize, int scopeWeight, int conaintmentWeight, int nonContainmentWeight, int unfinishedWFWeight) | ||
59 | { | ||
60 | this.scopeObjective = scopeObjective | ||
61 | this.unfinishedMultiplicityObjectives = unfinishedMultiplicityObjectives | ||
62 | this.unfinishedWFObjective = unfinishedWFObjective | ||
63 | |||
64 | this.punishSize = punishSize | ||
65 | this.scopeWeight = scopeWeight | ||
66 | this.conaintmentWeight = conaintmentWeight | ||
67 | this.nonContainmentWeight = nonContainmentWeight | ||
68 | this.unfinishedWFWeight = unfinishedWFWeight | ||
40 | } | 69 | } |
41 | 70 | ||
42 | override init(ThreadContext context) { | 71 | override init(ThreadContext context) { |
@@ -48,7 +77,8 @@ class ModelGenerationCompositeObjective implements IObjective{ | |||
48 | 77 | ||
49 | override createNew() { | 78 | override createNew() { |
50 | return new ModelGenerationCompositeObjective( | 79 | return new ModelGenerationCompositeObjective( |
51 | this.scopeObjective, this.unfinishedMultiplicityObjectives, this.unfinishedWFObjective) | 80 | this.scopeObjective, this.unfinishedMultiplicityObjectives, this.unfinishedWFObjective, |
81 | this.punishSize, this.scopeWeight, this.conaintmentWeight, this.nonContainmentWeight, this.unfinishedWFWeight) | ||
52 | } | 82 | } |
53 | 83 | ||
54 | override getComparator() { Comparators.LOWER_IS_BETTER } | 84 | override getComparator() { Comparators.LOWER_IS_BETTER } |
@@ -67,16 +97,19 @@ class ModelGenerationCompositeObjective implements IObjective{ | |||
67 | nonContainmentMultiplicity+=multiplicityObjective.getFitness(context) | 97 | nonContainmentMultiplicity+=multiplicityObjective.getFitness(context) |
68 | } | 98 | } |
69 | } | 99 | } |
70 | val size = 0.9/model.newElements.size | 100 | val size = if(punishSize) { |
101 | 0.9/model.newElements.size | ||
102 | } else { | ||
103 | 0 | ||
104 | } | ||
105 | |||
71 | var sum = 0.0 | 106 | var sum = 0.0 |
72 | sum += scopeFitnes | 107 | sum += scopeFitnes*scopeWeight |
73 | sum += containmentMultiplicity*2 | 108 | sum += containmentMultiplicity*conaintmentWeight |
74 | sum += nonContainmentMultiplicity | 109 | sum += nonContainmentMultiplicity*nonContainmentWeight |
75 | sum += unfinishedWFsFitness | 110 | sum += unfinishedWFsFitness*unfinishedWFWeight |
76 | sum+=size | 111 | sum+=size |
77 | 112 | ||
78 | |||
79 | |||
80 | //println('''Sum=«sum»|Scope=«scopeFitnes»|ContainmentMultiplicity=«containmentMultiplicity»|NonContainmentMultiplicity=«nonContainmentMultiplicity»|WFs=«unfinishedWFsFitness»''') | 113 | //println('''Sum=«sum»|Scope=«scopeFitnes»|ContainmentMultiplicity=«containmentMultiplicity»|NonContainmentMultiplicity=«nonContainmentMultiplicity»|WFs=«unfinishedWFsFitness»''') |
81 | 114 | ||
82 | return sum | 115 | return sum |