Beispiel #1
0
        public LTLMonitorHard(ITLFormula formula)
        {
            /*
            var ltl2buchi = new GPVW ();
            var positiveGBA = ltl2buchi.GetAutomaton (formula);
            var negativeGBA = ltl2buchi.GetAutomaton (formula.Negate ());

            var positiveBA = GBA2BA.Transform (positiveGBA);
            var negativeBA = GBA2BA.Transform (negativeGBA);

            positiveNFA = BA2NFA.Transform (positiveBA);
            negativeNFA = BA2NFA.Transform (negativeBA);

            positiveNFA.ToSingleInitialState ();
            negativeNFA.ToSingleInitialState ();

            currentNegative = new HashSet<AutomatonNode> (negativeNFA.InitialNodes);
            currentPositive = new HashSet<AutomatonNode> (positiveNFA.InitialNodes);

            var graphviz = new GraphvizAlgorithm<AutomatonNode,AutomataTransition>(positiveNFA);
            graphviz.FormatVertex += (object sender, FormatVertexEventArgs<AutomatonNode> e) => {
                e.VertexFormatter.Label = e.Vertex.Name + "(" + string.Join (",", e.Vertex.Labels) + ")";;
                if (positiveNFA.InitialNodes.Contains (e.Vertex)) {
                    e.VertexFormatter.FillColor = QuickGraph.Graphviz.Dot.GraphvizColor.LightYellow;
                }
            };
            graphviz.FormatEdge += (object sender, FormatEdgeEventArgs<AutomatonNode, AutomataTransition> e) => {
                e.EdgeFormatter.Label.Value = string.Join (",", e.Edge.Labels);
            };
            string output = graphviz.Generate();
            Console.WriteLine (output);

            graphviz = new GraphvizAlgorithm<AutomatonNode,AutomataTransition>(negativeNFA);
            graphviz.FormatVertex += (object sender, FormatVertexEventArgs<AutomatonNode> e) => {
                e.VertexFormatter.Label = e.Vertex.Name + "(" + string.Join (",", e.Vertex.Labels) + ")";
                if (positiveNFA.InitialNodes.Contains (e.Vertex)) {
                    e.VertexFormatter.FillColor = QuickGraph.Graphviz.Dot.GraphvizColor.LightYellow;
                }
            };
            graphviz.FormatEdge += (object sender, FormatEdgeEventArgs<AutomatonNode, AutomataTransition> e) => {
                e.EdgeFormatter.Label.Value = string.Join (",", e.Edge.Labels);
            };
            output = graphviz.Generate();
            Console.WriteLine (output);

            Console.WriteLine (string.Join ("/", positiveNFA.AcceptanceSet.Select (x => x.Name)));
            Console.WriteLine (string.Join ("/", negativeNFA.AcceptanceSet.Select (x => x.Name)));

            var negativeAcceptance = currentNegative.All (t => !negativeNFA.AcceptanceSet.Contains (t));
            var positiveAcceptance = currentPositive.All (t => !positiveNFA.AcceptanceSet.Contains (t));
            Status = MonitorStatus.Inconclusive;
            if (negativeAcceptance)
                Status = MonitorStatus.False;
            if (positiveAcceptance)
                Status = MonitorStatus.True;
                */
        }
Beispiel #2
0
        public LTLMonitor(ITLFormula formula)
        {
            var tpositiveNFA = translator.GetBuchiAutomaton (formula).ToNFA();
            var tnegativeNFA = translator.GetBuchiAutomaton (formula.Negate ()).ToNFA();

            positiveNFA = tpositiveNFA.Determinize ();
            negativeNFA = tnegativeNFA.Determinize ();

            currentNegative = negativeNFA.InitialNode;
            currentPositive = positiveNFA.InitialNode;

            UpdateStatus ();
        }
Beispiel #3
0
 public Unless(ITLFormula left, ITLFormula right)
     : base(left, right)
 {
 }
Beispiel #4
0
 public StrongImplication(ITLFormula left, ITLFormula right)
     : base(left, right)
 {
 }
Beispiel #5
0
 public StrongEquivalence(ITLFormula left, ITLFormula right)
     : base(left, right)
 {
 }
Beispiel #6
0
 public Release(ITLFormula left, ITLFormula right)
     : base(left, right)
 {
 }
Beispiel #7
0
 public Disjunction(ITLFormula left, ITLFormula right)
     : base(left, right)
 {
 }
