Skip to content

Commit de4613f

Browse files
Christoph BodensteinChristoph Bodenstein
authored andcommitted
bugfx in distance calculation
1 parent 7d540a9 commit de4613f

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

TimeNetExperimentGenerator/src/toe/helper/StatisticAggregator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ public static void printOptiStatistics() {
243243
support.log(tmpOutValue);
244244
support.log(tmpOutDSValue);
245245
}
246+
//Latex-Friendly output
247+
support.log("Sim#, Distance, DistancsDS, CPU-Time");
248+
support.log("&"+averageNumberOfSimulations+" &"+averageDistanceToOptimumInValueRange+"\\% &"+averageDistanceToOptimumInDefinitionRange+"\\% &"+averageCPUTimeTotal);
246249
support.log("++++ End of Optimization Statistics ++++");
247250
}
248251
support.setLogToWindow(logToWindow);//Set Window-logging to original value

TimeNetExperimentGenerator/src/toe/optimization/OptimizerHill.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import toe.simulation.Simulator;
2121
import toe.support;
2222
import toe.simulation.SimulationCache;
23-
import toe.typedef.*;
23+
import toe.typedef;
2424

2525
/**
2626
*
@@ -383,7 +383,7 @@ protected ArrayList<parameter> getNextParameterset(ArrayList<parameter> actualPa
383383
wrongSolutionPerDirectionCounter = myPreferences.getPref_WrongSimulationsPerDirection();
384384

385385
support.log(myPreferences.getPref_WrongSimulationsPerDirection() + " wrong solutions in one direction.");
386-
if (this.directionOfOptimization && myPreferences.getPref_NeighborhoodType() == typeOfNeighborhoodEnum.StepForwardBackward) {
386+
if (this.directionOfOptimization && myPreferences.getPref_NeighborhoodType() == typedef.typeOfNeighborhoodEnum.StepForwardBackRandom) {
387387
//Switch direction of Optimization but change the same old parameter
388388
//This only applies if StepForwardBackward
389389

@@ -560,13 +560,13 @@ protected double getActualDistance(SimulationType p) {
560560
MeasureType activeMeasure = p.getMeasureByName(listOfMeasures.get(measureCount).getMeasureName());
561561
MeasureType activeMeasureFromInterface = listOfMeasures.get(measureCount);//Contains Optimization targets
562562
activeMeasure.setTargetValue(activeMeasureFromInterface.getTargetValue(), activeMeasureFromInterface.getTargetTypeOf());
563-
if (activeMeasure.getTargetTypeOf().equals("value")) {
563+
if (activeMeasure.getTargetTypeOf().equals(typedef.typeOfTarget.value)) {
564564
distance = activeMeasure.getDistanceFromTarget();
565565
} else {
566-
if (activeMeasure.getTargetTypeOf().equals("min")) {
566+
if (activeMeasure.getTargetTypeOf().equals(typedef.typeOfTarget.min)) {
567567
distance = activeMeasure.getMeanValue();
568568
} else {
569-
if (activeMeasure.getTargetTypeOf().equals("max")) {
569+
if (activeMeasure.getTargetTypeOf().equals(typedef.typeOfTarget.max)) {
570570
distance = 0 - activeMeasure.getMeanValue();
571571
}
572572
}

TimeNetExperimentGenerator/src/toe/support.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,13 +1202,13 @@ public static void printOptimizedMeasures(SimulationType p, ArrayList<MeasureTyp
12021202
MeasureType activeMeasure = p.getMeasureByName(measureList.get(measureCount).getMeasureName());
12031203
MeasureType activeMeasureFromInterface = measureList.get(measureCount);//Contains Optimization targets
12041204
activeMeasure.setTargetValue(activeMeasureFromInterface.getTargetValue(), activeMeasureFromInterface.getTargetTypeOf());
1205-
if (activeMeasure.getTargetTypeOf().equals("value")) {
1205+
if (activeMeasure.getTargetTypeOf().equals(typedef.typeOfTarget.value)) {
12061206
distance = activeMeasure.getDistanceFromTarget();
12071207
} else {
1208-
if (activeMeasure.getTargetTypeOf().equals("min")) {
1208+
if (activeMeasure.getTargetTypeOf().equals(typedef.typeOfTarget.min)) {
12091209
distance = activeMeasure.getMeanValue();
12101210
} else {
1211-
if (activeMeasure.getTargetTypeOf().equals("max")) {
1211+
if (activeMeasure.getTargetTypeOf().equals(typedef.typeOfTarget.max)) {
12121212
distance = 0 - activeMeasure.getMeanValue();
12131213
}
12141214
}

0 commit comments

Comments
 (0)