コード例 #1
0
        //====================================================================================
        public List <Case> FindAlternative_NonClustering(Case problem, string sim)
        {
            List <Case>   NonClusterdArrCases = new List <Case>();
            DefaultEngine _engine             = new DefaultEngine();

            Db.set_xml(sim, casename, tablename);
            ArrayList myarr = Db.get_cases_as_arraylist_condition(standrize_table, casename);

            // get particular cluster
            _engine.SetEnvironmentVariable(_env);
            _engine.SetProblem(problem);
            _engine.Startup();
            ArrayList cases          = _engine.Run_caseRetrieval_partial(myarr);
            int       count_solution = cases.Count;

            if (count_solution != 0)
            {
                Stat ss = null;
                Case cc = null;
                for (int i = 0; i < cases.Count; i++)
                {
                    ss = (Stat)(cases[i]);
                    cc = ss.GetCBRCase();
                    NonClusterdArrCases.Add(cc);
                }
            }
            return(NonClusterdArrCases);
        }
コード例 #2
0
        //=================================================================================

        public List <Case> FindAlternative_SMF(Case problem, string sim)
        {
            List <Case>   ClusterdArrCases = new List <Case>();
            DefaultEngine _engine          = new DefaultEngine();

            Db.set_xml(sim, casename, tablename);
            // centroids = new List<Case>();
            Kmeans    kmeans = new Kmeans();
            ArrayList current_cases_partial = new ArrayList();

            // get centroids
            //centroids = Db.get_Centroids(standrize_table, casename);
            // know which cluster
            ClusterdArrCases = new List <Case>();
            current_cases_partial.Clear();
            int t = kmeans.findCluster_customize(problem, centroids);

            // get particular cluster
            current_cases_partial = Db.get_cases_condition_cluster_arraylist(standrize_table, casename, "cluster", t.ToString());

            _engine.SetEnvironmentVariable(_env);
            _engine.SetProblem(problem);
            // Run the reasoning engine
            _engine.Startup();
            ArrayList mcases         = _engine.Run_caseRetrieval_partial(current_cases_partial);
            int       count_solution = mcases.Count;

            if (count_solution != 0)
            {
                Stat ss = null;
                Case cc = null;
                for (int i = 0; i < mcases.Count; i++)
                {
                    ss = (Stat)(mcases[i]);
                    cc = ss.GetCBRCase();
                    ClusterdArrCases.Add(cc);
                }
            }

            return(ClusterdArrCases);
        }