|
@@ -365,10 +365,12 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
stepsSizeLabel.setEnabled(false);
|
|
|
singleParameterPanel.add(stepsSizeLabel);
|
|
|
|
|
|
- JFormattedTextField stepsSizeTextField = new JFormattedTextField(doubleFormatter);
|
|
|
+ NumberFormatter doubleFormatterForStepping = new NumberFormatter(doubleFormat);
|
|
|
+ doubleFormatterForStepping.setCommitsOnValidEdit(true);
|
|
|
+ JFormattedTextField stepsSizeTextField = new JFormattedTextField(doubleFormatterForStepping);
|
|
|
stepsSizeTextField.setEnabled(false);
|
|
|
stepsSizeTextField.setValue(1.0);
|
|
|
- stepsSizeTextField.setToolTipText("Only double \u2208 [" + minValue + "," + maxValue + "]");
|
|
|
+ stepsSizeTextField.setToolTipText("Only double");
|
|
|
stepsSizeTextField.addPropertyChangeListener(actionEvent -> doubleParameterStepping.stepSize = Double.parseDouble(stepsSizeTextField.getValue().toString()));
|
|
|
stepsSizeTextField.setMaximumSize(new Dimension(40, 30));
|
|
|
stepsSizeTextField.setPreferredSize(new Dimension(40, 30));
|
|
@@ -482,6 +484,7 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
runPrinter.openStream();
|
|
|
runPrinter.println("");
|
|
|
runPrinter.println("Start:" + stringStatFromActualState());
|
|
|
+ runPrinter.closeStream();
|
|
|
if(this.useStepping) {
|
|
|
initParameterStepping();
|
|
|
do {
|
|
@@ -496,7 +499,6 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
updateVisual();
|
|
|
runProgressbar.finishedCancel();
|
|
|
control.guiDisable(false);
|
|
|
- runPrinter.closeStream();
|
|
|
}
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
private void initParameterStepping() {
|
|
@@ -545,8 +547,11 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
double startFitness = evaluatePosition(extractPositionAndAccess());
|
|
|
console.println("BitLength: " + access.size());
|
|
|
resetChain.removeLast();
|
|
|
+ runPrinter.openStream();
|
|
|
runPrinter.println("");
|
|
|
runPrinter.println(algoInformationToPrint());
|
|
|
+ console.println(algoInformationToPrint());
|
|
|
+ runPrinter.closeStream();
|
|
|
runProgressbar.start();
|
|
|
Individual runBest = new Individual();
|
|
|
runBest.fitness = Double.MAX_VALUE;
|
|
@@ -556,9 +561,11 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
startTimer();
|
|
|
Individual roundBest = executeAlgo();
|
|
|
long executionTime = printElapsedTime();
|
|
|
+ runPrinter.openStream();
|
|
|
runPrinter.println(runList.stream().map(Object::toString).collect(Collectors.joining(", ")));
|
|
|
runPrinter.println(stringStatFromActualState());
|
|
|
runPrinter.println("Result: " + roundBest.fitness + " ExecutionTime:" + executionTime);
|
|
|
+ runPrinter.closeStream();
|
|
|
if(cancel)return;
|
|
|
resetState();
|
|
|
if(roundBest.fitness < runBest.fitness) runBest = roundBest;
|
|
@@ -1016,7 +1023,14 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
* @return
|
|
|
*/
|
|
|
public static int nextIntegerInRange(int min, int max) {
|
|
|
- return min + random.nextInt(max - min);
|
|
|
+ int result = min;
|
|
|
+ try {
|
|
|
+ result = min + random.nextInt(max - min);
|
|
|
+ }catch(java.lang.IllegalArgumentException e){
|
|
|
+ System.err.println("min : " + min + " max : " + max);
|
|
|
+ System.err.println("max should be more then min");
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|
|
|
|