示例#1
0
        public void AddOneHyperParameter_SuccessfullySaved()
        {
            hyperParameters.AddOrReplaceHyperParameter(hyperParams.ElementAt(0), values.ElementAt(0));

            Assert.True(hyperParameters.GetHyperParameterNames().Length == 1);

            Assert.Equal(values.ElementAt(0),
                         hyperParameters.GetHyperParameterValue <double>(Prefix + "0"));
        }
示例#2
0
        /// <summary>
        /// Constructs a new Nelder-Mead Simplex local search optimiser.
        /// </summary>
        /// <param name="fitnessCalculator">A <see cref="FitnessCalculatorSingleObjective"/>. <see cref="Optimiser"/></param>
        /// <param name="initialLocation">Starting location for the search.</param>
        /// <param name="hyperParameters">
        /// Instance of <see cref="HyperParameterManager"/> containing values for
        /// all the coefficients required by <see cref="NelderMeadHyperParameters"/>.
        /// </param>
        public NelderMead(
            IFitnessCalculator fitnessCalculator,
            DecisionVector initialLocation,
            HyperParameterManager hyperParameters) :
            base(new Simplex(initialLocation.Count), fitnessCalculator)
        {
            // Set up simplex operations
            OperationsManager = new NelderMeadSimplexOperationsManager(hyperParameters);

            //Set up simplex
            InitialVerticesStillUnevaluated = Simplex.CreateInitialVertices(
                initialLocation,
                hyperParameters.GetHyperParameterValue <double>(NelderMeadHyperParameters.Simplex_Creation_Step_Size));

            //Initialise historian
            tempProgress.Add(NelderMeadSimplexOperations.R);
        }
示例#3
0
 /// <summary>
 /// Creates an Evolutionary Algorithm.
 /// </summary>
 /// <param name="initialPopulation">The initial population (can be empty).</param>
 /// <param name="fitnessCalculator">A <see cref="FitnessCalculatorSingleObjective"/>. <see cref="Optimiser"/></param>
 /// <param name="initialIndividualGenerator">Creates new decision vectors to build the first population. <seealso cref="Base.Conversion.IModel"/></param>
 /// <param name="parentSelector">The <see cref="IParentSelectionOperator"/> to use.</param>
 /// <param name="recombinationOperator">The <see cref="IRecombinationOperator"/> to use.</param>
 /// <param name="mutationOperator">The <see cref="IMutationOperator"/> to use.</param>
 /// <param name="reinsertionOperator">The <see cref="IReinsertionOperator"/> to use.</param>
 /// <param name="hyperParameters">The <see cref="HyperParameterManager"/> object with relevant settings.</param>
 public EvolutionaryAlgorithm(
     Population initialPopulation,
     IFitnessCalculator fitnessCalculator,
     Func <DecisionVector> initialIndividualGenerator,
     IParentSelectionOperator parentSelector,
     IRecombinationOperator recombinationOperator,
     IMutationOperator mutationOperator,
     IReinsertionOperator reinsertionOperator,
     HyperParameterManager hyperParameters)
     : base(initialPopulation, fitnessCalculator)
 {
     this.initialIndividualGenerator = initialIndividualGenerator;
     this.parentSelector             = parentSelector;
     numberOfParents            = hyperParameters.GetHyperParameterValue <int>(EvolutionaryAlgorithmHyperParameters.Number_Of_Parents);
     this.recombinationOperator = recombinationOperator;
     this.mutationOperator      = mutationOperator;
     this.reinsertionOperator   = reinsertionOperator;
 }