nl.uu.cs.ape.models.sltlxStruc.SLTLxImplication 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 implication in SLTLx.
*
* @author Vedran Kasalica
*
*/
public class SLTLxImplication extends SLTLxFormula {
private SLTLxFormula ifFact;
private SLTLxFormula thenFact;
public SLTLxImplication(SLTLxFormula ifFact, SLTLxFormula thenFact) {
super();
this.ifFact = ifFact;
this.thenFact = thenFact;
}
@Override
public Set getCNFEncoding(int stateNo, SLTLxVariableSubstitutionCollection variableMapping,
SATSynthesisEngine synthesisEngine) {
Set> allClauses = new HashSet<>();
/* Add the elements of the if element of the implication.. */
allClauses.add(ifFact.getNegatedCNFEncoding(stateNo, variableMapping, synthesisEngine));
allClauses.add(thenFact.getCNFEncoding(stateNo, variableMapping, synthesisEngine));
return CNFClause.disjoinClausesCollection(allClauses);
}
@Override
public Set getNegatedCNFEncoding(int stateNo, SLTLxVariableSubstitutionCollection variableMapping,
SATSynthesisEngine synthesisEngine) {
Set> allClauses = new HashSet<>();
/* Add the elements of the if element of the implication.. */
allClauses.add(ifFact.getCNFEncoding(stateNo, variableMapping, synthesisEngine));
allClauses.add(thenFact.getNegatedCNFEncoding(stateNo, variableMapping, synthesisEngine));
return CNFClause.conjunctClausesCollection(allClauses);
}
}