code: public double getValue(Configuration configuration) {
          int pos = 0;
          int neg = -1;
          int capacity = this.problem.getCapacity();
          int weight = 0;
          KnapsackItem item;
          for (int i = 0; i < this.problem.getDimension(); i++) {
              item = this.problem.getKnapsackItems().get(i);
              if (configuration.valueAt(item.getIndex()) == 1) {
                  pos += item.getPrice();
                  weight += item.getWeight();
              } else neg -= item.getPrice();
          }
          if (weight > capacity) return neg;
          return pos;
      }
docs: Default fitness for knapsack algorithm.
  <p/>
  Returns positive number if weight if lower or equal to knapsack capacity. Returned number is price of
  knapsackItems in knapsack.
  <p/>
  Returns negative number for overfilled knapsacks. Returned number is negative price of knapsackItems not in
  knapsack -1. (eg. if all knapsackItems are in knapsack , -1 is returned).
  
  @param configuration attributes to compute fitness
  @return fitness of attributes