0

I'm trying to perform a genetic programming system which solves an equation (basically first and second degree polynom equations) symboliclly.

It means that for a*x+b=0 it must give me a tree representation of -b/a. What i mean by symbolically is that i'm not giving numbers for 'a' and 'b' ... basically what Generic Programming are made for.

I'm actually stuck in finding the fitness function. For a given gene (potential solution), how can i predict how far is this one from the right solution.

My doubt is that there's no way to do such a thing unless i convert the problem into a numerical one.

I've been searching in the net, but all i found was related to genetic algorithms and so numerical resolution for such problem.

a link exposing such topic is found here: Generic Programming but it's not explaining a detailed approach about the problem.

Any ideas ?

Thanks in advance.

Mssm
  • 717
  • 11
  • 29
  • In which language are you programming? Most computer algebra systems have a `Solve(a*x+b==0,x)`or an `Eliminate` function. – axelclk Dec 05 '19 at 19:38
  • I'm programming in Java... look, i know that it's possible to solve a linear or quadratic equation to get a numeric value of x.. but i'm not looking for a numeric result, otherwise i would have implemented that, it requires 1 line of code only... what i was looking for is a GP program to solve the equation and get the formula as a result, like for a linear problem it give -b/a , or for quadratic one it gives (-b + sqrt(b² - 4ac))/(2a) or (-b - sqrt(b² - 4ac))/(2a) – Mssm Dec 07 '19 at 11:41
  • Yes, that's what I meant for example with this Solve function in Java: https://github.com/axkr/symja_android_library/blob/master/symja_android_library/doc/functions/Solve.md or https://github.com/axkr/symja_android_library/blob/master/symja_android_library/doc/functions/Roots.md – axelclk Dec 07 '19 at 12:56
  • Maan awesome library, it's just amazing, i checked its brievely and sorry for late answer ... you're created the library using Genetic Programming ? – Mssm Dec 11 '19 at 14:24

1 Answers1

0

I've finally found a solution.

I've found a powerfull library which is designed for Genetic Algorithms for java developpers, and have a module specialized in Genetic Programming (GP).

Library's link: Jenetics

My implementation of the solution is available on my github at this link: Symbolic Equation Solver

It's basically a Maven based project, which makes use of Java 11 and the above library to solve Linear and Quadratic equations and gives symbolic (and not numeric) result.

Mssm
  • 717
  • 11
  • 29