示例#1
0
        public void Run()
        {
            //retrieve similarity case
            ICaseRetrieval caseRetrieval = CasePhaseFactory.GetCaseRetrieval();

            caseRetrieval.SetEnv(_name);
            ArrayList cases = caseRetrieval.RetrievalCases(_problem);
            //reuse case
            ICaseReuse caseReuse = CasePhaseFactory.GetCaseReuse();

            caseReuse.SetEnv(_name);
            Case solution = caseReuse.ReuseCase(cases);

            #region only for test
            if (Version.DEBUG && solution != null)
            {
                System.Console.WriteLine("=====case reuse result====");
                foreach (Feature f in solution.GetFeatures())
                {
                    System.Console.WriteLine(f.GetFeatureName() + "\t" + f.GetFeatureValue());
                }
                System.Console.WriteLine("=====end of case reuse result=====");
            }
            #endregion
            //revise case
            ICaseRevise caseRevise = CasePhaseFactory.GetCaseRevise();
            caseRevise.SetEnv(_name);
            Case evaluateSolution = caseRevise.ReviseCase(solution);
            //restore case
            ICaseRestore caseRestore = CasePhaseFactory.GetCaseRestore();
            caseRestore.SetEnv(_name);
            caseRestore.RestoreCase(evaluateSolution);
        }
    public void Run(Case solution)
    {
        //revise case
        ICaseRevise caseRevise = CasePhaseFactory.GetCaseRevise();

        caseRevise.SetEnv(_name);
        Case evaluateSolution = caseRevise.ReviseCase(solution);
        //restore case
        ICaseRestore caseRestore = CasePhaseFactory.GetCaseRestore();

        caseRestore.SetEnv(_name);
        caseRestore.RestoreCase(evaluateSolution);
    }