| The genetic algorithm is a kind of searching method using probability which simulates the natural evolution. It is widely used in many fields because it is simple and easy to implement, fit for parallel process, especially it doesn't need the special field knowledge.An all-purpose ActiveX controller about genetic algorithm is developed in this paper. We adopt Visual C++ 6.0 as the development environment. Through this controller which is used to optimize the user's own defined objective function, users can easily join the genetic algorithm to their own software. Users only need to provide objective function and corresponding set codes then the genetic algorithm can be used to optimize their function.Firstly, the basic theories of genetic algorithm are concentrated in this paper, and then an improved genetic algorithm is put forward, about which the ActiveX controller is completed. The controller has the following characteristics: First, the controller realizes a variety of codes: binary code, real code, gray code, which users can choose. Second, the controller realizes a variety of populations. The evolution of each species is in an independent thread. The threads are parallel in the course of evolution. In each population, code method, select method, crossover method, mutation method, crossover probability, mutation probability, keep percentage can be all variable. Third, the evolution of each species adopts the elite law which accelerates the convergence rate. Finally, the controller is tested. The results show that the controller is good at searching capability and searching speed. It also provides an effective way to avoid the "premature" phenomenon. |