private void VerifySeedAcceptedNodes( IEnumerable <CstNode> seedCsts, ICollection <CstNode> uppermostSeedAcceptedNodes, LearningExperiment oracle) { var anotherUppermostSeedAcceptedNodes = seedCsts .SelectMany(cst => LearningExperimentUtil .GetUppermostNodesByNames(cst, SelectedNodeNames)) .Where(oracle.ProtectedIsAcceptedUsingOracle) .ToList(); var b1 = !uppermostSeedAcceptedNodes.All(oracle.IsAcceptedUsingOracle); var b2 = anotherUppermostSeedAcceptedNodes .Select(node => node.AncestorWithSingleChild()) .Any(e => !uppermostSeedAcceptedNodes.Contains(e)); var b3 = uppermostSeedAcceptedNodes.Count != anotherUppermostSeedAcceptedNodes.Count; Console.WriteLine("Initial: " + string.Join(", ", oracle.OracleNames)); Console.WriteLine("Learned: " + string.Join(", ", SelectedNodeNames)); if (b1 || b2 || b3) { Console.WriteLine("--------------------------------------------------"); foreach (var e in uppermostSeedAcceptedNodes) { Console.WriteLine(e); } Console.WriteLine("--------------------------------------------------"); foreach (var e in anotherUppermostSeedAcceptedNodes) { Console.WriteLine(e); } throw new Exception("Wrong Oracle."); } }
private IEnumerable <CstNode> CreateRejectedNodes( IEnumerable <CstNode> csts, ICollection <CstNode> acceptedNodes) { var uppermostNodes = csts .SelectMany(cst => LearningExperimentUtil .GetUppermostNodesByNames(cst, SelectedNodeNames)); return(uppermostNodes.Where(node => !acceptedNodes.Contains(node))); }
private static IEnumerable <string> SelectNodeNames( ICollection <CstNode> uppermostSeedAcceptedNodes) { return(LearningExperimentUtil.FindGoodNodeNames(uppermostSeedAcceptedNodes)); }