Beispiel #8
0
 public Until(ITLFormula left, ITLFormula right)
     : this(left, right, -1)
 {
 }
Beispiel #9
0
 public ParenthesedExpression(ITLFormula expression)
     : base(expression)
 {
     if (expression is ParenthesedExpression)
         Enclosed = (expression as ParenthesedExpression).Enclosed;
 }
Beispiel #10
0
 public Next(ITLFormula expression)
     : base(expression)
 {
 }
Beispiel #11
0
 public Negation(ITLFormula expression)
     : base(expression)
 {
 }
Beispiel #12
0
 public IUnaryOperator(ITLFormula enclosed)
 {
     Enclosed = enclosed;
 }
Beispiel #13
0
 public IBinaryOperator(ITLFormula left, ITLFormula right)
 {
     Left = left; Right = right;
 }
Beispiel #14
0
 public Globally(ITLFormula expression)
     : base(expression)
 {
 }
Beispiel #15
0
 public Finally(ITLFormula expression)
     : base(expression)
 {
 }
Beispiel #16
0
 public ProbabilisticOperator(ITLFormula expression, double p)
     : this(expression, p, p)
 {
 }
Beispiel #17
0
        private void AssertEquivalentEmptiness(ITLFormula f)
        {
            var gpvw = new GPVW ();
            var ltl2buchi = new Gia02 ();

            var gba = gpvw.GetGBA (f);
            var ba = gba.ToBA ();
            var ba2 = ltl2buchi.GetBuchiAutomaton (f);

            Console.WriteLine (ba.ToDot ());
            Console.WriteLine (ba2.ToDot ());

            var ec = new GBAEmptinessChecker ();
            var ec2 = new EmptinessChecker<AutomatonNode> (ba);
            var ec3 = new EmptinessChecker<AutomatonNode> (ba2);

            var e1 = ec.EmptinessSearch (gba);
            var e2 = ec2.Emptiness ();
            var e3 = ec3.Emptiness ();

            Console.WriteLine (e2);
            Console.WriteLine (e3);

            Assert.That (e1 == e2, "GBAEmptinessChecker and EmptinessChecker (on transformed ba) differs");
            Assert.That (e2 == e3, "EmptinessChecker and EmptinessChecker (on transformed ba) differs");
            Assert.That (e1 == e3, "GBAEmptinessChecker and EmptinessChecker differs");
        }
Beispiel #18
0
 public ProbabilisticOperator(ITLFormula expression, double lower, double upper)
     : base(expression)
 {
     LowerBound = lower;
     UpperBound = upper;
     InclusiveLowerBound = true;
     InclusiveUpperBound = true;
 }
Beispiel #19
0
        private void AssertEquivalentEmptiness(ITLFormula f)
        {
            var t = new GPVW ();

            var gba = t.GetGBA (f);
            var ba = gba.ToBA ();

            var ec = new GBAEmptinessChecker ();
            var e1 = ec.EmptinessSearch (gba);
            //            Console.WriteLine (e1 ? "Empty" : "Not empty");

            var ec2 = new EmptinessChecker<AutomatonNode> (ba);
            var e2 = ec2.Emptiness ();
            //            Console.WriteLine (e2 ? "Empty" : "Not empty");

            //Console.WriteLine (gba.AcceptanceSets.Length);
            //foreach (var aset in gba.AcceptanceSets) {
            //    Console.WriteLine (aset.Id + " : " + string.Join (",", aset.Nodes));
            //}

            //Console.WriteLine ("---");
            //Console.WriteLine (gba.ToDot ());
            //Console.WriteLine ("---");
            //Console.WriteLine (ba.ToDot ());
            //Console.WriteLine ("---");

            //if (e1) {

            //    foreach (var i in ec2.dfsStack1.Reverse ()) {
            //        Console.WriteLine (ba.Nodes [i].Name);
            //    }
            //    Console.WriteLine ("-- loop starts here --");
            //    foreach (var i in ec2.dfsStack2.Reverse ()) {
            //        Console.WriteLine (ba.Nodes [i].Name);
            //    }
            //    Console.WriteLine ("-- loop ends here --");
            //}

            Assert.That (e1 == e2);
        }
Beispiel #20
0
 public Until(ITLFormula left, ITLFormula right, int bound)
     : base(left, right)
 {
     Bound = bound;
 }