本文整理汇总了Java中kodkod.engine.fol2sat.SymmetryDetector类的典型用法代码示例。如果您正苦于以下问题:Java SymmetryDetector类的具体用法?Java SymmetryDetector怎么用?Java SymmetryDetector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SymmetryDetector类属于kodkod.engine.fol2sat包,在下文中一共展示了SymmetryDetector类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: solve
import kodkod.engine.fol2sat.SymmetryDetector; //导入依赖的package包/类
protected Solution solve(Formula formula, Bounds bounds) {
final Set<IntSet> parts = SymmetryDetector.partition(bounds);
final Bounds inc = new Bounds(bounds.universe());
final TupleFactory t = inc.universe().factory();
for(IndexedEntry<TupleSet> e : inc.intBounds()) {
inc.boundExactly(e.index(), e.value());
}
for(IntSet part : parts) {
// dummy relations to set up initial symmetry classes
inc.boundExactly(Relation.unary("r" + part.min()), t.setOf(1, part));
}
Solution sol = solver.solve(Formula.TRUE, inc);
assertEquals(Solution.Outcome.TRIVIALLY_SATISFIABLE, sol.outcome());
//System.out.println("FORMULAS: " + Nodes.roots(formula).size());
for(Formula f : Nodes.roots(formula)) {
inc.relations().clear();
if (!bounds.relations().isEmpty()) {
final Set<Relation> rels = AnnotatedNode.annotate(f).relations();
rels.retainAll(bounds.relations());
for(Relation r : rels) {
inc.bound(r, bounds.lowerBound(r), bounds.upperBound(r));
}
bounds.relations().removeAll(rels);
}
//System.out.println(f + ", " + inc.relations() + "\n");
sol = solver.solve(f, inc);
if (sol.unsat()) {
break;
}
}
return sol;
}