nl.uu.cs.ape.models.sltlxStruc.SLTLxFinally Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of APE Show documentation
Show all versions of APE Show documentation
APE is a command line tool and an API for the automated exploration of possible computational pipelines (workflows) from large collections of computational tools.
The newest version!
package nl.uu.cs.ape.models.sltlxStruc;
import java.util.HashSet;
import java.util.Set;
import nl.uu.cs.ape.solver.minisat.SATSynthesisEngine;
/**
* Structure used to model Finally (F) modal statement in SLTLx.
*
* @author Vedran Kasalica
*
*/
public class SLTLxFinally extends SLTLxFormula {
private SLTLxFormula formula;
public SLTLxFinally(SLTLxFormula formula) {
super();
this.formula = formula;
}
@Override
public Set getCNFEncoding(int stateNo, SLTLxVariableSubstitutionCollection variableMapping,
SATSynthesisEngine synthesisEngine) {
Set> allClauses = new HashSet<>();
/*
* Disjoint the collection of clauses that encode the formula at each of the
* workflow steps.
*/
for (int i = stateNo; i <= synthesisEngine.getSolutionSize(); i++) {
allClauses.add(formula.getCNFEncoding(i, variableMapping, synthesisEngine));
}
return CNFClause.disjoinClausesCollection(allClauses);
}
@Override
public Set getNegatedCNFEncoding(int stateNo, SLTLxVariableSubstitutionCollection variableMapping,
SATSynthesisEngine synthesisEngine) {
Set> allClauses = new HashSet<>();
/*
* Conjunct the collection of clauses that encode negation the formula at each
* of the workflow steps.
*/
for (int i = stateNo; i <= synthesisEngine.getSolutionSize(); i++) {
allClauses.add(formula.getNegatedCNFEncoding(i, variableMapping, synthesisEngine));
}
return CNFClause.conjunctClausesCollection(allClauses);
}
}