Exemplo n.º 1
0
        public static void CreateTestLogContent(out InMemoryLogger logger, out Dictionary<string, string> strMsg, out Dictionary<string, string> popTags)
        {
            logger = new InMemoryLogger();
            strMsg =
                      new Dictionary<string, string>()
                      {
                        {"Message", "the string message"},
                        {"Category", "the string category"}
                      };

            logger.Write("String message", strMsg);

            var evaluator = new IdentityObjEval();
            var inPoints = new List<TestHyperCube>();
            inPoints.Add(createPoint(1.0, 2.0, 3.0));
            inPoints.Add(createPoint(1.0, 2.2, 4.0));
            inPoints.Add(createPoint(2.0, 3.0, 5.0));
            var inScores = Array.ConvertAll(inPoints.ToArray(), (x => (IObjectiveScores)evaluator.EvaluateScore(x)));

            popTags = new Dictionary<string, string>()
                      {
                        {"Message", "initial population msg"},
                        {"Category", "initial population category"}
                      };

            logger.Write(inScores, popTags);
        }
Exemplo n.º 2
0
 public void TestInterpolator()
 {
     var evaluator = new IdentityObjEval();
     var inPoints = new List<TestHyperCube>();
     inPoints.Add(createPoint(1.0, 2.0, 3.0));
     inPoints.Add(createPoint(1.0, 2.0, 4.0));
     inPoints.Add(createPoint(2.0, 3.0, 5.0));
     var inScores = Array.ConvertAll( inPoints.ToArray(), (x => evaluator.EvaluateScore(x) ));
     var outPoints = MetaheuristicsHelper.InterpolateBetweenPoints<TestHyperCube>(evaluator, inScores, 0.1+1e-11);
     Assert.AreEqual(21, outPoints.Length);
     assertPoint(outPoints[0], 1.0, 2.0, 3.0);
     assertPoint(outPoints[1], 1.0, 2.0, 3.1);
     assertPoint(outPoints[10], 1.0, 2.0, 4.0);
     assertPoint(outPoints[15], 1.5, 2.5, 4.5);
 }
Exemplo n.º 3
0
        public static IEnumerable <IObjectiveScores> IdentityScores(params TestHyperCube[] inPoints)
        {
            var evaluator = new IdentityObjEval();

            return(new ObjResultsWrapper(Array.ConvertAll(inPoints.ToArray(), (x => (IObjectiveScores)evaluator.EvaluateScore(x)))));
        }