Adds a formula which is already in CNF with a given relaxation to the solver.
@param relaxationVar the relaxation variable
@param formula       the formula in CNF
334306
private void addClauseSetWithRelaxation(final Variable relaxationVar, final Formula formula) {
        switch (formula.type()) {
            case TRUE:
                break;
            case FALSE:
            case LITERAL:
            case OR:
                this.addClauseWithRelaxation(relaxationVar, formula);
                break;
            case AND:
                for (final Formula op : formula) { this.addClauseWithRelaxation(relaxationVar, op); }
                break;
            default:
                throw new IllegalArgumentException("Input formula ist not a valid CNF: " + formula);
        }
    }
718746
def __set_formulas(self, formulas):
        
        # Tuple of tuples is required
        array = tuple(tuple(self._clean_formula(col) for col in row) for row in formulas)
        self._get_target().setFormulaArray(array)
1260323
@Override
    public IMolecularFormula add(IMolecularFormula formula) {
        for (IIsotope newIsotope : formula.isotopes()) {
            addIsotope(newIsotope, formula.getIsotopeCount(newIsotope));
        }
        if (formula.getCharge() != null) {
            if (charge != null)
                charge += formula.getCharge();
            else
                charge = formula.getCharge();
        }
        return this;
    }
942054
public void addFactor(String factorName, T factor, VariablePattern factorPattern) {
    parametricFactors.add(factor);
    factorPatterns.add(factorPattern);
    parametricFactorNames.add(factorName);
  }
57216
static void populateCellValue(final Cell cell, final ICellValue value) {
        if (cell == null) { return; }
        
        int cellType = resolveCellType(value);
        cell.setCellType(cellType);
        switch (cellType) {
            case CELL_TYPE_BLANK: { break; }
            case CELL_TYPE_BOOLEAN: { cell.setCellValue((Boolean) value.get()); break; }
            case CELL_TYPE_NUMERIC: { cell.setCellValue((Double) value.get()); break; }
            case CELL_TYPE_FORMULA: {
                try {
                    cell.setCellFormula(((String) value.get()).substring(1));
                    break;
                } catch (FormulaParseNameException e) {
                    log.error("Formula parsing error while trying to set formula field in cell " + e.getMessage());
                    cell.setCellFormula(ErrorEval.NAME_INVALID.getErrorString());
                    break;
                } catch (FormulaParseNAException e) {
                    log.error("Formula parsing error while trying to set formula field in cell " + e.getMessage());
                    cell.setCellFormula(ErrorEval.NA.getErrorString());
                    break;
                }
            }
            case CELL_TYPE_ERROR: { cell.setCellErrorValue(FormulaError.forString((String) value.get()).getCode()); break; }
            case CELL_TYPE_STRING: { cell.setCellValue((String) value.get()); break; }
            
            default: { throw new CalculationEngineException(String.format("Type of value %s is not supported: %s", value, value.getClass().getSimpleName())); }
        }
    }
437481
@Override
    public boolean setA(DMatrixRMaj A) {
        if( A.numRows < A.numCols )
            throw new IllegalArgumentException("Can't solve for wide systems.  More variables than equations.");
        if( A.numRows > maxRows || A.numCols > maxCols )
            setMaxSize(A.numRows,A.numCols);

        R.reshape(A.numCols,A.numCols);
        a.reshape(A.numRows,1);
        temp.reshape(A.numRows,1);

        _setA(A);
        if( !decomposer.decompose(A) )
            return false;

        gammas = decomposer.getGammas();
        QR = decomposer.getQR();
        decomposer.getR(R,true);
        return true;
    }
966260
@Override
    public void add(IMolecularFormulaSet formulaSet) {

        for (IMolecularFormula mf : formulaSet.molecularFormulas()) {
            addMolecularFormula(mf);
        }
    }
846083
public static Backbone computeNegative(final Formula formula) {
        return compute(formula, formula.variables(), BackboneType.ONLY_NEGATIVE);
    }
