diff options
author | 2019-08-08 16:45:45 -0400 | |
---|---|---|
committer | 2019-08-08 16:45:45 -0400 | |
commit | c33f0b9c4e112ee573d1b26d205a253cc0e487f8 (patch) | |
tree | 1ec2c4ab56b5bc0d0d56fa111bab0520c05604b4 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend | |
parent | Further development of realistic solver, create generation config for ecore m... (diff) | |
download | VIATRA-Generator-c33f0b9c4e112ee573d1b26d205a253cc0e487f8.tar.gz VIATRA-Generator-c33f0b9c4e112ee573d1b26d205a253cc0e487f8.tar.zst VIATRA-Generator-c33f0b9c4e112ee573d1b26d205a253cc0e487f8.zip |
Configurations for generation and new domain for generation ecore model
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ModelGenerationCompositeObjective.xtend | 22 |
1 files changed, 18 insertions, 4 deletions
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 2489c751..9fc6853c 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 | |||
@@ -26,15 +26,22 @@ class ModelGenerationCompositeObjective implements IObjective{ | |||
26 | val ScopeObjective scopeObjective | 26 | val ScopeObjective scopeObjective |
27 | val List<UnfinishedMultiplicityObjective> unfinishedMultiplicityObjectives | 27 | val List<UnfinishedMultiplicityObjective> unfinishedMultiplicityObjectives |
28 | val UnfinishedWFObjective unfinishedWFObjective | 28 | val UnfinishedWFObjective unfinishedWFObjective |
29 | var boolean isWFOptional = false; | ||
29 | 30 | ||
30 | public new( | 31 | public new( |
31 | ScopeObjective scopeObjective, | 32 | ScopeObjective scopeObjective, |
32 | List<UnfinishedMultiplicityObjective> unfinishedMultiplicityObjectives, | 33 | List<UnfinishedMultiplicityObjective> unfinishedMultiplicityObjectives, |
33 | UnfinishedWFObjective unfinishedWFObjective) | 34 | UnfinishedWFObjective unfinishedWFObjective, |
35 | boolean isWFOptional) | ||
34 | { | 36 | { |
35 | this.scopeObjective = scopeObjective | 37 | this.scopeObjective = scopeObjective |
36 | this.unfinishedMultiplicityObjectives = unfinishedMultiplicityObjectives | 38 | this.unfinishedMultiplicityObjectives = unfinishedMultiplicityObjectives |
37 | this.unfinishedWFObjective = unfinishedWFObjective | 39 | this.unfinishedWFObjective = unfinishedWFObjective |
40 | this.isWFOptional = isWFOptional; | ||
41 | } | ||
42 | |||
43 | def getIsWFOptional(){ | ||
44 | return this.isWFOptional; | ||
38 | } | 45 | } |
39 | 46 | ||
40 | override init(ThreadContext context) { | 47 | override init(ThreadContext context) { |
@@ -45,7 +52,7 @@ class ModelGenerationCompositeObjective implements IObjective{ | |||
45 | 52 | ||
46 | override createNew() { | 53 | override createNew() { |
47 | return new ModelGenerationCompositeObjective( | 54 | return new ModelGenerationCompositeObjective( |
48 | this.scopeObjective, this.unfinishedMultiplicityObjectives, this.unfinishedWFObjective) | 55 | this.scopeObjective, this.unfinishedMultiplicityObjectives, this.unfinishedWFObjective, this.isWFOptional) |
49 | } | 56 | } |
50 | 57 | ||
51 | override getComparator() { Comparators.LOWER_IS_BETTER } | 58 | override getComparator() { Comparators.LOWER_IS_BETTER } |
@@ -53,7 +60,6 @@ class ModelGenerationCompositeObjective implements IObjective{ | |||
53 | var sum = 0.0 | 60 | var sum = 0.0 |
54 | val scopeFitnes = scopeObjective.getFitness(context) | 61 | val scopeFitnes = scopeObjective.getFitness(context) |
55 | //val unfinishedMultiplicitiesFitneses = unfinishedMultiplicityObjectives.map[x|x.getFitness(context)] | 62 | //val unfinishedMultiplicitiesFitneses = unfinishedMultiplicityObjectives.map[x|x.getFitness(context)] |
56 | val unfinishedWFsFitness = unfinishedWFObjective.getFitness(context) | ||
57 | 63 | ||
58 | sum+=scopeFitnes | 64 | sum+=scopeFitnes |
59 | var multiplicity = 0.0 | 65 | var multiplicity = 0.0 |
@@ -61,7 +67,12 @@ class ModelGenerationCompositeObjective implements IObjective{ | |||
61 | multiplicity+=multiplicityObjective.getFitness(context)//*0.5 | 67 | multiplicity+=multiplicityObjective.getFitness(context)//*0.5 |
62 | } | 68 | } |
63 | sum+=multiplicity | 69 | sum+=multiplicity |
64 | sum += unfinishedWFsFitness//*0.5 | 70 | |
71 | // the WF can be optional when generating realistic models | ||
72 | if(!isWFOptional){ | ||
73 | val unfinishedWFsFitness = unfinishedWFObjective.getFitness(context) | ||
74 | sum += unfinishedWFsFitness//*0.5 | ||
75 | } | ||
65 | 76 | ||
66 | //println('''Sum=«sum»|Scope=«scopeFitnes»|Multiplicity=«multiplicity»|WFs=«unfinishedWFsFitness»''') | 77 | //println('''Sum=«sum»|Scope=«scopeFitnes»|Multiplicity=«multiplicity»|WFs=«unfinishedWFsFitness»''') |
67 | 78 | ||
@@ -70,6 +81,9 @@ class ModelGenerationCompositeObjective implements IObjective{ | |||
70 | 81 | ||
71 | override getLevel() { 2 } | 82 | override getLevel() { 2 } |
72 | override getName() { "CompositeUnfinishednessObjective"} | 83 | override getName() { "CompositeUnfinishednessObjective"} |
84 | def getObjective(){ | ||
85 | return this.unfinishedMultiplicityObjectives; | ||
86 | } | ||
73 | 87 | ||
74 | override isHardObjective() { true } | 88 | override isHardObjective() { true } |
75 | override satisifiesHardObjective(Double fitness) { fitness <= 0.001 } | 89 | override satisifiesHardObjective(Double fitness) { fitness <= 0.001 } |