public void LoadEvolutionParametersFromJsonTest()
        {
            EvolutionParameters parameters = JsonConvert.DeserializeObject <EvolutionParameters>(EvolutionParamterJson);

            Assert.AreEqual(PopulationSize, parameters.PopulationSize);
            Assert.AreEqual(Iterations, parameters.Iterations);
            Assert.AreEqual(RoundEval, parameters.RoundEvaluation);
            Assert.AreEqual(ParentSelectionPercentage, parameters.ParentSelectionPercentage);
            Assert.AreEqual(ChildMutationPercentage, parameters.ChildMutationPercentage);
            Assert.AreEqual(ElitismSelectedPercentage, parameters.ElitismSelectedPercentage);
            Assert.AreEqual(ElitismPoolSizePercentage, parameters.ElitismPoolSizePercentage);

            Assert.AreEqual(ScoreConnectTwoMin, parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.ScoreConnectTwo));
            Assert.AreEqual(ScoreConnectTwoMax, parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.ScoreConnectTwo));

            Assert.AreEqual(ScoreConnectThreeMin, parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.ScoreConnectThree));
            Assert.AreEqual(ScoreConnectThreeMax, parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.ScoreConnectThree));

            Assert.AreEqual(ScoreConnectFourMin, parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.ScoreConnectFour));
            Assert.AreEqual(ScoreConnectFourMax, parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.ScoreConnectFour));

            Assert.AreEqual(GiveScoreConnectTwoMin, parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.GiveConnectTwo));
            Assert.AreEqual(GiveScoreConnectTwoMax, parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.GiveConnectTwo));

            Assert.AreEqual(GiveScoreConnectThreeMin, parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.GiveConnectThree));
            Assert.AreEqual(GiveScoreConnectThreeMax, parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.GiveConnectThree));

            Assert.AreEqual(GiveScoreConnectFourMin, parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.GiveConnectFour));
            Assert.AreEqual(GiveScoreConnectFourMax, parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.GiveConnectFour));
        }
예제 #2
0
        /// <summary>
        /// Localises evolutionary parameters related to score boundaries for candidates.
        /// </summary>
        /// <param name="parameters">Evolution parameters.</param>
        private static void SetupScoreParameters(EvolutionParameters parameters)
        {
            _scoreConnectTwoMin = parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.ScoreConnectTwo);
            _scoreConnectTwoMax = parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.ScoreConnectTwo);

            _scoreConnectThreeMin = parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.ScoreConnectThree);
            _scoreConnectThreeMax = parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.ScoreConnectThree);

            _scoreConnectFourMin = parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.ScoreConnectFour);
            _scoreConnectFourMax = parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.ScoreConnectFour);

            _scoreGivingConnectTwoMin = parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.GiveConnectTwo);
            _scoreGivingConnectTwoMax = parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.GiveConnectTwo);

            _scoreGivingConnectThreeMin = parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.GiveConnectThree);
            _scoreGivingConnectThreeMax = parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.GiveConnectThree);

            _scoreGivingConnectFourMin = parameters.GetCandidateScoreParameterMin(CandidateScoreTypes.GiveConnectFour);
            _scoreGivingConnectFourMax = parameters.GetCandidateScoreParameterMax(CandidateScoreTypes.GiveConnectThree);
        }