code: public void addSoftFormula(final Formula formula, int weight) {
      if (this.result != UNDEF)
        throw new IllegalStateException("The MaxSAT solver does currently not support an incremental interface.  Reset the solver.");
      if (weight < 1)
        throw new IllegalArgumentException("The weight of a formula must be > 0");
      this.addCNF(formula.cnf(), weight);
    }
docs: Adds a new soft formula to the solver.
  @param formula the formula
  @param weight  the weight
  @throws IllegalStateException    if a formula is added to a solver which is already solved.
  @throws IllegalArgumentException if the weight is &lt;1