Refactoring and bugfixes
This presentation is the property of its rightful owner.
Sponsored Links
1 / 17

Refactoring and Bugfixes PowerPoint PPT Presentation


  • 45 Views
  • Uploaded on
  • Presentation posted in: General

Refactoring and Bugfixes. February 18 th , 2014 Erik Fredericks. Overview. Updates to fitness and grammar Example output Current tasks. Updates. More changes to fitness and grammar Spoiler: it’s working much better now! Grammar Added wrapper and function pointer constructs

Download Presentation

Refactoring and Bugfixes

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Refactoring and bugfixes

Refactoring and Bugfixes

February 18th, 2014

Erik Fredericks


Overview

Overview

  • Updates to fitness and grammar

  • Example output

  • Current tasks


Updates

Updates

  • More changes to fitness and grammar

    • Spoiler: it’s working much better now!

  • Grammar

    • Added wrapper and function pointerconstructs

    • Modularized pre and post-conditions

      • Example application can be “dropped” in, as they are defined solely by pre and post-conditions

        • Assuming grammar representation remains constant


Updates1

Updates

  • Fitness

    • Refactored composition and module-level sub-functions

      • Added fitness for wrapper and function pointers

        • Similar to module fitness

    • Added ordering to pre/post-condition matching for terminals

    • Added extra terminal(s) to satisfy post-condition matching


Bubblesort example

BubbleSort Example

Target module

int∗ bubbleSort(int∗ numbers, int array size );

Source pre-conditions

Target pre-conditions


Bubblesort example1

BubbleSort Example

Target post-conditions

Source post-conditions


Bubblesort example output

BubbleSort Example Output

Code Injection

COMPOSITION(

% precondition xforms

DOUBLE2INT(convert-me-to-int),ARR-FLOAT2INT(incoming_array),

% module invocation

MODULE(bubble_sort,incoming_array,convert-me-to-int),

% postconditionxforms

ARR-INT2FLOAT(sorted_values)

)

COMPOSITION(

% precondition xforms

DOUBLE2INT(convert-me-to-int), FLATTEN(EXPAND(ARR-FLOAT2INT(incoming_array))),

% module invocation

MODULE(bubble_sort,convert-me-to-int,incoming_array),

% postconditionxforms

ARR-INT2FLOAT(sorted_values)

)


Bubblesort example output1

BubbleSort Example Output

Wrapper

COMPOSITION(

NWRAPPER(

% precondition xforms

FLATTEN(EXPAND(ARR-FLOAT2INT(incoming_array))),

DOUBLE2INT(convert-me-to-int),

% module invocation

MODULE(bubble_sort,incoming_array,convert-me-to-int),

% postconditionxforms

ARR-INT2FLOAT(sorted_values)

)

)


Bubblesort example output2

BubbleSort Example Output

Function Pointer

COMPOSITION(

% precondition xforms

ARR-FLOAT2INT(incoming_array),

DOUBLE2INT(convert-me-to-int),

% target module

FN_PTR(MODULE(bubble_sort,convert-me-to-int,incoming_array)),

% postconditionxforms

FLATTEN(EXPAND(FLATTEN(EXPAND(sorted_values)))),

ARR-INT2FLOAT(FLATTEN(EXPAND(sorted_values)))

)


Quicksort ish example

QuickSort-ish Example

Target module

int∗ quickSort(int∗∗ numbers_2D_array, intlow_index, inthigh_index);

Source pre-conditions

Target pre-conditions


Quicksort example

QuickSort Example

Target post-conditions

Source post-conditions


Quicksort example output

QuickSort Example Output

Code Injection

COMPOSITION(

% precondition xforms

DOUBLE2INT(convert-me-to-int),

EXPAND(ARR-FLOAT2INT(incoming_array)),

CHAR2INT(FLOAT2CHAR(num_cols)),

% target module

MODULE(quicksort,convert-me-to-int,incoming_array,num_cols),

% postconditionxforms

EXPAND(sorted_values)

)


Quicksort example output1

QuickSort Example Output

Wrapper

COMPOSITION(

NWRAPPER(

% precondition xforms

EXPAND(ARR-FLOAT2INT(incoming_array)),

DOUBLE2INT(convert-me-to-int),

FLOAT2INT(num_cols),

% target module

MODULE(quicksort,convert-me-to-int,incoming_array,num_cols),

% postconditionxforms

EXPAND(sorted_values)

)

)


Quicksort example output2

QuickSort Example Output

Function Pointer

COMPOSITION(

% precondition xforms

CHAR2INT(DOUBLE2CHAR(convert-me-to-int)),

EXPAND(ARR-FLOAT2INT(incoming_array)),

FLOAT2INT(num_cols),

% target module

FN_PTR(MODULE(quicksort,num_cols,convert-me-to-int,incoming_array)),

% postconditionxforms

FLATTEN(EXPAND(sorted_values)),

EXPAND(sorted_values)

)


Current tasks

Current Tasks

  • Value representation

    • Working on backend factory implementation

      • Provide abstract representation of value, based upon run-time context

    • Updates to get “correct” output took precedence this past week


Current tasks1

Current Tasks

  • Parse tree translator

    • Working on code generation based on generated parse tree

COMPOSITION(

WRAPPER(

FLOAT2INT(number),

TARGET_METHOD(method,number),

INT2FLOAT(returned_number)

)

)

float module_wrapper(float);

void main()

{

float number;

module_wrapper(number);

}

float module_wrapper(float in_val)

{

intretval;

inttemp_val = (int)in_val;

retval = method(temp_val);

return (float)retval;

}


Discussion point

Discussion Point

  • One thing I have noticed is that fitness converges quite early

    • Configured to run for 500 generations, and best fitness is typically found within 50


  • Login