use of org.logicng.LongRunningTag in project LogicNG by logic-ng.
the class CnfMethodComparisonTest method compareFullBackbonesOnLargeFormulas.
@ParameterizedTest
@MethodSource("cnfConfigurations")
@LongRunningTag
public void compareFullBackbonesOnLargeFormulas(final CNFConfig cnfConfig, final MiniSatConfig.CNFMethod cnfMethod) throws IOException, ParserException {
final String baseDir = "src/test/resources/formulas/";
final List<String> fileNames = Arrays.asList("formula1.txt", "formula2.txt", "formula3.txt", "large_formula.txt", "small_formulas.txt");
for (final String fileName : fileNames) {
final String filePath = baseDir + fileName;
final Backbone backboneReference = computeBackbone(filePath, CNFConfig.builder().build(), MiniSatConfig.builder().build().getCnfMethod());
final Backbone backbone = computeBackbone(filePath, cnfConfig, cnfMethod);
assertThat(backboneReference).isEqualTo(backbone);
}
}
use of org.logicng.LongRunningTag in project LogicNG by logic-ng.
the class DnnfCompilerTest method testAllSmallFormulas.
@Test
@LongRunningTag
public void testAllSmallFormulas() throws IOException, ParserException {
final Formula formulas = FormulaReader.readPseudoBooleanFormula("src/test/resources/formulas/small_formulas.txt", this.f);
formulas.stream().forEach(f -> testFormula(f, false));
}
use of org.logicng.LongRunningTag in project LogicNG by logic-ng.
the class DRUPTest method testUnsatCoresFromLargeTestset.
@Test
@LongRunningTag
public void testUnsatCoresFromLargeTestset() throws IOException {
final File testFolder = new File("src/test/resources/sat");
final File[] files = testFolder.listFiles();
assert files != null;
int count = 0;
for (final SATSolver solver : this.solvers) {
for (final File file : files) {
final String fileName = file.getName();
if (fileName.endsWith(".cnf")) {
final List<Formula> cnf = DimacsReader.readCNF(file, this.f);
solver.add(cnf);
if (solver.sat() == FALSE) {
final UNSATCore<Proposition> unsatCore = solver.unsatCore();
verifyCore(unsatCore, cnf);
count++;
}
solver.reset();
}
}
solver.reset();
}
assertThat(count).isEqualTo(11 * this.solvers.length);
}
use of org.logicng.LongRunningTag in project LogicNG by logic-ng.
the class CCIncrementalFormulaTest method testLargeModularTotalizerAMK.
@Test
@LongRunningTag
public void testLargeModularTotalizerAMK() {
for (final SATSolver solver : this.solvers) {
final CCEncoder encoder = this.encoders[2];
final CCEncoder initialEncoder = new CCEncoder(this.f);
final int numLits = 100;
int currentBound = numLits - 1;
final Variable[] vars = new Variable[numLits];
for (int i = 0; i < numLits; i++) {
vars[i] = this.f.variable("v" + i);
}
final Pair<List<Formula>, CCIncrementalData> cc = encoder.encodeIncremental((CardinalityConstraint) this.f.cc(CType.LE, currentBound, vars));
final CCIncrementalData incData = cc.second();
solver.reset();
// >= 42
solver.add(initialEncoder.encode((CardinalityConstraint) this.f.cc(CType.GE, 42, vars)));
solver.add(cc.first());
// search the lower bound
while (solver.sat() == Tristate.TRUE) {
// <= currentBound - 1
solver.add(incData.newUpperBound(--currentBound));
}
assertThat(currentBound).isEqualTo(41);
}
}
use of org.logicng.LongRunningTag in project LogicNG by logic-ng.
the class CCIncrementalSolverTest method testVeryLargeModularTotalizerAMK.
@Test
@LongRunningTag
public void testVeryLargeModularTotalizerAMK() {
this.f.putConfiguration(this.configs[2]);
final int numLits = 300;
int currentBound = numLits - 1;
final Variable[] vars = new Variable[numLits];
for (int i = 0; i < numLits; i++) {
vars[i] = this.f.variable("v" + i);
}
final SATSolver solver = this.solvers[3];
solver.reset();
solver.add(this.f.cc(CType.GE, 234, vars));
final CCIncrementalData incData = solver.addIncrementalCC((CardinalityConstraint) this.f.cc(CType.LE, currentBound, vars));
// search the lower bound
while (solver.sat() == Tristate.TRUE) {
incData.newUpperBoundForSolver(--currentBound);
}
assertThat(currentBound).isEqualTo(233);
}
Aggregations