Home About Us Contact Blog
What's New Products Buy Now Downloads Forum Karva Notation


Gene Expression Programming


Karva Notation: The Native Language of GeneXproTools

Karva notation is used internally by GeneXproTools as it allows the compact encoding and rapid expression of complex models. And although very simple to understand, you don't actually have to know it in order to model with GeneXproTools, as all the code generated by GeneXproTools is automatically converted into the most commonly used programming languages (a total of 16 in GeneXproTools 4.0). But since it is so simple and so handy, we encourage you to learn about this representation so that you can benefit from some of the most advanced features of GeneXproTools.

Karva notation was developed specifically for Gene Expression Programming (GEP) and consists of a universal way of compactly representing any mathematical or logical expression that can be represented as a tree. Besides its compactness, this universal representation is also linear, and this is a fundamental characteristic for any system that has to breed mathematical expressions to create new, more precise ones.

The linear structures of GEP are called chromosomes and each chromosome contains one or more genes. And each gene is associated with its own K-expression ("K" or "Kappa" is for Karva notation). Genes and K-expressions are very easy to decode. For example, the gene:


can be represented as a diagram or expression tree (ET):

The translation of the gene into the corresponding ET is straightforward: The first element in the gene (position 0) corresponds to the root of the ET; then, below that node, are attached as many nodes as there are arguments to that function (two, in this case); then these nodes are filled consecutively with the elements in the gene (in this case, positions 1 and 2), and so forth. The process is repeated until a line composed of only terminals is formed (in this case, the third line).

More formally, both the gene and ET above can be represented by the mathematical expression:


Usually the genes evolved by GEP are more interesting than the gene presented above, not only with noncoding regions at their ends but also with more diverse branching structures. For example, consider the gene:


where "Q" represents the square root function. This gene has a head (from position 0 through 7 and shown in blue) of length 8 and a tail (from position 8 through 16) of length 9. Note that the head contains both functions (which may take 1, 2,..., n arguments) and terminals (the variables and constants in a problem), whereas the tail contains exclusively terminals (this structural organization is indeed the cornerstone of GEP as it ensures that all the programs encoded in the genes are syntactically correct). The translation of such genes is done exactly as in the previous example, giving:

Note that, in this case, not all the elements in the gene were used to construct the ET, as the translation ends whenever a line containing only terminals is formed. In this particular case, the gene ends at position 16 whereas the K-expression ends at position 9.

Furthermore, GEP chromosomes are usually multigenic, and each gene codes for a sub-ET or sub-program. After translation, the sub-ETs are linked by a particular linking function: addition, subtraction, multiplication, or division for all kinds of mathematical models in GeneXproTools 4.0 and And, Or, Nand, Nor, Xor, Nxor, Less Than, Greater Than, Less Or Equal, and Greater Or Equal for logical expressions.

For example, the following chromosome composed of three genes (position 0 indicates the beginning of each gene):


encodes the following sub-ETs:

Then the sub-ETs are afterwards linked by one of the available linking functions. For instance, if the linking function were addition, then the following program would be obtained (the linking function is shown in gray):

Note that the ET above can be easily linearized into a single K-expression:


These manipulations are important in order to fully explore all the features of GeneXproTools, especially the Change Seed method, which allows you to take an existing model, tinker (or not) with it a bit, and then use it to breed even better models.

But unless you want to use extraneous models, you don't have to be fluent in Karva as all the models evolved by GeneXproTools in its native Karva code are automatically converted not only into a wide range of programming languages (Ada, C, C++, C#, Fortran, Java, Java Script, Matlab, Pascal, Perl, PHP, Python, Visual Basic, VB.Net, Verilog, and VHDL) but also into diagram representations or expression trees for an immediate visualization of the model structure.

Last modified: September 1, 2007

Cite this as:

Ferreira, C. "Karva Notation: The Native Language of GeneXproTools." From GeneXproTools Tutorials – A Gepsoft Web Resource. http://www.gepsoft.com/tutorial003.htm


 Time Limited Trial

 Try GeneXproTools for free for 30 days!

 Released February 19, 2014

 Last update: 5.0.3883


   Academic Editions

