[galib] CONSTRAINS DEFINITION
Liekens, A.M.L.
A.M.L.Liekens at tue.nl
Mon Nov 10 12:50:54 EST 2003
Hi,
The constraints you want to use and those used in example 9 of galib differ quite a lot. In example 9, we just want to find the optimum (in this case the maximum) of the quadratic function y = - x1^2 - x2^2, where x1 and x2 should be within the intervals [-5..5]. In order to solve this, we can easily represent values x1 and x2 (which we need to find) as genomes that represent numbers with the range from -5 to 5, which is done in the program. In the case of example 9, we use a 16 bit binary representation of these numbers by mapping them.
A constraint problem like the one you suggest, on the other hand, is quite different from a genome's point of view. In your case, the resulting genome (x1,x2,x3) needs to hold for X1+6*X2-13*X3 = 20, which is quite different from having a square sized search space we need to search for an as-optimal-as-possible solution. In order to solve a similar problem there are a couple of approaches you can try.
1. Find a good mapping from an easily representable search space to your constrained search space. This easily representable space can than be searched, where you map the genome to a place in your constrained space before computing the fitness of the genome. This is a hard option.
2. Similarly, you could construct crossover and mutation operators that keep your genomes in the constrained search space, if their inputs are within your constrained search space (e.g. if the parents are in the constrained space, make sure that their children, created through crossover and mutation are also in the constrained space). If you start a GA, where all the initial genomes are within the constrained search space, and use these genetic operators to work with your GA, the GA will look for a solution in your constrained space. This is a pretty tough solution as it is not easy to create crossover and mutation operators that follow these directions.
3. Just use a larger search space than the one you require (i.e. use a bounding box of your 3d face) and change the fitness function by adding a penalty to the fitness if your genome does not follow your constraint. More so, you can add a larger penalty to the fitness function if the genome is further away. As a result, if the GA is trying to solve this problem, it will not only look for a solution in your bounding box, but it will also try to move its genomes towards your constraining face, as these genomes will receive a smaller penalty and therefore be a better solution to your problem. Note that this approach does not necessarily return a solution that fits to your constraints.
I hope this helps. If you are, as you state, a beginner in GAs, then try the last option, and add a penalty to your fitness if the genome is not within the constrained search space.
Please refrain from using CAPS LOCK in your message headers.
Anthony,-
-----Original Message-----
From: Carlos Andres
To: galib at mit.edu
Sent: 11/9/2003 8:21 AM
Subject: [galib] CONSTRAINS DEFINITION
Hi everyone, I saw the example 9 that comes witth galib, and I need to
do something similar, my problem is that in this example they uses
constrains that have only one variable and I need to represent
constrains that uses two or more variables, like this:
X1+6*X2-13*X3 = 20
How can I do that?
using the GABin2DecPhenotype?
Please be the clearest as you can, Im new. Thanks
More information about the galib
mailing list