gips-tests/gipsl.all.build.simple/src/gipsl/all/build/simple/Model.gipsl
Maximilian Kratz 0c7e4eea2c Removes duplex host edges in all GIPSL specifications
gipsl.all.build.model: EOpposite for host + guests and removes duplex edges in GIPSL specifications
Removes duplex host edges in all other GIPSL projects
2023-04-06 15:43:38 +02:00

69 lines
1.4 KiB
Plaintext

package "gipsl.all.build.simple"
import "platform:/resource/gipsl.all.build.model/model/Model.ecore"
config {
solver := GLPK [home:="fu", license:="bar"];
launchConfig := true [main := "TODO"];
timeLimit := true [value := 42.0];
randomSeed := true [value := 73];
presolve := true;
debugOutput := true;
}
condition vnodeNotMapped = forbid vnodeIsMapped
pattern vnodeIsMapped {
host: SubstrateNode
vnode: VirtualNode {
-host -> host
}
}
pattern vnodeNotMapped {
vnode: VirtualNode
}
when vnodeNotMapped
rule mapVnode {
root: Root {
-containers -> substrateContainer
-containers -> virtualContainer
}
substrateContainer: SubstrateContainer {
-substrateNodes -> snode
}
virtualContainer: VirtualContainer {
-virtualNodes -> vnode
}
snode: SubstrateResourceNode
vnode: VirtualResourceNode {
++ -host -> snode
}
# vnode.resourceDemand <= snode.resourceAmountAvailable
# snode.resourceAmountAvailable >= 0
}
//
// GIPSL starts here!
//
mapping n2n with mapVnode;
constraint -> class::SubstrateResourceNode {
mappings.n2n->filter(m | m.nodes().snode == self)->sum(m | m.nodes().vnode.resourceDemand) <= self.resourceAmountAvailable
}
constraint -> pattern::vnodeNotMapped {
mappings.n2n->filter(m | m.nodes().vnode == self.nodes().vnode)->count() == 1
}
objective nObj -> mapping::n2n {
1
}
global objective : min {
2 * nObj + 1
}