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

nl.uu.cs.ape.models.sltlxStruc.SLTLxVarQuantification 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.solver.minisat.SATSynthesisEngine;

/**
 * Structure used to model exists statement in SLTLx.
 * 
 * @author Vedran Kasalica
 *
 */
public abstract class SLTLxVarQuantification extends SLTLxFormula {

	protected SLTLxVariable boundVariable;
	protected SLTLxFormula formula;

	protected SLTLxVarQuantification(SLTLxVariable boundVariable, SLTLxFormula formula) {
		super();
		this.boundVariable = boundVariable;
		this.formula = formula;
	}

	@Override
	public Set getCNFEncoding(int stateNo, SLTLxVariableSubstitutionCollection newVarMapping,
			SATSynthesisEngine synthesisEngine) {
		Set clauses = new HashSet();
		SLTLxVariable flatBoundVariable = newVarMapping.getVarSabstitute(boundVariable);
		/** Encode the underlying formula. */
		clauses.addAll(formula.getCNFEncoding(stateNo, newVarMapping, synthesisEngine));
		/**
		 * Ensure that the variables and states they substitute satisfy the same
		 * properties.
		 * The rules have to be applied after visiting the bound formula (as done in the
		 * previous step).
		 */
		clauses.addAll(flatBoundVariable.getVariableSubstitutionToPreserveProperties(stateNo, newVarMapping,
				synthesisEngine));
		clauses.addAll(flatBoundVariable.getVariableMutualExclusion(stateNo, newVarMapping, synthesisEngine));
		return clauses;
	}

	@Override
	public Set getNegatedCNFEncoding(int stateNo, SLTLxVariableSubstitutionCollection newVarMapping,
			SATSynthesisEngine synthesisEngine) {
		Set clauses = new HashSet<>();
		SLTLxVariable flatBoundVariable = newVarMapping.getVarSabstitute(boundVariable);
		/** Encode the underlying formula. */
		clauses.addAll(formula.getNegatedCNFEncoding(stateNo, newVarMapping, synthesisEngine));
		/**
		 * Ensure that the variables and states they substitute satisfy the same
		 * properties.
		 * The rules have to be applied after visiting the bound formula (as done in the
		 * previous step).
		 */
		clauses.addAll(flatBoundVariable.getVariableSubstitutionToPreserveProperties(stateNo, newVarMapping,
				synthesisEngine));
		clauses.addAll(flatBoundVariable.getVariableMutualExclusion(stateNo, newVarMapping, synthesisEngine));
		return clauses;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy