Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/12/17 21:02:01 (7 years ago)
Author:
abeham
Message:

#2666, #2706, #2730, #2736: merged revisions 14412, 14475, 14476, 14659, 14660, 14663, 14779, 14780, 14912, 15050, 15067, 15069, 15079, 15162, 15166, 15172, 15173 to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Tests

  • stable/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GAGroupingProblemSampleTest.cs

    r14186 r15217  
    4949    public bool Maximization { get { return false; } }
    5050
    51     private bool[,] allowedTogether;
     51    private bool[,] adjacencyMatrix;
    5252     
    5353    public override void Initialize() {
    5454      var encoding = new LinearLinkageEncoding(""lle"", length: ProblemSize);
    55       allowedTogether = new bool[encoding.Length, encoding.Length];
     55      adjacencyMatrix = new bool[encoding.Length, encoding.Length];
    5656      var random = new System.Random(13);
    5757      for (var i = 0; i < encoding.Length - 1; i++)
    5858        for (var j = i + 1; j < encoding.Length; j++)
    59           allowedTogether[i, j] = allowedTogether[j, i] = random.Next(2) == 0;
     59          adjacencyMatrix[i, j] = adjacencyMatrix[j, i] = random.Next(2) == 0;
    6060     
    6161      Encoding = encoding;
     
    6868        for (var j = 0; j < groups[i].Count; j++)
    6969          for (var k = j + 1; k < groups[i].Count; k++)
    70             if (!allowedTogether[groups[i][j], groups[i][k]]) penalty++;
     70            if (!adjacencyMatrix[groups[i][j], groups[i][k]]) penalty++;
    7171      }
    72       if (penalty > 0) return penalty + ProblemSize;
    73       else return groups.Count;
     72      var result = groups.Count;
     73      if (penalty > 0) result += penalty + ProblemSize;
     74      return result;
    7475    }
    7576
     
    105106      ga.SetSeedRandomly.Value = false;
    106107      SamplesUtils.RunAlgorithm(ga);
    107       Assert.AreEqual(26, SamplesUtils.GetDoubleResult(ga, "BestQuality"));
    108       Assert.AreEqual(27.58, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"));
    109       Assert.AreEqual(105, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"));
     108      Assert.AreEqual(127, SamplesUtils.GetDoubleResult(ga, "BestQuality"));
     109      Assert.AreEqual(129,38, SamplesUtils.GetDoubleResult(ga, "CurrentAverageQuality"));
     110      Assert.AreEqual(132, SamplesUtils.GetDoubleResult(ga, "CurrentWorstQuality"));
    110111      Assert.AreEqual(99100, SamplesUtils.GetIntResult(ga, "EvaluatedSolutions"));
    111112    }
     
    121122      #endregion
    122123      #region Algorithm Configuration
    123       ga.Name = "Genetic Algorithm - Grouping Problem";
    124       ga.Description = "A genetic algorithm which solves a grouping problem using the linear linkage encoding.";
     124      ga.Name = "Genetic Algorithm - Graph Coloring";
     125      ga.Description = "A genetic algorithm which solves a graph coloring problem using the linear linkage encoding.";
    125126      ga.Problem = problem;
    126127      SamplesUtils.ConfigureGeneticAlgorithmParameters<TournamentSelector, MultiLinearLinkageCrossover, MultiLinearLinkageManipulator>(
Note: See TracChangeset for help on using the changeset viewer.