Esempio n. 1
0
        private void test()
        {
            Graph1 = WMH.Model.GraphGenerator.GraphGenerator.generateGraph(4);
            Graph2 = WMH.Model.GraphGenerator.GraphGenerator.generateGraph(4);

            ltm  = new LongTermMemory(10);
            tl   = new TabuList(10);
            isc  = new IterationStopCriteria(100);
            ncsc = new NoChangesStopCriteria(10);
            csc  = new CostStopCriteria(1000);
        }
Esempio n. 2
0
 private void parametersAlg(object sender, EventArgs e)
 {
     try
     {
         AlgorithmParametersView apv = new AlgorithmParametersView();
         apv.ShowDialog();
         ltm  = new LongTermMemory(apv.longTermMemory);
         tl   = new TabuList(apv.tabuList);
         isc  = new IterationStopCriteria(apv.IterationStopCrit);
         ncsc = new NoChangesStopCriteria(apv.NoChangeStopCrit);
         csc  = new CostStopCriteria(apv.CostCrit);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
        private void StartAlgorithm(int vertexNumber, int ltmLenght, int stmLenght, int endCryt, int noChangeFor, double costLessThan, int?numberOfLoop)
        {
            string currentDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string pathG1, pathG2, pathResult;

            if (numberOfLoop != null)
            {
                pathG1     = currentDir + "\\g1\\graph" + numberOfLoop;
                pathG2     = currentDir + "\\g2\\graph" + numberOfLoop;
                pathResult = currentDir + "\\result\\res" + numberOfLoop;
            }
            else
            {
                pathG1     = currentDir + "\\g1\\graph";
                pathG2     = currentDir + "\\g2\\graph";
                pathResult = currentDir + "\\result\\res";
            }
            Graph Graph1 = GraphGenerator.generateGraph(vertexNumber);

            WMH.Model.FileOperation.FileOperationGraph.SaveToFile(pathG1, Graph1.Vertexes);
            Graph Graph2 = GraphGenerator.generateGraph(vertexNumber);

            WMH.Model.FileOperation.FileOperationGraph.SaveToFile(pathG2, Graph2.Vertexes);

            LongTermMemory        ltm  = new LongTermMemory(ltmLenght);
            TabuList              tl   = new TabuList(stmLenght);
            IterationStopCriteria isc  = new IterationStopCriteria(endCryt);
            NoChangesStopCriteria ncsc = new NoChangesStopCriteria(noChangeFor);
            CostStopCriteria      csc  = new CostStopCriteria(costLessThan);

            WMH.TabuSearch.CostFinder      cf = new TabuSearch.CostFinder();
            WMH.TabuSearch.NeighbourFinder nf = new TabuSearch.NeighbourFinder(cf, ltm);
            WMH.TabuSearch.Implementation.AspirationCriteria ac = new TabuSearch.Implementation.AspirationCriteria(cf);
            WMH.TabuSearch.TabuSearch alg = new TabuSearch.TabuSearch(nf, tl, ltm, cf, ac, isc, ncsc, csc);

            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            IList <Edge> result = alg.FindSolution(Graph1, Graph2);

            stopWatch.Stop();


            WMH.Model.FileOperation.FileOperationResult.SaveResultToFile(result, pathResult, stopWatch);
        }