From 3c8c3c84b7160b26ceb6e9daf0d6638c5ec3fecb Mon Sep 17 00:00:00 2001 From: Oszkar Semerath Date: Sun, 17 May 2020 20:53:49 +0200 Subject: TransformationExecutionTime + weights can be controlled from config --- .../dse/BestFirstStrategyForModelGeneration.java | 3 +- .../dse/ModelGenerationCompositeObjective.xtend | 53 ++++++++++++++++++---- 2 files changed, 45 insertions(+), 11 deletions(-) (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse') 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 { long numericalSolverSolving = this.numericSolver.getSolverSolvingProblem()/1000000; long numericalSolverInterpreting = this.numericSolver.getSolverSolution()/1000000; this.times.add( - "(StateCoderTime:"+statecoderTime+ + "(TransformationExecutionTime"+method.getStatistics().transformationExecutionTime+ + "|StateCoderTime:"+statecoderTime+ "|SolutionCopyTime:"+solutionCopy+ "|ActivationSelectionTime:"+activationSelection+ "|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 import org.eclipse.viatra.dse.objectives.IObjective import org.eclipse.viatra.dse.objectives.impl.BaseObjective import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation +import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration //class ViatraReasonerNumbers { // public static val scopePriority = 2 @@ -28,15 +29,43 @@ class ModelGenerationCompositeObjective implements IObjective{ val List unfinishedMultiplicityObjectives val UnfinishedWFObjective unfinishedWFObjective var PartialInterpretation model=null; + val boolean punishSize + val int scopeWeight + val int conaintmentWeight + val int nonContainmentWeight + val int unfinishedWFWeight - public new( + new( ScopeObjective scopeObjective, List unfinishedMultiplicityObjectives, - UnfinishedWFObjective unfinishedWFObjective) + UnfinishedWFObjective unfinishedWFObjective, + ViatraReasonerConfiguration configuration) { this.scopeObjective = scopeObjective this.unfinishedMultiplicityObjectives = unfinishedMultiplicityObjectives this.unfinishedWFObjective = unfinishedWFObjective + + this.punishSize = configuration.punishSize + this.scopeWeight = configuration.scopeWeight + this.conaintmentWeight = configuration.conaintmentWeight + this.nonContainmentWeight = configuration.nonContainmentWeight + this.unfinishedWFWeight = configuration.unfinishedWFWeight + } + new( + ScopeObjective scopeObjective, + List unfinishedMultiplicityObjectives, + UnfinishedWFObjective unfinishedWFObjective, + boolean punishSize, int scopeWeight, int conaintmentWeight, int nonContainmentWeight, int unfinishedWFWeight) + { + this.scopeObjective = scopeObjective + this.unfinishedMultiplicityObjectives = unfinishedMultiplicityObjectives + this.unfinishedWFObjective = unfinishedWFObjective + + this.punishSize = punishSize + this.scopeWeight = scopeWeight + this.conaintmentWeight = conaintmentWeight + this.nonContainmentWeight = nonContainmentWeight + this.unfinishedWFWeight = unfinishedWFWeight } override init(ThreadContext context) { @@ -48,7 +77,8 @@ class ModelGenerationCompositeObjective implements IObjective{ override createNew() { return new ModelGenerationCompositeObjective( - this.scopeObjective, this.unfinishedMultiplicityObjectives, this.unfinishedWFObjective) + this.scopeObjective, this.unfinishedMultiplicityObjectives, this.unfinishedWFObjective, + this.punishSize, this.scopeWeight, this.conaintmentWeight, this.nonContainmentWeight, this.unfinishedWFWeight) } override getComparator() { Comparators.LOWER_IS_BETTER } @@ -67,16 +97,19 @@ class ModelGenerationCompositeObjective implements IObjective{ nonContainmentMultiplicity+=multiplicityObjective.getFitness(context) } } - val size = 0.9/model.newElements.size + val size = if(punishSize) { + 0.9/model.newElements.size + } else { + 0 + } + var sum = 0.0 - sum += scopeFitnes - sum += containmentMultiplicity*2 - sum += nonContainmentMultiplicity - sum += unfinishedWFsFitness + sum += scopeFitnes*scopeWeight + sum += containmentMultiplicity*conaintmentWeight + sum += nonContainmentMultiplicity*nonContainmentWeight + sum += unfinishedWFsFitness*unfinishedWFWeight sum+=size - - //println('''Sum=«sum»|Scope=«scopeFitnes»|ContainmentMultiplicity=«containmentMultiplicity»|NonContainmentMultiplicity=«nonContainmentMultiplicity»|WFs=«unfinishedWFsFitness»''') return sum -- cgit v1.2.3-70-g09d2