diff options
author | 2019-04-07 13:46:36 +0200 | |
---|---|---|
committer | 2019-04-07 13:46:36 +0200 | |
commit | 3f9b1c92cc35fa4ed9672a2b8601f4c22af24921 (patch) | |
tree | 927c41492ff3b50b3d998a4fbe87861187d85912 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend | |
parent | Add reliability probability and mtff objectives (diff) | |
download | VIATRA-Generator-3f9b1c92cc35fa4ed9672a2b8601f4c22af24921.tar.gz VIATRA-Generator-3f9b1c92cc35fa4ed9672a2b8601f4c22af24921.tar.zst VIATRA-Generator-3f9b1c92cc35fa4ed9672a2b8601f4c22af24921.zip |
Infrastructure for objective functions
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend deleted file mode 100644 index e0111cf6..00000000 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/UnfinishedWFObjective.xtend +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse | ||
2 | |||
3 | import org.eclipse.viatra.dse.objectives.IObjective | ||
4 | import org.eclipse.viatra.query.runtime.api.IPatternMatch | ||
5 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher | ||
6 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification | ||
7 | import java.util.Collection | ||
8 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine | ||
9 | import org.eclipse.viatra.query.runtime.emf.EMFScope | ||
10 | import org.eclipse.viatra.dse.base.ThreadContext | ||
11 | import java.util.List | ||
12 | import org.eclipse.viatra.dse.objectives.Comparators | ||
13 | import java.util.ArrayList | ||
14 | import java.util.Comparator | ||
15 | |||
16 | class UnfinishedWFObjective implements IObjective { | ||
17 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> unfinishedWFs | ||
18 | val List<ViatraQueryMatcher<?>> matchers | ||
19 | |||
20 | public new(Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> unfinishedWFs) { | ||
21 | this.unfinishedWFs = unfinishedWFs | ||
22 | matchers = new ArrayList(unfinishedWFs.size) | ||
23 | } | ||
24 | override getName() '''unfinishedWFs''' | ||
25 | override createNew() { | ||
26 | return new UnfinishedWFObjective(unfinishedWFs) | ||
27 | } | ||
28 | override init(ThreadContext context) { | ||
29 | val engine = context.queryEngine//ViatraQueryEngine.on(new EMFScope(context.model)) | ||
30 | for(unfinishedWF : unfinishedWFs) { | ||
31 | matchers += unfinishedWF.getMatcher(engine) | ||
32 | } | ||
33 | } | ||
34 | |||
35 | override getComparator() { Comparators.LOWER_IS_BETTER } | ||
36 | override getFitness(ThreadContext context) { | ||
37 | var sumOfMatches = 0 | ||
38 | for(matcher : matchers) { | ||
39 | val number = matcher.countMatches | ||
40 | //println('''«matcher.patternName» = «number»''') | ||
41 | sumOfMatches+=number | ||
42 | } | ||
43 | return sumOfMatches.doubleValue | ||
44 | } | ||
45 | |||
46 | override getLevel() { 2 } | ||
47 | override isHardObjective() { true } | ||
48 | override satisifiesHardObjective(Double fitness) { return fitness <=0.01 } | ||
49 | |||
50 | override setComparator(Comparator<Double> comparator) { | ||
51 | throw new UnsupportedOperationException("TODO: auto-generated method stub") | ||
52 | } | ||
53 | override setLevel(int level) { | ||
54 | throw new UnsupportedOperationException("TODO: auto-generated method stub") | ||
55 | } | ||
56 | } \ No newline at end of file | ||