What is a Genetic Algorithm?
ou have found
the Visual Basic Genetic Algorithm Library Page. (audio
.mpeg of this page) Okay you scurvy, Visual Basic Dogs! Are
you tired of the C and C++ cats having all the great genetic algorithm tools? Well, I know
I was, and so I've put together a small friendware library for you. What is a genetic
algorithm? A genetic algorithm is a model of machine data sorting which derives its
behavior by analogy to certain mechanisms of evolution in nature. This is done by the
creation within your computer of a population of individuals represented by chromosomes.
Loosely speaking, In GALIB these are implemented as 8-bit bytes in an array. (In real
biology, as in what's going on in your body, there are only 4 bits to your DNA, but the
data structure processes used by the GALIB are somewhat similar.) GALIB uses collections
of bits spread across the bytes (held within the population array I just mentioned) to
simulate evolution. And it doesn't use strings, so it's fast!
Now the scurvy Visual Basic dog faces several hurdles when s/he
tries to get into the genetic algorithm act
- Language Barrier. Most
of the free code to be found on the internet via commonly known search engines is in
languages other than Visual Basic. Don't feel like learning C++, plus the compiler
environment, plus the data structure of a genetic algorithm? You lazy mutt!
- Boy Toys. What code
there is to be found (at least easily and readily) by the common search engines is
"toy code". Toy implementations will let you watch bits shuffle around. They
will show you the evolutionary processes. They will probably use pretty graphics too.
It'll be real clear what's going on. But they never give you a generalized way to apply
that bit fiddling to any real world problem! In a phrase, they do not implement the
most important "second order" function of a GA--you know, like finding
values for an equation that you get to put in. That would be just too hard to program and
then simply give it way for free. (See next point)
- Peonic Greed. "We
worked hard on this over a zillion man hours..." "It's easy to use..."
"It does this, that, and the other.." "Now send us your [$70, $140, even
$500] dollars!" Hey man, that's a lot of bones! What ever happen to The Big Dogs
giving it away for everybody else to howl at? The best musicians play for free; likewise,
the best programmers also play for free. (Like Napster did, but w/o going corporate! Those
losers.) This is friendware, you don't have to pay if you don't want to, and you can still
keep using it or modifying it. If you can make millions off of it and not tell me--go for
- Code Slakkers.
Generally, when some of the more advanced computational structures are ported to Visual
Basic, it's not well documented. Yeah, you can run the code. But how can you tell what
it's doing? Not five minutes before writing this sentence, I downloaded a VB neural net
program. I ran it. Pretty lights blinked and fancy-pants terms appeared on buttons. Not a
READ.ME file in sight. About one out of fifty lines was cryptically commented. Look, if
you're such a programming wolf, how come you can't explain what you're doing? Listen:
friends don't let friends drive drunk; and, hackers shouldn't let hackers program mute.
Won't somebody hide their keyboards until they're back on their feet?!
- Ph.D. Hey, I like
mathematicians and academic tech-heads as much as the next guy, but they didn't start out
that way upon slipping from the birth canal. Can't somebody once in a while write some
entry level code that doesn't demand I know everything from Active X,Y,Z to Class
Structures to Database SQL just to learn the basics? No wonder High School people don't
program anymore. Whose code could they steal? A.M. Turing, the inventor of the computer,
just had a tape, a read/write head, and a few back and forth commands. Where did we go so
wrong? (I'll admit that my assembly language flashbacks affect my better
- .EXE vs .BAS. It is not
unusual to find cool GA applications that do understandable things. There are genetic
algorithm programs which draw pictures, simulate chemistry problems, build
boards, and lots of other stuff. "Mind if I look under the hood mister ?!"
What's the response? "Keep your paws off the apparatus, son. This is .EXE only. No
source code for you, putz." Yelp! Yelp! That smarts.
Well, that's plenty of fur flying to make the point: If you want to
do some genetic algorithms with your computer, GALIB is a great place to start. Here's what it
- The Language You Know.
All the code is written in Visual Basic 6.0. Except for one matrix to matrix transfer (for
speed, which could be recoded quite easily), the code could be easily ported to other
versions of Visual Basic, even other languages. (I'm probably going to code this back into
C++ eventually, but into very basic and friendly code, I assure you.)
- Toys-R-Not-Us. This
isn't toy code. You can put in your own equations with virtually as many or as few
variables as you want. And then have GALIB solve for those variables. One
the GALIB implements the second-order uses in one routine. Remember polynomials from High
School Algebra? (X + 3)(X+2) yields X^2 + 5X + 6 = 0. That's got one variable you might
want to solve. GALIB can solve equations like this (and more difficult, real-world ones
not like this) and with a whole lot more variables than just one. You can control how many
chromosomes are in your population, the crossover rates, how many bits are in individual
genes (thus, defining your own genome), and other relevant
parameters of a GA data structure.
- I've got a Career. I'm
a middle class, late 30s white guy. I got healthy kids, a loving wife, a circle of
friends, and professional peers that respect me. I go to work each day and enjoy my job.
I'm not sitting behind my keyboard after a day job at Hairnet Temporary Job Services
dreaming that you're all going to send me $5.99 so that I get rich one Abe Lincoln at a
time. It's friendware. Go figure.
- Show and Tell. I've
documented the code. But that's usually not enough, really. So I've put together this
Hypertext document of just how my program works; how the information flows among the
routines; how the variables are used; and how to use the module with your programs. If
you've programmed in any of the common languages out there, you shouldn't have any trouble
figuring out what various applications of the GALIB are doing.
- The Ivory Tower. I'm a
professor, I'll admit it. But that doesn't mean my code doesn't have bugs, or that you
can't improve on what I'm doing here. Go ahead, make my day. Dare to email me all your
great tweaks. I'll just fix GALIB and put out a better version the next time. Anyhow, I
rarely even teach programming anymore; it's not even my area of specialty. I'll say this:
If you go through this document, you'll learn plenty about a very important area in
multi-disciplinary computer programming.
- .BAS You Can See. I've
tried to avoid the slick features that Visual Basic 6.0 offers. By doing so, I make it
easier to understand what GALIB is doing. In turn, this makes it easier for you to
appropriate GALIB's routines in your own programs. (After all, it's a module you append to
your own Visual Basic Projects). If you're Pat Putz, Professional Programmer, then add all
the slick stuff you want.
I've tired of ranting. Let's get down to business. Start this
whole tutorial by clicking on the links at the left of this document.
Info on Last Update: [08/15/2003]
web counter by: