本文整理汇总了C#中Generator.BuildRandomExpressionTree方法的典型用法代码示例。如果您正苦于以下问题:C# Generator.BuildRandomExpressionTree方法的具体用法?C# Generator.BuildRandomExpressionTree怎么用?C# Generator.BuildRandomExpressionTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator.BuildRandomExpressionTree方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CrossoverTest
public void CrossoverTest()
{
var obj = new SimpleClass();
var generator = new Generator<SimpleClass>();
CodeExpression<SimpleClass> leftTree = generator.BuildRandomExpressionTree();
CodeExpression<SimpleClass> rightTree = generator.BuildRandomExpressionTree();
Trace.WriteLine("Vor dem Crossover");
Trace.WriteLine("-----------------");
Trace.WriteLine("");
Trace.WriteLine("Tree links:");
Trace.WriteLine(leftTree);
Trace.WriteLine("");
Trace.WriteLine("Tree rechts:");
Trace.WriteLine(rightTree);
generator.Crossover(ref leftTree, ref rightTree);
Trace.WriteLine("");
Trace.WriteLine("Nach dem Crossover");
Trace.WriteLine("------------------");
Trace.WriteLine("");
Trace.WriteLine("Tree links:");
Trace.WriteLine(leftTree);
Trace.WriteLine("");
Trace.WriteLine("Tree rechts:");
Trace.WriteLine(rightTree);
}
示例2: GenerateExpressionTree
public void GenerateExpressionTree()
{
var obj = new SimpleClass();
var generator = new Generator<SimpleClass>();
var func = generator.BuildRandomExpressionTree();
Trace.WriteLine(func);
func.Execute(obj);
}
示例3: MutationTest
public void MutationTest()
{
var obj = new SimpleClass();
var generator = new Generator<SimpleClass>();
CodeExpression<SimpleClass> tree = generator.BuildRandomExpressionTree();
Trace.WriteLine("Vor der Mutation");
Trace.WriteLine("----------------");
Trace.WriteLine("");
Trace.WriteLine(tree);
generator.Mutate(ref tree);
Trace.WriteLine("");
Trace.WriteLine("Nach der Mutation");
Trace.WriteLine("-----------------");
Trace.WriteLine("");
Trace.WriteLine(tree);
}