Obviously this is hypothetical, but is true? I know "perfect fitness function" is a bit hand-wavy, but I mean it as we have a perfect way to measure the completion of any problem.
-
1$\begingroup$ Of course, you will have to then assume that a solution to the problem is indeed expressible by some element of the program space. For example, if the problem is to compute Ackerman's function, then that can't be solved by GP with a primitive recursive function set. $\endgroup$– NietzscheanAIOct 7, 2016 at 12:42
-
$\begingroup$ This question is unclear to me. What is a genetic program? Do you mean a genetic programming algorithm (which is able to evolve programs)? $\endgroup$– nbroDec 7, 2020 at 17:44
2 Answers
Yes.
A totally random algorithm could solve any problem given unlimited time and a perfect fitness function. All you need to do is give the GA some new random population members each generation and you're guaranteed to find the solution eventually. Even if you keep only descendants of the previous generation, setting the mutation rate and number of crossovers high enough could effectively get you random individuals.
-
1$\begingroup$ Of course this doesn't have much to do with genetic programming. If there is a solution, you can find it with random guessing given unlimited time. I would provide you even with an bounded time algorithm: If there is a solution, you can find it by trying all possible solutions. $\endgroup$ Oct 7, 2016 at 7:26
-
$\begingroup$ @BlindKungFuMaster You missed the magical words "Brute force" :) $\endgroup$– AnkurOct 7, 2016 at 10:16
As per the answer to this AI SE question, the presence of mutation makes a GA into a global search algorithm, i.e. it will eventually visit each point in the search space.
How efficiently it will do so is indeed related to the quality of the fitness function:
A 'perfect fitness function' could conceivably mean any of the following:
- A function which takes on an optimal value iff it is applied to an optimal solution.
- A function which forms a quadratic bowl (Newton's method can solve this in one step).
A degenerate case of 1. is a 'Needle in a haystack' function, which returns the same arbitrarily poor value everywhere that isn't an optimum, and 2. unfortunately doesn't arise very often in practice.
Hence, the role of a well-designed fitness function is to impose a gradient on the search process, which in practice will generally lie somewhere in-between 'Needle in a haystack' and 'Quadratic bowl'.
The presence of some form of smoothness in the fitness function is one mechanism that allows better performance than random or exhaustive methods.