Automatic Programmer: coding elementary functions, Draft 1, #geneticProgramming #AutomaticProgramming


Hi,  As you may be aware, I am the sole human computer-programmer developing SPEL, though of course my computer helps me by compiling things and checking for errors. I would like to have my computer do more for me, including the actual writing of code.

Toy Problem
I’m going to start with a very simple automatic programmer, to solve a very simply problem, simply to get all the pieces built. Later on can elaborate and make it more complicated.

For now, the toy problem will be, adding two numbers. It will have the option of using, subtraction, multiplication, division or addition to accomplish this task. I’m feeling amused, as it is indeed a very simple task, so I’m confident the automatic programmer will be able to succeed.

However there are multiple elements of this task,  for instance an initial population must be produced, members of that population must be checked for fitness, and the winning solution must be returned.

Fitness Checking List

Also there is the formating of how such a seed program will be written in SPEL. Which is probably where it is best to start.  There needs to be a test set for checking fitness:

REAL NOM add check INF start ACC check sentence INS list
REAL add ACC NUM one INS NUM one DAT NUM two
REAL add ACC NUM one INS NUM two DAT NUM three
REAL add ACC NUM two INS NUM two DAT NUM four

While that will be okay for this toy example, for synthesizing more complex code, which emulates a known function. Can give it a function or “activity”, such as an add function from C.  Then the check list generator would feed it random input variables, see what the outputs are, and record the corresponding declarative check list. This would also be good for reverse engineering more complex functions — such as pseudo-random number generators, speech recognition, or language translation.

Program Elements List

The program elements list is like the nucletides of DNA, the buildling blocks of how the program will come together.

REAL NOM add elements INF start ACC activity elements INS list
REAL increase
REAL subtraction
REAL partition
REAL multiply
REAL and
REAL and-or
REAL exclusive-or
REAL not
REAL exchange

Alternative Simplified Coding

To make seed programming more natural, can make it in the form of a question,

for instance 2 ? 3 = 5,


INT INF what ACC NUM two INS NUM three DAT NUM five

(what, 2 by 3 to 5?)

This question could then start a search of known check tests, or even automatically program a function which fits the given parameters.

Conclusion and Future Expansion

If I understand it correctly, those two input files, should be more than sufficient for generating the  function.  In future can make more complex functions, or build up functions from primitives, for instance by making a reversible version of add, by using conditional not and conditional exchange, though that will require some kind of connections between functions which will add extra complexity that can be explored in a later post.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s