Exemple #1
0
        public HyperParameterManagerTests()
        {
            hyperParams = new List <IVariable>();
            values      = new List <double>();

            for (var i = 0; i < 3; i++)
            {
                hyperParams.Add(new VariableContinuous(name: Prefix + $"{i}"));
                values.Add(i);
            }

            hyperParameters = new HyperParameterManager();
        }
Exemple #2
0
 public EvolutionaryAlgorithmBuilderContinuousMO(
     Population population,
     DecisionSpace decisionSpace,
     HyperParameterManager hyperParameters,
     IParentSelectionOperator parentSelector,
     IRecombinationOperator recombinationOperator,
     IMutationOperator mutationOperator,
     IReinsertionOperator reinsertionOperator)
 {
     this.decisionSpace = decisionSpace;
     HyperParameters.AddFromExistingHyperParameterSet(hyperParameters);
     this.population            = population;
     this.parentSelector        = parentSelector;
     this.recombinationOperator = recombinationOperator;
     this.mutationOperator      = mutationOperator;
     this.reinsertionOperator   = reinsertionOperator;
 }
Exemple #3
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);
        }
        public static HyperParameterManager GetDefaultHyperParameters()
        {
            var mgr = new HyperParameterManager();

            mgr.AddOrReplaceHyperParameter(
                new VariableDiscrete(5, 10000,
                                     10, 1000,
                                     Population_Size),
                100);

            mgr.AddOrReplaceHyperParameter(
                new VariableDiscrete(2, 1000,
                                     2, 200,
                                     Number_Of_Parents),
                40);

            return(mgr);
        }
 /// <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;
 }
Exemple #6
0
        public static HyperParameterManager GetDefaultHyperParameters()
        {
            var mgr = new HyperParameterManager();

            mgr.AddOrReplaceHyperParameter(
                new VariableContinuous(0.001, 100,
                                       0.001, 100,
                                       Simplex_Creation_Step_Size),
                0.5);

            mgr.AddOrReplaceHyperParameter(
                new VariableContinuous(0.001, double.MaxValue,
                                       0.5, 2,
                                       Reflection_Coefficient),
                1.0);

            mgr.AddOrReplaceHyperParameter(
                new VariableContinuous(1.001, double.MaxValue,
                                       1.1, 5,
                                       Expansion_Coefficient),
                2.0);

            mgr.AddOrReplaceHyperParameter(
                new VariableContinuous(0.001, 1.0,
                                       0.01, 0.9,
                                       Contraction_Coefficient),
                0.5);

            mgr.AddOrReplaceHyperParameter(
                new VariableContinuous(0.001, 1.0,
                                       0.01, 0.9,
                                       Shrinkage_Coefficient),
                0.5);

            return(mgr);
        }
 public NelderMeadBuilder(DecisionSpace decisionSpace, HyperParameterManager hyperParameters)
 {
     this.decisionSpace = decisionSpace;
     HyperParameters.AddFromExistingHyperParameterSet(hyperParameters);
 }