当前位置: 首页>>代码示例>>Java>>正文


Java SolverFactory.instance方法代码示例

本文整理汇总了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());
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:18,代码来源:BasicLauncher.java

示例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());
}
 
开发者ID:TakehideSoh,项目名称:Scarab,代码行数:18,代码来源:BasicLauncher.java

示例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;
}
 
开发者ID:TakehideSoh,项目名称:Scarab,代码行数:41,代码来源:MUSLauncher.java

示例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());
}
 
开发者ID:TakehideSoh,项目名称:Scarab,代码行数:8,代码来源:TestAllMUSesAndCheckTest.java

示例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());
}
 
开发者ID:TakehideSoh,项目名称:Scarab,代码行数:38,代码来源:BackboneTest.java

示例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();
}
 
开发者ID:TakehideSoh,项目名称:Scarab,代码行数:6,代码来源:TestAllMSSes.java

示例7: setUp

import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    check = new CheckMUSSolutionListener(SolverFactory.instance());
}
 
开发者ID:TakehideSoh,项目名称:Scarab,代码行数:5,代码来源:TestCheckItIsAMUS.java

示例8: setUp

import org.sat4j.minisat.SolverFactory; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    this.allMUSes = new AllMUSes(SolverFactory.instance());
    this.solver = allMUSes.getSolverInstance();
}
 
开发者ID:TakehideSoh,项目名称:Scarab,代码行数:6,代码来源:TestAllMUSes.java


注:本文中的org.sat4j.minisat.SolverFactory.instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。