In this article, we propose a new approach to the virus DNA–based evolutionary algorithm (VDNA-EA) to implement self-learning of a class of Takagi-Sugeno (T-S) fuzzy controllers. The fuzzy controllers use T-S fuzzy rules with linear consequent, the generalized input fuzzy sets, Zadeh fuzzy logic and operators, and the generalized defuzzifier. The fuzzy controllers are proved to be nonlinear proportional-integral (PI) controllers with variable gains. The fuzzy rules are discovered automatically and the design parameters in the input fuzzy sets and the linear rule consequent are optimized simultaneously by the VDNA-EA. The VDNA-EA uses the VDNA encoding method that stemmed from the structure of the VDNA to encode the design parameters of the fuzzy controllers. We use the frameshift decoding method of the VDNA to decode the DNA chromosome into the design parameters of the fuzzy controllers. In addition, the gene transfer operation and bacterial mutation operation inspired by a microbial evolution phenomenon are introduced into the VDNA-EA. Moreover, frameshift mutation operations based on the DNA genetic operations are used in the VDNA-EA to add and delete adaptively fuzzy rules. Our encoding method can significantly shorten the code length of the DNA chromosomes and improve the encoding efficiency. The length of the chromosome is variable and it is easy to insert and delete parts of the chromosome. It is suitable for complex knowledge representation and is easy for the genetic operations at gene level to be introduced into the VDNA-EA. We show how to implement the new method to self-learn a T-S fuzzy controller in the control of a nonlinear system. The fuzzy controller can be constructed automatically by the VDNA-EA. Computer simulation results indicate that the new method is effective and the designed fuzzy controller is satisfactory. © 2003 Wiley Periodicals, Inc.