docs: private static double computeCost(
        int[] assignments,
        double[][] costMatrix,
        double[] sourceTermDeletionCosts,
        double[] targetTermDeletionCosts) {
  
      // We need to sum the costs of each assigned pair, each unassigned source term, and each
      // unassigned target term.
  
      // Start with the total cost of _not_ using all the target terms, then when we use one we'll
      // remove it from this total.
      double totalCost = DoubleStream.of(targetTermDeletionCosts).sum();
      for (int sourceTermIndex = 0; sourceTermIndex < assignments.length; sourceTermIndex++) {
        int targetTermIndex = assignments[sourceTermIndex];
        if (targetTermIndex == -1) {
          // not using this source term
          totalCost += sourceTermDeletionCosts[sourceTermIndex];
        } else {
          // add the cost of the assignments
          totalCost += costMatrix[sourceTermIndex][targetTermIndex];
  
          // we are using this target term and so we should remove the cost of deleting it
          totalCost -= targetTermDeletionCosts[targetTermIndex];
        }
      }
      return totalCost;
    }