diff --git a/README.markdown b/README.markdown
new file mode 100755
index 0000000..f907e32
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,53 @@
+# Industrial Benchmark
+
+Requires: Java 8 and Apache Maven 3.x
+
+Documentation: The documentation is available online at: https://arxiv.org/abs/1709.09480
+ Source: D. Hein, S. Depeweg, M. Tokic, S. Udluft, A. Hentschel, T.A. Runkler, and V. Sterzing.
+ "A Benchmark Environment Motivated by Industrial Control Problems". arXiv preprint arXiv:1709.09480, 2017.
+
+## Citing Industrial Benchmark
+
+To cite Industrial Benchmark, please reference:
+ D. Hein, S. Depeweg, M. Tokic, S. Udluft, A. Hentschel, T.A. Runkler, and V. Sterzing. "A Benchmark Environment
+ Motivated by Industrial Control Problems". arXiv preprint arXiv:1709.09480, 2017.
+
+ D. Hein, S. Udluft, M. Tokic, A. Hentschel, T.A. Runkler, and V. Sterzing. "Batch Reinforcement
+ Learning on the Industrial Benchmark: First Experiences," in 2017 International Joint Conference on Neural
+ Networks (IJCNN), 2017, pp. 4214–4221.
+
+ S. Depeweg, J. M. Hernández-Lobato, F. Doshi-Velez, and S. Udluft. "Learning and
+ policy search in stochastic dynamical systems with bayesian neural networks." arXiv
+ preprint arXiv:1605.07127, 2016.
+
+## Inclusion as a dependency to your Java/Maven project
+
+
+ com.siemens.oss.industrialbenchmark
+ industrialbenchmark
+ 1.1.1
+
+
+
+## Compilation + Run
+
+NOTE: It is important to run the maven clean phase (`mvn clean`, like below)
+when working with this project for the first time.
+This will install the `RLGlue:JavaRLGlueCodec:1.0` dependency into the local repo.
+Without it, compilation will fail.
+
+ mvn clean package
+ java -jar target/industrialbenchmark-*-jar-with-dependencies.jar
+ # or
+ java -jar target/industrialbenchmark-*-jar-with-dependencies.jar src/main/resources/sim.properties
+
+* => a random trajectory is generated
+* => all observable state variables are written to file dyn-observable.csv.
+* => all markov state variables are written to file dyn-markov.csv
+
+# Sample usage in code
+
+An example usage of the industrial benchmark can be found in the class `com.siemens.industrialbenchmark.ExampleMain`.
+It is intented to be a template for data generation.
+
+
diff --git a/README.txt b/README.txt
deleted file mode 100755
index 3490f4e..0000000
--- a/README.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-Industrial Benchmark:
-=====================
-
-Requires: Java 8 and Apache Maven 3.x
-
-Documentation: The documentation is available online at: https://arxiv.org/abs/1610.03793
- Source: D. Hein, A. Hentschel, V. Sterzing, M. Tokic and S. Udluft. "Introduction to the
- Industrial Benchmark". CoRR, arXiv:1610.03793 [cs.LG], pages 1-11. 2016.
-
-Citing Industrial Benchmark:
-============================
-To cite Industrial Benchmark, please reference:
- D. Hein, A. Hentschel, V. Sterzing, M. Tokic and S. Udluft. "Introduction to the
- Industrial Benchmark". CoRR, arXiv:1610.03793 [cs.LG], pages 1-11. 2016.
-
- D. Hein, S. Udluft, M. Tokic, A. Hentschel, T.A. Runkler, and V. Sterzing. "Batch Reinforcement
- Learning on the Industrial Benchmark: First Experiences." Neural Networks (IJCNN), 2017
- International Joint Conference on. IEEE, 2017. (accepted) (to be published)
-
- S. Depeweg, J. M. Hernández-Lobato, F. Doshi-Velez, and S. Udluft. "Learning and
- policy search in stochastic dynamical systems with bayesian neural networks." arXiv
- preprint arXiv:1605.07127, 2016.
-
-Inclusion as a dependency to your Java/Maven project:
-=====================================================
-
-
- com.siemens.oss.industrialbenchmark
- industrialbenchmark
- 1.1.1
-
-
-
-Compilation + Run:
-==================
- mvn clean package
- java -jar industrialbenchmark-.jar
-
- E.g.: java -jar target/industrialbenchmark--SNAPSHOT-jar-with-dependencies.jar src/main/resources/sim.properties
-
- => a random trajectory is generated
- => all observable state variables are written to file dyn-observable.csv.
- => all markov state variables are written to file dyn-markov.csv
-
-Example main()-Function:
-========================
-
- An example usage of the industrial benchmark can be found in the class com.siemens.industrialbenchmark.ExampleMain.
- This class is intented to be a template for data generation.
-
-
diff --git a/pom.xml b/pom.xml
index eeb29b1..d800747 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1,15 +1,24 @@
4.0.0
+
com.siemens.oss.industrialbenchmarkindustrialbenchmark1.1.2-SNAPSHOT
- 1.8
- 1.8
- UTF-8
+ UTF-8
+ ${project.build.encoding}
+ ${project.build.encoding}
+ 8
+
+ com.siemens.industrialbenchmark
+ ${project.mainPackage}.TrialGuiMain
+
+ Siemens
+ http://ct.siemens.com
+ Industrial Benchmarkhttp://github.com/siemens/industrialbenchmarkA novel reinforcement learning benchmark, called Industrial Benchmark, is introduced.
@@ -17,6 +26,7 @@ The Industrial Benchmark aims at being be realistic in the sense, that it includ
of aspects that we found to be vital in industrial applications. It is not designed to be an
approximation of any real system, but to pose the same hardness and complexity.
+ 20??
@@ -27,6 +37,12 @@ approximation of any real system, but to pose the same hardness and complexity.
+ jar
+
+
+ 2.2.1
+
+
Michel Tokic
@@ -67,6 +83,57 @@ approximation of any real system, but to pose the same hardness and complexity.
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 2.17
+
+ ${project.build.sourceEncoding}
+ true
+ src/main/resources/checkstyle.xml
+ java.header.regex.template.file=${basedir}/src/main/resources/java_header_regex_template.txt
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.7
+
+ true
+ true
+ ${project.build.sourceEncoding}
+ 1.${java.min.version}
+
+ ${basedir}/src/main/resources/pmd.xml
+
+
+
+
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+ 3.0.4
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+ 2.19.1
+
+
+
+ org.apache.maven.plugins
+ maven-project-info-reports-plugin
+ 2.9
+
+
+
+
org.slf4j
@@ -144,9 +211,11 @@ approximation of any real system, but to pose the same hardness and complexity.
maven-compiler-plugin2.3.2
- ${javaSource}
- ${javaTarget}
+ 1.${java.min.version}
+ 1.${java.min.version}${project.build.sourceEncoding}
+ true
+ -Xlint:unchecked
@@ -162,8 +231,15 @@ approximation of any real system, but to pose the same hardness and complexity.
used to specify that all needed libraries are found under lib/ directory. -->
lib/
- com.siemens.industrialbenchmark.ExampleMain
+ ${project.mainClass}
+
+
+
+
@@ -218,14 +294,11 @@ approximation of any real system, but to pose the same hardness and complexity.
-
-
-
- maven-assembly-plugin
+
- com.siemens.industrialbenchmark.ExampleMain
+ ${project.mainClass}
@@ -233,6 +306,74 @@ approximation of any real system, but to pose the same hardness and complexity.
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.8
+
+ ${project.build.sourceEncoding}
+ ${project.build.sourceEncoding}
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.0.2
+
+ ${project.build.resourceEncoding}
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.5.0
+
+
+
+ java
+
+
+
+
+ ${project.mainClass}
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 2.17
+
+ ${project.build.sourceEncoding}
+ true
+ src/main/resources/checkstyle.xml
+ java.header.regex.template.file=${basedir}/src/main/resources/java_header_regex_template.txt
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.7
+
+ true
+ true
+ ${project.build.sourceEncoding}
+ 1.${java.min.version}
+
+ ${basedir}/src/main/resources/pmd.xml
+
+
+
+
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+ 3.0.4
+
@@ -255,7 +396,8 @@ approximation of any real system, but to pose the same hardness and complexity.
- com.siemens.industrialbenchmark.*
+ ${project.build.sourceEncoding}
+ ${project.build.sourceEncoding}
@@ -307,5 +449,49 @@ approximation of any real system, but to pose the same hardness and complexity.
+
+
+ Extensive-Reports
+
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 2.5
+
+ ${project.build.sourceEncoding}
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.8
+
+ ${project.build.sourceEncoding}
+ ${project.build.sourceEncoding}
+
+
+
+
+ org.apache.maven.plugins
+ maven-changelog-plugin
+ 2.3
+
+
+
+ org.codehaus.mojo
+ sonar-maven-plugin
+ 3.2
+
+
+
+
diff --git a/src/main/java/com/siemens/industrialbenchmark/ExampleExperiment.java b/src/main/java/com/siemens/industrialbenchmark/ExampleExperiment.java
new file mode 100644
index 0000000..176ca6a
--- /dev/null
+++ b/src/main/java/com/siemens/industrialbenchmark/ExampleExperiment.java
@@ -0,0 +1,107 @@
+/*
+Copyright 2017 Siemens AG.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package com.siemens.industrialbenchmark;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+import com.siemens.industrialbenchmark.properties.PropertiesException;
+import com.siemens.industrialbenchmark.properties.PropertiesUtil;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * Runs a series of simulations.
+ */
+public class ExampleExperiment {
+
+ private ExampleExperiment() {}
+
+ private static class SimulationWrapper implements Callable {
+
+ private final Callable simulation;
+ private final int simulationIndex;
+ private final int numSimulations;
+ private final long startTimeMillis;
+
+ SimulationWrapper(final Callable simulation, final int simulationIndex, final int numSimulations, final long startTimeMillis) {
+
+ this.simulation = simulation;
+ this.simulationIndex = simulationIndex;
+ this.numSimulations = numSimulations;
+ this.startTimeMillis = startTimeMillis;
+ }
+
+ @Override
+ public R call() throws Exception {
+
+ final R result = simulation.call();
+
+ final long currentMillis = System.currentTimeMillis();
+ System.out.println("Compleeted simulation " + (simulationIndex + 1) + "/" + numSimulations + " after " + (currentMillis - startTimeMillis) + "ms");
+
+ return result;
+ }
+
+ public Callable getSimulation() {
+ return simulation;
+ }
+
+ public int getSimulationIndex() {
+ return simulationIndex;
+ }
+
+ public int getNumSimulations() {
+ return numSimulations;
+ }
+
+ public long getStartTimeMillis() {
+ return startTimeMillis;
+ }
+ }
+
+ public static void main(final String[] args) throws IOException, PropertiesException {
+
+ final int numThreads = 2;
+ final int simulationSteps = 1500;
+ final String simPropsFilePath = "src/main/resources/sim.properties";
+ final String outputFileNameTemplate = System.getProperty("user.home")
+ + "/indBenchSimRes_"
+ + "SetPoint${STATIONARY_SETPOINT}_"
+ + "Seed${SEED}_"
+ + "Time${time:yyyy-MM-dd_HH:mm:ss:SSS}.csv"; // for time format documentation, see: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
+
+ final Properties props = PropertiesUtil.loadSetPointProperties(new File(simPropsFilePath));
+
+ final ExecutorService simulationThreadPool = Executors.newFixedThreadPool(numThreads);
+ int experimentIndex = 0;
+ final long startTimeMillis = System.currentTimeMillis();
+
+ final int numExperiments = 100 * 100;
+ for (int setPoint = 0; setPoint < 100; setPoint++) {
+ for (int seed = 0; seed < 100; seed++) {
+ props.setProperty("STATIONARY_SETPOINT", String.valueOf(setPoint));
+ props.setProperty("SEED", String.valueOf(seed));
+
+ final String outputFileName = TrialGuiMain.formatSaveFileName(outputFileNameTemplate, props);
+ final RandomSimulation randomSimulation = new RandomSimulation(simulationSteps, props, null, new File(outputFileName));
+ simulationThreadPool.submit(new SimulationWrapper<>(randomSimulation, experimentIndex, numExperiments, startTimeMillis));
+ experimentIndex++;
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/siemens/industrialbenchmark/ExampleMain.java b/src/main/java/com/siemens/industrialbenchmark/ExampleMain.java
index d6a75ac..b7e6e5c 100755
--- a/src/main/java/com/siemens/industrialbenchmark/ExampleMain.java
+++ b/src/main/java/com/siemens/industrialbenchmark/ExampleMain.java
@@ -1,130 +1,66 @@
-/**
-Copyright 2016 Siemens AG.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package com.siemens.industrialbenchmark;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Properties;
-import java.util.Random;
-
-import com.siemens.industrialbenchmark.datavector.action.ActionDelta;
-import com.siemens.industrialbenchmark.datavector.state.MarkovianStateDescription;
-import com.siemens.industrialbenchmark.dynamics.IndustrialBenchmarkDynamics;
-import com.siemens.industrialbenchmark.properties.PropertiesException;
-import com.siemens.industrialbenchmark.properties.PropertiesUtil;
-import com.siemens.industrialbenchmark.util.PlotCurve;
-import com.siemens.rl.interfaces.DataVector;
-import com.siemens.rl.interfaces.Environment;
-
-public class ExampleMain {
-
- /**
- * Run example benchmark with random actions for data generation purposes.
- *
- * @param args
- * @throws IOException
- * @throws PropertiesException
- */
- public static void main(String[] args) throws IOException, PropertiesException {
-
- // configuration of the properties file
- String filename = "src/main/resources/sim.properties"; // default filepath
- if (args.length >= 1) { // if filepath was given to main()
- filename = args[0];
- System.out.println("Using config file: '" + filename + "'");
- } else {
- System.out.println("Using default config file: '" + filename + "'. A custom config file can be passed as an additional parameter.");
- }
-
- /**
- * Instantiate benchmark
- */
- // setpoint configuration parameters
- Properties props = PropertiesUtil.setpointProperties( new File (filename));
-
- // instantiate industrial benchmark
- Environment db = new IndustrialBenchmarkDynamics(props);
-
- // seed PRNG from configured seed in configuration file
- long seed = PropertiesUtil.getLong(props, "SEED", System.currentTimeMillis());
- System.out.println("main seed: " + seed);
- Random rand = new Random(seed);
-
- DataVector markovState = db.getInternalMarkovState();
- DataVector observableState = db.getState();
-
- // apply constant action (gain and velocity transitions from 0 => 100)
- final ActionDelta deltaAction = new ActionDelta(0.1f, 0.1f, 0.1f);
-
- // write column headers
- FileWriter fwm = new FileWriter("dyn-markov.csv");
- fwm.write("time ");
- for (String key : db.getInternalMarkovState().getKeys()) {
- fwm.write(key + " ");
- }
- fwm.write("\n");
-
- FileWriter fw = new FileWriter("dyn-observable.csv");
- fw.write("time ");
- for (String key : db.getState().getKeys()) {
- fw.write(key + " ");
- }
- fw.write("\n");
-
-
- // data array for memorizing the reward
- final int steps = PropertiesUtil.getInt(props, "SIM_STEPS", 1500);
- double data[] = new double[steps];
-
- /*************************************************************
- * Perform random actions and write markov state to text file
- *************************************************************/
- for (int i = 0; i < steps; i++) {
-
- // set random action from the interval [-1, 1]
- deltaAction.setDeltaGain(2.f * (rand.nextFloat() - 0.5f));
- deltaAction.setDeltaVelocity(2.f * (rand.nextFloat() - 0.5f));
- deltaAction.setDeltaShift(2.f * (rand.nextFloat() - 0.5f));
-
- db.step(deltaAction);
- markovState = db.getInternalMarkovState();
- observableState = db.getState();
-
- // write data
- fw.write(Integer.toString(i+1) + " ");
- for (String key : observableState.getKeys()) {
- fw.write(observableState.getValue(key) + " ");
- }
- fw.write("\n");
-
- fwm.write(Integer.toString(i+1) + " ");
- for (String key : markovState.getKeys()) {
- fwm.write(markovState.getValue(key) + " ");
- }
- fwm.write("\n");
-
- data[i] = db.getState().getValue(MarkovianStateDescription.RewardTotal);
- }
-
- fw.close();
- fwm.close();
-
- // plot reward
- PlotCurve.plot("RewardTotal", "t", "reward", data);
- }
-
-}
+/*
+Copyright 2016 Siemens AG.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package com.siemens.industrialbenchmark;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+import com.siemens.industrialbenchmark.datavector.state.MarkovianStateDescription;
+import com.siemens.industrialbenchmark.properties.PropertiesException;
+import com.siemens.industrialbenchmark.properties.PropertiesUtil;
+import com.siemens.industrialbenchmark.util.PlotCurve;
+import java.util.List;
+import java.util.Map;
+
+public final class ExampleMain {
+
+ public static final String DEFALT_SIM_PROPS_FILE_PATH = "src/main/resources/sim.properties";
+
+ private ExampleMain() {}
+
+ /**
+ * Run example benchmark with random actions for data generation purposes.
+ *
+ * @param args command-line arguments
+ * @throws IOException when there is an error reading the configuration file
+ * @throws PropertiesException if the configuration file is badly formatted
+ */
+ public static void main(final String[] args) throws IOException, PropertiesException {
+
+ final int nSteps = 1500;
+ final String outputVar = MarkovianStateDescription.REWARD_TOTAL;
+
+ // configuration of the properties file
+ final String simPropsFilePath;
+ if (args.length >= 1) { // if filepath was given to main()
+ simPropsFilePath = args[0];
+ System.out.println("Using config file: '" + simPropsFilePath + "'");
+ } else {
+ simPropsFilePath = DEFALT_SIM_PROPS_FILE_PATH;
+ System.out.println("Using default config file: '" + simPropsFilePath + "'. A custom config file can be passed as an additional parameter.");
+ }
+
+ // setpoint configuration parameters
+ final Properties props = PropertiesUtil.loadSetPointProperties(new File(simPropsFilePath));
+
+ final RandomSimulation randomSimulation = new RandomSimulation(nSteps, props, null, new File("dyn-markov.csv"));
+ final Map> states = randomSimulation.call();
+ final List data = states.get(outputVar);
+
+ // plot the data
+ PlotCurve.plot(outputVar, "t", outputVar, data);
+ }
+}
diff --git a/src/main/java/com/siemens/industrialbenchmark/RandomSimulation.java b/src/main/java/com/siemens/industrialbenchmark/RandomSimulation.java
new file mode 100644
index 0000000..bca90e6
--- /dev/null
+++ b/src/main/java/com/siemens/industrialbenchmark/RandomSimulation.java
@@ -0,0 +1,141 @@
+/*
+Copyright 2017 Siemens AG.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package com.siemens.industrialbenchmark;
+
+import com.siemens.industrialbenchmark.datavector.action.ActionDelta;
+import com.siemens.industrialbenchmark.dynamics.IndustrialBenchmarkDynamics;
+import com.siemens.industrialbenchmark.properties.PropertiesException;
+import com.siemens.industrialbenchmark.properties.PropertiesUtil;
+import com.siemens.rl.interfaces.DataVector;
+import com.siemens.rl.interfaces.Environment;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.Random;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import javax.swing.BoundedRangeModel;
+
+public class RandomSimulation implements Callable