Implementation of the FindBestSplit algorithm from E.Ikonomovska et al.
490231
protected AttributeSplitSuggestion searchForBestSplitOption(Node currentNode, AttributeSplitSuggestion currentBestOption, SplitCriterion criterion, int attIndex) {
        // Return null if the current node is null or we have finished looking through all the possible splits
        if (currentNode == null || countRightTotal == 0.0) {
            return currentBestOption;
        }

        if (currentNode.left != null) {
            currentBestOption = searchForBestSplitOption(currentNode.left, currentBestOption, criterion, attIndex);
        }

        sumTotalLeft += currentNode.leftStatistics.getValue(1);
        sumTotalRight -= currentNode.leftStatistics.getValue(1);
        sumSqTotalLeft += currentNode.leftStatistics.getValue(2);
        sumSqTotalRight -= currentNode.leftStatistics.getValue(2);
        countLeftTotal += currentNode.leftStatistics.getValue(0);
        countRightTotal -= currentNode.leftStatistics.getValue(0);

        double[][] postSplitDists = new double[][]{{countLeftTotal, sumTotalLeft, sumSqTotalLeft}, {countRightTotal, sumTotalRight, sumSqTotalRight}};
        double[] preSplitDist = new double[]{(countLeftTotal + countRightTotal), (sumTotalLeft + sumTotalRight), (sumSqTotalLeft + sumSqTotalRight)};
        double merit = criterion.getMeritOfSplit(preSplitDist, postSplitDists);

        if ((currentBestOption == null) || (merit > currentBestOption.merit)) {
            currentBestOption = new AttributeSplitSuggestion(
                    new NumericAttributeBinaryTest(attIndex,
                            currentNode.cut_point, true), postSplitDists, merit);

        }

        if (currentNode.right != null) {
            currentBestOption = searchForBestSplitOption(currentNode.right, currentBestOption, criterion, attIndex);
        }
        sumTotalLeft -= currentNode.leftStatistics.getValue(1);
        sumTotalRight += currentNode.leftStatistics.getValue(1);
        sumSqTotalLeft -= currentNode.leftStatistics.getValue(2);
        sumSqTotalRight += currentNode.leftStatistics.getValue(2);
        countLeftTotal -= currentNode.leftStatistics.getValue(0);
        countRightTotal += currentNode.leftStatistics.getValue(0);

        return currentBestOption;
    }
250901
private double[] calculateMaximumSlope( BitMatrix analizedMatrix, RandomIter pitRandomIter, WritableRandomIter tcaRandomIter,
            int col, int row ) {
        double[] maxSlopeData = new double[10];
        int n = 1, m = 1;

        double dirmax = 0f, e1min = -9999f, e2min = -9999f;

        analizedMatrix.mark(col, row);
        tcaRandomIter.setSample(col, row, 0, 1);
        double pendmax = 0f;
        maxSlopeData[3] = pitRandomIter.getSampleDouble(col, row, 0);
        /*
         * per ogni triangolo calcolo la pendenza massima e la direzione di
         * deflusso reale.
         */
        for( int j = 0; j <= 7; j++ ) {
            n = tri[j][0];
            m = tri[j][1];

            maxSlopeData[4] = pitRandomIter.getSampleDouble(col + order[n][1], row + order[n][0], 0);
            maxSlopeData[5] = pitRandomIter.getSampleDouble(col + order[m][1], row + order[m][0], 0);
            /*
             * verifico che i punti attorno al pixel considerato non siano
             * novalue. In questo caso trascuro il triangolo.
             */
            if (!isNovalue(maxSlopeData[4]) && !isNovalue(maxSlopeData[5])) {
                calculateMaxSlopeAndDirection4Triangles(maxSlopeData);
                if (maxSlopeData[1] > pendmax) {
                    dirmax = maxSlopeData[2];
                    pendmax = maxSlopeData[1];
                    /* - direzione cardinale */
                    maxSlopeData[7] = tri[j][0];
                    /* - direzione diagonale */
                    maxSlopeData[8] = tri[j][1];
                    /* - segno del triangolo */
                    maxSlopeData[9] = tri[j][2];
                    /*
                     * - quote del triangolo avente pendenza
                     * maggiore
                     */
                    e1min = maxSlopeData[4];
                    /*
                     * non necessariamente sono le quote
                     * minime.
                     */
                    e2min = maxSlopeData[5];
                }
            }
        }
        maxSlopeData[1] = pendmax;
        maxSlopeData[2] = dirmax;
        maxSlopeData[4] = e1min;
        maxSlopeData[5] = e2min;

        return maxSlopeData;
    }
505876
function(seg, n, d)
{
    var a = vdot(n, seg.ta) - seg.r;
    var b = vdot(n, seg.tb) - seg.r;
    return min(a, b) - d;
}
1291735
private static List<Segmentation> getSegmentations(String str, int begin, int end, int nbMaxComponents, int minComponentSize, List<CuttingPoint> cuttingPoints) {
		List<Segmentation> s = new ArrayList<Segmentation>(nbMaxComponents);
		for(CuttingPoint cp:getPossibleCuttingPoints(str, begin, end, nbMaxComponents, minComponentSize)) {
			s.add(new Segmentation(str, addToDuplicate(cuttingPoints, cp, nbMaxComponents - 1)));
			if(nbMaxComponents > 2) {
				if(cp.isHypen())
					// recursivity on the left part only if the cp was an hypen
					if((cp.getIndex() - begin) >= 2*minComponentSize)
						s.addAll(getSegmentations(str, begin, cp.getIndex(), nbMaxComponents -1, minComponentSize, addToDuplicate(cuttingPoints, cp, nbMaxComponents - 1)));
				
				if((end - (cp.getIndex() + cp.getOffset())) >= 2*minComponentSize)
					s.addAll(getSegmentations(str, cp.getIndex() + cp.getOffset(), end, nbMaxComponents -1, minComponentSize, addToDuplicate(cuttingPoints, cp, nbMaxComponents - 1)));
			}
		}
		return s;
	}
465968
private static final int bestPivot(int rank, int m1, int m2, int m3, int m4, int m5) {
    if(rank < m1) {
      return m1;
    }
    if(rank > m5) {
      return m5;
    }
    if(rank < m2) {
      return m2;
    }
    if(rank > m4) {
      return m4;
    }
    return m3;
  }
538304
def hclust_ordering(X, metric="sqeuclidean"):
    
    
    # compute a hierarchical clustering
    D = sp.spatial.distance.pdist(X, metric)
    cluster_matrix = sp.cluster.hierarchy.complete(D)
    
    # merge clusters, rotating them to make the end points match as best we can
    sets = [[i] for i in range(X.shape[0])]
    for i in range(cluster_matrix.shape[0]):
        s1 = sets[int(cluster_matrix[i,0])]
        s2 = sets[int(cluster_matrix[i,1])]
        
        # compute distances between the end points of the lists
        d_s1_s2 = pdist(np.vstack([X[s1[-1],:], X[s2[0],:]]), metric)[0]
        d_s2_s1 = pdist(np.vstack([X[s1[0],:], X[s2[-1],:]]), metric)[0]
        d_s1r_s2 = pdist(np.vstack([X[s1[0],:], X[s2[0],:]]), metric)[0]
        d_s1_s2r = pdist(np.vstack([X[s1[-1],:], X[s2[-1],:]]), metric)[0]

        # concatenete the lists in the way the minimizes the difference between
        # the samples at the junction
        best = min(d_s1_s2, d_s2_s1, d_s1r_s2, d_s1_s2r)
        if best == d_s1_s2:
            sets.append(s1 + s2)
        elif best == d_s2_s1:
            sets.append(s2 + s1)
        elif best == d_s1r_s2:
            sets.append(list(reversed(s1)) + s2)
        else:
            sets.append(s1 + list(reversed(s2)))
    
    return sets[-1]
