示例#1
0
        private static void SolveTestProblem()
        {
            TestKnowledgeBase           kb            = new TestKnowledgeBase(2);
            TestDomainConstraintsSource source        = new TestDomainConstraintsSource(kb);
            GKOConfiguration            configuration = new GKOConfiguration();
            StructuralReasoner          reasoner;

            //List<GKOConstraintType> types = StructuralRelationsManager.GenerateConstraintTypes();
            //int notRight = 0;

            //foreach (var type in types)
            //{
            //    foreach (var tuple in type.Tuples)
            //    {
            //        for (int i = 0; i < tuple.Count; i++)
            //        {
            //            if (type.Signature[i] is GKODomain)
            //            {
            //                GKODomain domain = type.Signature[i] as GKODomain;
            //                if (!domain.Values.Contains(tuple[i]))
            //                {
            //                    notRight++;
            //                }
            //            }
            //        }
            //    }
            //}

            configuration.StructuringContexts = kb.StructuringContexts;
            configuration.Components          = kb.Components;
            configuration.Components.ForEach(x => x.Active = true);

            configuration.StructuringContexts[0].Active = true;
            configuration.StructuringContexts[0].IncludedRelationFamilies.Clear();
            configuration.StructuringContexts[0].IncludedRelationFamilies.Add(StructuralRelationsManager.MetricRelationsFamily);

            reasoner = new StructuralReasoner();
            reasoner.Options.MetricReasoningAlgorithm = MetricReasoningAlgorithm.CdaStar;
            reasoner.Options.MaxMetricValue           = 35;

            reasoner.ConfigureTms();

            //reasoner.Solve(configuration, source);
        }
示例#2
0
        public void ReasonerGeneralTest1()
        {
            TestKnowledgeBase           kb            = new TestKnowledgeBase(6);
            TestDomainConstraintsSource source        = new TestDomainConstraintsSource(kb);
            GKOConfiguration            configuration = new GKOConfiguration();
            StructuralReasoner          reasoner;

            configuration.StructuringContexts = kb.StructuringContexts;
            configuration.Components          = kb.Components;
            configuration.Components.ForEach(x => x.Active = true);

            configuration.StructuringContexts[0].Active = true;
            configuration.StructuringContexts[0].IncludedRelationFamilies.Clear();
            configuration.StructuringContexts[0].IncludedRelationFamilies.Add(StructuralRelationsManager.MetricRelationsFamily);
            //configuration.StructuringContexts[0].IncludedRelationFamilies.Add(StructuralRelationsManager.ExtendedPointAlgebra);

            reasoner = new StructuralReasoner();
            reasoner.Options.MetricReasoningAlgorithm = MetricReasoningAlgorithm.CdaStar;
            reasoner.Options.MaxMetricValue           = 6;

            reasoner.ConfigureTms();
            var result = reasoner.Solve(configuration, source);
        }