@@ -0,0 +1,2680 @@
+package org.uma.jmetal.problem.impl;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.function.Function;%0Aimport java.util.stream.IntStream;%0Aimport org.uma.jmetal.solution.DoubleSolution;%0Aimport org.uma.jmetal.util.solutionattribute.impl.NumberOfViolatedConstraints;%0Aimport org.uma.jmetal.util.solutionattribute.impl.OverallConstraintViolation;%0A%0Apublic class OnTheFlyDoubleProblem extends AbstractDoubleProblem %7B%0A%0A  private List%3CFunction%3CDouble%5B%5D, Double%3E%3E objectiveFunction ;%0A  private List%3CFunction%3CDouble%5B%5D, Double%3E%3E constraints ;%0A  public OverallConstraintViolation%3CDoubleSolution%3E overallConstraintViolationDegree ;%0A  public NumberOfViolatedConstraints%3CDoubleSolution%3E numberOfViolatedConstraints ;%0A%0A  public OnTheFlyDoubleProblem(int numberOfVariables, int numberOfObjectives) %7B%0A    this(numberOfVariables, numberOfObjectives, 0) ;%0A  %7D%0A%0A  public OnTheFlyDoubleProblem(int numberOfVariables, int numberOfObjectives, int numberOfConstraints) %7B%0A    setNumberOfVariables(numberOfVariables);%0A    setNumberOfObjectives(numberOfObjectives);%0A    setNumberOfConstraints(numberOfConstraints);%0A    objectiveFunction = new ArrayList%3C%3E(numberOfObjectives) ;%0A    constraints = new ArrayList%3C%3E(numberOfConstraints) ;%0A%0A    overallConstraintViolationDegree = new OverallConstraintViolation%3CDoubleSolution%3E() ;%0A    numberOfViolatedConstraints = new NumberOfViolatedConstraints%3CDoubleSolution%3E() ;%0A  %7D%0A%0A  public void addFunction(Function%3CDouble%5B%5D, Double%3E objective) %7B%0A    objectiveFunction.add(objective) ;%0A  %7D%0A%0A  public void addConstraint(Function%3CDouble%5B%5D, Double%3E constraint) %7B%0A    constraints.add(constraint) ;%0A  %7D%0A%0A  public void setLowerBounds(List%3CDouble%3E lowerBounds) %7B%0A    setLowerLimit(lowerBounds);%0A  %7D%0A%0A  public void setUpperBounds(List%3CDouble%3E upperBounds) %7B%0A    setUpperLimit(upperBounds);%0A  %7D%0A%0A  @Override%0A  public void evaluate(DoubleSolution solution) %7B%0A    Double%5B%5D vars = solution.getVariables().toArray(new Double%5BgetNumberOfVariables()%5D);%0A%0A    IntStream.range(0, getNumberOfObjectives())%0A        .forEach(i -%3E solution.setObjective(i, objectiveFunction.get(i).apply(vars)));%0A%0A    if (getNumberOfConstraints() %3E 0) %7B%0A      double overallConstraintViolation = 0.0 ;%0A      int violatedConstraints = 0 ;%0A      for (int i = 0; i %3C getNumberOfConstraints(); i++) %7B%0A        double violationDegree = constraints.get(i).apply(vars) ;%0A        if (violationDegree %3C 0) %7B%0A          overallConstraintViolation += violationDegree ;%0A          violatedConstraints ++ ;%0A        %7D%0A      %7D%0A      overallConstraintViolationDegree.setAttribute(solution, overallConstraintViolation);%0A      numberOfViolatedConstraints.setAttribute(solution, violatedConstraints);%0A    %7D%0A  %7D%0A%7D%0A

Add class OnTheFlyDoubleProblem