1357666
protected void attemptToSplit(LeafNode node, Node parent, int parentIndex) {
		// Initialize the split criterion 
		SplitCriterion splitCriterion = (SplitCriterion) getPreparedClassOption(splitCriterionOption);

		// Using this criterion, find the best split per attribute and rank the results
		AttributeSplitSuggestion[] bestSplitSuggestions = node.getBestSplitSuggestions(splitCriterion);
		List<AttributeSplitSuggestion> acceptedSplits = new LinkedList<AttributeSplitSuggestion>();
		Arrays.sort(bestSplitSuggestions);

		// Declare a variable to determine the number of splits to be performed
		int numSplits = 0;

		// If only one split was returned, use it (this generally shouldn't happen)
		if (bestSplitSuggestions.length == 1) {
			numSplits = 1;
			acceptedSplits.add(bestSplitSuggestions[0]);
		} else if (bestSplitSuggestions.length > 1) { // Otherwise, consider which of the splits proposed may be worth trying

			// Determine the Hoeffding bound value, used to select how many instances should be used to make a test decision
			// to feel reasonably confident that the test chosen by this sample is the same as what would be chosen using infinite examples
			double hoeffdingBound = computeHoeffdingBound(1, splitConfidenceOption.getValue(), node.examplesSeen);

			// Determine the top two ranked splitting suggestions
			AttributeSplitSuggestion bestSuggestion = bestSplitSuggestions[bestSplitSuggestions.length - 1];
			AttributeSplitSuggestion secondBestSuggestion = bestSplitSuggestions[bestSplitSuggestions.length - 2];

			// If the upper bound of the sample mean for the ratio of SDR(best suggestion) to SDR(second best suggestion),
			// as determined using the Hoeffding bound, is less than 1, then the true mean is also less than 1, and thus at this
			// particular moment of observation the bestSuggestion is indeed the best split option with confidence 1-delta, and
			// splitting should occur.
			// Alternatively, if two or more splits are very similar or identical in terms of their splits, then a threshold limit
			// (default 0.05) is applied to the Hoeffding bound; if the Hoeffding bound is smaller than this limit then the two
			// competing attributes are equally good, and the split will be made on the one with the higher SDR value.
			if (secondBestSuggestion.merit / bestSuggestion.merit < 1 - hoeffdingBound) {
				numSplits = 1;
				acceptedSplits.add(bestSuggestion);
			} else if (numTrees < maxTreesOption.getValue() && node.getLevel() <= maxOptionLevelOption.getValue()) {
				for (AttributeSplitSuggestion suggestion : bestSplitSuggestions) {
					if (suggestion.merit / bestSuggestion.merit >= 1 - hoeffdingBound) {
						numSplits++;
						acceptedSplits.add(suggestion);
					}
				}
			} else if (hoeffdingBound < tieThresholdOption.getValue()) {
				numSplits = 1;
				acceptedSplits.add(bestSplitSuggestions[0]);
			} else { // If the splitting criterion was not met, initiate pruning of the E-BST structures in each attribute observer
				for (int i = 0; i < node.attributeObservers.size(); i++) {
					AttributeClassObserver obs = node.attributeObservers.get(i);
					if (obs != null) {
						((FIMTDDNumericAttributeClassObserver) obs).removeBadSplits(splitCriterion, secondBestSuggestion.merit / bestSuggestion.merit, bestSuggestion.merit, hoeffdingBound);    
					}
				}
			}
		}

		// If the splitting criterion was met, split the current node using the chosen attribute test, and
		// make two new branches leading to (empty) leaves
		if (numSplits > 0) {
			double optionFactor = numSplits * Math.pow(optionDecayFactorOption.getValue(), (double) node.getLevel());

			if (numSplits == 1 || optionFactor < 2.0 || maxTreesOption.getValue() - numTrees <= 1) {
				AttributeSplitSuggestion splitDecision = acceptedSplits.get(0);
				SplitNode newSplit = newSplitNode(splitDecision.splitTest);
				for (int i = 0; i < splitDecision.numSplits(); i++) {
					LeafNode newChild = newLeafNode();
					newChild.setParent(newSplit);
					newSplit.setChild(i, newChild);
				}
				leafNodeCount--;
				innerNodeCount++;
				leafNodeCount += splitDecision.numSplits();
				if (parent == null) {
					treeRoot = newSplit;
				} else {
					parent.setChild(parent.getChildIndex(node), newSplit);
					newSplit.setParent(parent);
				}
			} else {
				OptionNode optionNode = newOptionNode();
				leafNodeCount--;
				int j = 0;

				for (AttributeSplitSuggestion splitDecision : acceptedSplits) {
					if (j > optionFactor || maxTreesOption.getValue() - numTrees <= 0) {
						break;
					}
					SplitNode newSplit = newSplitNode(splitDecision.splitTest);
					for (int i = 0; i < splitDecision.numSplits(); i++) {
						LeafNode newChild = newLeafNode();
						newChild.setParent(newSplit);
						newSplit.setChild(i, newChild);
					}

					leafNodeCount += splitDecision.numSplits();
					innerNodeCount++;
					numTrees++;

					newSplit.setParent(optionNode);
					optionNode.setChild(j, newSplit);
					j++;
				}

				innerNodeCount++;
				optionNodeCount++;

				if (parent == null) {
					treeRoot = optionNode;
				} else {
					parent.setChild(parent.getChildIndex(node), optionNode);
					optionNode.setParent(parent);
				}

				optionNode.resetFF();
			}
		}
	}
