예제 #1
0
 public override AbstractTrack Clone()
 {
     UnclosedTrack track = new UnclosedTrack(this.Genotype, _graph);
     track.FirstParent = this.FirstParent;
     track.SecondParent = this.SecondParent;
     return (AbstractTrack)track;
 }
 public void MyTestInitialize()
 {
     int[,] ribs = new int[6, 2] { { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } };
     double[] weights = new double[] { 3, 5, 10, 7, 8, 9 };
     _graph = new UndirectedConnectedGraph(ribs, weights);
     int[] trackPoints = new int[] { 0, 2, 1, 3 };
     _mutant = new UnclosedTrack(trackPoints, _graph);
     _subject = new UnclosedTrack(trackPoints, _graph);
 }
 public void MyTestInitialize()
 {
     int[,] ribs = new int[6, 2] { { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } };
     double[] weights = new double[] { 3, 5, 10, 7, 8, 9 };
     _graph = new UndirectedConnectedGraph(ribs, weights);
     _parents = new AbstractTrack[2];
     int[] trackPoints1 = new int[] { 0, 2, 1, 3 };
     int[] trackPoints2 = new int[] { 1, 3, 0, 2 };
     _parents[0] = new UnclosedTrack(trackPoints1, _graph);
     _parents[1] = new UnclosedTrack(trackPoints2, _graph);
 }
 public void MyTestInitialize()
 {
     int[] trackPoints1 = new int[] { 0, 2, 1, 3 };
     int[] trackPoints2 = new int[] { 1, 3, 0, 2 };
     _parent1 = new UnclosedTrack(trackPoints1, _graph);
     _parent2 = new UnclosedTrack(trackPoints2, _graph);
     _child1 = new UnclosedTrack(CountOfAllele, _graph, false);
     _child2 = new UnclosedTrack(CountOfAllele, _graph, false);
     int[,] ribs = new int[6, 2] { { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } };
     double[] weights = new double[] { 3, 5, 10, 7, 8, 9 };
     _graph = new UndirectedConnectedGraph(ribs, weights);
 }
        public void MyTestInitialize()
        {
            int[,] ribs = new int[6, 2] { { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 1, 3 }, { 2, 3 } };
            double[] weights = new double[] { 3, 5, 10, 7, 8, 9 };
            _graph = new UndirectedConnectedGraph(ribs, weights);

            _parents = new AbstractTrack[CountOfTracks];
            _parents[0] = new UnclosedTrack(new int[] { 0, 1, 3, 2 }, _graph);
            _parents[1] = new UnclosedTrack(new int[] { 1, 0, 2, 3 }, _graph);
            _parents[2] = new UnclosedTrack(new int[] { 2, 0, 3, 1 }, _graph);

            _childs = new AbstractTrack[CountOfTracks];
            _childs[0] = new UnclosedTrack(new int[] { 2, 1, 0, 3 }, _graph);
            _childs[1] = new UnclosedTrack(new int[] { 0, 3, 2, 1 }, _graph);
            _childs[2] = new UnclosedTrack(new int[] { 0, 1, 2, 3 }, _graph);
        }
예제 #6
0
 public override AbstractTrack EmptyClone()
 {
     UnclosedTrack track = new UnclosedTrack(this.Genotype.Length, _graph, false);
     return (AbstractTrack) track;
 }
 public void UnclosedTrackConstructorTest()
 {
     AbstractTrack track = new UnclosedTrack(CountOfAllele, _graph, true);
     Assert.IsTrue(track.Genotype.Length == CountOfAllele);
     Assert.IsTrue(track.Genotype[0] != track.Genotype[track.Genotype.Length - 1]);
     Assert.IsFalse(Array.Exists(track.Genotype, NegativeNumber));
     Assert.IsFalse(Array.Exists(track.Genotype, UpperLimitNumber));
     Assert.IsTrue(track.TypeOfCrossingover == AbstractCrossingover.WithoutCrossingover);
     Assert.IsTrue(track.TypeOfMutation == AbstractMutation.WithoutMutation);
     Assert.IsTrue(track.TypeOfSelection == AbstractSelection.WithoutSelection);
 }