Sign in to follow this  
thecheeselover

[Answered] Real numbers (constants) in genetic programming

Recommended Posts

Hello,

 

    I can't figure out how a genetically programmed A.I. can determine when there should be a constant in the final equation. If I take the formula F(m) = ma; F(m) = m9.8, how can the A.I. know what the real number 9.8 actually is? I understand that instead of putting the final number in the binary tree, you can actually put a symbol that describes a constant and then later calculate or guess what is its value in a certain way. How would you do it?

Thank you,
Thecheeselover

Share this post


Link to post
Share on other sites

I don't quite understand the question or what it has to do with genetic algorithms. GAs are just a way of gradually tweaking function parameters by employing genetics and evolutional methods. The goal is to improve the overall 'fitness' of the system.

Share this post


Link to post
Share on other sites

I don't quite understand the question or what it has to do with genetic algorithms. GAs are just a way of gradually tweaking function parameters by employing genetics and evolutional methods. The goal is to improve the overall 'fitness' of the system.

If I use GP to find the quadratic formula, how an individual could find the constants? (-b +- sqrt(b² - 4ac)) / (2a) In this example, the constants are 4 and 2.

Share this post


Link to post
Share on other sites

The implementation that I used for genetic programming was representing the program as a tree.  Each node in the the tree had an INode interface with a method 'Evaluate( INode[] params)'

Then I had concrete implementations of nodes for each of the different operators I wanted to represent

 

operator+

operator*

sqrt

while(...)

if(...)

and so on...

 

I also had a literal operator which just returned a bounded value which was generated randomly at instantiation of the tree (through initial creation or mutation)

so at runtime I would create a concrete class through c# IL  e.g.

 

class literal5 : INode

{

     INode Execute(INode[] params)

    {

            return 5.0;

    }

}

 

hope that helps

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this