public void TestMutate() { var gp = new Gp(); var input1ParamExp = Expression.Parameter(typeof(int), "input1"); var input2ParamExp = Expression.Parameter(typeof(int), "input2"); var paramArr = new[] { input1ParamExp, input2ParamExp }; var random1 = Gp.MakeRandomTree(paramArr); var printer = new GpPrinter(); TestOutput(printer.Display(random1)); TestOutput("-----------我是分隔线-------------"); var newExp = gp.Mutate(random1, paramArr); TestOutput(printer.Display(newExp)); }
public void TestMutateResult() { var gp = new Gp(); var input1ParamExp = Expression.Parameter(typeof(int), "input1"); var input2ParamExp = Expression.Parameter(typeof(int), "input2"); var paramArr = new[] { input1ParamExp, input2ParamExp }; var random1 = Gp.MakeRandomTree(paramArr); var hiddenset = gp.BuildHiddenSet(); var func1 = random1.Compile <Func <int, int, int> >(paramArr); TestOutput(gp.ScoreFunction(func1, hiddenset)); TestOutput("-----------我是分隔线-------------"); var newExp = gp.Mutate(random1, paramArr); var funcMutate = newExp.Compile <Func <int, int, int> >(paramArr); TestOutput(gp.ScoreFunction(funcMutate, hiddenset)); }