Search in sources :

Example 16 with Context

use of com.google.cloud.dialogflow.v2.Context in project bmoth by hhu-stups.

the class InvariantSatisfiabilityChecker method doInvariantSatisfiabilityCheck.

static InvariantSatisfiabilityCheckingResult doInvariantSatisfiabilityCheck(MachineNode machine) {
    Context ctx = new Context();
    Solver solver = Z3SolverFactory.getZ3Solver(ctx);
    MachineToZ3Translator machineTranslator = new MachineToZ3Translator(machine, ctx);
    final BoolExpr invariant = machineTranslator.getInvariantConstraint();
    solver.add(invariant);
    Status check = solver.check();
    return new InvariantSatisfiabilityCheckingResult(check);
}
Also used : Context(com.microsoft.z3.Context) Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Solver(com.microsoft.z3.Solver) MachineToZ3Translator(de.bmoth.backend.z3.MachineToZ3Translator)

Example 17 with Context

use of com.google.cloud.dialogflow.v2.Context in project bmoth by hhu-stups.

the class Issue59Test method testIssue59JustInvariant.

@Test
public void testIssue59JustInvariant() {
    Context ctx = new Context();
    Solver s = ctx.mkSolver();
    String formula = "x**2 = x*x & #x.({x} \\/ {1,2} = {1,2})";
    BoolExpr combinedConstraint = FormulaToZ3Translator.translatePredicate(formula, ctx);
    s.add(combinedConstraint);
    Status check = s.check();
    assertEquals(Status.SATISFIABLE, check);
}
Also used : Context(com.microsoft.z3.Context) Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Solver(com.microsoft.z3.Solver) Test(org.junit.Test)

Example 18 with Context

use of com.google.cloud.dialogflow.v2.Context in project bmoth by hhu-stups.

the class Issue59Test method testIssue59JustInvariant2.

@Test
public void testIssue59JustInvariant2() {
    Context ctx = new Context();
    Solver s = ctx.mkSolver();
    String formula = "x**2 = x*x";
    BoolExpr combinedConstraint = FormulaToZ3Translator.translatePredicate(formula, ctx);
    s.add(combinedConstraint);
    Status check = s.check();
    assertEquals(Status.SATISFIABLE, check);
}
Also used : Context(com.microsoft.z3.Context) Status(com.microsoft.z3.Status) BoolExpr(com.microsoft.z3.BoolExpr) Solver(com.microsoft.z3.Solver) Test(org.junit.Test)

Example 19 with Context

use of com.google.cloud.dialogflow.v2.Context in project bmoth by hhu-stups.

the class TestUsingZ3 method setup.

@Before
public void setup() {
    z3Context = new Context();
    z3Solver = z3Context.mkSolver();
}
Also used : Context(com.microsoft.z3.Context) Before(org.junit.Before)

Example 20 with Context

use of com.google.cloud.dialogflow.v2.Context in project kie-wb-common by kiegroup.

the class ContextPropertyConverter method wbFromDMN.

public static Context wbFromDMN(final org.kie.dmn.model.v1_1.Context dmn) {
    Id id = new Id(dmn.getId());
    Description description = new Description(dmn.getDescription());
    QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    Context result = new Context(id, description, typeRef);
    for (org.kie.dmn.model.v1_1.ContextEntry ce : dmn.getContextEntry()) {
        ContextEntry ceConverted = ContextEntryPropertyConverter.wbFromDMN(ce);
        result.getContextEntry().add(ceConverted);
    }
    return result;
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)

Aggregations

Context (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context)58 Context (com.microsoft.z3.Context)39 CoreException (org.eclipse.core.runtime.CoreException)34 Context (org.osate.aadl2.Context)31 BoolExpr (com.microsoft.z3.BoolExpr)25 ArrayList (java.util.ArrayList)18 HashMap (java.util.HashMap)18 Test (org.junit.Test)18 ServerInstance (org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)17 List (java.util.List)16 Map (java.util.Map)15 Solver (com.microsoft.z3.Solver)13 File (java.io.File)13 IOException (java.io.IOException)11 IPath (org.eclipse.core.runtime.IPath)11 IStatus (org.eclipse.core.runtime.IStatus)11 Status (org.eclipse.core.runtime.Status)11 Factory (org.eclipse.jst.server.tomcat.core.internal.xml.Factory)11 Feature (org.osate.aadl2.Feature)11 FileNotFoundException (java.io.FileNotFoundException)10