public void DileepTest2() { var solver = new CharSetSolver(BitWidth.BV64); List <char> alph = new List <char> { 'a', 'b' }; HashSet <char> al = new HashSet <char>(alph); PDLPred phi = new PDLIntGeq(new PDLIndicesOf("ba"), 3); var dfaCorr = phi.GetDFA(al, solver); var a = solver.MkCharConstraint(false, 'a'); var b = solver.MkCharConstraint(false, 'b'); var moves = new List <Move <BDD> >(); moves.Add(new Move <BDD>(0, 0, a)); moves.Add(new Move <BDD>(0, 1, b)); moves.Add(new Move <BDD>(1, 2, a)); moves.Add(new Move <BDD>(1, 0, b)); moves.Add(new Move <BDD>(2, 2, a)); moves.Add(new Move <BDD>(2, 3, b)); moves.Add(new Move <BDD>(3, 4, a)); moves.Add(new Move <BDD>(3, 2, b)); moves.Add(new Move <BDD>(4, 4, a)); moves.Add(new Move <BDD>(4, 5, b)); moves.Add(new Move <BDD>(5, 6, a)); moves.Add(new Move <BDD>(5, 4, b)); moves.Add(new Move <BDD>(6, 6, a)); moves.Add(new Move <BDD>(6, 6, b)); var dfa2 = Automaton <BDD> .Create(0, new int[] { 4, 5 }, moves); solver.SaveAsDot(dfaCorr, "aa", "trytrycorr"); solver.SaveAsDot(dfa2, "aa", "trytry"); //var v0 = DFADensity.GetDFADifferenceRatio(dfa1, dfa2, al, solver); //var v1 = PDLEditDistance.GetMinimalFormulaEditDistanceRatio(dfa1, dfa2, al, solver, timeout); //var v2 = DFAEditDistance.GetDFAOptimalEdit(dfa1, dfa2, al, solver, 4, new StringBuilder()); //Console.WriteLine("density ratio: {0}; pdl edit distance: {1}; dfa edit distance: {2}", v0, v1, v2); var gr = DFAGrading.GetGrade(dfaCorr, dfa2, al, solver, 2000, 10, FeedbackLevel.Hint, true, true, true); Console.WriteLine(gr.First); foreach (var f in gr.Second) { Console.WriteLine(f.ToString()); } }
public void DileepTest() { PDLEnumerator pdlEnumerator = new PDLEnumerator(); PDLPred phi = new PDLIntGeq(new PDLIndicesOf("ab"), 2); var solver = new CharSetSolver(BitWidth.BV64); var alph = new List <char> { 'a', 'b' }; var al = new HashSet <char>(alph); var dfa = phi.GetDFA(al, solver); PDLPred synthPhi = null; StringBuilder sb = new StringBuilder(); foreach (var phi1 in pdlEnumerator.SynthesizePDL(al, dfa, solver, sb, 10000)) { synthPhi = phi1; break; } Console.WriteLine(sb); }
public void DileepTest2() { var solver = new CharSetSolver(BitWidth.BV64); List<char> alph = new List<char> { 'a', 'b' }; HashSet<char> al = new HashSet<char>(alph); PDLPred phi = new PDLIntGeq(new PDLIndicesOf("ba"), 3); var dfaCorr = phi.GetDFA(al, solver); var a = solver.MkCharConstraint(false, 'a'); var b = solver.MkCharConstraint(false, 'b'); var moves = new List<Move<BDD>>(); moves.Add(new Move<BDD>(0, 0, a)); moves.Add(new Move<BDD>(0, 1, b)); moves.Add(new Move<BDD>(1, 2, a)); moves.Add(new Move<BDD>(1, 0, b)); moves.Add(new Move<BDD>(2, 2, a)); moves.Add(new Move<BDD>(2, 3, b)); moves.Add(new Move<BDD>(3, 4, a)); moves.Add(new Move<BDD>(3, 2, b)); moves.Add(new Move<BDD>(4, 4, a)); moves.Add(new Move<BDD>(4, 5, b)); moves.Add(new Move<BDD>(5, 6, a)); moves.Add(new Move<BDD>(5, 4, b)); moves.Add(new Move<BDD>(6, 6, a)); moves.Add(new Move<BDD>(6, 6, b)); var dfa2 = Automaton<BDD>.Create(0, new int[] { 4,5 }, moves); solver.SaveAsDot(dfaCorr, "aa", "trytrycorr"); solver.SaveAsDot(dfa2, "aa", "trytry"); //var v0 = DFADensity.GetDFADifferenceRatio(dfa1, dfa2, al, solver); //var v1 = PDLEditDistance.GetMinimalFormulaEditDistanceRatio(dfa1, dfa2, al, solver, timeout); //var v2 = DFAEditDistance.GetDFAOptimalEdit(dfa1, dfa2, al, solver, 4, new StringBuilder()); //Console.WriteLine("density ratio: {0}; pdl edit distance: {1}; dfa edit distance: {2}", v0, v1, v2); var gr = DFAGrading.GetGrade(dfaCorr, dfa2, al, solver, 2000,10,FeedbackLevel.Hint,true,true,true); Console.WriteLine(gr.First); foreach (var f in gr.Second) Console.WriteLine(f.ToString()); }
public void DileepTest() { PDLEnumerator pdlEnumerator = new PDLEnumerator(); PDLPred phi = new PDLIntGeq(new PDLIndicesOf("ab"), 2); var solver = new CharSetSolver(BitWidth.BV64); var alph = new List<char> { 'a', 'b' }; var al = new HashSet<char>(alph); var dfa = phi.GetDFA(al, solver); PDLPred synthPhi = null; StringBuilder sb = new StringBuilder(); foreach (var phi1 in pdlEnumerator.SynthesizePDL(al, dfa, solver, sb, 10000)) { synthPhi = phi1; break; } Console.WriteLine(sb); }