Academic licenses of all GeneXproTools editions are available at a discount for education institutions & students.

   Software Bundles

Bundles of GeneXproTools & GeneXproServer are available at a discount price for all editions of GeneXproTools, including academic editions.

   Subscribe to the GEP-List

3 8 4

"Finally, a world class user interface in the field of genetic programming and evolutionary computation !! GeneXproTools is simply unrivaled in its marvelous user interface, the breadth of its Fitness Functions, the choice and flexibility in Math and Logic functions, the clarity of its final Model Presentation, and a built in panel for Scoring new data, right inside the interface. This kind of functionality and ease of use has never been seen before in the field of Genetic Programming. Additionally, Dr Ferreira's specific methodology of Gene Expression Programming makes important contributions to the field of evolutionary computation, and the various algorithms she has developed and deployed inside of GeneXproTools are brilliantly conceived, and her methodologies evolve highly predictive models that solve real business problems. GeneXproTools is an extraordinary structural tour de force."

Brian C. Watt, CRM
Chief Risk Officer / Chief Financial Officer


"I have been using GeneXproTools against a variety of drug research related problems and have found the GUI to be readily-usable and well-attuned to the stages of predictive modeling..."

Steven J Barrett, Ph.D
Principal Scientist
New Applications Team
Data Exploration Sciences GlaxoSmithKline


"Gene Expression Programming, combined with GeneXproTools, allow us here at Mercator GeoSystems to explore new and exciting methods for spatially modelling the relationship between a company's outlets and their customers. The GeneXproTools software is simple to use, well-designed and very flexible. In particular the ability to load training data from a database, and the option to create models in the programming language of our choice, really make this product stand out. Product support is excellent and very responsive - heartily recommended!"

Steve Hall
Mercator GeoSystems Ltd
United Kingdom

"As a professional software developer, I could have attempted to read up on all the latest developments in the field of evolutionary programming and start writing my own modeling tools. One look at the GeneXproTools demo, however, was enough to convince me of the absurdity of that thought. Not only does GeneXproTools have all the power that I would ever need, but it also allows me to customize all parts of the modeling process. I don't have to know the first thing about evolutionary algorithms and yet I can write my own grammars or fitness functions if I wanted to. It is obvious that a huge amount of work went into the making of GeneXproTools, and I am now a very happy customer. Keep up the great work, Gepsoft!"

Glenn Lewis
Software developer, USA

"I've been working as a coastal engineer and mathematical modeler for more than 10 years and now I'm using GeneXproTools to discover complex nonlinear relations that exist in hydraulic and wave processes. For example, GeneXproTools recently helped me establish several explicit approximations to the Wave Dispersion Equation and now with the new version, which allows more independent variables, fitness functions and unlimited records, I plan to develop my own formulae to evaluate the wave overtopping of breakwaters and seawalls. Thanks Gepsoft for providing such an exciting, creative and useful software tool to the scientific community."

Ricardo Carvalho
PROMAN - Centro de Estudos & Projectos, SA
Lisbon, Portugal

"GeneXproTools is being used to look at problems involving parasite populations, where the data is highly skewed. The results using GeneXproTools are considerably better than those obtained using conventional statistics."

Prof John Barrett
Head of the Parasitology Group
University of Wales, UK

"We are using GeneXproTools for modeling the rainfall-runoff process and time series forecasting. GeneXproTools has a nice graphical user interface system and a lot of flexibility in choosing the type of input file. Configuring the problem setup, running and visualizing the graphical outputs with GeneXproTools is indeed user friendly. Being able to get the final model in the languages of our choice makes GeneXproTools stand out from other packages."

Professor S. Mohan
Professor & Head of the Department
Department of Civil Engineering
Indian Institute of Technology, Madras


Home | What's New | Products | Buy Now | Downloads | Quick Tour | Support | Contact Us | About Gepsoft | Sign Up
Forum | Blog | Videos | Tutorials | Knowledge Base | Server KB | Logistic Regression Guide | Terms of Use | Privacy & Cookies

Copyright (c) 2000-2014 Gepsoft Ltd. All rights reserved.