public Individual run(
      EvolutionState state,
      SimpleProblemForm p,
      Individual x,
      int maxIter,
      ClusWrapperNonStatic objectClus)
      throws Exception { // talvez passe um individuo já com o genoma e score

    Random rand = new Random();

    // IntegerVectorIndividual mutatedX = (IntegerVectorIndividual) deepClone(x);
    IntegerVectorIndividual mutatedX = (IntegerVectorIndividual) x.clone();

    mutatedX.evaluated = false;

    double alpha = 0.95; // cálculo do alpha, percentual de diminuição da temperatura
    double t_final = 1;
    double t0 = Math.pow(alpha, maxIter + Math.log(t_final)); // estimar a temperatura inicial
    double temp_atual = t0; // tf = temperatura da vez

    int iter = 0;
    maxIter *= 2;

    while (iter < maxIter) {

      int[] genome = mutatedX.genome;
      genome = mutate(genome, 1 - iter / maxIter); // mutar o vetor

      mutatedX.setGenome(genome);

      ((ec.Problem) p).prepareToEvaluate(state, 0);
      System.out.print("Mutated Genoma: " + mutatedX.genome[0]);
      for (int i = 0; i < mutatedX.genomeLength(); i++) System.out.print("," + mutatedX.genome[i]);
      System.out.println();

      p.evaluate(state, mutatedX, 0, 0, objectClus);
      ((ec.Problem) p).finishEvaluating(state, 0);

      double newF = mutatedX.fitness.fitness();
      // adequar para minimizar o fitness
      float delta = (float) (x.fitness.fitness() - newF);

      if (delta < 0 || rand.nextDouble() < Math.exp(-(delta) / temp_atual)) {
        ((IntegerVectorIndividual) x).setGenome(mutatedX.getGenome());
        x.evaluated = false;
        ((ec.Problem) p).prepareToEvaluate(state, 0);
        p.evaluate(state, x, 0, 0, objectClus);
        ((ec.Problem) p).finishEvaluating(state, 0);
      }

      iter += 1;
      temp_atual = temp_atual * alpha;
    }
    return x;
  }
  private void read_problem() throws IOException {
    BufferedReader fp = new BufferedReader(new FileReader(input_file_name));
    Vector<Double> vy = new Vector<Double>();
    Vector<svm_node[]> vx = new Vector<svm_node[]>();
    int max_index = 0;

    while (true) {
      String line = fp.readLine();
      if (line == null) break;

      StringTokenizer st = new StringTokenizer(line, " \t\n\r\f:");

      vy.addElement(atof(st.nextToken()));
      int m = st.countTokens() / 2;
      svm_node[] x = new svm_node[m];
      for (int j = 0; j < m; j++) {
        x[j] = new svm_node();
        x[j].index = atoi(st.nextToken());
        x[j].value = atof(st.nextToken());
      }
      if (m > 0) max_index = Math.max(max_index, x[m - 1].index);
      vx.addElement(x);
    }

    prob = new svm_problem();
    prob.l = vy.size();
    prob.x = new svm_node[prob.l][];
    for (int i = 0; i < prob.l; i++) prob.x[i] = vx.elementAt(i);
    prob.y = new double[prob.l];
    for (int i = 0; i < prob.l; i++) prob.y[i] = vy.elementAt(i);

    if (param.gamma == 0 && max_index > 0) param.gamma = 1.0 / max_index;

    fp.close();
  }
  public void eval(
      final EvolutionState state,
      final int thread,
      final GPData input,
      final ADFStack stack,
      final GPIndividual individual,
      final Problem problem) {
    RegressionData rd = ((RegressionData) (input));

    children[0].eval(state, thread, input, stack, individual, problem);
    rd.x = Math.tan(rd.x);
  }