本文整理汇总了C#中BasicNetwork.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# BasicNetwork.Clone方法的具体用法?C# BasicNetwork.Clone怎么用?C# BasicNetwork.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasicNetwork
的用法示例。
在下文中一共展示了BasicNetwork.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NeuralGeneticAlgorithm
/// <summary>
/// Construct a neural genetic algorithm.
/// </summary>
///
/// <param name="network">The network to base this on.</param>
/// <param name="randomizer">The randomizer used to create this initial population.</param>
/// <param name="calculateScore">The score calculation object.</param>
/// <param name="populationSize">The population size.</param>
/// <param name="mutationPercent">The percent of offspring to mutate.</param>
/// <param name="percentToMate">The percent of the population allowed to mate.</param>
public NeuralGeneticAlgorithm(BasicNetwork network,
IRandomizer randomizer, ICalculateScore calculateScore,
int populationSize, double mutationPercent,
double percentToMate) : base(TrainingImplementationType.Iterative)
{
Genetic = new NeuralGeneticAlgorithmHelper
{
CalculateScore = new GeneticScoreAdapter(calculateScore)
};
IPopulation population = new BasicPopulation(populationSize);
Genetic.MutationPercent = mutationPercent;
Genetic.MatingPopulation = percentToMate*2;
Genetic.PercentToMate = percentToMate;
Genetic.Crossover = new Splice(network.Structure.CalculateSize()/3);
Genetic.Mutate = new MutatePerturb(4.0d);
Genetic.Population = population;
for (int i = 0; i < population.PopulationSize; i++)
{
var chromosomeNetwork = (BasicNetwork) (network
.Clone());
randomizer.Randomize(chromosomeNetwork);
var genome = new NeuralGenome(chromosomeNetwork) {GA = Genetic};
Genetic.PerformCalculateScore(genome);
Genetic.Population.Add(genome);
}
population.Sort();
}