View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

# [Answered] Real numbers (constants) in genetic programming

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1thecheeselover  Members

Posted 27 October 2013 - 10:22 AM

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

Hide yo cheese! Hide yo wife!

### #2Madhed  Members

Posted 27 October 2013 - 01:16 PM

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.

### #3thecheeselover  Members

Posted 27 October 2013 - 01:54 PM

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.

Hide yo cheese! Hide yo wife!

### #4/ rouncer   Members

Posted 27 October 2013 - 04:08 PM

who cares about making it complex, just kill off freaks so only the most fitting survives.  just make it regenerate its sense data

### #5Druzil  Members

Posted 27 October 2013 - 07:38 PM

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

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.