Beispiel #1
0
        // results in "qap/results/testName"
        public void test(string testName)
        {
            QAPProblem problem = problemFromFile(testName);

            //configuration
            GlobalConfiguration globalConfig = new GlobalConfiguration()
            {
                maximize = false
            };

            globalConfig.configurations = new List <IslandConfiguration>();
            globalConfig.configurations.Add(new IslandConfiguration(algorithm.enums.EvolutionStrategy.Tournament, 0.01, 0.1, 20, 10, 1));
            globalConfig.configurations.Add(new IslandConfiguration(algorithm.enums.EvolutionStrategy.Tournament, 0.02, 0.05, 30, 10, 1));
            globalConfig.configurations.Add(new IslandConfiguration(algorithm.enums.EvolutionStrategy.Tournament, 0.05, 0.02, 20, 10, 1));
            globalConfig.configurations.Add(new IslandConfiguration(algorithm.enums.EvolutionStrategy.Tournament, 0.1, 0.01, 30, 10, 1));
            globalConfig.connections = new List <int> [globalConfig.configurations.Count];
            for (int i = 0; i < globalConfig.configurations.Count; i++)
            {
                globalConfig.connections[i] = new List <int>();
            }
            //globalConfig.connections[0].Add(3);
            //globalConfig.connections[1].Add(3);
            //globalConfig.connections[2].Add(3);
            globalConfig.evolutionTimeInSeconds = 25;
            globalConfig.generator = new QAPGenerator(problem);

            IslandSupervisor supervisor = new IslandSupervisor(globalConfig);
            QAPIndividual    result     = (QAPIndividual)supervisor.getResult();

            foreach (int i in result.permutation)
            {
                Console.WriteLine(i.ToString() + " ");
            }
            //int result = 5;
            saveResult(result.value(), testName);
        }
Beispiel #2
0
 public QAPGenerator(QAPProblem problem)
 {
     this.problem = problem;
 }
Beispiel #3
0
 public QAPGenerator(QAPProblem problem)
 {
     this.problem = problem;
 }
Beispiel #4
0
 public QAPIndividual(QAPProblem problem, int[] value)
 {
     this.problem = problem;
     permutation = value;
 }
Beispiel #5
0
 public QAPIndividual(QAPProblem problem, int[] value)
 {
     this.problem = problem;
     permutation  = value;
 }