private void CompareScoreMethods(VectorPicture vectorPicture, PolygonChanged mutation, Bitmap image)
 {
     var algorithm = new TestAlgorithm(image, vectorPicture, PictureMutationAlgorithm.ScoringMethodEnum.FullEvaluationScoring);
     var scores = new List<double>(scorers.Length);
     foreach (var scorer in scorers.Select(sf => sf(algorithm)))
     {
         algorithm.SetInitial();
         scorer.FoundBetter(vectorPicture);
         scores.Add(scorer.GetError(mutation));
     }
     Assert.IsTrue(scores.Distinct().Count() == 1);
 }
 public void ScoreMethodsAreEquivalentWeak()
 {
     foreach (var polygon in testPolygons)
     {
         var vectorPicture = new VectorPicture();
         vectorPicture.Polygons.Add(polygon);
         var mutation = new PolygonChanged(polygon, 0);
         CompareScoreMethods(vectorPicture, mutation);
     }
 }
 private void CompareScoreMethods(VectorPicture vectorPicture, PolygonChanged mutation)
 {
     foreach (var image in testImages)
     {
         CompareScoreMethods(vectorPicture,mutation,image);
     }
 }
 public void ScoreMethodsAreEquivalentLeftRightPolygon()
 {
     var vectorPicture = new VectorPicture();
     vectorPicture.Polygons.Add(LeftPolygon());
     var mutation = new PolygonChanged(RightPolygon(), 0);
     CompareScoreMethods(vectorPicture,mutation,Properties.Resources.whiteRectangle);
 }
 public void ScoreMethodsAreEquivalentCase2()
 {
     var polygon = new Polygon(Color.White);
     polygon.AddPoint(5, 7);
     polygon.AddPoint(10, 5);
     polygon.AddPoint(7, 15);
     var picture = new VectorPicture();
     picture.Polygons.Add(polygon);
     var mutationPolygon = new Polygon(Color.White);
     mutationPolygon.AddPoint(6, 0);
     mutationPolygon.AddPoint(5, 0);
     mutationPolygon.AddPoint(19, 18);
     mutationPolygon.AddPoint(18, 1);
     var mutation = new PolygonChanged(mutationPolygon, 0);
     CompareScoreMethods(picture, mutation, Resources.Polygon);
 }
 public void ScoreMethodsAreEquivalentCase1()
 {
     var polygon = new Polygon(Color.White);
     polygon.AddPoint(8,13);
     polygon.AddPoint(7,1);
     polygon.AddPoint(11,14);
     var picture = new VectorPicture();
     picture.Polygons.Add(polygon);
     var mutationPolygon = new Polygon(Color.White);
     mutationPolygon.AddPoint(1, 4);
     mutationPolygon.AddPoint(13, 0);
     mutationPolygon.AddPoint(17, 15);
     mutationPolygon.AddPoint(2, 10);
     var mutation = new PolygonChanged(mutationPolygon, 0);
     CompareScoreMethods(picture,mutation,Resources.Polygon);
 }
 public void ScoreMethodsAreEquivalent()
 {
     foreach (var polygonPair in testPolygons.ShakeHands())
     {
         var vectorPicture = new VectorPicture();
         vectorPicture.Polygons.Add(polygonPair.Item1);
         var mutation = new PolygonChanged(polygonPair.Item2, 0);
         CompareScoreMethods(vectorPicture, mutation);
     }
 }
 public void ErrorDataFakeChangePolygonHasNoEffect()
 {
     foreach (var polygon in testPolygons)
     {
         var vectorPicture = new VectorPicture();
         vectorPicture.Polygons.Add(polygon);
         var mutation = new PolygonChanged(polygon, 0);
         var noMutation = new EmptyMutation();
         var testAlgorithms = testImages.Select(image => new TestAlgorithm(image, vectorPicture, PictureMutationAlgorithm.ScoringMethodEnum.FullEvaluationScoring));
         foreach (var scorer1 in testAlgorithms.Select(algorithm => new ErrorDataScoring(algorithm.SourceData)))
         {
             scorer1.FoundBetter(vectorPicture);
             Assert.AreEqual(scorer1.GetError(noMutation), scorer1.GetError(mutation));
         }
     }
 }