jnaithani / genetic-programming

A Genetic Programming Environment (SEIS 610/Fall 2013)
2 stars 2 forks source link

Main Program #15

Open jnaithani opened 10 years ago

jnaithani commented 10 years ago

Main program to perform the general Genetic Programming System steps:

  1. Randomly initialize population
  2. Evaluate fitness of each solution
  3. Determine termination criteria
  4. If termination criteria not met 4.1. Generate next generation population 4.1.1. Perform Selection 4.1.2. Perform Crossover 4.1.3. Perform Mutation
  5. Go to Step 2
jnaithani commented 10 years ago

All, @warsamebashir @rkg11gupta @KBenderaa @mohammedalkhiat

Our GP system main program task. No one is assigned to it at the moment. Please assign it to yourself if you are able to work on it.

-Jayesh

rkg11gupta commented 10 years ago

I will assign this to myself. Also I will take a look in the evening and take other pending tasks as well. Will send you an update later tonight.

Thanks & Regards, Rajesh Gupta Cell# 612-296-1302 Home# 651-647-4467

On Monday, November 18, 2013 12:30 PM, jnaithani notifications@github.com wrote:

All, @warsamebashir @rkg11gupta @KBenderaa @mohammedalkhiat Our GP system main program task. No one is assigned to it at the moment. Please assign it to yourself if you are able to work on it. -Jayesh — Reply to this email directly or view it on GitHub.

wbashir commented 10 years ago

@jnaithani

I am not sure what the current implementation does or if your still working out some issues, there are a few errors around 'heap size and overflows', i will wait for your next commit before pushing anything out. Let me know where things currently stands with the program output.

jnaithani commented 10 years ago

Warsame, @warsamebashir

What are the issues around heap size and overflow?

Also, what do you need to know about the current implementation?

I am currently testing the main program - working on verifying the results of each of the steps.

-Jayesh

wbashir commented 10 years ago

I just pulled the latest, then ran the the main program, the first run produced output in less than 10 seconds but i am not sure if the threshold check had to do with that or some other piece of code that made the process exit so fast. Without doing anything else, i ran it again right away and received multiple java.lang.StackOverflowError errors at Tree.Java: line 47 which is the size method. I am trying to reproduce this now

jnaithani commented 10 years ago

Rajesh, @rkg11gupta

For testing purposes - max generation is set to 10. So we can validate the results of the program - and resolve issues that you and Warsame @warsamebashir are discovering.

Let us know what you find out with the StackOverFlowError. We need to isolate it and fix it with a JUnit test. I will look into it as well.

-Jayesh

rkg11gupta commented 10 years ago

Ok I will let you know.

Rajesh

Sent from my iPhone

On Nov 27, 2013, at 2:20 PM, jnaithani notifications@github.com wrote:

Rajesh, @rkg11gupta

For testing purposes - max generation is set to 10. So we can validate the results of the program - and resolve issues that you and Warsame @warsamebashir are discovering.

Let us know what you find out with the StackOverFlowError. We need to isolate it and fix it with a JUnit test. I will look into it as well.

-Jayesh

— Reply to this email directly or view it on GitHub.

wbashir commented 10 years ago

@jnaithani , @rkg11gupta

I was able to change the size method at Tree.java to explicitly catch by throwing StackOverflowError. This stops the error from happening but we may need to figure out why, i noticed in that method that getLeftChild() and getRightChild can be null which could cause problems but we end up visiting this method so much and I am not sure why

wbashir commented 10 years ago

Carefull before pushing again, i just pulled/pushed changes that need to be merged

jnaithani commented 10 years ago

Warsame, Rajesh, @warsamebashir @rkg11gupta

I haven't hit the StackOverFlowError so far. Have increased the initial population size to 1000 even. Are you able to duplicate it consistently?

-Jayesh

wbashir commented 10 years ago

If i remove from the size method the 'throws' stackoverflow text, the error happens consistently, i added this and it stops happening.

jnaithani commented 10 years ago

Warsame, @warsamebashir

The code I have been testing with is no longer using Tree.size() - instead is using Tree.depth(). Can you try and duplicate again?

We need to work on a few more things:

-Jayesh

wbashir commented 10 years ago

1) Can we start max tree depth = 4, i have talked to other finding success with a small number, integrating means building and tree and throwing out if depth is greater than our max or checking while generating each GP 2) Can we use a probability to make sure we have enough trees moving forward, in other words, the selection probability which right now picks top 8, 5 and so on will have to be ignored when our max trees in population is hit. This may not be a good idea as we may start to force our way through the right tree. 3) I will look into another selection algorithm, how bad is our crossover operation ? Does it at least meet the defined requirements. 4) All of our core tests right now print trees, we should start using assertEquals to make sure mutate, crossover actually do their job. 5) The program running for 15 min is a good test case to build. 6) Once we package it up with eclipse, running the jar file from the command line just needs the manifest file and that should be it

jnaithani commented 10 years ago

Warsame, @warsamebashir

Output from one of the successful runs. Need to validate the results still.

Trees moving forward are constant - at least the same as the initial population size.

