public static void readFormula(String fileLocation) {
		//open up the file
		Scanner reader = null;
		try {
			reader = new Scanner(new File(fileLocation));
		} catch (FileNotFoundException e) {
			System.out.println("File not found: '" + fileLocation + "'");
			System.exit(1);
		}

		assert reader != null;

		//read in the comments and problem lines
		//once we have read in the problem line, go onto the clauses
		while(reader.hasNextLine()) {
			String nextLine = reader.nextLine();

			if(nextLine.substring(0, 1).equals("c")) {
				//just print out the comment lines
				System.out.println(nextLine.substring(1));
			} else if(nextLine.substring(0,1).equals("p")) {
				//read in the problem line
				//should look like this
				//"p cnf <num variables> <num clauses>"

				//set up a scanner to read the line
				Scanner problemScanner = new Scanner(nextLine);

				//advance the scanner to the ints
				while(!problemScanner.hasNextInt()) problemScanner.next();

				//read in the number of variables and set up the variables Vector
				int numVars = problemScanner.nextInt();
				variables = new Vector<Variable>(numVars+1);
				//so we don't have off by one errors, put a null in the 0th index
				for(int i = 0; i <= numVars; i++) {
					Variable nextVar = new Variable(i);
					variables.add(i, nextVar);
					if(DEBUG) {
						System.out.println("Added variable " + variables.get(i).getName());
					}
				}
				variables.set(0, null);

				//get the number of clauses, and use it to set up the clauses Vector
				int numClauses = problemScanner.nextInt();
				clauses = new Vector<Clause>(numClauses);

				if(DEBUG) System.out.println("read that we have " + numVars + " variables and " + numClauses + " clauses.");

				//done reading in the problem line, so clauses should come next
				//so break out of the while loop
				break;
			} else {
				System.out.println("Error: got unexpected line in file. '" + nextLine + "'");
				System.exit(2);
			}
		}		

		//start reading in clauses
		for(int i = 0; i < clauses.capacity(); i++) {
			Clause nextClause = new Clause();
			int nextVarNum = reader.nextInt();
			Variable nextVar;
			while(nextVarNum != 0) {
				if(DEBUG) {
					System.out.println("read variable " + nextVarNum + " in clause " + i);
				}

				nextVar = variables.get(Math.abs(nextVarNum));

				if(DEBUG) {
					System.out.println("Got variable " + nextVar.getName() + " from array");
				}


				nextClause.addVariable(nextVar, nextVarNum > 0);

				nextVarNum = reader.nextInt();
				if(DEBUG) System.out.println("\n");
			}

			clauses.add(nextClause);
		}

		//done reading in clauses - read in the variable probabilities

		//get to the next int
		while(! reader.hasNextInt()) reader.next();

		//start reading in the variable information.
		for(int i = 1; i < variables.size(); i++) {
			int variableName = reader.nextInt();
			double variableValue = reader.nextDouble();

			if(DEBUG) 
				System.out.println("Read in variable " + variableName + " with value " + variableValue);

			variables.get(variableName).setValue(variableValue);	
		}

		if(DEBUG) {
			System.out.println("");
			for(int i = 1; i < variables.size(); i++){
				Variable v = variables.get(i);
				System.out.println("Variable " + v.getName() + " is a choice variable? " + v.isChoice());
				System.out.println("Variable " + v.getName() + " is a chance variable? " + v.isChance() + "\n");
			}
		}

	}