Giter Site home page Giter Site logo

kaist-musynth's Introduction

CS454 Team #7 - Kaisynth

Program Synthesis via Code Reuse and Code Manipulation for Python

Running Environments

Design

Input

  • Program with a code hole defined by us
  • One part of program was subtituted by HOLE (ex. HOLE = None)
  • An explanation for the hole written in the comment
>> max.py

# INPUT: [5 7 3]
# OUTPUT: 7

A = array_from_args()
# HOLE: sort /// A
print(A[-1])

Code Pool

  • Manually generated code for algorithm (search, sort and etc)
  • Copy code snippets from the Internet (StackOverflow ... )

Evolutionary Search

Seeding

Get candidates from code pool

  • Ideal: match the hole explanation & explanation of code from the pool
  • Real: get candidates from certain directory

Evaluate

  • Fitness function
    • Sanity check
      • Error (1/0)
      • Runtime (~500ms : 1 / 0)
    • Developer check
      • Match input & output (percentage of passed cases)

Parameters

Param Name Default
Runtime limit 500ms
Iteration 1000
Population size 50
Mutation Prob. .5 (all)

Mutation Probability is list of probabilities in order specified below

Selection (can be changed)

  • lexicase selection
  • tournament selection

Mutation

Let's say that the hole code is A, and the donated code snippet is B.

  • Rebind Variables
    • Change the name of variable in B to the name in A.
  • Fix off-by-one
    • Decrease the value of constant in B by one.
  • Replace variable with a constant
    • Change the variable in B into new constant value.
  • Delete statement
    • If B consists of more than one line, delete one line from B.
  • Insert new statement (insert a new donor statement at random within the hole)
    • Insert a new line into B regarding surrounding context of B

Reference

Note

Coding Note

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.