Exemplo n.º 1
0
        /// <summary>
        /// Configures the current gray box handler.
        /// </summary>
        private void ConfigureGrayBoxHandler()
        {
            var genomeTransformation       = new GenomeTransformation <CategoricalBinaryEncoding>(this._parameterTree);
            var genomeDoubleRepresentation =
                genomeTransformation.ConvertGenomeToArray(this._currentEvaluation.GenomeInstancePair.Genome.CreateMutableGenome());

            var tunerDataRecord = new TunerDataRecord <TResult>(
                NetworkUtils.GetFullyQualifiedDomainName(),
                this._currentEvaluation.GenerationId,
                this._currentEvaluation.TournamentId,
                this._currentEvaluation.GenomeInstancePair.Instance.ToId(),
                double.NaN,
                genomeTransformation.GetConverterColumnHeader(),
                genomeDoubleRepresentation,
                null);

            this._grayBoxHandler = new GrayBoxHandler <TInstance, TResult>(
                this._configuration,
                this._configuredTargetAlgorithm as IGrayBoxTargetAlgorithm <TInstance, TResult>,
                this._id,
                tunerDataRecord,
                this._currentEvaluation.UseGrayBoxInEvaluation && this._successfullyDeserializedGrayBoxRandomForest,
                this._customGrayBoxMethods,
                this._grayBoxRandomForest);
        }
Exemplo n.º 2
0
        public void TransformGeneToDoubleArrayOrdinal()
        {
            var tree = this.BuildCategoricalDomainParameterTree();

            // Set genes to values.
            this._genome.SetGene("1intDom", new Allele <int>(0));
            this._genome.SetGene("2intDom", new Allele <int>(1));
            this._genome.SetGene("3catDom", new Allele <int>(4));

            var converter = new GenomeTransformation <CategoricalOrdinalEncoding>(tree);

            var result = converter.ConvertGenomeToArray(this._genome);

            var expected = new[] { 0d, 1d, 3d };

            Assert.True(expected.SequenceEqual(result), "Expected different double-representation.");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets all competitive genomes as <see cref="GenomeDoubleRepresentation"/>.
        /// </summary>
        /// <returns>The competitive genomes as <see cref="GenomeDoubleRepresentation"/>.</returns>
        public List <GenomeDoubleRepresentation> GetAllCompetitiveGenomesAsGenomeDoubleRepresentation()
        {
            var converter = new GenomeTransformation <CategoricalBinaryEncoding>(this.ParameterTree);
            var listOfGenomeDoubleRepresentations = this.MostRecentSorting
                                                    .Select(point => (GenomeDoubleRepresentation)converter.ConvertGenomeToArray(point.Genome.CreateMutableGenome())).ToList();

            return(listOfGenomeDoubleRepresentations);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets all competitive genomes as <see cref="GenomeDoubleRepresentation"/>.
        /// </summary>
        /// <returns>The competitive genomes as <see cref="GenomeDoubleRepresentation"/>.</returns>
        public List <GenomeDoubleRepresentation> GetAllCompetitiveGenomesAsGenomeDoubleRepresentation()
        {
            var converter = new GenomeTransformation <CategoricalBinaryEncoding>(this._parameterTree);
            var listOfGenomeDoubleRepresentations = this._population.GetCompetitiveIndividuals()
                                                    .Select(genome => (GenomeDoubleRepresentation)converter.ConvertGenomeToArray(genome)).ToList();

            return(listOfGenomeDoubleRepresentations);
        }