1 / 13

Example Output

Example Output. February 5 th , 2014 Erik Fredericks. Overview. Grammar / fitness update Examples Next steps. Grammar/Fitness Update. Fixed glitch with grammar and fitness sub-function, as presented last week

damien
Download Presentation

Example Output

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Example Output February 5th, 2014 Erik Fredericks

  2. Overview • Grammar / fitness update • Examples • Next steps

  3. Grammar/Fitness Update • Fixed glitch with grammar and fitness sub-function, as presented last week • MODULE production was not able to reach low-level variables properly, resulting in bad output • Fitness was limiting mid-level output to a single child • Rewarding trees that produced a COMPOSITION with a number of children that matched the amount of source postconditions • In this case, 1

  4. Examples / Setup • Live variables (terminals) • bubble_sort : target_method • num_cols : int • incoming_array : array_int_2d • convert-me-to-int : double

  5. Examples / Setup // - source preconditions: what variables are available to us convert-me-to-int : DOUBLE num_cols : INT bubble_sort: TARGET_METHOD incoming_array : ARRAY_INT_2D // - source postconditions: what we expect the variables to be in the end sorted_numbers_2D_array: ARRAY_INT_2D // - target preconditions: target module parameters bubble_sort: TARGET_METHOD values_to_sort : ARRAY_INT_2D low_index : INT // (these will be updated to be low/high index high_index : INT // following addition of values and slight grammar // change) // - target postconditions: output from module sorted_values: INT_ARRAY

  6. Examples / Setup Terminals // - source preconditions: what variables are available to us convert-me-to-int : DOUBLE num_cols : INT bubble_sort: TARGET_METHOD incoming_array : ARRAY_INT_2D // - source postconditions: what we expect the variables to be in the end sorted_numbers_2D_array : ARRAY_INT_2D // - target preconditions: target module parameters bubble_sort: TARGET_METHOD values_to_sort : ARRAY_INT_2D low_index : INT // (these will be updated to be low/high index high_index : INT // following addition of values and slight grammar // change) // - target postconditions: output from module sorted_values : INT_ARRAY Composition fitness sub-function Module fitness sub-function

  7. Examples • Example 1.1: Code injection • Grammar specifies module only COMPOSITION( MODULE(bubble_sort, DOUBLE2INT(convert-me-to-int), incoming_array) )

  8. Example • Example 1.2: Code Injection • Grammar allows all available statements COMPOSITION( EXPAND(FLATTEN(incoming_array)), MODULE(bubble_sort, DOUBLE2INT(convert-me-to-int), incoming_array ) ) ////////////////////////////////////////////// COMPOSITION( EXPAND(FLATTEN(incoming_array)), MODULE(bubble_sort, DOUBLE2INT(convert-me-to-int), EXPAND(FLATTEN(incoming_array)) ) )

  9. Example Source post-condition: - 2D INT ARRAY • Example 1.2: Code Injection COMPOSITION( EXPAND(FLATTEN(incoming_array)), MODULE(bubble_sort, DOUBLE2INT(convert-me-to-int), incoming_array ) ) ////////////////////////////////////////////// COMPOSITION( EXPAND(FLATTEN(incoming_array)), MODULE(bubble_sort, DOUBLE2INT(convert-me-to-int), EXPAND(FLATTEN(incoming_array)) ) ) Target pre-conditions: - TARGET_METHOD - 2D INT ARRAY - INT - INT

  10. Example Discussion • Things I am noticing with this example: • Output tends to converge to single subset of solutions with little variation • Either: • Pre- and post-conditions too constrained • Grammar too constrained • FLATTEN rule seems to take precedence when 2D array is encountered • Tree must then EXPAND back to 2D to satisfy conditions

  11. WRAPPER Example • Work in progress • NWRAPPER (accepts n-children) COMPOSITION( <wrapper> ) <wrapper> ::= NWRAPPER( <statement_list>, <module_invocation>, <statement_list> )

  12. WRAPPER Example COMPOSITION( NWRAPPER( EXPAND(FLATTEN(incoming_array)), MODULE(bubble_sort,convert-me-to-int), DOUBLE2INT(convert-me-to-int) ) ) ////////////////////////// COMPOSITION( NWRAPPER( EXPAND(FLATTEN(incoming_array)), MODULE(bubble_sort,num_cols), DOUBLE2INT(convert-me-to-int) ) )

  13. Next Steps • Strengthen Wrapper fitness function • Implementing factory pattern to facilitate live variables • Abstract data type so that role transforms may be seamlessly applied to underlying value • Generic type required to pass values between nodes in GP tree • For example: • var = 5; | var = factory.create(5,Int); • var = (int)var; | var = factory.xform(var,Int); • var = (float)var; | var = factory.xform(var,Float); • var = var.toString(); | var = factory.xform(var,String);

More Related