The selection method for next generation is the following:

        ArrayList<GeneticProgrammingTree> nextGenPopulation = GeneticOperators.selection(population);

        ArrayList<GeneticProgrammingTree> children = GeneticOperators.crossoverTrees(population);

        GeneticOperators.mutateTrees(children);

        nextGenPopulation.addAll(children);

Hope it makes sense.

-Jayesh

Output from one of the runs:


----------------------------------------------------------------* Final Results *----------------------------------------------------------------------------- Elapsed seconds : 622 Current generation count : 557 Current generation population size : 10 Fittest Solution : (((( 6 + ( 6 + 6 )) - ( x * (( x + ( x + x )) + ((((( x - 6 ) - 6 ) - ( x - x )) / 8 ) / x )))) / 6 ) - ( x * x )) Fittest Soluton depth : 11 Fitness : 5.041666666666657

jnaithani commented 10 years ago

All, @rkg11gupta @warsamebashir @KBenderaa @mohammedalkhiat

Couple of websites to test results:

http://www.wolframalpha.com/widget/widgetPopup.jsp?p=v&id=7014d9722bc42de3f621eaad1da2615e&title=Simplifying%20Algebraic%20Expressions%20Calculator&theme=blue&i0=9x-9y%5E3&podSelect=

http://rechneronline.de/function-graphs/

-Jayesh

jnaithani commented 10 years ago

All, @rkg11gupta @warsamebashir @KBenderaa @mohammedalkhiat

The GP program is sometimes able to find the optimal solution. Here is an output from a test run.

Warsame @warsamebashir, Rajesh @rkg11gupta - test as well please when you get a chance.

Can we start max tree depth = 4, i have talked to other finding success with a small number, integrating means building and tree and throwing out if depth is greater than our max or checking while generating each GP

Max Initial Tree Depth = 4 Max Depth Limit after Crossover=10

If depth limit exceeded - the none of the parents is randomly chosen.

Can we use a probability to make sure we have enough trees moving forward, in other words, the selection probability which right now picks top 8, 5 and so on will have to be ignored when our max trees in population is hit. This may not be a good idea as we may start to force our way through the right tree.

The population size is constant in each generation

I will look into another selection algorithm, how bad is our crossover operation ? Does it at least meet the defined requirements.

Could you review the current algorithm? The GP Program is able to successfully find an optimal solution on occasion.

All of our core tests right now print trees, we should start using assertEquals to make sure mutate, crossover actually do their job.

Could use help here.

The program running for 15 min is a good test case to build.

Have to still test for this case.

Once we package it up with eclipse, running the jar file from the command line just needs the manifest file and that should be it

It's time one of us tried this and ran some tests this way as well. We need to work on a program/user guide as well.

-Jayesh


----------------------------------------------------------------* Final Results *----------------------------------------------------------------------------- Elapsed seconds : 1005 Current generation count : 153 Current generation population size : 100 Fittest Solution : (( 3 + ( 3 / ( 3 * 2 ))) - ((((( 4 - 1 ) + ( x / 2 )) + ( x - 3 )) * 3 ) * ( x / 3 ))) Fittest Soluton depth : 7 Fitness : 0.0



jnaithani commented 10 years ago

All, @rkg11gupta @warsamebashir @mohammedalkhiat @KBenderaa

The program is now making use of the JFreeChart charting APIs to record execution results. You will have to add the two libraries in the lib directory into the program classpath.

-Jayesh

wbashir commented 10 years ago

@jnaithani Awesome.

I just saw this, i will be running the application now

jnaithani commented 10 years ago

Warsame, @warsamebashir

Okay - let me know if you find issues. We needs to improve our tests and test coverage still, and perform a quantitative analysis on the code, gather efficiency/performance/quality metrics, and measure complexity. So I am going to stop coding and optimizing for now, and focus on the other things.

-Jayesh

wbashir commented 10 years ago

I just ran the application with no errors or issues, I did the logic error in the main program but noticed it has been fixed with the latest commits. I will write the test for mutate and see if i can match up either trees by flattening and checking indexes. As far as quality/metrics/performance, our options are to improve either the crossover or selection but i think when i ran it, it stopped in under 15 minutes and the fitness was near 0

jnaithani commented 10 years ago

Warsame, @warsamebashir

Did you review the charts that were generated? They are located in the same directory as the settings and training data.

Also, to verify the results of the program, you can also use these tools:

http://rechneronline.de/function-graphs/ http://www.wolframalpha.com/widgets/view.jsp?id=97ffcbd95363387c7e371563057eb02f

-Jayesh

jnaithani commented 10 years ago

Program metrics to collect and present:

capture

jnaithani commented 10 years ago

Class Level Metrics:

classmetrics

wbashir commented 10 years ago

I did notice the JFreeChart images that get created on each run, we should put this in our user manual so the professor knows what to look for after running the application. How are we distrbuting the final JAR files? Can we copy and paste these into our design document, when we meet online we can add these to the document on google docs. Maybe @KBenderaa and @mohammedalkhiat can use them to determine some of the other test measurements.