475464
public Formula encode(final Formula formula) {
    switch (this.config().algorithm) {
      case FACTORIZATION:
        if (this.factorization == null)
          this.factorization = new CNFFactorization();
        return formula.transform(this.factorization);
      case TSEITIN:
        if (this.tseitin == null || this.currentAtomBoundary != this.config().atomBoundary) {
          this.currentAtomBoundary = this.config().atomBoundary;
          this.tseitin = new TseitinTransformation(this.config().atomBoundary);
        }
        return formula.transform(this.tseitin);
      case PLAISTED_GREENBAUM:
        if (this.plaistedGreenbaum == null || this.currentAtomBoundary != this.config().atomBoundary) {
          this.currentAtomBoundary = this.config().atomBoundary;
          this.plaistedGreenbaum = new PlaistedGreenbaumTransformation(this.config().atomBoundary);
        }
        return formula.transform(this.plaistedGreenbaum);
      case BDD:
        if (this.bddCnfTransformation == null)
          this.bddCnfTransformation = new BDDCNFTransformation();
        return formula.transform(this.bddCnfTransformation);
      case ADVANCED:
        if (this.factorizationHandler == null) {
          this.factorizationHandler = new AdvancedFactorizationHandler();
          this.advancedFactorization = new CNFFactorization(this.factorizationHandler);
        }
        this.factorizationHandler.reset(this.config().distributionBoundary, this.config().createdClauseBoundary);
        return this.advancedEncoding(formula);
      default:
        throw new IllegalStateException("Unknown CNF encoding algorithm: " + this.config().algorithm);
    }
  }
586605
public void addWithRelaxation(final Variable relaxationVar, final ImmutableFormulaList formulas) {
        for (final Formula formula : formulas) { this.addWithRelaxation(relaxationVar, formula); }
    }
821511
def __set_formulas(self, formulas):
        
        array = tuple((self._clean_formula(v),) for v in formulas)
        self._get_target().setFormulaArray(array)
866203
public void addUnreplicatedFactor(String factorName, Factor factor, VariableNumMap vars) {
    plateFactors.add(new ReplicatedFactor(factor, new WrapperVariablePattern(vars)));
    plateFactorNames.add(factorName);
  }
1369372
private final void addVariableValue(String value, String variableName) {
		if (StringUtils.isNotEmpty(variableName)) {
			JMeterVariables vars = getVariables();
			if (vars != null) {
				vars.put(variableName, value);
			}
		}
	}
629457
public function calc_formula($formula, $params=false) {
        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
        self::__construct($formula, $params);
    }
138757
public void add(double value)
    {
        max = Math.max(max, value);
        min = Math.min(min, value);
        if (count == 0)
        {
            average = value;
        }
        else
        {
            average = count*average/(count+1) + value/(count+1);
            deviationSquare = count*deviationSquare/(count+1) + Math.pow(value-average, 2)/(count+1);
        }
        count++;
    }
222327
public void add(double value) {
    count++;
    min = Math.min(min, value);
    max = Math.max(max, value);
    sum += value;
    sumOfSquares += value * value;
    addQuantileValue(value);
  }
1195272
public void add(final Modulo2Equation equation) {
			int i = 0, j = 0, k = 0;
			final int s = variables.size(), t = equation.variables.size();
			final int[] a = variables.elements(), b = equation.variables.elements(), result = new int[s + t];

			if (t != 0 && s != 0) {
				for (;;) {
					if (a[i] < b[j]) {
						result[k++]  = a[i++];
						if (i == s) break;
					}
					else if (a[i] > b[j]) {
						result[k++]  = b[j++];
						if (j == t) break;
					}
					else {
						i++;
						j++;
						if (i == s) break;
						if (j == t) break;
					}
				}
			}

			while (i < s) result[k++] = a[i++];
			while (j < t) result[k++] = b[j++];

			c ^= equation.c;
			variables.size(k);
			System.arraycopy(result, 0, variables.elements(), 0, k);
		}