Ejemplo n.º 1
0
        public static double Evaluate(Individual individual, FeatureCollection features, string path, Robot robot,
                                      IEnumerable <IndexedItem <StringValue> > enemies, string robotName = null, bool showUI = false, int nrOfRounds = 200)
        {
            if (robotName == null)
            {
                robotName = GenerateRobotName();
            }
            RealVector realVector = individual.BpEaRealVector();

            double[] featureWeights = realVector.ToArray();
            String   indStr         = "";

            for (int i = 0; i < features.Count; i++)
            {
                indStr += featureWeights[i] + "*" + features.CheckedItems.ToArray()[i].Value.Name;
                if (i < features.Count - 1)
                {
                    indStr += "+";
                }
            }

            return(RunGamesLocaly(@"c:\Thesis\robocode", indStr, robot.FullName, enemies.ToArray()[0].Value.Value, robotName, nrOfRounds));
        }
Ejemplo n.º 2
0
        public static RealVectorEncoding.RealVector BpEaRealVector(this Individual individual)
        {
            var encoding = individual.GetEncoding <BpEaRealVectorEncoding>();

            return(individual.BpEaRealVector(encoding.Name));
        }