public Formula(StringBuffer formulaString)  {
        LinkedList<Integer> originalFormula = new LinkedList<Integer>();
        variablesAffected = new Stack<LinkedList<Integer>>();
        unitVariables = new TreeSet<Integer>();

        // Temporary string that is used for reading each line of the file
        String temp = "";

        // Current clause
        int clauseCount = 0;
        String comment = null;
        String formulaType = "";
        int varTotal;
        int clauseTotal = 0;

        // Create a  scanner to read the formula
        Scanner sc = new Scanner(formulaString.toString());

        // Go through each line
        while (sc.hasNextLine()) {
            temp = sc.nextLine();

            // Its a comment
            if (temp.startsWith("c")) {
                comment += (temp + "\n");

               // This is the line that tells us the formula information
            } else if (temp.startsWith("p")) {

                // Split it into an array of strings and then we can get the
                // Number of clauses and variables
                String[] parse;

                // Parse the string apart by all whitespaces
                parse = temp.trim().split("\\s+");
                formulaType = parse[1];

                // number of variables
                varTotal = Integer.parseInt(parse[2]);

                // initialize variableRank array
                variableRanks = new double[2 * varTotal + 1];

                // initialize currentAssignment need to loop through and make
                // default value -1
                currentAssignment = new int[varTotal + 1];

                // Initialize all variables as unassigned
                for (int i = 1; i < currentAssignment.length; i++) {
                    currentAssignment[i] = UNASSIGNED;
                }

                // number of clauses
                clauseTotal = Integer.parseInt(parse[3]);

                // Initialize the formula
                formula = new int[clauseTotal][];

            }
            // Put the value into the formula
            else {
                if (clauseCount != clauseTotal) {

                    String[] parse;
                    parse = temp.trim().split("\\s+");

                    int varInClause = parse.length - 1;

                    // each clause we have add it to the currentFormula
                    originalFormula.add(clauseCount);

                    // if the clause has only one variable add to unit clause
                    if (varInClause == 1) {
                        unitVariables.add(new Integer(parse[0]));
                    }

                    // set the number of literals for this clause
                    // in the formula array
                    formula[clauseCount] = new int[varInClause];

                    // now fill the clause with the correct values
                    for (int i = 0; i < varInClause; i++) {
                        formula[clauseCount][i] = Integer.parseInt(parse[i]);
                    }
                    clauseCount++;
                }
            }// end of if statement
        }// end of while statement

        currentFormula.push(originalFormula);
        variablesAffected.add(new LinkedList<Integer>());

        hasEmptyClause = false;

        unitVariables.clear();
    }