Optimization of a Mini-Golf Game using the Genetic Algorithm

A fundamental definition of optimization is finding the best solution under the given constraints. Solving the optimization problems is possible by using the algorithms based on mathematical expressions or rules that are providing defined limitations are met. There is not an effective method that can be commonly used for solving entire optimization problems and the methods used do not guarantee finding the exact solution of the problem. However, in general they are successful in finding a better solution than the acceptable measure at the acceptable speed. The artificial intelligence optimization techniques aimed at solving the optimization problems are also known as meta-intuitional research techniques. These algorithms are the criteria or computer methods those are defined to decide which of the various alternative movements are effective to realize any one solution or to reach any specific target. For larger problems, researchers have been directed to study on the methods those are reaching a “good” solution in shorter times even though they may not be the best solution methods, that is because the number of problems are limited, which can be solved using definite solving methods and magnitudes of the required time for the calculations are so great. The application results of the artificial intelligence optimization algorithms are also important because they do constitute an upper or lower limit for the definite solution methods. Such solution algorithms do not guarantee the definite solution; however they may guarantee to find a solution that is convenient for the purpose. Results of the application show that the artificial intelligence optimization algorithms are problem dependent algorithms. In other words, while they may be successful for a certain problem they may not be successful same way for another problem. The simulated annealing (SA) algorithms, genetic algorithms, tabu search algorithms may be given as the principal examples of the artificial intelligence optimization algorithms [1]. Genetic algorithms are more effective than the classical optimization methods and more flexible due to its progressiveness by making minor changes in the solution approach. For this reason, genetic algorithm attracts the attention of the researchers. As already known, the main goal of optimization is to reach to an optimal point, or rather to approach it as close as possible. There are many known classical methods for realization of this goal. Successfulness of these methods is measured by whether they are able to reach the optimal point or how close they can get to it. In this study, a mini-golf game has been simulated in a three dimensional virtual world by using genetic algorithm. There is a robot (red box) that is controlled by the algorithm, a ball that can be moved by the robot by applying a force on it, a target point (blue pole), where the ball has to be conveyed to by the robot, and two obstacles those may be located anywhere on the way of the ball towards the target point in the above mentioned virtual world. Goal of the application is to find the proper velocity and direction components of the ball to reach the target point by adapting the genetic algorithm to this problem.


Introduction
A fundamental definition of optimization is finding the best solution under the given constraints.Solving the optimization problems is possible by using the algorithms based on mathematical expressions or rules that are providing defined limitations are met.There is not an effective method that can be commonly used for solving entire optimization problems and the methods used do not guarantee finding the exact solution of the problem.However, in general they are successful in finding a better solution than the acceptable measure at the acceptable speed.
The artificial intelligence optimization techniques aimed at solving the optimization problems are also known as meta-intuitional research techniques.These algorithms are the criteria or computer methods those are defined to decide which of the various alternative movements are effective to realize any one solution or to reach any specific target.For larger problems, researchers have been directed to study on the methods those are reaching a "good" solution in shorter times even though they may not be the best solution methods, that is because the number of problems are limited, which can be solved using definite solving methods and magnitudes of the required time for the calculations are so great.The application results of the artificial intelligence optimization algorithms are also important because they do constitute an upper or lower limit for the definite solution methods.Such solution algorithms do not guarantee the definite solution; however they may guarantee to find a solution that is convenient for the purpose.
Results of the application show that the artificial intelligence optimization algorithms are problem dependent algorithms.In other words, while they may be successful for a certain problem they may not be successful same way for another problem.The simulated annealing (SA) algorithms, genetic algorithms, tabu search algorithms may be given as the principal examples of the artificial intelligence optimization algorithms [1].
Genetic algorithms are more effective than the classical optimization methods and more flexible due to its progressiveness by making minor changes in the solution approach.For this reason, genetic algorithm attracts the attention of the researchers.As already known, the main goal of optimization is to reach to an optimal point, or rather to approach it as close as possible.There are many known classical methods for realization of this goal.Successfulness of these methods is measured by whether they are able to reach the optimal point or how close they can get to it.
In this study, a mini-golf game has been simulated in a three dimensional virtual world by using genetic algorithm.There is a robot (red box) that is controlled by the algorithm, a ball that can be moved by the robot by applying a force on it, a target point (blue pole), where the ball has to be conveyed to by the robot, and two obstacles those may be located anywhere on the way of the ball towards the target point in the above mentioned virtual world.Goal of the application is to find the proper velocity and direction components of the ball to reach the target point by adapting the genetic algorithm to this problem.

General information in relation with the genetic algorithm
It is known that at present various studies are carried out in the area of developing new solution methods for solving the complicated and difficult problems faster and easier.In this context one of the most significant methods developed so far is the genetic algorithms.
Genetic algorithm is an iterative and stochastic process.To initialize the starting population randomly and to continue the algorithm until the best solution reached are the fundamental properties of the genetic algorithm.Famous mathematician J. Hadmard had said "Both in mathematics and in the other areas discoveries and inventions are realized by merging the ideas from different areas" [2].This saying briefly explains how the Genetic Algorithms have come into existence while also explaining its basic operational principle.Structure of the genetic algorithm is given in the following paragraphs in basic steps.
Step 1. Initialize a starting population of the solutions.Step 2. Calculate the suitability value of each solution in your population.
Step 3. Stop the research in case the stopping criterion is met.
Otherwise perform the following steps.
3.2.Apply the genetic algorithm operators in order to change the starting population.
Step 4. Go to Step 2. Flow diagram of GA that is used for solving a problem is shown in Figure 1 Fig. 1