393564
function hierarchicalClustering(options) {
  var cy = this.cy();
  var nodes = this.nodes(); // Set parameters of algorithm: linkage type, distance metric, etc.

  var opts = setOptions$2(options);
  var attrs = opts.attributes;

  var getDist = function getDist(n1, n2) {
    return clusteringDistance(opts.distance, attrs.length, function (i) {
      return attrs[i](n1);
    }, function (i) {
      return attrs[i](n2);
    });
  }; // Begin hierarchical algorithm


  var clusters = [];
  var dists = []; // distances between each pair of clusters

  var mins = []; // closest cluster for each cluster

  var index = []; // hash of all clusters by key
  // In agglomerative (bottom-up) clustering, each node starts as its own cluster

  for (var n = 0; n < nodes.length; n++) {
    var cluster = {
      value: opts.mode === 'dendrogram' ? nodes[n] : [nodes[n]],
      key: n,
      index: n
    };
    clusters[n] = cluster;
    index[n] = cluster;
    dists[n] = [];
    mins[n] = 0;
  } // Calculate the distance between each pair of clusters


  for (var i = 0; i < clusters.length; i++) {
    for (var j = 0; j <= i; j++) {
      var dist = void 0;

      if (opts.mode === 'dendrogram') {
        // modes store cluster values differently
        dist = i === j ? Infinity : getDist(clusters[i].value, clusters[j].value);
      } else {
        dist = i === j ? Infinity : getDist(clusters[i].value[0], clusters[j].value[0]);
      }

      dists[i][j] = dist;
      dists[j][i] = dist;

      if (dist < dists[i][mins[i]]) {
        mins[i] = j; // Cache mins: closest cluster to cluster i is cluster j
      }
    }
  } // Find the closest pair of clusters and merge them into a single cluster.
  // Update distances between new cluster and each of the old clusters, and loop until threshold reached.


  var merged = mergeClosest(clusters, index, dists, mins, opts);

  while (merged) {
    merged = mergeClosest(clusters, index, dists, mins, opts);
  }

  var retClusters; // Dendrogram mode builds the hierarchy and adds intermediary nodes + edges
  // in addition to returning the clusters.

  if (opts.mode === 'dendrogram') {
    retClusters = buildClustersFromTree(clusters[0], opts.dendrogramDepth, cy);
    if (opts.addDendrogram) buildDendrogram(clusters[0], cy);
  } else {
    // Regular mode simply returns the clusters
    retClusters = new Array(clusters.length);
    clusters.forEach(function (cluster, i) {
      // Clean up meta data used for clustering
      cluster.key = cluster.index = null;
      retClusters[i] = cy.collection(cluster.value);
    });
  }

  return retClusters;
}
1128142
public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException {
    setFormat(job);
    job.setLong("mapred.min.split.size", Long.MAX_VALUE);
    return root.getSplits(job, numSplits);
  }
847939
private int reduceNondominatedSet(double[][] front, int noPoints, int objective,
                                    double threshold) {
    int n;
    int i;

    n = noPoints;
    for (i = 0; i < n; i++) {
      if (front[i][objective] <= threshold) {
        n--;
        swap(front, i, n);
      }
    }

    return n;
  }
157020
private int addIndexedSplits(
			List<InputSplit> splits, int i, List<InputSplit> newSplits,
			Configuration cfg)
		throws IOException
	{
		final Path file = ((FileSplit)splits.get(i)).getPath();

		final BGZFBlockIndex idx = new BGZFBlockIndex(
			file.getFileSystem(cfg).open(getIdxPath(file)));

		int splitsEnd = splits.size();
		for (int j = i; j < splitsEnd; ++j)
			if (!file.equals(((FileSplit)splits.get(j)).getPath()))
				splitsEnd = j;

		for (int j = i; j < splitsEnd; ++j) {
			final FileSplit fileSplit = (FileSplit)splits.get(j);

			final long start =         fileSplit.getStart();
			final long end   = start + fileSplit.getLength();

			final Long blockStart = idx.prevBlock(start);
			final Long blockEnd   = j == splitsEnd-1 ? idx.prevBlock(end)
			                                         : idx.nextBlock(end);

			if (blockStart == null)
				throw new RuntimeException(
					"Internal error or invalid index: no block start for " +start);

			if (blockEnd == null)
				throw new RuntimeException(
					"Internal error or invalid index: no block end for " +end);

			newSplits.add(new FileSplit(
				file, blockStart, blockEnd - blockStart,
				fileSplit.getLocations()));
		}
		return splitsEnd;
	}
