summaryrefslogtreecommitdiff
path: root/module/acme
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2021-01-25 21:29:12 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2021-01-25 21:29:12 +0100
commit912bc8b903dfa6d438c2469ecdad35c181c71830 (patch)
tree1e6ee9fdcb2b9d488914b80623d68189867533bb /module/acme
parent92b957036218c03a20ba35c19a70bdf5e2333fd3 (diff)
downloadrules-sandbox-912bc8b903dfa6d438c2469ecdad35c181c71830.tar.gz
rules-sandbox-912bc8b903dfa6d438c2469ecdad35c181c71830.tar.bz2
rules-sandbox-912bc8b903dfa6d438c2469ecdad35c181c71830.tar.xz
rules-sandbox-912bc8b903dfa6d438c2469ecdad35c181c71830.zip
Improving usability, massive refactoring.
* Moving all Drools code into their own modules. This fixes ri-engine to acme dependency. * Now they all inherit from their own parent, should be used by third party code too. * Separating acme planning code into its own module. * Splitting rules code from ri-engine into ri-base. ri-engine is now a pure launcher for modules. * Dumping kogito for the most part, but it seems like the planner still requires that.
Diffstat (limited to 'module/acme')
-rw-r--r--module/acme/classpath.txt62
-rw-r--r--module/acme/pom.xml23
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/AcmeAppsMain.java24
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/VpnMain.java41
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudBalance.java48
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudBalancingEasyScoreCalculator.java45
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudComputer.java16
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudPlaningMain.java52
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudPlanner.java22
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudProcess.java48
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudProcessDifficultyComparator.java15
-rw-r--r--module/acme/src/main/java/io/trygvis/acme/planning/machine/ScalewayInstance.java25
-rw-r--r--module/acme/src/main/resources/io/trygvis/acme/planning/machine/solver-config.xml18
13 files changed, 40 insertions, 399 deletions
diff --git a/module/acme/classpath.txt b/module/acme/classpath.txt
index ea09fc3..96576c4 100644
--- a/module/acme/classpath.txt
+++ b/module/acme/classpath.txt
@@ -1,78 +1,28 @@
-io.trygvis.rules-sandbox:acme:1.0-SNAPSHOT:jar
-ch.obermuhlner:big-math:2.0.0:jar
-ch.qos.logback:logback-classic:1.2.3:jar
-ch.qos.logback:logback-core:1.2.3:jar
+io.trygvis.rules-sandbox.module:acme:1.0-SNAPSHOT:jar
com.fasterxml.jackson.core:jackson-annotations:2.12.0:jar
com.fasterxml.jackson.core:jackson-core:2.12.0:jar
com.fasterxml.jackson.core:jackson-databind:2.12.0:jar
-com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.0:jar
com.github.javaparser:javaparser-core:3.13.10:jar
-com.google.code.findbugs:annotations:3.0.1:jar
-com.google.errorprone:error_prone_annotations:2.1.3:jar
-com.google.guava:guava:25.0-jre:jar
-com.google.j2objc:j2objc-annotations:1.1:jar
-com.google.re2j:re2j:1.2:jar
-com.googlecode.java-ipv6:java-ipv6:0.17:jar
-com.hubspot.jinjava:jinjava:2.5.6:jar
-com.sun.activation:jakarta.activation:1.2.2:jar
-com.sun.istack:istack-commons-runtime:3.0.8:jar
com.thoughtworks.xstream:xstream:1.4.14:jar
commons-codec:commons-codec:1.14:jar
commons-io:commons-io:2.8.0:jar
-commons-net:commons-net:3.3:jar
-info.picocli:picocli:4.6.1:jar
-io.trygvis.rules-sandbox:ri-engine:1.0-SNAPSHOT:jar
-io.trygvis.rules-sandbox:ri-wireguard:1.0-SNAPSHOT:jar
-jakarta.activation:jakarta.activation-api:1.2.2:jar
-jakarta.xml.bind:jakarta.xml.bind-api:2.3.3:jar
+io.trygvis.rules-sandbox.module:ri-base:1.0-SNAPSHOT:jar
+io.trygvis.rules-sandbox.module:ri-wireguard:1.0-SNAPSHOT:jar
org.antlr:antlr-runtime:3.5.2:jar
-org.apache.commons:commons-lang3:3.10:jar
-org.apache.commons:commons-math3:3.4.1:jar
-org.checkerframework:checker-compat-qual:2.0.0:jar
-org.codehaus.mojo:animal-sniffer-annotations:1.14:jar
org.drools:drools-canonical-model:7.48.0.Final:jar
org.drools:drools-compiler:7.48.0.Final:jar
org.drools:drools-core:7.48.0.Final:jar
+org.drools:drools-core-dynamic:7.48.0.Final:jar
org.drools:drools-core-reflective:7.48.0.Final:jar
org.drools:drools-ecj:7.48.0.Final:jar
org.drools:drools-model-compiler:7.48.0.Final:jar
-org.drools:drools-mvel:7.48.0.Final:jar
org.drools:drools-mvel-compiler:7.48.0.Final:jar
org.drools:drools-mvel-parser:7.48.0.Final:jar
-org.glassfish.jaxb:jaxb-runtime:2.3.3:jar
-org.glassfish.jaxb:txw2:2.3.3:jar
-org.javassist:javassist:3.24.1-GA:jar
-org.jsoup:jsoup:1.10.3:jar
+org.kie:kie-api:7.48.0.Final:jar
+org.kie:kie-internal:7.48.0.Final:jar
org.kie:kie-memory-compiler:7.48.0.Final:jar
-org.kie.kogito:drools-compiler:1.1.0.Final:jar
-org.kie.kogito:drools-core:1.1.0.Final:jar
-org.kie.kogito:drools-core-dynamic:1.1.0.Final:jar
-org.kie.kogito:drools-core-static:1.1.0.Final:jar
-org.kie.kogito:kogito-api:1.1.0.Final:jar
-org.kie.kogito:kogito-drools-model:1.1.0.Final:jar
-org.kie.kogito:kogito-internal:1.1.0.Final:jar
-org.kie.kogito:kogito-services:1.1.0.Final:jar
-org.kie.kogito:kogito-timer:1.1.0.Final:jar
-org.kie.soup:kie-soup-commons:7.48.0.Final:jar
org.kie.soup:kie-soup-maven-support:7.48.0.Final:jar
-org.kie.soup:kie-soup-project-datamodel-api:7.48.0.Final:jar
-org.kie.soup:kie-soup-project-datamodel-commons:7.48.0.Final:jar
org.kie.soup:kie-soup-xstream:7.48.0.Final:jar
-org.mvel:mvel2:2.4.11.Final:jar
-org.optaplanner:optaplanner-core:8.1.0.Final:jar
-org.optaplanner:optaplanner-persistence-common:8.1.0.Final:jar
-org.optaplanner:optaplanner-persistence-jackson:8.1.0.Final:jar
-org.optaplanner:optaplanner-spring-boot-autoconfigure:8.1.0.Final:jar
-org.optaplanner:optaplanner-spring-boot-starter:8.1.0.Final:jar
org.slf4j:slf4j-api:1.7.30:jar
-org.springframework:spring-aop:5.2.7.RELEASE:jar
-org.springframework:spring-beans:5.2.7.RELEASE:jar
-org.springframework:spring-context:5.2.7.RELEASE:jar
-org.springframework:spring-core:5.2.7.RELEASE:jar
-org.springframework:spring-expression:5.2.7.RELEASE:jar
-org.springframework:spring-jcl:5.2.7.RELEASE:jar
-org.springframework.boot:spring-boot:2.3.1.RELEASE:jar
-org.springframework.boot:spring-boot-autoconfigure:2.3.1.RELEASE:jar
-org.yaml:snakeyaml:1.26:jar
xmlpull:xmlpull:1.1.3.1:jar
xpp3:xpp3_min:1.1.4c:jar
diff --git a/module/acme/pom.xml b/module/acme/pom.xml
index 396b1d2..3081602 100644
--- a/module/acme/pom.xml
+++ b/module/acme/pom.xml
@@ -5,34 +5,25 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.trygvis.rules-sandbox</groupId>
- <artifactId>rules-sandbox</artifactId>
+ <groupId>io.trygvis.rules-sandbox.module</groupId>
+ <artifactId>ri-module-parent</artifactId>
<version>1.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
+ <relativePath>../ri-module-parent/pom.xml</relativePath>
</parent>
<artifactId>acme</artifactId>
<dependencies>
<dependency>
- <groupId>org.optaplanner</groupId>
- <artifactId>optaplanner-spring-boot-starter</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>ri-base</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>ri-engine</artifactId>
+ <artifactId>ri-wireguard</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.optaplanner</groupId>
- <artifactId>optaplanner-spring-boot-starter</artifactId>
- <version>8.1.0.Final</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
</project>
diff --git a/module/acme/src/main/java/io/trygvis/acme/AcmeAppsMain.java b/module/acme/src/main/java/io/trygvis/acme/AcmeAppsMain.java
index caab325..c65a3b2 100644
--- a/module/acme/src/main/java/io/trygvis/acme/AcmeAppsMain.java
+++ b/module/acme/src/main/java/io/trygvis/acme/AcmeAppsMain.java
@@ -1,18 +1,14 @@
package io.trygvis.acme;
-import io.trygvis.rules.engine.Engine;
-
-import java.io.File;
-import java.io.IOException;
-
public class AcmeAppsMain {
- public static void main(String[] args) throws IOException {
- try (var engine = new Engine(
- "acme-apps",
- "acme.yaml",
- new File("acme-apps"),
- new String[]{"init", "generate"})) {
- engine.io.dump("acme/apps", engine.session.getFactHandles());
- }
- }
+// public static void main(String[] args) throws IOException {
+// try (var engine = new Engine(
+// "acme-apps",
+// new File("acme.yaml"),
+// new File("acme-apps"),
+// new String[]{"init", "generate"},
+// new File[0])) {
+// engine.io.dump(new File("out", "acme/apps.yaml"), engine.session.getFactHandles());
+// }
+// }
}
diff --git a/module/acme/src/main/java/io/trygvis/acme/VpnMain.java b/module/acme/src/main/java/io/trygvis/acme/VpnMain.java
index 1859e2a..cbf962c 100644
--- a/module/acme/src/main/java/io/trygvis/acme/VpnMain.java
+++ b/module/acme/src/main/java/io/trygvis/acme/VpnMain.java
@@ -1,28 +1,21 @@
package io.trygvis.acme;
-import io.trygvis.rules.dns.DnsEntry;
-import io.trygvis.rules.engine.Engine;
-import io.trygvis.rules.machine.Machine;
-import io.trygvis.rules.network.Ipv4Address;
-import io.trygvis.rules.network.Ipv4Cidr;
-
-import java.io.File;
-import java.io.IOException;
-
public class VpnMain {
- public static void main(String[] args) throws IOException {
- try (var engine = new Engine(
- "acme-wireguard",
- "acme.yaml",
- new File("acme-wireguard"),
- new String[]{"init", "generate"})) {
- engine.io.dump("acme/wireguard", engine.session.getFactHandles(), (Object o) ->
- o.getClass().getName().contains("Wg")
- || o instanceof Machine
- || o instanceof DnsEntry
- || o instanceof Ipv4Cidr
- || o instanceof Ipv4Address
- );
- }
- }
+// public static void main(String[] args) throws IOException {
+// try (var engine = new Engine(
+// "acme-wireguard",
+// new File("acme.yaml"),
+// new File("acme-wireguard"),
+// new String[]{"init", "generate"},
+// new File[0])) {
+// var outputFile = new File("out", "acme/wireguard.yaml");
+// engine.io.dump(outputFile, engine.session.getFactHandles(), (Object o) ->
+// o.getClass().getName().contains("Wg")
+// || o instanceof Machine
+// || o instanceof DnsEntry
+// || o instanceof Ipv4Cidr
+// || o instanceof Ipv4Address
+// );
+// }
+// }
}
diff --git a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudBalance.java b/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudBalance.java
deleted file mode 100644
index 7311918..0000000
--- a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudBalance.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.trygvis.acme.planning.machine;
-
-import org.optaplanner.core.api.domain.solution.PlanningEntityCollectionProperty;
-import org.optaplanner.core.api.domain.solution.PlanningScore;
-import org.optaplanner.core.api.domain.solution.PlanningSolution;
-import org.optaplanner.core.api.domain.solution.ProblemFactCollectionProperty;
-import org.optaplanner.core.api.domain.valuerange.ValueRangeProvider;
-import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore;
-
-import java.util.List;
-
-@PlanningSolution
-public class CloudBalance {
-
- private List<CloudComputer> computerList;
-
- private List<CloudProcess> processList;
-
- private HardSoftScore score;
-
- public CloudBalance(List<CloudComputer> computerList, List<CloudProcess> processList) {
- this.computerList = computerList;
- this.processList = processList;
- }
-
- public CloudBalance() {
- }
-
- @ValueRangeProvider(id = "computerRange")
- @ProblemFactCollectionProperty
- public List<CloudComputer> getComputerList() {
- return computerList;
- }
-
- @PlanningEntityCollectionProperty
- public List<CloudProcess> getProcessList() {
- return processList;
- }
-
- @PlanningScore
- public HardSoftScore getScore() {
- return score;
- }
-
- public void setScore(HardSoftScore score) {
- this.score = score;
- }
-}
diff --git a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudBalancingEasyScoreCalculator.java b/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudBalancingEasyScoreCalculator.java
deleted file mode 100644
index 6a14372..0000000
--- a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudBalancingEasyScoreCalculator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package io.trygvis.acme.planning.machine;
-
-import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore;
-import org.optaplanner.core.api.score.calculator.EasyScoreCalculator;
-
-public class CloudBalancingEasyScoreCalculator implements EasyScoreCalculator<CloudBalance, HardSoftScore> {
-
- @Override
- public HardSoftScore calculateScore(CloudBalance cloudBalance) {
- int hardScore = 0;
- int softScore = 0;
- for (CloudComputer computer : cloudBalance.getComputerList()) {
- int cpu = 0;
- int memory = 0;
- boolean used = false;
-
- // Calculate usage
- for (CloudProcess process : cloudBalance.getProcessList()) {
- if (computer.equals(process.computer)) {
- cpu += process.requiredCpu;
- memory += process.requiredMemory;
- used = true;
- }
- }
-
- var instance = computer.instance;
-
- // Hard constraints
- int cpuPowerAvailable = instance.cpu - cpu;
- if (cpuPowerAvailable < 0) {
- hardScore += cpuPowerAvailable;
- }
- int memoryAvailable = instance.memory - memory;
- if (memoryAvailable < 0) {
- hardScore += memoryAvailable;
- }
-
- // Soft constraints
- if (used) {
- softScore -= instance.cost;
- }
- }
- return HardSoftScore.of(hardScore, softScore);
- }
-}
diff --git a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudComputer.java b/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudComputer.java
deleted file mode 100644
index aa2087d..0000000
--- a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudComputer.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package io.trygvis.acme.planning.machine;
-
-public class CloudComputer {
- public final String host;
- public final ScalewayInstance instance;
-
- public CloudComputer(String host, ScalewayInstance instance) {
- this.host = host;
- this.instance = instance;
- }
-
- @Override
- public String toString() {
- return host;
- }
-}
diff --git a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudPlaningMain.java b/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudPlaningMain.java
deleted file mode 100644
index 60b3fd3..0000000
--- a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudPlaningMain.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package io.trygvis.acme.planning.machine;
-
-import org.optaplanner.core.api.solver.SolverFactory;
-
-import java.util.ArrayList;
-
-public class CloudPlaningMain {
- public static final ScalewayInstance Stardust1_s = new ScalewayInstance("Stardust1-s", 0.0025, 1000, 1000);
- public static final ScalewayInstance DEV1_S = new ScalewayInstance("DEV1-S", 0.01, 2000, 2000);
- public static final ScalewayInstance DEV1_M = new ScalewayInstance("DEV1-M", 0.02, 3000, 4000);
- public static final ScalewayInstance DEV1_L = new ScalewayInstance("DEV1-L", 0.04, 4000, 8000);
- public static final ScalewayInstance DEV1_XL = new ScalewayInstance("DEV1-XL", 0.06, 4000, 12000);
-
- public static void main(String[] args) {
- var solverFactory = SolverFactory.<CloudBalance>createFromXmlResource("io/trygvis/acme/planning/machine/solver-config.xml");
- var solver = solverFactory.buildSolver();
-
- var computers = new ArrayList<CloudComputer>();
-
- computers.add(new CloudComputer("acme-1", DEV1_S));
- computers.add(new CloudComputer("acme-2", DEV1_M));
- computers.add(new CloudComputer("acme-3", DEV1_S));
-
- var processes = new ArrayList<CloudProcess>();
-
- processes.add(new CloudProcess("statera", 200, 1000));
- processes.add(new CloudProcess("statera-console", 100, 50));
- processes.add(new CloudProcess("4tune-web", 100, 50));
- processes.add(new CloudProcess("4tune-api", 200, 200));
- processes.add(new CloudProcess("pdb", 500, 500));
- processes.add(new CloudProcess("mdb", 500, 200));
-
- var unsolvedCloudBalance = new CloudBalance(computers, processes);
-
- var solvedCloudBalance = solver.solve(unsolvedCloudBalance);
-
- System.out.println("solvedCloudBalance.getScore() = " + solvedCloudBalance.getScore());
- for (CloudProcess process : solvedCloudBalance.getProcessList()) {
- System.out.println("process.id = " + process.id);
- if (process.computer == null) {
- System.out.println("COMPUTER IS NULL");
- } else {
- System.out.println("process.computer.host = " + process.computer.host);
- }
- }
-
- System.out.println("------------------------------------------------------------------------");
-
-// System.out.println("\nSolved cloudBalance with 400 computers and 1200 processes:\n"
-// + toDisplayString(solvedCloudBalance));
- }
-}
diff --git a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudPlanner.java b/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudPlanner.java
deleted file mode 100644
index c629656..0000000
--- a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudPlanner.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package io.trygvis.acme.planning.machine;
-
-import org.optaplanner.core.api.domain.entity.PlanningEntity;
-import org.optaplanner.core.api.domain.variable.PlanningVariable;
-
-@PlanningEntity()
-public class CloudPlanner {
- private int requiredCpuPower;
- private int requiredMemory;
- private int requiredNetworkBandwidth;
-
- private CloudComputer computer;
-
- @PlanningVariable(valueRangeProviderRefs = {"computerRange"})
- public CloudComputer getComputer() {
- return computer;
- }
-
- public void setComputer(CloudComputer computer) {
- this.computer = computer;
- }
-}
diff --git a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudProcess.java b/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudProcess.java
deleted file mode 100644
index 2002903..0000000
--- a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudProcess.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package io.trygvis.acme.planning.machine;
-
-import org.apache.commons.lang3.builder.CompareToBuilder;
-import org.optaplanner.core.api.domain.entity.PlanningEntity;
-import org.optaplanner.core.api.domain.variable.PlanningVariable;
-
-import java.util.Comparator;
-
-@PlanningEntity(difficultyComparatorClass = CloudProcessDifficultyComparator.class)
-public class CloudProcess {
- public String id;
- public int requiredCpu;
- public int requiredMemory;
- public int requiredMultiplicand;
-
- @PlanningVariable(
- valueRangeProviderRefs = "computerRange",
- strengthComparatorClass = CloudComputerStrengthComparator.class)
- public CloudComputer computer;
-
- public CloudProcess(String id, int requiredCpu, int requiredMemory) {
- this.id = id;
- this.requiredCpu = requiredCpu;
- this.requiredMemory = requiredMemory;
-
- this.requiredMultiplicand = requiredCpu * requiredMemory;
- }
-
- @SuppressWarnings("unused")
- public CloudProcess() {
- }
-
- public String toString() {
- return id;
- }
-
- public static class CloudComputerStrengthComparator implements Comparator<CloudComputer> {
- public int compare(CloudComputer a, CloudComputer b) {
- var x = a.instance;
- var y = b.instance;
- return new CompareToBuilder()
- .append(x.multiplicand, y.multiplicand)
- .append(y.cost, x.cost) // Descending (but this is debatable)
- .append(x.kind, y.kind)
- .toComparison();
- }
- }
-}
diff --git a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudProcessDifficultyComparator.java b/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudProcessDifficultyComparator.java
deleted file mode 100644
index 658e826..0000000
--- a/module/acme/src/main/java/io/trygvis/acme/planning/machine/CloudProcessDifficultyComparator.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.trygvis.acme.planning.machine;
-
-import org.apache.commons.lang3.builder.CompareToBuilder;
-
-import java.util.Comparator;
-
-public class CloudProcessDifficultyComparator implements Comparator<CloudProcess> {
-
- public int compare(CloudProcess a, CloudProcess b) {
- return new CompareToBuilder()
- .append(a.requiredMultiplicand, b.requiredMultiplicand)
- .append(a.id, b.id)
- .toComparison();
- }
-}
diff --git a/module/acme/src/main/java/io/trygvis/acme/planning/machine/ScalewayInstance.java b/module/acme/src/main/java/io/trygvis/acme/planning/machine/ScalewayInstance.java
deleted file mode 100644
index dfdc0e0..0000000
--- a/module/acme/src/main/java/io/trygvis/acme/planning/machine/ScalewayInstance.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.trygvis.acme.planning.machine;
-
-public class ScalewayInstance {
- public final String kind;
- // Euros / hour
- public final double cost;
- public final int cpu;
- public final int memory;
-
- public int multiplicand;
-
- public ScalewayInstance(String kind, double cost, int cpu, int memory) {
- this.kind = kind;
- this.cost = cost;
- this.cpu = cpu;
- this.memory = memory;
-
- this.multiplicand = cpu * memory;
- }
-
- @Override
- public String toString() {
- return kind;
- }
-}
diff --git a/module/acme/src/main/resources/io/trygvis/acme/planning/machine/solver-config.xml b/module/acme/src/main/resources/io/trygvis/acme/planning/machine/solver-config.xml
deleted file mode 100644
index 81ae8ed..0000000
--- a/module/acme/src/main/resources/io/trygvis/acme/planning/machine/solver-config.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<solver xmlns="https://www.optaplanner.org/xsd/solver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="https://www.optaplanner.org/xsd/solver https://www.optaplanner.org/xsd/solver/solver.xsd">
- <!-- Domain model configuration -->
- <solutionClass>io.trygvis.acme.planning.machine.CloudBalance</solutionClass>
- <entityClass>io.trygvis.acme.planning.machine.CloudProcess</entityClass>
-
- <!-- Score configuration -->
- <scoreDirectorFactory>
- <easyScoreCalculatorClass>io.trygvis.acme.planning.machine.CloudBalancingEasyScoreCalculator</easyScoreCalculatorClass>
- <!--<scoreDrl>org/optaplanner/examples/cloudbalancing/solver/cloudBalancingConstraints.drl</scoreDrl>-->
- </scoreDirectorFactory>
-
- <!-- Optimization algorithms configuration -->
- <termination>
- <secondsSpentLimit>3</secondsSpentLimit>
- </termination>
-</solver>