// ----------------------------------------------------------- public static void main(String[] args) { try { Options.verbose = true; // DEBUG for (int i = 0; i < args.length; i++) { Automata agv = AutomataIO.loadXML(args[i]); long time = System.currentTimeMillis(); BDDAutomata ba = new BDDAutomata(agv); DisjunctivePartitions part = new DisjunctivePartitions(ba); DisjunctiveSearch ds = new DisjunctiveSearch(part); int initial = BDDAutomataHelper.getI(ba); int x = ds.forward(initial); double states = BDDAutomataHelper.countStates(ba, x); part.cleanup(); ds.cleanup(); ba.cleanup(); time = System.currentTimeMillis() - time; System.out.println("Found " + states + " states in " + args[i] + " in " + time + "ms."); } } catch (Exception exx) { exx.printStackTrace(); } }
public int[] solve() { // (0,1 or -1 for dont care) int rounds = 0, num_lits = cnf.num_lits; long starttime = System.currentTimeMillis(); long endtime = starttime + maxtime; boolean[] minterm = new boolean[num_lits]; int flips = Math.min(1000, 3 * num_lits); if (stack == null) { stack = new int[num_lits]; } randomize(minterm); while (endtime > System.currentTimeMillis()) { rounds++; if (cnf.satisfies(minterm)) { JDDConsole.out.println("SAT/" + (System.currentTimeMillis() - starttime) + "ms"); return toIntVector(minterm); } if ((rounds % flips) == 0) { randomize(minterm); } else { int choice = (Math.random() < p) ? choice = random(num_lits) : findLiteral(minterm); minterm[choice] = !minterm[choice]; } } JDDConsole.out.println( "UNKNOWN(" + rounds + " rounds)/" + (System.currentTimeMillis() - starttime) + "ms"); return null; }