예제 #1
0
  public void setup(final EvolutionState state, final Parameter base) {
    // very important, remember this
    super.setup(state, base);

    // set up our input -- don't want to use the default base, it's unsafe here
    input =
        (DoubleData)
            state.parameters.getInstanceForParameterEq(base.push(P_DATA), null, DoubleData.class);
    input.setup(state, base.push(P_DATA));
  }
  public void setup(final EvolutionState state, final Parameter base) {
    super.setup(state, base);

    String temp;
    temp = state.parameters.getStringWithDefault(base.push(P_COMPETE_STYLE), null, "");
    if (temp.equalsIgnoreCase("single-elim-tournament")) {
      style = STYLE_SINGLE_ELIMINATION;
    } else if (temp.equalsIgnoreCase("round-robin")) {
      style = STYLE_ROUND_ROBIN;
    } else if (temp.equalsIgnoreCase("rand-1-way")) {
      style = STYLE_N_RANDOM_COMPETITORS_ONEWAY;
    } else if (temp.equalsIgnoreCase("rand-2-way")) {
      style = STYLE_N_RANDOM_COMPETITORS_TWOWAY;
    } else if (temp.equalsIgnoreCase("rand-2-ways")) {
      state.output.fatal(
          "'rand-2-ways' is no longer a valid style name: use 'rand-2-way'",
          base.push(P_COMPETE_STYLE),
          null);
    } else {
      state.output.fatal(
          "Incorrect value for parameter. Acceptable values: "
              + "single-elim-tournament, round-robin, rand-1-way, rand-2-way",
          base.push(P_COMPETE_STYLE));
    }

    if (style == STYLE_N_RANDOM_COMPETITORS_ONEWAY || style == STYLE_N_RANDOM_COMPETITORS_TWOWAY) {
      groupSize = state.parameters.getInt(base.push(P_GROUP_SIZE), null, 1);
      if (groupSize < 1) {
        state.output.fatal("Incorrect value for parameter", base.push(P_GROUP_SIZE));
      }
    }
    allowOverEvaluation = state.parameters.getBoolean(base.push(P_OVER_EVAL), null, false);
  }