diff options
author | 2019-05-21 17:00:01 -0400 | |
---|---|---|
committer | 2019-05-21 17:00:01 -0400 | |
commit | fd3684b5440dacca0c4bf4be15930555a79e2100 (patch) | |
tree | 24120a5c7fdae1532529fa0c4687dc1078cd1cde /Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend | |
parent | Interval hull aggregation operator (diff) | |
download | VIATRA-Generator-fd3684b5440dacca0c4bf4be15930555a79e2100.tar.gz VIATRA-Generator-fd3684b5440dacca0c4bf4be15930555a79e2100.tar.zst VIATRA-Generator-fd3684b5440dacca0c4bf4be15930555a79e2100.zip |
VIATRA DSE and COIN-OR CBC implementations of CPS case study
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend index 0a510f0f..390d13d3 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/generator/CpsGenerator.xtend | |||
@@ -5,6 +5,8 @@ import hu.bme.mit.inf.dslreasoner.domains.cps.CyberPhysicalSystem | |||
5 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType | 5 | import hu.bme.mit.inf.dslreasoner.domains.cps.HostType |
6 | import java.util.Collection | 6 | import java.util.Collection |
7 | import java.util.Random | 7 | import java.util.Random |
8 | import org.eclipse.emf.common.util.URI | ||
9 | import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl | ||
8 | 10 | ||
9 | class CpsGenerator { | 11 | class CpsGenerator { |
10 | extension val CpsFactory = CpsFactory.eINSTANCE | 12 | extension val CpsFactory = CpsFactory.eINSTANCE |
@@ -28,8 +30,11 @@ class CpsGenerator { | |||
28 | } | 30 | } |
29 | 31 | ||
30 | def generateCpsProblem() { | 32 | def generateCpsProblem() { |
33 | val resourceSet = new ResourceSetImpl | ||
34 | val resource = resourceSet.createResource(URI.createFileURI("dummy.dummyext")) | ||
31 | createCyberPhysicalSystem => [ | 35 | createCyberPhysicalSystem => [ |
32 | val cps = it | 36 | val cps = it |
37 | resource.contents += cps | ||
33 | createLowCpuHostTypes | 38 | createLowCpuHostTypes |
34 | val highCpuHostTypes = createHighCpuHostTypes | 39 | val highCpuHostTypes = createHighCpuHostTypes |
35 | for (var int i = 0; i < applicationTypeCount; i++) { | 40 | for (var int i = 0; i < applicationTypeCount; i++) { |
@@ -58,6 +63,7 @@ class CpsGenerator { | |||
58 | val hdd = nextInt(MIN_HDD, MAX_HDD) | 63 | val hdd = nextInt(MIN_HDD, MAX_HDD) |
59 | for (hostType : allowedHostTypes) { | 64 | for (hostType : allowedHostTypes) { |
60 | appType.requirements += createResourceRequirement => [ | 65 | appType.requirements += createResourceRequirement => [ |
66 | it.hostType = hostType | ||
61 | requiredMemory = memory | 67 | requiredMemory = memory |
62 | requiredHdd = hdd | 68 | requiredHdd = hdd |
63 | ] | 69 | ] |
@@ -83,6 +89,7 @@ class CpsGenerator { | |||
83 | 89 | ||
84 | private def createHostType(CyberPhysicalSystem it, int cost, int memory, int hdd) { | 90 | private def createHostType(CyberPhysicalSystem it, int cost, int memory, int hdd) { |
85 | val hostType = createHostType => [ | 91 | val hostType = createHostType => [ |
92 | it.cost = cost | ||
86 | defaultMemory = memory | 93 | defaultMemory = memory |
87 | defaultHdd = hdd | 94 | defaultHdd = hdd |
88 | ] | 95 | ] |