From 4e3ab442c0ee89f51d8fe7d77d68fd1d78d52ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Babi=C4=8D?= Date: Wed, 25 Mar 2015 22:12:41 +0100 Subject: [PATCH] colored output --- .gitignore | 2 +- hello.png | 3 +++ src/neural/BattlefieldParameterEvaluator.java | 11 +++++++++-- src/neural/Palette.java | 9 ++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 hello.png diff --git a/.gitignore b/.gitignore index efb0fa1..43ffe60 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ hs_err_pid* /bin/ -*.png +/png/ diff --git a/hello.png b/hello.png new file mode 100644 index 0000000..1b90b2a --- /dev/null +++ b/hello.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6dd45349bc94101a70a274b8c1e51c873d96e11313609d6fedc347a1161d5c2 +size 17255 diff --git a/src/neural/BattlefieldParameterEvaluator.java b/src/neural/BattlefieldParameterEvaluator.java index ca87faa..39230cb 100644 --- a/src/neural/BattlefieldParameterEvaluator.java +++ b/src/neural/BattlefieldParameterEvaluator.java @@ -148,6 +148,9 @@ public class BattlefieldParameterEvaluator { MyTestData[NdxCooling + NdxBattleSize * NUMCOOLINGRATES][1] = 0.1 + 0.9 * ((double) NdxCooling) / NUMCOOLINGRATES; } } + + Palette palette = new Palette(); + // Simulate the neural network with the test samples and fill a matrix for (int NdxBattleSize = 0; NdxBattleSize < NUMBATTLEFIELDSIZES; NdxBattleSize++) { for (int NdxCooling = 0; NdxCooling < NUMCOOLINGRATES; NdxCooling++) { @@ -157,17 +160,21 @@ public class BattlefieldParameterEvaluator { double MyResult = output.getData()[0]; // 2 * fix introduced to shift the top gradient more down to se whole ColorMap spectrum MyValue = ClipColor(MyResult * 2); - MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue); +// MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue); + MyColor = palette.getColor(MyValue); OutputRGBint[NdxCooling + NdxBattleSize * NUMCOOLINGRATES] = MyColor.getRGB(); } } System.out.println("Testing completed."); + + // Plot the training samples for (int NdxSample = 0; NdxSample < NUMSAMPLES; NdxSample++) { // MyValue = ClipColor(FinalScore1[NdxSample] / BATTLE_MAX_SCORE); // 2 * fix introduced to shift the top gradient more down to se whole ColorMap spectrum MyValue = ClipColor(2 * FinalScore1[NdxSample] / BATTLE_MAX_SCORE); - MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue); +// MyColor = new Color((float) MyValue, (float) MyValue, (float) MyValue); + MyColor = palette.getColor(MyValue); int MyPixelIndex = (int) (Math.round(NUMCOOLINGRATES * ((GunCoolingRate[NdxSample] / MAXGUNCOOLINGRATE) - 0.1) / 0.9) + Math .round(NUMBATTLEFIELDSIZES * ((BattlefieldSize[NdxSample] / MAXBATTLEFIELDSIZE) - 0.1) / 0.9) * NUMCOOLINGRATES); diff --git a/src/neural/Palette.java b/src/neural/Palette.java index 850f3d2..f720624 100644 --- a/src/neural/Palette.java +++ b/src/neural/Palette.java @@ -43,12 +43,15 @@ public class Palette implements Cloneable { // public static void main(String[] args) { // // Palette palette = new Palette(); -// palette.split(0.25); -// palette.split(0.5); -// palette.split(0.75); +//// palette.split(0.25); +//// palette.split(0.5); +//// palette.split(0.75); +// System.out.println(palette.getColor(0.990987643)); +// // System.exit(0); // // } +//