Exemplo n.º 1
0
 @Override
 public ExprTree mutateExprTree(ExprTree ptree, ExprTreeSchema schema, IRandGen randgen) {
   // Copy of expr
   ExprTree stree = ptree.copy();
   // Node selection
   int selectIndex = randgen.choose(0, ptree.size());
   // Mutated node
   IPrimitive oldBlock = stree.getBlock(selectIndex);
   Class<?> rtype = oldBlock.returnType();
   int arity = oldBlock.argumentTypes().length;
   IPrimitive newBlock = schema.getAnyBlock(rtype, randgen, arity);
   stree.setBlock(newBlock, selectIndex);
   // Return result
   return stree;
 }
Exemplo n.º 2
0
 /** {@inheritDoc} */
 public double getRandom(IRandGen randgen) {
   return randgen.uniform(efLeft(), efRight());
 }