Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophBodenstein authored and ChristophBodenstein committed Sep 13, 2017
1 parent 4aa666e commit aa0aadb
Showing 1 changed file with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import toe.MeasurementForm;
import toe.datamodel.parameter;
import toe.datamodel.SimulationType;
import toe.datamodel.MeasureType;
Expand Down Expand Up @@ -247,6 +248,8 @@ public void operationFeedback(String message, typedef.typeOfProcessFeedback feed
ArrayList<SimulationType> foundOptima = new ArrayList<>();
foundOptima.add(simulationResults.get(0));

MeasureType targetMeasure = support.getOptimizationMeasure();

for (int i = 1; i < simulationResults.size(); i++) {
support.spinInLabel();
support.log(String.valueOf(simulationResults.get(i).getDistanceToTargetValue()), typeOfLogLevel.VERBOSE);
Expand All @@ -259,6 +262,21 @@ public void operationFeedback(String message, typedef.typeOfProcessFeedback feed
}
}

support.log("Target value(s) found at: ", typeOfLogLevel.RESULT);
for (int i = 0; i < foundOptima.size(); i++) {
support.log("Parameterset: " + i, typeOfLogLevel.RESULT);
for (int c = 0; c < foundOptima.get(i).getListOfParameters().size(); c++) {
if (foundOptima.get(i).getListOfParameters().get(c).isIteratable()) {
foundOptima.get(i).getListOfParameters().get(c).printInfo(typeOfLogLevel.INFO);
}
}
}
support.log("Targetvalue #0 will be used for optimization and statistics.", typeOfLogLevel.RESULT);
calculatedOptimum = foundOptima.get(0);
support.log("Will set targetvalue to: " + calculatedOptimum.getMeasureValueByMeasureName(targetMeasure.getMeasureName()), typeOfLogLevel.RESULT);
MeasurementForm tmpMeasurementForm = (MeasurementForm) support.getMeasureFormPane().getComponent(0);
tmpMeasurementForm.setTargetValue(calculatedOptimum.getMeasureValueByMeasureName(targetMeasure.getMeasureName()));

if (foundOptima.size() < 1) {
//Error checking the target
listener.operationFeedback("Opticheck failed.", typedef.typeOfProcessFeedback.TargetCheckFailed);
Expand All @@ -268,25 +286,16 @@ public void operationFeedback(String message, typedef.typeOfProcessFeedback feed
support.log("The distance to target is: " + oldDistance, typeOfLogLevel.INFO);
} else if (foundOptima.size() == 1) {
//Exactly one optimum with selected target value was found
if (oldDistance > 0.0) {
if (Math.abs(oldDistance - simulationResults.get(0).getDistanceToTargetValue()) < support.DEFAULT_TARGET_STEPPING) {
//distance not zero --> will adapt selected optimum!
listener.operationFeedback("Target is unique, will change target value to match distance of 0.0.", typedef.typeOfProcessFeedback.TargetCheckSuccessful);
support.log("Old distance to target is: " + oldDistance, typeOfLogLevel.INFO);
listener.operationFeedback("Target will be adapted.", typedef.typeOfProcessFeedback.TargetCheckSuccessful);
support.log("Old distance to target was: " + oldDistance, typeOfLogLevel.INFO);

} else {
listener.operationFeedback("Target is unique and distance is 0.0!", typedef.typeOfProcessFeedback.TargetCheckSuccessful);
}
}
support.log("Target value(s) found at: ", typeOfLogLevel.RESULT);
for (int i = 0; i < foundOptima.size(); i++) {
support.log("Parameterset: " + i, typeOfLogLevel.RESULT);
for (int c = 0; c < foundOptima.get(i).getListOfParameters().size(); c++) {
if (foundOptima.get(i).getListOfParameters().get(c).isIteratable()) {
foundOptima.get(i).getListOfParameters().get(c).printInfo(typeOfLogLevel.INFO);
}
}
}
support.log("Targetvalue #0 will be used for optimization and statistics.", typeOfLogLevel.RESULT);

calculatedOptimum = foundOptima.get(0);
break;
case SimulationCanceled:
Expand Down

0 comments on commit aa0aadb

Please sign in to comment.