Skip to content

Commit aa0aadb

Browse files
ChristophBodensteinChristophBodenstein
authored andcommitted
bugfixes
1 parent 4aa666e commit aa0aadb

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

TimeNETOptimizationEnvironment/src/toe/simulation/SimulatorBenchmark.java

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.io.File;
99
import java.util.ArrayList;
1010
import java.util.Calendar;
11+
import toe.MeasurementForm;
1112
import toe.datamodel.parameter;
1213
import toe.datamodel.SimulationType;
1314
import toe.datamodel.MeasureType;
@@ -247,6 +248,8 @@ public void operationFeedback(String message, typedef.typeOfProcessFeedback feed
247248
ArrayList<SimulationType> foundOptima = new ArrayList<>();
248249
foundOptima.add(simulationResults.get(0));
249250

251+
MeasureType targetMeasure = support.getOptimizationMeasure();
252+
250253
for (int i = 1; i < simulationResults.size(); i++) {
251254
support.spinInLabel();
252255
support.log(String.valueOf(simulationResults.get(i).getDistanceToTargetValue()), typeOfLogLevel.VERBOSE);
@@ -259,6 +262,21 @@ public void operationFeedback(String message, typedef.typeOfProcessFeedback feed
259262
}
260263
}
261264

265+
support.log("Target value(s) found at: ", typeOfLogLevel.RESULT);
266+
for (int i = 0; i < foundOptima.size(); i++) {
267+
support.log("Parameterset: " + i, typeOfLogLevel.RESULT);
268+
for (int c = 0; c < foundOptima.get(i).getListOfParameters().size(); c++) {
269+
if (foundOptima.get(i).getListOfParameters().get(c).isIteratable()) {
270+
foundOptima.get(i).getListOfParameters().get(c).printInfo(typeOfLogLevel.INFO);
271+
}
272+
}
273+
}
274+
support.log("Targetvalue #0 will be used for optimization and statistics.", typeOfLogLevel.RESULT);
275+
calculatedOptimum = foundOptima.get(0);
276+
support.log("Will set targetvalue to: " + calculatedOptimum.getMeasureValueByMeasureName(targetMeasure.getMeasureName()), typeOfLogLevel.RESULT);
277+
MeasurementForm tmpMeasurementForm = (MeasurementForm) support.getMeasureFormPane().getComponent(0);
278+
tmpMeasurementForm.setTargetValue(calculatedOptimum.getMeasureValueByMeasureName(targetMeasure.getMeasureName()));
279+
262280
if (foundOptima.size() < 1) {
263281
//Error checking the target
264282
listener.operationFeedback("Opticheck failed.", typedef.typeOfProcessFeedback.TargetCheckFailed);
@@ -268,25 +286,16 @@ public void operationFeedback(String message, typedef.typeOfProcessFeedback feed
268286
support.log("The distance to target is: " + oldDistance, typeOfLogLevel.INFO);
269287
} else if (foundOptima.size() == 1) {
270288
//Exactly one optimum with selected target value was found
271-
if (oldDistance > 0.0) {
289+
if (Math.abs(oldDistance - simulationResults.get(0).getDistanceToTargetValue()) < support.DEFAULT_TARGET_STEPPING) {
272290
//distance not zero --> will adapt selected optimum!
273-
listener.operationFeedback("Target is unique, will change target value to match distance of 0.0.", typedef.typeOfProcessFeedback.TargetCheckSuccessful);
274-
support.log("Old distance to target is: " + oldDistance, typeOfLogLevel.INFO);
291+
listener.operationFeedback("Target will be adapted.", typedef.typeOfProcessFeedback.TargetCheckSuccessful);
292+
support.log("Old distance to target was: " + oldDistance, typeOfLogLevel.INFO);
275293

276294
} else {
277295
listener.operationFeedback("Target is unique and distance is 0.0!", typedef.typeOfProcessFeedback.TargetCheckSuccessful);
278296
}
279297
}
280-
support.log("Target value(s) found at: ", typeOfLogLevel.RESULT);
281-
for (int i = 0; i < foundOptima.size(); i++) {
282-
support.log("Parameterset: " + i, typeOfLogLevel.RESULT);
283-
for (int c = 0; c < foundOptima.get(i).getListOfParameters().size(); c++) {
284-
if (foundOptima.get(i).getListOfParameters().get(c).isIteratable()) {
285-
foundOptima.get(i).getListOfParameters().get(c).printInfo(typeOfLogLevel.INFO);
286-
}
287-
}
288-
}
289-
support.log("Targetvalue #0 will be used for optimization and statistics.", typeOfLogLevel.RESULT);
298+
290299
calculatedOptimum = foundOptima.get(0);
291300
break;
292301
case SimulationCanceled:

0 commit comments

Comments
 (0)