Beispiel #1
0
 private void PrintNotDistinguishedElement(
     CstNode e, BigInteger vector, EncodingResult result, LearningExperiment oracle)
 {
     if (--_printCount >= 0)
     {
         Console.WriteLine("==========================================");
         Console.WriteLine(e.Parent.Name + ", " + e.Name + ", " + e.Code);
         Console.WriteLine(Experiment.GetGoodAncestorNode(e).Code);
         Console.WriteLine(
             result.Vector2Node[vector].Parent.Name + ", "
             + result.Vector2Node[vector].Name + ", "
             + result.Vector2Node[vector].Code);
         Console.WriteLine(Experiment.GetGoodAncestorNode(result.Vector2Node[vector]).Code);
         Console.WriteLine("------------------------------------------");
         if (Experiment.GetGoodAncestorNode(e).Code.Contains("Contract.Requires") &&
             Experiment.GetGoodAncestorNode(result.Vector2Node[vector])
             .Code.Contains("Contract.Requires"))
         {
             oracle.IsAcceptedUsingOracle(e);
             oracle.IsAcceptedUsingOracle(result.Vector2Node[vector]);
         }
         foreach (var featureString in GetFeatureStringsByVector(vector))
         {
             Console.WriteLine(Experiment.Beautify(featureString));
         }
     }
 }
Beispiel #2
0
 private void EncodeTargetNodes(
     IEnumerable <CstNode> allUppermostNodes, EncodingResult result,
     LearningExperiment oracle)
 {
     foreach (var uppermostNode in allUppermostNodes)
     {
         var vector = uppermostNode.GetFeatureVector(_featureString2Bit, _extractor);
         if (oracle.IsAcceptedUsingOracle(uppermostNode))
         {
             // TODO: for debug
             if (result.IdealRejectedVector2GroupPath.ContainsKey(vector))
             {
                 PrintNotDistinguishedElement(uppermostNode, vector, result, oracle);
             }
             UpdateVector2GroupPath(result.IdealAcceptedVector2GroupPath, vector,
                                    uppermostNode);
         }
         else
         {
             // TODO: for debug
             if (result.IdealAcceptedVector2GroupPath.ContainsKey(vector))
             {
                 PrintNotDistinguishedElement(uppermostNode, vector, result, oracle);
             }
             UpdateVector2GroupPath(result.IdealRejectedVector2GroupPath, vector,
                                    uppermostNode);
         }
         UpdateVectorDict(result, vector, uppermostNode);
     }
 }
Beispiel #3
0
 private void EncodeSeedNodes(
     IEnumerable <CstNode> seedNodes, EncodingResult result,
     IDictionary <BigInteger, string> idealVector2Path,
     IDictionary <BigInteger, string> seedVector2Path, LearningExperiment oracle)
 {
     foreach (var node in seedNodes)
     {
         var vector = node.GetFeatureVector(_featureString2Bit, _extractor);
         if (oracle.IsAcceptedUsingOracle(node))
         {
             // TODO: for debug
             if (result.IdealRejectedVector2GroupPath.ContainsKey(vector))
             {
                 PrintNotDistinguishedElement(node, vector, result, oracle);
             }
         }
         else
         {
             // TODO: for debug
             if (result.IdealAcceptedVector2GroupPath.ContainsKey(vector))
             {
                 PrintNotDistinguishedElement(node, vector, result, oracle);
             }
         }
         UpdateVector2GroupPath(idealVector2Path, vector, node);
         seedVector2Path[vector] = idealVector2Path[vector];
         UpdateVectorDict(result, vector, node);
     }
 }
Beispiel #4
0
 private void PrintNotDistinguishedElement(
         CstNode e, BigInteger vector, EncodingResult result, LearningExperiment oracle) {
     if (--_printCount >= 0) {
         Console.WriteLine("==========================================");
         Console.WriteLine(e.Parent.Name + ", " + e.Name + ", " + e.Code);
         Console.WriteLine(Experiment.GetGoodAncestorNode(e).Code);
         Console.WriteLine(
                 result.Vector2Node[vector].Parent.Name + ", "
                 + result.Vector2Node[vector].Name + ", "
                 + result.Vector2Node[vector].Code);
         Console.WriteLine(Experiment.GetGoodAncestorNode(result.Vector2Node[vector]).Code);
         Console.WriteLine("------------------------------------------");
         if (Experiment.GetGoodAncestorNode(e).Code.Contains("Contract.Requires") &&
             Experiment.GetGoodAncestorNode(result.Vector2Node[vector])
                     .Code.Contains("Contract.Requires")) {
             oracle.IsAcceptedUsingOracle(e);
             oracle.IsAcceptedUsingOracle(result.Vector2Node[vector]);
         }
         foreach (var featureString in GetFeatureStringsByVector(vector)) {
             Console.WriteLine(Experiment.Beautify(featureString));
         }
     }
 }
Beispiel #5
0
 private void EncodeTargetNodes(
         IEnumerable<CstNode> allUppermostNodes, EncodingResult result,
         LearningExperiment oracle) {
     foreach (var uppermostNode in allUppermostNodes) {
         var vector = uppermostNode.GetFeatureVector(_featureString2Bit, _extractor);
         if (oracle.IsAcceptedUsingOracle(uppermostNode)) {
             // TODO: for debug
             if (result.IdealRejectedVector2GroupPath.ContainsKey(vector)) {
                 PrintNotDistinguishedElement(uppermostNode, vector, result, oracle);
             }
             UpdateVector2GroupPath(result.IdealAcceptedVector2GroupPath, vector,
                     uppermostNode);
         } else {
             // TODO: for debug
             if (result.IdealAcceptedVector2GroupPath.ContainsKey(vector)) {
                 PrintNotDistinguishedElement(uppermostNode, vector, result, oracle);
             }
             UpdateVector2GroupPath(result.IdealRejectedVector2GroupPath, vector,
                     uppermostNode);
         }
         UpdateVectorDict(result, vector, uppermostNode);
     }
 }
Beispiel #6
0
 private void EncodeSeedNodes(
         IEnumerable<CstNode> seedNodes, EncodingResult result,
         IDictionary<BigInteger, string> idealVector2Path,
         IDictionary<BigInteger, string> seedVector2Path, LearningExperiment oracle) {
     foreach (var node in seedNodes) {
         var vector = node.GetFeatureVector(_featureString2Bit, _extractor);
         if (oracle.IsAcceptedUsingOracle(node)) {
             // TODO: for debug
             if (result.IdealRejectedVector2GroupPath.ContainsKey(vector)) {
                 PrintNotDistinguishedElement(node, vector, result, oracle);
             }
         } else {
             // TODO: for debug
             if (result.IdealAcceptedVector2GroupPath.ContainsKey(vector)) {
                 PrintNotDistinguishedElement(node, vector, result, oracle);
             }
         }
         UpdateVector2GroupPath(idealVector2Path, vector, node);
         seedVector2Path[vector] = idealVector2Path[vector];
         UpdateVectorDict(result, vector, node);
     }
 }