. Flow diagram of genetic algorithm
Steps those will be used in solving a problem must be as listed in the following paragraphs.
Representing the chromosomes (Coding).The first step in the genetic algorithm is coding the variables those consisting of the problem in every gene those consisting of the chromosomes.The created chromosome carries the entire information about a definite solving method.The coding mechanism is dependent on the variables of the problem and its method that is used has an importance for its performance.There are various ways of coding.Most commonly used coding is the binary coding.A simple genetic algorithm is operated on a population consisting of binary sets.The chromosomes here are the sets consisting of 0's and 1's."n" bits are used for every parameter."n" may differ for every parameter.[3].
Initializing of the starting population.The first step in application of the genetic algorithm is initializing of a starting population of the chromosomes.A solutions group is created where probable solutions are coded.The solutions group is called "population" for the sake of its resemblance in biology, and the codings of the solutions are called "chromosomes".This step is started by defining the number of individuals existing in the population.There is not a standard for this number.In general a magnitude in the 100-300 range is suggested.Complicatedness of the operations executed and the depth of the research are important for choosing the magnitude.Following this procedure population is initialized randomly.
Fitness value.The technique that is used in evaluation of the solutions is rather effective on the performance of the genetic algorithm.In case the genetic algorithm will be used for solving a problem a fitness function or a goal function is needed.In genetic algorithm basically every chromosome becomes subject to a qualitative assessment to see how good it is.The function, which qualitatively assesses how good any chromosome is, is called fitness function.The procedure of operating this function and assessing the fitness of the chromosomes is called calculation (evaluation) [4,5].
Selection.Selection is an operation, where the individuals are selected for reproduction.It is a process that is used to select the fitter solutions within the initialized population.It must be defined that how the individuals will be selected to breed a new generation to form the next generation and how many children each individual will have.An intermediate population is created with the individuals those will breed to form the next generation called the breeding pool.Then random individuals are selected for breeding from the pool.While there are many methods developed for selection, the most commonly used ones are roulette wheel selection (Ranking Scheme), tournament selection (Tournament Scheme) and elitist selection.Following the initialization population has been formed to generate the next new population by reproduction the selection method must be decided upon; the selection probabilities of the individuals with higher fitting values will also be higher.Here, the goal is to copy the individual having a higher fitting value (best fit) into the next generation.
Genetic operators.Selection procedure may provide information in relation with the solution of the problem.However, do not lead to a definite solution.Selection procedure continues until the magnitude of the population has been reached, and every individual that has been selected is taken into the breeding pool.Selected individuals are the parents of the new generation.The new individuals those will ensure to reach the solution are obtained at this stage by means of genetic operators.There are two important operators that take part in generating new solutions: crossing and mutation.

Genetic algorithm (GA) applications
GA literature encompasses many successful applications.However, there are also many cases where, GA's are not successful.How can it be decided whether the GA is a good method to be used, when an application has to be made?Even though many researchers are commonly sharing the opinions those are listed in the following paragraphs, there is not a serious explanation yet.In case the space is large, where the search will be made within, and it is known that it is rather regular and not having a single peak, if not firmly comprehended, or if the fitness function is noisy (i.e.assigns different values to the same chromosome in every other assessments) then GA may have a chance to be more successful than the weak methods or to compete with them.
GA applications may be gathered in three main groups.The fist one of these groups is the experimental applications; these are the studies where the genetic algorithm is used in solving certain problems to prove the superiority of it against other existing optimization algorithms.Traveling Salesman Problem and Graphical Division Problem may be given as examples of such.The second group is practical applications; these are the applications where the genetic algorithm is used for the industrial solutions and other real problems.Timetable Problems, Numerical Optimization Problems, Image Processing Applications are the examples for this group.Last group is consisting of applications of classifying systems.This class is consisting of the studies where the genetic algorithms are used for data retrieval purposes.The third group applications are the applications, where the genetic algorithm is used in order to obtain the rules those are constitute the information base of an expert system.

Optimization of a mini-golf game using the genetic algorithm
An individual, a gene, and a fitness function have to be defined, suitable for the problem, in order to use the genetic algorithm for solving that problem.These definitions are made as shown in the following paragraphs: Individual (Chromosome).Each application of a hit to the ball of the robot constitutes an individual Gene.Each component of the power vector that the robot applies to the ball in every hit constitutes a gene.Therefore, every individual is consisting of two genes: one is the x component of the power vector and the other is the y component of the power vector; Fitness Function.The ball will come to a halt after a certain time elapses, following each hit of the robot applied to the ball.A fitness function has been defined that is inversely proportional with the distance of the ball's halt position to the target point.

Tests
In the table complicatedness of the problem has been evaluated according to how the obstacles are located.
In case the selected number is greater than the mutation probability ratio, mutation is not realized and the original individuals are added to the new generation; o In case the selected number is smaller than Table1.Some test results obtained in the solution