本文整理汇总了Java中org.sat4j.minisat.SolverFactory.instance方法的典型用法代码示例。如果您正苦于以下问题:Java SolverFactory.instance方法的具体用法?Java SolverFactory.instance怎么用?Java SolverFactory.instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sat4j.minisat.SolverFactory
的用法示例。
在下文中一共展示了SolverFactory.instance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
/**
* Lance le prouveur sur un fichier Dimacs.
*
* @param args
* doit contenir le nom d'un fichier Dimacs, eventuellement
* compress?.
*/
public static void main(final String[] args) {
BasicLauncher<ISolver> lanceur = new BasicLauncher<ISolver>(
SolverFactory.instance());
if (args.length != 1) {
lanceur.usage();
return;
}
lanceur.run(args);
System.exit(lanceur.getExitCode().value());
}
示例2: main
import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
/**
* Lance le prouveur sur un fichier Dimacs.
*
* @param args
* doit contenir le nom d'un fichier Dimacs, eventuellement
* compress?.
*/
public static void main(final String[] args) {
BasicLauncher<ISolver> lanceur = new BasicLauncher<ISolver>(
SolverFactory.instance());
if (args.length == 0 || args.length > 2) {
lanceur.usage();
return;
}
lanceur.run(args);
System.exit(lanceur.getExitCode().value());
}
示例3: configureSolver
import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
@Override
protected ISolver configureSolver(String[] args) {
String problemName = args[args.length - 1];
if (problemName.endsWith(".gcnf")) {
this.highLevel = true;
}
ISolver solver;
if (this.highLevel) {
HighLevelXplain<ISolver> hlxp = new HighLevelXplain<ISolver>(
SolverFactory.newDefault());
this.xplain = hlxp;
solver = hlxp;
} else {
Xplain<ISolver> xp = new Xplain<ISolver>(
SolverFactory.newDefault(), false);
this.xplain = xp;
solver = xp;
}
solver.setDBSimplificationAllowed(true);
if (args.length == 2) {
// retrieve minimization strategy
if ("all".equals(args[0])) {
allMuses = new AllMUSes(highLevel, SolverFactory.instance());
solver = allMuses.getSolverInstance();
} else {
String className = "org.sat4j.tools.xplain." + args[0]
+ "Strategy";
try {
this.xplain
.setMinimizationStrategy((MinimizationStrategy) Class
.forName(className).newInstance());
} catch (Exception e) {
log(e.getMessage());
}
}
}
solver.setTimeout(Integer.MAX_VALUE);
getLogWriter().println(solver.toString(COMMENT_PREFIX));
return solver;
}
示例4: setUp
import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
this.allMUSes = new AllMUSes(SolverFactory.instance());
this.solver = allMUSes.getSolverInstance();
this.checkListener = new CheckMUSSolutionListener(
SolverFactory.instance());
}
示例5: testBugBr4cpWithExplanation
import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
@Test
public void testBugBr4cpWithExplanation() throws ContradictionException,
TimeoutException {
AllMUSes muses = new AllMUSes(true, SolverFactory.instance());
IGroupSolver solver = muses.getSolverInstance();
IVecInt clause = new VecInt();
int one, two, three;
clause.push(one = solver.nextFreeVarId(true));
solver.addClause(clause, 1);
clause.clear();
clause.push(two = solver.nextFreeVarId(true)).push(
three = solver.nextFreeVarId(true));
solver.addClause(clause, 2);
clause.clear();
clause.push(-two).push(-three);
solver.addClause(clause, 3);
clause.clear();
IVecInt backbone = Backbone.instance().compute(solver);
assertEquals(1, backbone.size());
assertEquals(one, backbone.get(0));
assertTrue(solver.isSatisfiable(new VecInt(new int[] { two })));
assertTrue(solver.isSatisfiable(new VecInt(new int[] { three })));
assertTrue(solver.isSatisfiable(new VecInt(new int[] { -two })));
assertTrue(solver.isSatisfiable(new VecInt(new int[] { -three })));
backbone = Backbone.instance().compute(solver,
new VecInt(new int[] { two }));
assertEquals(3, backbone.size());
backbone = Backbone.instance().compute(solver,
new VecInt(new int[] { -two }));
assertEquals(3, backbone.size());
backbone = Backbone.instance().compute(solver,
new VecInt(new int[] { three }));
assertEquals(3, backbone.size());
backbone = Backbone.instance().compute(solver,
new VecInt(new int[] { -three }));
assertEquals(3, backbone.size());
}
示例6: setUp
import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
this.allMUSes = new AllMUSes(true, SolverFactory.instance());
this.solver = allMUSes.getSolverInstance();
}
示例7: setUp
import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
check = new CheckMUSSolutionListener(SolverFactory.instance());
}
示例8: setUp
import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
this.allMUSes = new AllMUSes(SolverFactory.instance());
this.solver = allMUSes.getSolverInstance();
}