Java Code Examples for kodkod.util.ints.Ints#EMPTY_SET
The following examples show how to use
kodkod.util.ints.Ints#EMPTY_SET .
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: LazyTrace.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} * * @see kodkod.engine.satlab.ResolutionTrace#implicants(kodkod.util.ints.IntSet) */ @Override public IntSet reachable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); for (int i = indices.max(); i >= axioms; i--) { if (ret.contains(i)) { int[] resolvent = trace[i]; if (resolved(i)) { for (int j = 1, antes = resolvent[0]; j <= antes; j++) { ret.add(resolvent[j]); } } else { for (int j = 0; j < resolvent.length; j++) { ret.add(resolvent[j]); } } } } return ret; } else throw new IndexOutOfBoundsException("invalid indices: " + indices); }
Example 2
Source File: StrategyUtils.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Returns the set of all variables in the core of the given trace that form * unit clauses. * * @return { v: [1..) | some c: trace.core | c.size() = 1 and c.maxVariable() = * v } */ public static IntSet coreUnits(ResolutionTrace trace) { final IntSet units = new IntTreeSet(); for (Iterator<Clause> itr = trace.reverseIterator(trace.core()); itr.hasNext();) { Clause c = itr.next(); if (c.size() == 1) { units.add(c.maxVariable()); } } if (units.isEmpty()) return Ints.EMPTY_SET; return Ints.asSet(units.toArray()); }
Example 3
Source File: LazyTrace.java From kodkod with MIT License | 6 votes |
/** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#implicants(kodkod.util.ints.IntSet) */ public IntSet reachable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); for(int i = indices.max(); i >= axioms; i--) { if (ret.contains(i)) { int[] resolvent = trace[i]; if (resolved(i)) { for(int j = 1, antes = resolvent[0]; j <= antes; j++) { ret.add(resolvent[j]); } } else { for(int j = 0; j < resolvent.length; j++) { ret.add(resolvent[j]); } } } } return ret; } else throw new IndexOutOfBoundsException("invalid indices: " + indices); }
Example 4
Source File: ECFPStrategy.java From kodkod with MIT License | 5 votes |
/** * {@inheritDoc} * @see kodkod.engine.satlab.ReductionStrategy#next(kodkod.engine.satlab.ResolutionTrace) */ public IntSet next(final ResolutionTrace trace) { final IntSet core = trace.core(); if (lastCore > core.size()) { lastCore = core.size(); return core; } else { lastCore = Integer.MIN_VALUE; return Ints.EMPTY_SET; } }
Example 5
Source File: LazyTrace.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * @see kodkod.engine.satlab.ResolutionTrace#resolvents() */ @Override public IntSet resolvents() { if (trace.length > axioms) return Ints.rangeSet(Ints.range(axioms, trace.length - 1)); else return Ints.EMPTY_SET; }
Example 6
Source File: StrategyUtils.java From kodkod with MIT License | 5 votes |
/** * Returns the set of all variables in the core of the given trace * that form unit clauses. * @return { v: [1..) | some c: trace.core | c.size() = 1 and c.maxVariable() = v } */ public static IntSet coreUnits(ResolutionTrace trace) { final IntSet units = new IntTreeSet(); for(Iterator<Clause> itr = trace.reverseIterator(trace.core()); itr.hasNext(); ) { Clause c = itr.next(); if (c.size()==1) { units.add(c.maxVariable()); } } if (units.isEmpty()) return Ints.EMPTY_SET; return Ints.asSet(units.toArray()); }
Example 7
Source File: LazyTrace.java From kodkod with MIT License | 5 votes |
/** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#directlyLearnable(kodkod.util.ints.IntSet) */ public IntSet directlyLearnable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); TOP: for(int i = axioms, length = trace.length; i < length; i++) { int[] resolvent = trace[i]; if (resolved(i)) { for(int j = 1, antes = resolvent[0]; j <= antes; j++) { if (!indices.contains(resolvent[j])) { continue TOP; } } } else { for(int j = 0; j < resolvent.length; j++) { if (!indices.contains(resolvent[j])) { continue TOP; } } } ret.add(i); } return ret; } else throw new IndexOutOfBoundsException("invalid indices: " + indices); }
Example 8
Source File: LazyTrace.java From kodkod with MIT License | 5 votes |
/** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#learnable(kodkod.util.ints.IntSet) */ public IntSet learnable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); TOP: for(int i = axioms, length = trace.length; i < length; i++) { int[] resolvent = trace[i]; if (resolved(i)) { for(int j = 1, antes = resolvent[0]; j <= antes; j++) { if (!ret.contains(resolvent[j])) { continue TOP; } } } else { for(int j = 0; j < resolvent.length; j++) { if (!ret.contains(resolvent[j])) { continue TOP; } } } ret.add(i); } return ret; } else throw new IndexOutOfBoundsException("invalid indices: " + indices); }
Example 9
Source File: LazyTrace.java From kodkod with MIT License | 5 votes |
/** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#backwardReachable(kodkod.util.ints.IntSet) */ public IntSet backwardReachable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); for(int i = axioms, length = trace.length; i < length; i++) { int[] resolvent = trace[i]; if (resolved(i)) { for(int j = 1, antes = resolvent[0]; j <= antes; j++) { if (ret.contains(resolvent[j])) { ret.add(i); break; } } } else { for(int j = 0; j < resolvent.length; j++) { if (ret.contains(resolvent[j])) { ret.add(i); break; } } } } return ret; } else throw new IndexOutOfBoundsException("invalid indices: " + indices); }
Example 10
Source File: LazyTrace.java From kodkod with MIT License | 5 votes |
/** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#resolvents() */ public IntSet resolvents() { if (trace.length > axioms) return Ints.rangeSet(Ints.range(axioms, trace.length-1)); else return Ints.EMPTY_SET; }
Example 11
Source File: ECFPStrategy.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * @see kodkod.engine.satlab.ReductionStrategy#next(kodkod.engine.satlab.ResolutionTrace) */ @Override public IntSet next(final ResolutionTrace trace) { final IntSet core = trace.core(); if (lastCore > core.size()) { lastCore = core.size(); return core; } else { lastCore = Integer.MIN_VALUE; return Ints.EMPTY_SET; } }
Example 12
Source File: LazyTrace.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * @see kodkod.engine.satlab.ResolutionTrace#directlyLearnable(kodkod.util.ints.IntSet) */ @Override public IntSet directlyLearnable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); TOP: for (int i = axioms, length = trace.length; i < length; i++) { int[] resolvent = trace[i]; if (resolved(i)) { for (int j = 1, antes = resolvent[0]; j <= antes; j++) { if (!indices.contains(resolvent[j])) { continue TOP; } } } else { for (int j = 0; j < resolvent.length; j++) { if (!indices.contains(resolvent[j])) { continue TOP; } } } ret.add(i); } return ret; } else throw new IndexOutOfBoundsException("invalid indices: " + indices); }
Example 13
Source File: LazyTrace.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * @see kodkod.engine.satlab.ResolutionTrace#learnable(kodkod.util.ints.IntSet) */ @Override public IntSet learnable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); TOP: for (int i = axioms, length = trace.length; i < length; i++) { int[] resolvent = trace[i]; if (resolved(i)) { for (int j = 1, antes = resolvent[0]; j <= antes; j++) { if (!ret.contains(resolvent[j])) { continue TOP; } } } else { for (int j = 0; j < resolvent.length; j++) { if (!ret.contains(resolvent[j])) { continue TOP; } } } ret.add(i); } return ret; } else throw new IndexOutOfBoundsException("invalid indices: " + indices); }
Example 14
Source File: LazyTrace.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * * @see kodkod.engine.satlab.ResolutionTrace#backwardReachable(kodkod.util.ints.IntSet) */ @Override public IntSet backwardReachable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); for (int i = axioms, length = trace.length; i < length; i++) { int[] resolvent = trace[i]; if (resolved(i)) { for (int j = 1, antes = resolvent[0]; j <= antes; j++) { if (ret.contains(resolvent[j])) { ret.add(i); break; } } } else { for (int j = 0; j < resolvent.length; j++) { if (ret.contains(resolvent[j])) { ret.add(i); break; } } } } return ret; } else throw new IndexOutOfBoundsException("invalid indices: " + indices); }
Example 15
Source File: Translation.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} * * @see kodkod.engine.fol2sat.Translation#primaryVariables(kodkod.ast.Relation) */ @Override public IntSet primaryVariables(Relation relation) { final IntSet vars = primaryVarUsage.get(relation); return vars == null ? Ints.EMPTY_SET : vars; }
Example 16
Source File: Translation.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.engine.fol2sat.Translation#primaryVariables(kodkod.ast.Relation) */ @Override public IntSet primaryVariables(Relation relation) { final IntSet vars = primaryVarUsage.get(relation); return vars==null ? Ints.EMPTY_SET : vars; }
Example 17
Source File: LeafInterpreter.java From org.alloytools.alloy with Apache License 2.0 | 2 votes |
/** * Returns a set view of the variables assigned to the given relation, or empty * set if no variables were assigned to the given relation. * * @return this.vars[r] */ public final IntSet vars(Relation r) { final IntRange v = vars.get(r); return v == null ? Ints.EMPTY_SET : Ints.rangeSet(v); }
Example 18
Source File: LeafInterpreter.java From kodkod with MIT License | 2 votes |
/** * Returns a set view of the variables assigned to the given relation, or empty set * if no variables were assigned to the given relation. * @return this.vars[r] */ public final IntSet vars(Relation r) { final IntRange v = vars.get(r); return v==null ? Ints.EMPTY_SET : Ints.rangeSet(v); }