Last change
on this file since 14477 was
14477,
checked in by abeham, 7 years ago
|
#2701:
- Added TryGetBy(First|Second) method to BidirectionalDictionary
- Updated linear linkage encoding
- Added move generator and moves for shift, merge, split, and extract moves
- Added unit test (Apply/Undo)
- Updated MemPR (linear linkage)
- Fixed bug in MemPR (permutation)
- Updated Tests project
|
File size:
832 bytes
|
Rev | Line | |
---|
[14477] | 1 | using System;
|
---|
| 2 | using System.Linq;
|
---|
| 3 | using HeuristicLab.Encodings.LinearLinkageEncoding;
|
---|
| 4 | using HeuristicLab.Random;
|
---|
| 5 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
| 6 |
|
---|
| 7 | namespace HeuristicLab.Tests.HeuristicLab.Encodings.LinearLinkageEncoding {
|
---|
| 8 | [TestClass]
|
---|
| 9 | public class LinearLinkageMoveTests {
|
---|
| 10 | [TestMethod]
|
---|
| 11 | public void TestApplyUndo() {
|
---|
| 12 | var random = new MersenneTwister(42);
|
---|
| 13 | var lle = MaxGroupsLinearLinkageCreator.Apply(random, 32, 8);
|
---|
| 14 | var before = (LinearLinkage)lle.Clone();
|
---|
| 15 | var moves = 0;
|
---|
| 16 | foreach (var move in MoveGenerator.Generate(lle)) {
|
---|
| 17 | move.Apply(lle);
|
---|
| 18 | Assert.IsFalse(before.SequenceEqual(lle));
|
---|
| 19 | move.Undo(lle);
|
---|
| 20 | Assert.IsTrue(before.SequenceEqual(lle));
|
---|
| 21 | moves++;
|
---|
| 22 | }
|
---|
| 23 | Assert.IsTrue(moves > 0);
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.