Package gpinterpreter.vector

Examples of gpinterpreter.vector.VecInterpreter


                throw new RuntimeException(String.format("Gene Type \"%s\" is not recognised.", type));
        }
    }

    public static ClusterHead convertInstructionGene(List<InstructionGene> program, ClusterHead originalTree) {
        VecInterpreter interp = new VecInterpreter(new ArrayList<VecInstruction>(), originalTree.deepCopy());

        int size = originalTree.getSize();

        VecInstruction inst = null;

        for (int i = 0; i < program.size(); i++) {

            Gene g = program.get(i);

            if (g instanceof IntegerGene) {
                IntegerGene ig = (IntegerGene) g;
                inst = IntegerInstructionGene.getInstruction(ig.intValue(),
                        size);
            } else if (g instanceof InstructionGene) {
                inst = ((InstructionGene) g).getInstruction();
            }

            interp.execute(inst);
        }
        return interp.getTree();
    }
View Full Code Here


        new VecInstruction(MOVE,1,2),
        new VecInstruction(NOP),
        new VecInstruction(NOP)
    };
    program = Arrays.asList(p);
    interpreter = new VecInterpreter(program, tree);
  }
View Full Code Here

        new VecInstruction(MERGE,2,1),
        new VecInstruction(MERGE,2,2)
    };
    tree = new ClusterHead(g);
    program = Arrays.asList(p);
    interpreter = new VecInterpreter(program,tree);
    while(!interpreter.isHalted())
      interpreter.step();
    ClusterUtils.prettyPrintTree(tree);
  }
View Full Code Here

TOP

Related Classes of gpinterpreter.vector.VecInterpreter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.