kodkod.instance.Bounds Java Examples
The following examples show how to use
kodkod.instance.Bounds.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SET967.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Returns bounds for the given scope. * * @return bounds for the given scope. */ public final Bounds bounds(int n) { assert n > 0; final List<String> atoms = new ArrayList<String>(n); for (int i = 0; i < n; i++) atoms.add("a" + i); final Universe u = new Universe(atoms); final Bounds b = new Bounds(u); final TupleFactory f = u.factory(); b.bound(empty, f.allOf(1)); b.bound(subset, f.allOf(2)); b.bound(in, f.allOf(2)); b.bound(disjoint, f.allOf(2)); b.bound(union, f.allOf(2)); b.bound(singleton, f.allOf(2)); b.bound(intersect2, f.allOf(3)); b.bound(cartesian2, f.allOf(3)); b.bound(union2, f.allOf(3)); b.bound(ordered, f.allOf(3)); b.bound(unordered, f.allOf(3)); return b; }
Example #2
Source File: ALG195_1.java From kodkod with MIT License | 6 votes |
/** * Usage: java examples.tptp.ALG195_1 */ public static void main(String[] args) { try { final ALG195_1 model = new ALG195_1(); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); final Formula f = model.axioms().and(model.co1().not()); final Bounds b = model.bounds(); // System.out.println(model.decls()); // System.out.println(model.ax2ax7()); // System.out.println(b); final Solution sol = solver.solve(f, b); if (sol.instance()==null) { System.out.println(sol); } else { System.out.println(sol.stats()); model.display(sol.instance()); } } catch (NumberFormatException nfe) { usage(); } }
Example #3
Source File: GEO158.java From kodkod with MIT License | 6 votes |
/** * Returns a bounds with the given number of maximum curves and points * @return a bounds with the given number of maximum curves and points */ public Bounds bounds(int scope) { assert scope > 0; List<String> atoms = new ArrayList<String>(scope); for(int i = 0; i < scope; i++) atoms.add("c"+i); for(int i = 0; i < scope; i++) atoms.add("p"+i); final Universe u = new Universe(atoms); final TupleFactory f = u.factory(); final Bounds b = new Bounds(u); final TupleSet c = f.range(f.tuple("c0"), f.tuple("c"+(scope-1))); final TupleSet p = f.range(f.tuple("p0"), f.tuple("p"+(scope-1))); final TupleSet cc = c.product(c), pc = p.product(c); b.bound(curve, c); b.bound(point, p); b.bound(partOf, cc); b.bound(incident, pc); b.bound(sum, c.product(cc)); b.bound(endPoint, pc); b.bound(innerPoint, pc); b.bound(meet, pc.product(c)); b.bound(closed, c); b.bound(open, c); return b; }
Example #4
Source File: UCoreTest.java From kodkod with MIT License | 6 votes |
private final void testTrivialProofExtractor(Class<?>[] probs, int maxScope) { for(Class<?> prob : probs) { Object instance = instance(prob); Map<Method, Formula> checks = invokeAll(instance, checks(prob)); for(Formula check : checks.values()) { for(int scope = 1; scope <= maxScope; scope++ ) { Bounds bounds = bounds(instance, scope); Solution sol = solver.solve(check, bounds); if (sol.outcome()==Solution.Outcome.TRIVIALLY_UNSATISFIABLE) { minimizeAndVerify(check, bounds, sol.proof(), null); } else { break; } } } } }
Example #5
Source File: SET967.java From kodkod with MIT License | 6 votes |
/** * Usage: java examples.tptp.SET967 [univ size] */ public static void main(String[] args) { if (args.length < 1) usage(); try { final int n = Integer.parseInt(args[0]); if (n < 1) usage(); final SET967 model = new SET967(); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); // solver.options().setSymmetryBreaking(n*n); // solver.options().setFlatten(false); final Formula f = model.checkT120_zfmisc_1(); final Bounds b = model.bounds(n); System.out.println(f); final Solution sol = solver.solve(f, b); System.out.println(sol); } catch (NumberFormatException nfe) { usage(); } }
Example #6
Source File: SET943.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Returns bounds for the given scope. * * @return bounds for the given scope. */ public final Bounds bounds(int n) { assert n > 0; final List<String> atoms = new ArrayList<String>(n); for (int i = 0; i < n; i++) atoms.add("a" + i); final Universe u = new Universe(atoms); final Bounds b = new Bounds(u); final TupleFactory f = u.factory(); b.bound(empty, f.allOf(1)); b.bound(subset, f.allOf(2)); b.bound(in, f.allOf(2)); b.bound(union, f.allOf(2)); b.bound(union2, f.allOf(3)); return b; }
Example #7
Source File: MED009.java From kodkod with MIT License | 6 votes |
/** * Usage: java examples.tptp.MED009 [univ size] */ public static void main(String[] args) { if (args.length < 1) usage(); try { final int n = Integer.parseInt(args[0]); if (n < 1) usage(); final MED009 model = new MED009(); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); // solver.options().setSymmetryBreaking(1000); // solver.options().setFlatten(false); final Formula f = model.checkTranssls2_qige27(); final Bounds b = model.bounds(n); System.out.println(f); final Solution sol = solver.solve(f, b); System.out.println(sol); } catch (NumberFormatException nfe) { usage(); } }
Example #8
Source File: MGT066.java From kodkod with MIT License | 6 votes |
/** * Usage: java examples.tptp.MGT066 [univ size] */ public static void main(String[] args) { if (args.length < 1) usage(); try { final int n = Integer.parseInt(args[0]); if (n < 1) usage(); final MGT066 model = new MGT066(); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); solver.options().setSymmetryBreaking(n*n); final Formula f = model.axioms(); final Bounds b = model.bounds(n); System.out.println(f); final Solution sol = solver.solve(f, b); System.out.println(sol); } catch (NumberFormatException nfe) { usage(); } }
Example #9
Source File: GEO158.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Returns a bounds with the given number of maximum curves and points * * @return a bounds with the given number of maximum curves and points */ public Bounds bounds(int scope) { assert scope > 0; List<String> atoms = new ArrayList<String>(scope); for (int i = 0; i < scope; i++) atoms.add("c" + i); for (int i = 0; i < scope; i++) atoms.add("p" + i); final Universe u = new Universe(atoms); final TupleFactory f = u.factory(); final Bounds b = new Bounds(u); final TupleSet c = f.range(f.tuple("c0"), f.tuple("c" + (scope - 1))); final TupleSet p = f.range(f.tuple("p0"), f.tuple("p" + (scope - 1))); final TupleSet cc = c.product(c), pc = p.product(c); b.bound(curve, c); b.bound(point, p); b.bound(partOf, cc); b.bound(incident, pc); b.bound(sum, c.product(cc)); b.bound(endPoint, pc); b.bound(innerPoint, pc); b.bound(meet, pc.product(c)); b.bound(closed, c); b.bound(open, c); return b; }
Example #10
Source File: FileLogger.java From kodkod with MIT License | 6 votes |
/** * Constructs a new file logger from the given annotated formula. * @ensures this.formula' = annotated.node * @ensures this.originalFormula' = annotated.source[annotated.node] * @ensures this.bounds' = bounds * @ensures this.log().roots() = Nodes.conjuncts(annotated) * @ensures no this.records' */ FileLogger(final AnnotatedNode<Formula> annotated, Bounds bounds) { this.annotated = annotated; try { this.file = File.createTempFile("kodkod", ".log"); this.out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); } catch (IOException e1) { throw new RuntimeException(e1); } final Map<Formula,Set<Variable>> freeVarMap = freeVars(annotated); final Variable[] empty = new Variable[0]; this.logMap = new FixedMap<Formula, Variable[]>(freeVarMap.keySet()); for(Map.Entry<Formula, Variable[]> e : logMap.entrySet()) { Set<Variable> vars = freeVarMap.get(e.getKey()); int size = vars.size(); if (size==0) { e.setValue(empty); } else { e.setValue(Containers.identitySort(vars.toArray(new Variable[size]))); } } this.bounds = bounds.unmodifiableView(); }
Example #11
Source File: ToyLists.java From kodkod with MIT License | 6 votes |
/** * Returns the bounds for the toy lists problem with the given number of lists and things. * @return bounds for the toy lists problem with the given number of lists and things. */ public Bounds bounds(int lists, int things) { final List<String> atoms = new ArrayList<String>(lists+things); for(int i = 0; i < lists; i++) { atoms.add("list"+i); } for(int i = 0; i < things; i++) { atoms.add("thing"+i); } final Universe univ = new Universe(atoms); final TupleFactory f = univ.factory(); final Bounds b = new Bounds(univ); b.bound(list, f.range(f.tuple("list0"), f.tuple("list"+(lists-1)))); b.bound(nonEmptyList, b.upperBound(list)); b.bound(emptyList, b.upperBound(list)); b.bound(thing, f.range(f.tuple("thing0"), f.tuple("thing"+(things-1)))); b.bound(car, b.upperBound(nonEmptyList).product(b.upperBound(thing))); b.bound(cdr, b.upperBound(nonEmptyList).product(b.upperBound(list))); b.bound(equivTo, b.upperBound(list).product(b.upperBound(list))); b.bound(prefixes, b.upperBound(list).product(b.upperBound(list))); return b; }
Example #12
Source File: LAT258.java From kodkod with MIT License | 6 votes |
/** * Returns the bounds for the given scope. * @return the bounds for the given scope. */ public final Bounds bounds(int n) { assert n > 0; final List<String> atoms = new ArrayList<String>(n); for(int i = 0; i < n; i++) atoms.add("n"+i); final Universe univ = new Universe(atoms); final TupleFactory f = univ.factory(); final Bounds b = new Bounds(univ); b.bound(goal, f.setOf("n0")); final TupleSet all1 = f.allOf(1); b.bound(p, all1); b.bound(t, all1); b.bound(v, all1); b.bound(w, all1); b.bound(u, all1); b.bound(x, all1); b.bound(y, all1); b.bound(z, all1); b.bound(lessThan, f.allOf(2)); final TupleSet all3 = f.allOf(3); b.bound(join, all3); b.bound(meet, all3); return b; }
Example #13
Source File: BugTests.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
public final void testFelix_11192007() { List<String> atomlist = Arrays.asList("A", "B", "C"); Universe universe = new Universe(atomlist); Bounds bounds = new Bounds(universe); Solver solver = new Solver(); solver.options().setLogTranslation(2); solver.options().setSolver(SATFactory.MiniSatProver); solver.options().setBitwidth(4); solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT); solver.options().setSymmetryBreaking(20); solver.options().setSkolemDepth(0); Solution sol = solver.solve(Formula.TRUE, bounds); assertNotNull(sol.instance()); }
Example #14
Source File: SET943.java From kodkod with MIT License | 6 votes |
/** * Returns bounds for the given scope. * @return bounds for the given scope. */ public final Bounds bounds(int n) { assert n > 0; final List<String> atoms = new ArrayList<String>(n); for(int i = 0; i < n; i++) atoms.add("a"+i); final Universe u = new Universe(atoms); final Bounds b = new Bounds(u); final TupleFactory f = u.factory(); b.bound(empty, f.allOf(1)); b.bound(subset, f.allOf(2)); b.bound(in, f.allOf(2)); b.bound(union, f.allOf(2)); b.bound(union2, f.allOf(3)); return b; }
Example #15
Source File: NUM378.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Usage: java examples.tptp.NUM378 */ public static void main(String[] args) { try { final NUM378 model = new NUM378(); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); final Formula f = model.decls().and(model.inequalities()); final Bounds b = model.bounds(); // System.out.println(f); // System.out.println(b); final Solution sol = solver.solve(f, b); System.out.println(sol.outcome()); System.out.println(sol.stats()); } catch (NumberFormatException nfe) { usage(); } }
Example #16
Source File: SocialGolfer.java From kodkod with MIT License | 6 votes |
/** * Returns the bounds for the scheduling problem with the given number of players, groups and weeks, using * the specified group size. * @return bounds for the scheduling problem with the given number of players, groups and weeks, using * the specified group size. */ public final Bounds bounds(int players, int groups, int weeks, int size) { if (players<1 || groups<1 || weeks<1 || size<1) throw new IllegalArgumentException("invalid schedule parameters"); final List<Object> atoms = new ArrayList<Object>(players+groups+weeks+1); for(int i = 0; i < players; i++) { atoms.add("p" + i); } for(int i = 0; i < groups; i++) { atoms.add("g" + i); } for(int i = 0; i < weeks; i++) { atoms.add("w" + i); } atoms.add(size); final Universe u = new Universe(atoms); final TupleFactory f = u.factory(); final Bounds b = new Bounds(u); b.boundExactly(size, f.setOf(size)); b.boundExactly(this.size, f.setOf(size)); b.boundExactly(this.player, f.range(f.tuple("p0"), f.tuple("p"+(players-1)))); b.boundExactly(this.group, f.range(f.tuple("g0"), f.tuple("g"+(groups-1)))); b.boundExactly(this.week, f.range(f.tuple("w0"), f.tuple("w"+(weeks-1)))); b.bound(this.plays, b.upperBound(week).product(b.upperBound(group)).product(b.upperBound(player))); return b; }
Example #17
Source File: Pigeonhole.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Returns the bounds for the given number of pigeons and holes. * * @return bounds */ public Bounds bounds(int pigeons, int holes) { final List<String> atoms = new ArrayList<String>(pigeons + holes); for (int i = 0; i < pigeons; i++) { atoms.add("Pigeon" + i); } for (int i = 0; i < holes; i++) { atoms.add("Hole" + i); } final Universe u = new Universe(atoms); final TupleFactory f = u.factory(); final Bounds b = new Bounds(u); final TupleSet pbound = f.range(f.tuple("Pigeon0"), f.tuple("Pigeon" + (pigeons - 1))); final TupleSet hbound = f.range(f.tuple("Hole0"), f.tuple("Hole" + (holes - 1))); b.boundExactly(Pigeon, pbound); b.boundExactly(Hole, hbound); b.bound(hole, pbound.product(hbound)); return b; }
Example #18
Source File: Handshake.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Returns a bounds for the given number of persons. * * @return a bounds for the given number of persons. */ public Bounds bounds(int persons) { final List<String> atoms = new ArrayList<String>(persons); atoms.add("Hilary"); atoms.add("Jocelyn"); for (int i = 2; i < persons; i++) { atoms.add("Person" + i); } final Universe u = new Universe(atoms); final TupleFactory f = u.factory(); final Bounds b = new Bounds(u); b.boundExactly(Person, f.allOf(1)); b.boundExactly(Hilary, f.setOf("Hilary")); b.boundExactly(Jocelyn, f.setOf("Jocelyn")); b.bound(spouse, f.allOf(2)); b.bound(shaken, f.allOf(2)); return b; }
Example #19
Source File: ALG212.java From kodkod with MIT License | 6 votes |
/** * Usage: java examples.tptp.ALG212 [univ size] */ public static void main(String[] args) { if (args.length < 1) usage(); try { final int n = Integer.parseInt(args[0]); if (n < 1) usage(); final ALG212 model = new ALG212(); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); // solver.options().setSymmetryBreaking(n*n); // solver.options().setFlatten(false); final Formula f = model.checkDistLong(); final Bounds b = model.bounds(n); System.out.println(f); final Solution sol = solver.solve(f, b); System.out.println(sol); } catch (NumberFormatException nfe) { usage(); } }
Example #20
Source File: GEO115.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Usage: ava examples.tptp.GEO115 [scope] */ public static void main(String[] args) { if (args.length < 1) usage(); try { final int n = Integer.parseInt(args[0]); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); final GEO115 model = new GEO115(); final Formula f = model.theorem385(); final Bounds b = model.bounds(n); final Solution sol = solver.solve(f, b); System.out.println(sol); } catch (NumberFormatException nfe) { usage(); } }
Example #21
Source File: GEO092.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Usage: ava examples.tptp.GEO192 [# curves] [# points] */ public static void main(String[] args) { if (args.length < 2) usage(); try { final int n = Integer.parseInt(args[0]); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); final GEO092 model = new GEO092(); final Formula f = model.checkProposition2141(); System.out.println(model.proposition2141()); final Bounds b = model.bounds(n); final Solution sol = solver.solve(f, b); System.out.println(sol); // System.out.println((new // Evaluator(sol.instance())).evaluate(model.axioms().and(model.theorem213().not()))); } catch (NumberFormatException nfe) { usage(); } }
Example #22
Source File: SET948.java From kodkod with MIT License | 6 votes |
/** * Usage: java examples.tptp.SET948 [univ size] */ public static void main(String[] args) { if (args.length < 1) usage(); try { final int n = Integer.parseInt(args[0]); if (n < 1) usage(); final SET948 model = new SET948(); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); // solver.options().setSymmetryBreaking(n*n); // solver.options().setFlatten(false); final Formula f = model.checkT101_zfmisc_1(); final Bounds b = model.bounds(n); System.out.println(f); final Solution sol = solver.solve(f, b); System.out.println(sol); } catch (NumberFormatException nfe) { usage(); } }
Example #23
Source File: HOLTranslation.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
public HOLTranslation(Bounds bounds, Options options, int depth) { super(bounds, options); this.depth = depth; rep = options.reporter() != null ? options.reporter() : new AbstractReporter() {}; // rep = new AbstractReporter() { // public void holLoopStart(HOLTranslation tr, Formula formula, Bounds // bounds) { // System.out.println("started: " + formula); // } // public void holCandidateFound(HOLTranslation tr, Instance candidate) // { // System.out.println(" candidate found"); // } // public void holVerifyingCandidate(HOLTranslation tr, Instance // candidate, Formula checkFormula, Bounds bounds) { // System.out.println(" verifying: " + checkFormula); // } // public void holCandidateVerified(HOLTranslation tr, Instance // candidate) {} // public void holCandidateNotVerified(HOLTranslation tr, Instance // candidate, Instance cex) {} // public void holFindingNextCandidate(HOLTranslation tr, Formula inc) { // System.out.println(" finding next: " + inc); // } // }; }
Example #24
Source File: SET943.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Usage: java examples.tptp.SET943 [univ size] */ public static void main(String[] args) { if (args.length < 1) usage(); try { final int n = Integer.parseInt(args[0]); if (n < 1) usage(); final SET943 model = new SET943(); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); // solver.options().setSymmetryBreaking(1000); // solver.options().setFlatten(false); final Formula f = model.checkT96_zfmisc_1(); final Bounds b = model.bounds(n); System.out.println(f); final Solution sol = solver.solve(f, b); System.out.println(sol); } catch (NumberFormatException nfe) { usage(); } }
Example #25
Source File: BugTests.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
public final void testEmina_10092006() { Relation r = Relation.ternary("r"); final Variable a = Variable.unary("A"); final Variable b = Variable.unary("B"); final Variable c = Variable.unary("C"); final Variable d = Variable.unary("D"); final Formula f0 = (b.join(a.join(r))).eq(d.join(c.join(r))); final Formula f1 = a.in(c).and(b.in(d)); final Formula f = f0.implies(f1).forAll(a.oneOf(UNIV).and(b.oneOf(UNIV)).and(c.oneOf(UNIV)).and(d.oneOf(UNIV))); final Universe u = new Universe(Arrays.asList("a0", "a1")); final Bounds bounds = new Bounds(u); bounds.bound(r, u.factory().allOf(3)); // System.out.println(f); System.out.println(bounds); solver.options().setSymmetryBreaking(0); // solver.options().setFlatten(false); final Solution s = solver.solve(f, bounds); // System.out.println(s); assertEquals(Solution.Outcome.SATISFIABLE, s.outcome()); }
Example #26
Source File: GEO091.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Usage: java examples.tptp.GEO191 [univ size] */ public static void main(String[] args) { if (args.length < 1) usage(); try { final int n = Integer.parseInt(args[0]); final Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); final GEO091 model = new GEO091(); final Formula f = model.checkTheorem_2_13(); System.out.println(model.theorem_2_13()); final Bounds b = model.bounds(n); final Solution sol = solver.solve(f, b); System.out.println(sol); // System.out.println((new // Evaluator(sol.instance())).evaluate(model.axioms().and(model.theorem213().not()))); } catch (NumberFormatException nfe) { usage(); } }
Example #27
Source File: HOLSolver.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
@Override public Iterator<Solution> solveAll(final Formula formula, final Bounds bounds) throws HigherOrderDeclException, UnboundLeafException, AbortedException { return new Iterator<Solution>() { private Solution lastSol = null; @Override public boolean hasNext() { return lastSol == null || lastSol.sat(); } @Override public Solution next() { if (!hasNext()) throw new NoSuchElementException(); lastSol = (lastSol == null) ? solve(formula, bounds) : solveNext(); return lastSol; } @Override public void remove() { throw new IllegalStateException("can't remove solution"); } }; }
Example #28
Source File: BugTests.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
public final void testFelix_05152007_1() { Relation x5 = Relation.nary("A", 1); List<String> atomlist = Arrays.asList("A0", "A1", "A2"); Universe universe = new Universe(atomlist); TupleFactory factory = universe.factory(); Bounds bounds = new Bounds(universe); TupleSet x5_upper = factory.noneOf(1); x5_upper.add(factory.tuple("A2")); x5_upper.add(factory.tuple("A1")); x5_upper.add(factory.tuple("A0")); bounds.bound(x5, x5_upper); Formula x7 = x5.some(); Formula x8 = x5.no(); Formula x6 = x7.and(x8); Solver solver = new Solver(); solver.options().setLogTranslation(1); solver.options().setSolver(SATFactory.MiniSatProver); solver.options().setBitwidth(4); solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT); Solution sol = solver.solve(x6, bounds); // System.out.println("Sol="+sol); Set<Formula> core = Nodes.minRoots(x6, sol.proof().highLevelCore().values()); assertEquals(2, core.size()); assertTrue(core.contains(x7)); assertTrue(core.contains(x8)); }
Example #29
Source File: RegressionTests.java From kodkod with MIT License | 5 votes |
@Test public final void testFelix_01062007() { Relation x1 = Relation.nary("A",1); List<String> atomlist = Arrays.asList("A"); Universe universe = new Universe(atomlist); TupleFactory factory = universe.factory(); Bounds bounds = new Bounds(universe); TupleSet x1_upper = factory.noneOf(1); x1_upper.add(factory.tuple("A")); bounds.bound(x1, x1_upper); Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); Iterator<Solution> sols = solver.solveAll(Formula.TRUE, bounds); assertNotNull(sols.next().instance()); assertNotNull(sols.next().instance()); assertNull(sols.next().instance()); // Solution sol1=sols.next(); // System.out.println("Solution1:"+sol1.instance()); // // Solution sol2=sols.next(); // System.out.println("Solution2:"+sol2.instance()); // // Solution sol3=sols.next(); // System.out.println("Solution3:"+sol3.instance()); }
Example #30
Source File: Skolemizer.java From kodkod with MIT License | 5 votes |
/** * Constructs a skolem replacer from the given arguments. */ private Skolemizer(AnnotatedNode<Formula> annotated, Bounds bounds, Options options) { super(annotated.sharedNodes()); // only cache intermediate computations for expressions with no free variables // and formulas with no free variables and no quantified descendants for(Node n: annotated.sharedNodes()) { final AbstractDetector fvdetect = annotated.freeVariableDetector(); final AbstractDetector qdetect = annotated.quantifiedFormulaDetector(); if (!(Boolean)n.accept(fvdetect)) { if (!(n instanceof Formula) || !((Boolean)n.accept(qdetect))) this.cache.put(n, null); } } this.reporter = options.reporter(); this.bounds = bounds; this.interpreter = LeafInterpreter.overapproximating(bounds, options); this.repEnv = Environment.empty(); this.nonSkolems = new ArrayList<DeclInfo>(); this.nonSkolemsView = new AbstractList<Decl>() { public Decl get(int index) { return nonSkolems.get(index).decl; } public int size() { return nonSkolems.size(); } }; this.topSkolemConstraints = new ArrayList<Formula>(); this.negated = false; this.skolemDepth = options.skolemDepth(); }