code: public int computeCostModel(final LNGBooleanVector currentModel, int weight) {
      assert currentModel.size() != 0;
      int currentCost = 0;
      for (int i = 0; i < nSoft(); i++) {
        boolean unsatisfied = true;
        for (int j = 0; j < softClauses.get(i).clause().size(); j++) {
          if (weight != Integer.MAX_VALUE && softClauses.get(i).weight() != weight) {
            unsatisfied = false;
            continue;
          }
          assert var(softClauses.get(i).clause().get(j)) < currentModel.size();
          if ((sign(softClauses.get(i).clause().get(j)) && !currentModel.get(var(softClauses.get(i).clause().get(j))))
                  || (!sign(softClauses.get(i).clause().get(j)) && currentModel.get(var(softClauses.get(i).clause().get(j))))) {
            unsatisfied = false;
            break;
          }
        }
        if (unsatisfied)
          currentCost += softClauses.get(i).weight();
      }
      return currentCost;
    }
docs: Computes the cost of a given model. The cost of a model is the sum of the weights of the unsatisfied soft
  clauses.  If a weight is specified, then it only considers the sum of the weights of the unsatisfied soft clauses
  with the specified weight.
  @param currentModel the model
  @param weight       the weight
  @return the cost of the given model