Exemplo n.º 1
0
        /// <summary>
        /// Called before every test case.
        /// </summary>
        protected override void InitializeDefault()
        {
            var parameterTree = this.GetDefaultParameterTree();
            var configuration = this.GetDefaultAlgorithmTunerConfiguration();
            var genomeBuilder = new GenomeBuilder(parameterTree, configuration);

            this._originalIncumbent = genomeBuilder.CreateRandomGenome(age: 2);

            for (int i = 0; i < 5; i++)
            {
                var searchPoint = PartialGenomeSearchPoint.CreateFromGenome(
                    genomeBuilder.CreateRandomGenome(age: 0),
                    parameterTree,
                    minimumDomainSize: 0);
                this._mostRecentSorting.Add(searchPoint);
                this._currentEvaluationInstances.Add(new TestInstance(i.ToString()));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates <paramref name="count"/> random genomes adhering to the given <see cref="ParameterTree"/>.
        /// </summary>
        /// <param name="tree"><see cref="ParameterTree"/> to base genomes on.</param>
        /// <param name="config"><see cref="AlgorithmTunerConfiguration"/> to use when creating genomes.</param>
        /// <param name="count">The number of genomes to create.</param>
        /// <returns>The created genomes.</returns>
        public static List <Genome> GenerateGenomes(ParameterTree tree, AlgorithmTunerConfiguration config, int count)
        {
            var result = new List <Genome>(count);

            var builder = new GenomeBuilder(tree, config);

            for (var i = 0; i < count; i++)
            {
                result.Add(builder.CreateRandomGenome(0));
            }

            return(result);
        }
Exemplo n.º 3
0
        public void AllDummyParametersAreFiltered()
        {
            Randomizer.Reset();
            Randomizer.Configure(0);
            var parameterTree = GurobiUtils.CreateParameterTree();
            var config        = new AlgorithmTunerConfiguration.AlgorithmTunerConfigurationBuilder().Build(1);
            var genomeBuilder = new GenomeBuilder(parameterTree, config);

            var genome = genomeBuilder.CreateRandomGenome(0);

            var filteredGenes = genome.GetFilteredGenes(parameterTree);

            foreach (var filteredGenesKey in filteredGenes.Keys)
            {
                filteredGenesKey.ShouldNotContain("Indicator");
            }
        }