Skip to content

codykenb/locoGP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

locoGP is a Genetic Programming system which modifies, compiles and executes Java source code with a focus on improving the performance of programs as measured in bytecodes executed.

To evolve a Java function In locoGP, such as Bubblesort, the function is defined as a string (which must be valid Java).

This source code string is parsed and the result is a tree of nodes.

The tree representation of java source code looks roughly like this:

  • MethodDeclaration
    • Modifier (1:n)
      • “public”
    • Parameter (1:n)
      • VariableDeclaration
        • Type
          • SimpleType
            • SimpleName
              • “Integer[]”
        • SimpleName
          • “a”
      • VariableDeclaration
        • Type
          • SimpleType
            • SimpleName
              • “Integer”
        • SimpleName
          • “length”
    • Name
      • “sort”
    • Body
      • Statement (1:n)
        • ForStatement

The parsing library used (JDT) gives you types for each node in the tree, so you can make a decision how you want to mutate the tree, based on the node type.

For example, see how the different expression types are replaced in target Java code.

locoGP selects nodes in the AST randomly, makes modifications and evaluates the resulting program for correctness and runtime. An initial generation of programs is created by mutating the original “seed” program.

A number of programs are mutated to make each generation. Programs are selected (biased towards the most correct and least costly) from each generation to produce programs for the next generation.

With repeat modifications over repeat generations, locoGP is able to find performance improvements in programs.

For more information, have a look at the locoGP paper (PDF) or drop me a line with any comments/questions

Getting Started

  • Install Eclipse and JDK (Tested with Java 6 and Java 7 with -noverify)
  • Import project -> locoGP_eclipse (Eclipse -> File -> Import) Import project -> bycounter (required by locoGP) This should import extra libraries required for locoGP/bycounter
  • Change memory options
    • add -Xss1000M
    • Eclipse -> Run Configurations -> Arguments -> VM arguments
    • adjust as needed depending on test problem and available memory, see GP_Master/88-runJarInNewDir.sh for examples

Notes:

GP_Master contains helper scripts for Master/Slave experiment workflow including graphing. Used as a working dir for deploying self-contained locoGP experiment jars

Performance can also be measured in terms of bytecodes executed with bycounter.

Developed mainly using openjdk-6-jdk, Eclipse 3.8.1, Debian wheezy & jessie

About

Improving Performance by Genetic Programming Java Source Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published