/**
* For internal use only, this initialises all base parameters to default values.
*/
private void createBaseParameters() {
rows = new IntegerParameter(5, "Rows", false, true) {
@Override
public void validate(Number newValue) {
if (newValue.intValue() <= 0) {
status = ParameterStatus.INVALID;
status.setDetails("Chromosome must have at least 1 row.");
} else {
status = ParameterStatus.VALID;
}
}
};
columns = new IntegerParameter(5, "Columns", false, true) {
@Override
public void validate(Number newValue) {
if (newValue.intValue() <= 0) {
status = ParameterStatus.INVALID;
status.setDetails("Chromosome must have at least 1 column.");
} else {
status = ParameterStatus.VALID;
}
}
};
inputs = new IntegerMonitor(3, "Inputs");
outputs = new IntegerMonitor(3, "Outputs");
populationSize = new IntegerParameter(5, "Population", false, true) {
@Override
public void validate(Number newValue) {
if (newValue.intValue() <= 0) {
status = ParameterStatus.INVALID;
status.setDetails("Population size must be at least 1.");
} else {
status = ParameterStatus.VALID;
}
}
};
levelsBack = new IntegerParameter(2, "Levels back", false, true) {
@Override
public void validate(Number newValue) {
if (newValue.intValue() <= 0) {
status = ParameterStatus.INVALID;
status.setDetails("Levels back must be at least 1.");
} else if (newValue.intValue() > columns()) {
status = ParameterStatus.INVALID;
status.setDetails("Levels back must be less than or equal to the number of columns.");
} else {
status = ParameterStatus.VALID;
}
}
};
generations = new IntegerParameter(1000000, "Generations") {
@Override
public void validate(Number newValue) {
if (newValue.intValue() <= 0) {
status = ParameterStatus.INVALID;
status.setDetails("Number of generations must be greater than 0.");
} else if (newValue.intValue() < currentGeneration.get()) {
status = ParameterStatus.WARNING_RESET;
status.setDetails("Setting generations to less than the current generation will cause the experiment to restart.");
} else {
status = ParameterStatus.VALID;
}
}
};
currentGeneration = new IntegerMonitor(1, "Generation");
runs = new IntegerParameter(5, "Runs") {
@Override
public void validate(Number newValue) {
if (newValue.intValue() <= 0) {
status = ParameterStatus.INVALID;
status.setDetails("Number of runs must be greater than 0.");
} else if (newValue.intValue() < currentRun.get()) {
status = ParameterStatus.WARNING_RESET;
status.setDetails("Setting runs to less than the current run will cause the experiment to restart.");
} else {
status = ParameterStatus.VALID;
}
}
};
currentRun = new IntegerMonitor(1, "Run");
arity = new IntegerMonitor(0, "Max arity");
seed = new IntegerParameter(1234, "Seed", false, true) {
@Override
public void validate(Number newValue) {
status = ParameterStatus.VALID;
}
};
seed.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(
ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
numberGenerator.setSeed(newValue.longValue());
}
});
numberGenerator.setSeed(seed.get());
reportInterval = new IntegerParameter(1, "Report interval", false, false) {
@Override
public void validate(Number newValue) {
if (newValue.intValue() > generations.get()) {
status = ParameterStatus.WARNING;
status.setDetails("No reports will be printed.");