All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.uu.cs.ape.models.sltlxStruc.SLTLxEquivalence Maven / Gradle / Ivy

Go to download

APE is a command line tool and an API for the automated exploration of possible computational pipelines (workflows) from large collections of computational tools.

There is a newer version: 2.3.0
Show newest version
package nl.uu.cs.ape.models.sltlxStruc;

import java.util.HashSet;
import java.util.Set;

import nl.uu.cs.ape.core.implSAT.SATSynthesisEngine;

/**
 * Structure used to model equivalence (e.g., "a <=> b") in SLTLx.
 * 
 * @author Vedran Kasalica
 *
 */
public class SLTLxEquivalence extends SLTLxFormula {

	private SLTLxFormula firstArg;
	private SLTLxFormula secondArg;

	public SLTLxEquivalence(SLTLxFormula firstArg, SLTLxFormula secondArg) {
		super();
		this.firstArg = firstArg;
		this.secondArg = secondArg;
	}

	@Override
	public Set getCNFEncoding(int stateNo, SLTLxVariableSubstitutionCollection variableMapping,
			SATSynthesisEngine synthesisEngine) {
		Set allClauses = new HashSet<>();

		/* Add the elements that represent the 2 way implication. */
		allClauses.addAll(
				new SLTLxImplication(firstArg, secondArg).getCNFEncoding(stateNo, variableMapping, synthesisEngine));
		allClauses.addAll(
				new SLTLxImplication(secondArg, firstArg).getCNFEncoding(stateNo, variableMapping, synthesisEngine));

		return allClauses;
	}

	@Override
	public Set getNegatedCNFEncoding(int stateNo, SLTLxVariableSubstitutionCollection variableMapping,
			SATSynthesisEngine synthesisEngine) {
		Set allClauses = new HashSet<>();

		/* Ensure that the 2 arguments are not the same. */
		allClauses.addAll(
				new SLTLxDisjunction(firstArg, secondArg).getCNFEncoding(stateNo, variableMapping, synthesisEngine));
		allClauses.addAll(new SLTLxNegatedConjunction(firstArg, secondArg).getCNFEncoding(stateNo, variableMapping,
				synthesisEngine));

		return allClauses;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy