I have a following problem - I have a rule engine (drools) that evaluates risk score of transactions.If risk is too high (>200) then it is marked as unsafe. Each rule has their weight (1-100) that is assigned to risk score if rule gets executed.
I wanted to have a tool for optimizing the weights. And so I thought of genetic algorithm.
1. I would send batch of test transactions (with additional parameter that tells how they should be marked -> as unsafe or not) to engine to let it evaluate them
2. I would check how many rules were fired (it would determine number of chromosomes in genotype) and let's say if 5 was fired then...
3....I would create first population consisting of 500 genotypes, each having 5 chromosomes (and chromosome having gene with value ranging 1-100)
4. I would repeat step one for all genotypes in population
5. I would check what percent of transactions was marked correctly by using additional parameter I mentioned earlier.
6. I would assign to each genotype fitness function based on percentage of how many transactions were evaluated correctly
7. Repeating the cycle for number of generations until solution is reached (100% transactions are marked correctly) with crossovers, mutations etc.
It is my first time trying to do anything with genetic algorithms, so first thing I would like to clarify is
my understanding of how genotype/chromosome/gene works. In different sites they sometimes use the terms as substitutes of one another and it can be confsuing. I was learning terminology basing on jenetics library cause I was thinking to use it for implementation.
I later realized that I did not take into account one thing - I may evolve values of weights of rules but the weight is not the only thing important - it is also important to which rule the weight will be assigned! but I have no idea where I should put that additional information as to which rule the weight refers to.. somewehre in chromosome? That is the biggest issue for me, I just cannot see where to fit it in equation.
Optimization is a fast and rapidly expanding field. You wil find that there are many terms flying around for the same characteristics, which can become very confusing. To me it seems you have a decent grasp of how the genetic algorithm works and it's associated terms (based on your outline in the question). For a nice reference please see this website. As a suggestion you can check out the MOEA Framework instead of jenetics. I think it's a better suited library for many optimisation techniques.
With regards to the second part of the question. If my understanding is correct you are uncertain how to keep track of which chromosome applies to which rule. If that is the case, you can simply keep your rules in a list and match them with the chromosomes. In other words the first chromosome of the individual (or genotype as per your reference) corresponds to the first rule in the problem. By doing so your can be sure to know which weight (chromosome value) applies to which rule.
Please correct me if I misunderstood.