use of org.sosy_lab.java_smt.api.BasicProverEnvironment in project java-smt by sosy-lab.
the class SolverConcurrencyTest method testConcurrentStack.
/**
* Test solving of large formula on concurrent stacks in one context (Stacks are not created in
* the Threads).
*/
@Test
public void testConcurrentStack() throws InvalidConfigurationException, InterruptedException {
requireConcurrentMultipleStackSupport();
SolverContext context = initSolver();
FormulaManager mgr = context.getFormulaManager();
IntegerFormulaManager imgr = mgr.getIntegerFormulaManager();
BooleanFormulaManager bmgr = mgr.getBooleanFormulaManager();
HardIntegerFormulaGenerator gen = new HardIntegerFormulaGenerator(imgr, bmgr);
ConcurrentLinkedQueue<BasicProverEnvironment<?>> proverList = new ConcurrentLinkedQueue<>();
for (int i = 0; i < NUMBER_OF_THREADS; i++) {
BooleanFormula instance = gen.generate(INTEGER_FORMULA_GEN.getOrDefault(solver, 9));
BasicProverEnvironment<?> pe = context.newProverEnvironment();
pe.push(instance);
proverList.add(pe);
}
assertConcurrency("testConcurrentStack", () -> {
BasicProverEnvironment<?> stack = proverList.poll();
assertWithMessage("Solver %s failed a concurrency test", solverToUse()).that(stack.isUnsat()).isTrue();
});
closeSolver(context);
}
Aggregations