/** * A subproblem is a formula and an (partial) assignment with the same number of variables. * Useful to model a subproblem of a larger SAT problem consisting of the formula without * an assignment. The (partial) assignment specifies a subtree of the total solution space * for the larger problem. * * @author Danielle and Dr. Lobo * @version 2008.01.10 * * * Modification log: * 1. 2008/02/07 Added constructor SubProblem(SubProblem s) which copy a SubProblem * 0. Created 2008/Jan by Andrea Lobo (AL) and Danielle Socha (DS) */ public class SubProblem { Formula f; Assignment partialAssignment; public SubProblem() { } /** * Constructor for SubProblem * * @param inputF input file name containg the * information for the formula; * formatted per the International * SAT competitions format * @param pa the parial assignment */ public SubProblem(Formula inputF, Assignment pa) { f = inputF; partialAssignment = pa; } /** * Constructor for Subproblem * * @param a current SubProblem * */ public SubProblem (SubProblem s) { //f = s.getFormula(); //partialAssignment = s.getAssignment(); f = new Formula (s.getFormula()); partialAssignment = new Assignment (s.getAssignment()); } /** * Sets the formula * * @param inputF input file name containg the * information for the formula; * formatted per the International * SAT competitions format */ public void setFormula(Formula inputF) { f = inputF; } /** * Sets the partial assignment * * @param pa the partial assignment */ public void setPartialAssignment(Assignment pa) { partialAssignment = pa; } /** * Rerturns the current formula * * @return the formula */ public Formula getFormula() { return f; } /** * Rerturns the current assignment * * @return the assignment */ public Assignment getAssignment() { return partialAssignment; } /** * the values of the variables * * @return a String with the values of the variables in the subproblem */ public String toString() { return partialAssignment.toString(); } }