869954
function getBestBinFit( start, len, blocks ) {
	var b, s, e, end = start + len, found = false,
		c, last_c = 0, last_s = 0, last_i = -1, last_bin = null;

	// Find the biggest chunk that can fit on these data
	for (var bi=0, bl=blocks.length; bi<bl; ++bi) {
		b = blocks[bi]; found = false;
		for (var i=0, il=b.length; i<il; ++i) {
			s = b[i][0]; e = s + b[i][1];

			// Find the common region of block-scan frame
			if ( ((s >= start) && (s < end-1)) ||	// Start in bounds
				 ((e >= start) && (e < end-1)) ||	// End in bounds
				 ((s <= start) && (e >= end)) )		// 
			{

				// Check bounds
				if (s < start) s = start;
				if (s > end-2) continue;
				if (e > end) e = end;
				if (s === e) continue;

				// Test coverage
				c = e - s;
				if (c > last_c) {
					last_c = c;
					last_s = s;
					last_bin = b[i];
					found = true;
				}

			}

		}

		// Prefer priority to length across different blocks
		// on the first block (repeated)
		if ((bi === 0) && found)
			return last_bin;

	}

	// Update bounds
	if (last_bin) {
		last_bin = last_bin.slice();
		last_bin[0] = last_s;
		last_bin[1] = last_c;
	}

	// Return last bin
	return last_bin;
}
1043614
protected void zSort(List<? extends SpatialComparable> objs, int start, int end, double[] mms, int[] dims, int depth) {
    final int numdim = (dims != null) ? dims.length : (mms.length >> 1);
    final int edim = (dims != null) ? dims[depth] : depth;
    // Find the splitting points.
    final double min = mms[2 * edim], max = mms[2 * edim + 1];
    double spos = (min + max) / 2.;
    // Safeguard against duplicate points:
    if(max - spos < STOPVAL || spos - min < STOPVAL) {
      boolean ok = false;
      for(int d = 0; d < numdim; d++) {
        int d2 = ((dims != null) ? dims[d] : d) << 1;
        if(mms[d2 + 1] - mms[d2] >= STOPVAL) {
          ok = true;
          break;
        }
      }
      if(!ok) {
        return;
      }
    }
    int split = pivotizeList1D(objs, start, end, edim, spos, false);
    assert (start <= split && split <= end);
    int nextdim = (depth + 1) % numdim;
    if(start < split - 1) {
      mms[2 * edim] = min;
      mms[2 * edim + 1] = spos;
      zSort(objs, start, split, mms, dims, nextdim);
    }
    if(split < end - 1) {
      mms[2 * edim] = spos;
      mms[2 * edim + 1] = max;
      zSort(objs, split, end, mms, dims, nextdim);
    }
    // Restore ranges
    mms[2 * edim] = min;
    mms[2 * edim + 1] = max;
  }
1311672
private void findBestWithFirst(DatanodeDescriptor first,
      List<DatanodeDescriptor> listOfNodes, DatanodeDescriptor[] result) {
    for (int in2 = 0; in2 < listOfNodes.size(); in2++) {
      DatanodeDescriptor n2 = listOfNodes.get(in2);
      if (!first.equals(n2)) {
        if (result[1] == null && inWindow(first, n2)) {
          result[0] = first;
          result[1] = n2;
        }

        for (int in3 = in2 + 1; in3 < listOfNodes.size(); in3++) {
          DatanodeDescriptor n3 = listOfNodes.get(in3);
          if (!first.equals(n3)
              && inWindow(first, n3, n2)) {
            result[0] = first;
            result[1] = n2;
            result[2] = n3;
            return;
          }
        }
      }
    }
  }
419146
private void topologicalSortVisit(V n, List<V> L, Set<V> visited, LinkedHashSet<V> sequence) throws CycleException, EX {
		//    if n has not been visited yet then
		//        mark n as visited
		if(visited.add(n)) {
			//        for each node m with an edge from n to m do
			for(Edge<V> e : (isForward ? graph.getEdgesFrom(n) : graph.getEdgesTo(n))) {
				V m = isForward ? e.getTo() : e.getFrom();
				//            visit(m)
				if(!sequence.add(m)) {
					List<V> vertices = new ArrayList<>();
					boolean found = false;
					for(V seq : sequence) {
						if(!found && seq.equals(m)) found = true;
						if(found) vertices.add(seq);
					}
					vertices.add(m);
					throw new CycleException(AoCollections.optimalUnmodifiableList(vertices));
				}
				topologicalSortVisit(m, L, visited, sequence);
				sequence.remove(m);
			}
			//        add n to L
			L.add(n);
		}
	}
