Package jcgp.backend.parameters

Examples of jcgp.backend.parameters.IntegerParameter


   *
   * @param resources a reference to the experiment's resources.
   */
  public MuPlusLambda(final Resources resources) {
    super(resources);
    mu = new IntegerParameter(1, "Parents (\u03BC)") {
      @Override
      public void validate(Number newValue) {
        if (newValue.intValue() + lambda.get() != getResources().populationSize()) {
          status = ParameterStatus.INVALID;
          status.setDetails("Parents + offspring must equal population size.");
        } else if (newValue.intValue() <= 0) {
          status = ParameterStatus.INVALID;
          status.setDetails("ES needs at least 1 parent.");
        } else {
          status = ParameterStatus.VALID;
        }
      }
    };

    lambda = new IntegerParameter(4, "Offspring (\u03BB)") {
      @Override
      public void validate(Number newValue) {
        if (newValue.intValue() + mu.get() != getResources().populationSize()) {
          status = ParameterStatus.INVALID;
          status.setDetails("Parents + offspring must equal population size.");
View Full Code Here


   *
   * @param resources a reference to the experiment's resources.
   */
  public TournamentSelection(final Resources resources) { 
    super(resources);
    tournamentSize = new IntegerParameter(1, "Tournament size") {
      @Override
      public void validate(Number newValue) {
        if (newValue.intValue() <= 0) {
          status = ParameterStatus.INVALID;
          status.setDetails("Tournament size must be greater than 0.");
View Full Code Here

 
  /**
   * 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.");
View Full Code Here

   *
   * @param resources a reference to the experiment's resources.
   */
  public FixedPointMutator(final Resources resources) {
    super(resources);
    genesMutated = new IntegerParameter(5, "Genes mutated", false, false) {
      @Override
      public void validate(Number newValue) {
        if (newValue.intValue() <= 0) {
          status = ParameterStatus.INVALID;
          status.setDetails("At least 1 mutation must take place.");
View Full Code Here

TOP

Related Classes of jcgp.backend.parameters.IntegerParameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.