diff options
author | 2019-08-01 18:38:15 +0200 | |
---|---|---|
committer | 2019-08-01 18:38:15 +0200 | |
commit | 6eb760ee960cd3efe51ca6e4107153c09838a1da (patch) | |
tree | 2edd0e21be50265f65f0cfd2fd43f18a252aef02 /Domains/hu.bme.mit.inf.dslreasoner.domains.cps/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageMemoryConstraint.java | |
parent | Dump required Xbase version down to 2.17 (diff) | |
download | VIATRA-Generator-6eb760ee960cd3efe51ca6e4107153c09838a1da.tar.gz VIATRA-Generator-6eb760ee960cd3efe51ca6e4107153c09838a1da.tar.zst VIATRA-Generator-6eb760ee960cd3efe51ca6e4107153c09838a1da.zip |
Clean up CPS and Satellite domains
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.cps/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageMemoryConstraint.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.cps/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageMemoryConstraint.java | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageMemoryConstraint.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageMemoryConstraint.java deleted file mode 100644 index 341925bc..00000000 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/cps/mdeo/TooLowAverageMemoryConstraint.java +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.cps.mdeo; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem; | ||
4 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance; | ||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType; | ||
6 | import hu.bme.mit.inf.dslreasoner.domains.cps.mdeo.ResourceUtilizationUtil; | ||
7 | import org.eclipse.emf.common.util.EList; | ||
8 | import org.eclipse.emf.ecore.EObject; | ||
9 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.IGuidanceFunction; | ||
10 | import uk.ac.kcl.inf.mdeoptimiser.libraries.core.optimisation.interpreter.guidance.Solution; | ||
11 | |||
12 | @SuppressWarnings("all") | ||
13 | public class TooLowAverageMemoryConstraint implements IGuidanceFunction { | ||
14 | private static final double THRESHOLD = 0.25; | ||
15 | |||
16 | @Override | ||
17 | public String getName() { | ||
18 | return "TooLowAverageMemory"; | ||
19 | } | ||
20 | |||
21 | @Override | ||
22 | public double computeFitness(final Solution solution) { | ||
23 | double _xblockexpression = (double) 0; | ||
24 | { | ||
25 | EObject _model = solution.getModel(); | ||
26 | final CyberPhysicalSystem cps = ((CyberPhysicalSystem) _model); | ||
27 | double sumUtilization = 0; | ||
28 | int numHosts = 0; | ||
29 | EList<HostType> _hostTypes = cps.getHostTypes(); | ||
30 | for (final HostType hostType : _hostTypes) { | ||
31 | { | ||
32 | int _numHosts = numHosts; | ||
33 | int _size = hostType.getInstances().size(); | ||
34 | numHosts = (_numHosts + _size); | ||
35 | EList<HostInstance> _instances = hostType.getInstances(); | ||
36 | for (final HostInstance host : _instances) { | ||
37 | { | ||
38 | final int utilization = ResourceUtilizationUtil.getMemoryUtilization(host); | ||
39 | double _sumUtilization = sumUtilization; | ||
40 | int _defaultMemory = hostType.getDefaultMemory(); | ||
41 | double _divide = (((double) utilization) / _defaultMemory); | ||
42 | sumUtilization = (_sumUtilization + _divide); | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | final double averageUtilization = (sumUtilization / numHosts); | ||
48 | final double difference = (TooLowAverageMemoryConstraint.THRESHOLD - averageUtilization); | ||
49 | double _xifexpression = (double) 0; | ||
50 | if ((difference > 0)) { | ||
51 | _xifexpression = difference; | ||
52 | } else { | ||
53 | _xifexpression = 0; | ||
54 | } | ||
55 | _xblockexpression = _xifexpression; | ||
56 | } | ||
57 | return _xblockexpression; | ||
58 | } | ||
59 | } | ||