255886
def getoptT(X, W, Y, Z, S, M_E, E, m0, rho):
    ''' 
    '''
    iter_max = 20
    norm2WZ = np.linalg.norm(W, ord='fro')**2 + np.linalg.norm(Z, ord='fro')**2
    f = np.zeros(iter_max + 1)
    f[0] = F_t(X, Y, S, M_E, E, m0, rho)

    t = -1e-1
    for i in range(iter_max):
        f[i + 1] = F_t(X + t * W, Y + t * Z, S, M_E, E, m0, rho)

        if f[i + 1] - f[0] <= 0.5 * t * norm2WZ:
            return t
        t /= 2
    return t
84243
@Override
   public Solution[] computeOptimizationProblem(SuitableOptions cloudOffers, QualityInformation requirements,
         Topology topology, int numPlansToGenerate) {

      // To findSolution method, we pass an Empty solution instead of a null
      // value to or create a new method that does not consider the current one.
      // This way may help for replanning, when even the first attempt for
      // solution will be based on the current deployment

      cloudOffers.sortDescendingPerformance();
      Solution[] bestSols = super.findInitialRandomSolutions(cloudOffers, numPlansToGenerate, topology);
      super.setFitnessOfSolutions(bestSols, requirements, topology, cloudOffers);
      if (logHill.isDebugEnabled()) {
         logHill.debug(
               "Start checking the presence of quality attached to solutions after the first generation HILLCLIMB");
         super.checkQualityAttachedToSolutions(bestSols);
      }
      super.sortSolutionsByFitnessAndReplaceNaN(bestSols);

      int numItersNoImprovement = 0;
      while (numItersNoImprovement < super.getMaxIterNoImprove()) { // each
                                                                    // iteration
                                                                    // finds a
                                                                    // peak

         Solution currentSol = super.findRandomSolution(cloudOffers, topology);
         currentSol.setSolutionFitness(super.fitness(currentSol, requirements, topology, cloudOffers));

         boolean neighborsImprove = true;
         int pathLengthTraversed = 0;
         while (neighborsImprove) {
            Solution[] candidates = super.findNeighbors(currentSol, cloudOffers, topology);
            if (candidates == null) {
               logHill.debug("New candidates not found");
               neighborsImprove = false;
               pathLengthTraversed = 0;
            } else {
               logHill.debug(
                     "Found " + candidates.length + " neighbors of the solution: Are " + Arrays.toString(candidates));

               super.setFitnessOfSolutions(candidates, requirements, topology, cloudOffers);
               Solution bestCandidate = super.getSolutionWithMaximumFitness(candidates);
               if (bestCandidate.getSolutionFitness() > currentSol.getSolutionFitness()) {
                  currentSol = bestCandidate;
                  pathLengthTraversed++;

                  if (pathLengthTraversed > 100) {
                     logHill.debug("Something weird is happening, iteration: " + pathLengthTraversed
                           + "without finding local maxima: Fitness: " + currentSol.getSolutionFitness() + " Solution: "
                           + currentSol.toString());
                  }

               } else {// there is not any better neighbor. See if this solution
                       // can be included among the set of best solutions
                  neighborsImprove = false;
                  pathLengthTraversed = 0;
               }
            }
         }

         // We have a local maxima in currentSol, let's see if it is better than
         // the previous maxima.
         if (super.solutionShouldBeIncluded(currentSol, bestSols)) {

            logHill.debug("After " + numItersNoImprovement
                  + " iterations we have found a local maxima solution that is going to be included: "
                  + currentSol.toString());

            super.insertOrdered(bestSols, currentSol);
            numItersNoImprovement = 0;

            if (logHill.isDebugEnabled()) {
               logHill.debug(
                     "Start checking the presence of quality attached to solutions after adding a solution in HILLCLIMB");
               super.checkQualityAttachedToSolutions(bestSols);
            }

         } else {

            logHill.debug("After " + numItersNoImprovement
                  + " iterations we have found a local maxima, but it will not be included: " + currentSol.toString());

            numItersNoImprovement++;
         }

      }

      if (logHill.isDebugEnabled()) {
         logHill.debug(
               "Start checking the presence of quality attached to solutions after adding a solution in HILLCLIMB");
         super.checkQualityAttachedToSolutions(bestSols);
      }

      return bestSols;

   }