public void TestMethod1()
        {
            var solver = new CharSetSolver(BitWidth.BV64);
            List<char> alph = new List<char> { 'a', 'b' };
            HashSet<char> al = new HashSet<char>(alph);

            PDLPred phi1 = new PDLContains("b");
            var dfa1 = phi1.GetDFA(al, solver);

            PDLPred phi2 = new PDLModSetEq(new PDLPredSet("x", new PDLAtPos('b', new PDLPosVar("x"))), 2, 1);
            var dfa2 = phi2.GetDFA(al, solver);

            StringBuilder sb = new StringBuilder();
            DFAEditDistance.GetDFAOptimalEdit(dfa1, dfa2, al, solver, 3000, sb);
            Console.WriteLine(sb);
        }
Exemplo n.º 2
0
        public void TestMethod1()
        {
            var         solver = new CharSetSolver(BitWidth.BV64);
            List <char> alph   = new List <char> {
                'a', 'b'
            };
            HashSet <char> al = new HashSet <char>(alph);

            PDLPred phi1 = new PDLContains("b");
            var     dfa1 = phi1.GetDFA(al, solver);

            PDLPred phi2 = new PDLModSetEq(new PDLPredSet("x", new PDLAtPos('b', new PDLPosVar("x"))), 2, 1);
            var     dfa2 = phi2.GetDFA(al, solver);

            StringBuilder sb = new StringBuilder();

            DFAEditDistance.GetDFAOptimalEdit(dfa1, dfa2, al, solver, 3000, sb);
            Console.WriteLine(sb);
        }
Exemplo n.º 3
0
        public void ComputeFeedback()
        {
            var         solver = new CharSetSolver(BitWidth.BV64);
            List <char> alph   = new List <char> {
                '0', '1'
            };
            HashSet <char> al = new HashSet <char>(alph);

            var correct = new PDLContains("0101");

            var dfa_correct = correct.GetDFA(al, solver);

            var o     = solver.MkCharConstraint(false, '0');
            var l     = solver.MkCharConstraint(false, '1');
            var moves = new List <Move <BDD> >();

            moves.Add(new Move <BDD>(0, 0, l));
            moves.Add(new Move <BDD>(0, 1, o));
            moves.Add(new Move <BDD>(1, 1, o));
            moves.Add(new Move <BDD>(1, 2, l));
            moves.Add(new Move <BDD>(2, 3, o));
            moves.Add(new Move <BDD>(2, 0, l));
            moves.Add(new Move <BDD>(3, 0, o));
            moves.Add(new Move <BDD>(3, 4, l));
            moves.Add(new Move <BDD>(4, 4, o));
            moves.Add(new Move <BDD>(4, 4, l));

            var dfa_wrong = Automaton <BDD> .Create(0, new int[] { 4 }, moves);

            var v1 = DFAGrading.GetGrade(dfa_correct, dfa_wrong, al, solver, timeout, 10, FeedbackLevel.Hint, true, true, true);

            Console.WriteLine("Grade: {0}", v1.First);
            foreach (var feed in v1.Second)
            {
                Console.WriteLine(feed.ToString());
            }
        }
        public void ComputeFeedback()
        {
            var solver = new CharSetSolver(BitWidth.BV64);
            List<char> alph = new List<char> { '0', '1' };
            HashSet<char> al = new HashSet<char>(alph);

            var correct = new PDLContains("0101");

            var dfa_correct = correct.GetDFA(al, solver);

            var o = solver.MkCharConstraint(false, '0');
            var l = solver.MkCharConstraint(false, '1');
            var moves = new List<Move<BDD>>();

            moves.Add(new Move<BDD>(0, 0, l));
            moves.Add(new Move<BDD>(0, 1, o));
            moves.Add(new Move<BDD>(1, 1, o));
            moves.Add(new Move<BDD>(1, 2, l));
            moves.Add(new Move<BDD>(2, 3, o));
            moves.Add(new Move<BDD>(2, 0, l));
            moves.Add(new Move<BDD>(3, 0, o));
            moves.Add(new Move<BDD>(3, 4, l));
            moves.Add(new Move<BDD>(4, 4, o));
            moves.Add(new Move<BDD>(4, 4, l));

            var dfa_wrong = Automaton<BDD>.Create(0, new int[] { 4 }, moves);

            var v1 = DFAGrading.GetGrade(dfa_correct, dfa_wrong, al, solver, timeout, 10, FeedbackLevel.Hint, true, true, true);

            Console.WriteLine("Grade: {0}", v1.First);
            foreach (var feed in v1.Second)
                Console.WriteLine(feed.ToString());

        }