Genetic algorithm assignment
Modify genetic algorithm code that designs a 6-bit parity checker
to design a 2-bit adder. Graduate students need to make
the GA design a three-bit adder without allowing the genetic
algorithm to use XOR gates. A 2-bit adder adds 2, 2-bit inputs
and produces a 3-bit output. A 3-bit adder adds two, 3-bit numbers
and produces a 4-bit output.
-
You will need to change code in app.c and perhaps some of the .h files.
- You will need to change appinfile (which specifies the problem to be
solved by the GA) and perhaps infile (which specifies GA parameters).
- You will probably need to read all the code to get an understanding
of what it does and how.
- You may write your own GA and evaluator (simulator) for
combinational logic circuits.
Resources
The genetic algorithm can be run with a number of options.
bin/run.sh is a shell script that uses
three of the available options.
- -i infile : The -i option can be used to specify a file of
ga parameters
- -a appinfile : The -a option can be used to specify the
name of a file from which to read application specific data. In the
parity problem, this is 1) Number of input bits, 2) Number of rows, and
3) the number of columns of the gate array that holds the circuit.
- -s 0.9374 : The -s option specifies a random seed
between 0 and 1 for the ga to use.
- -o outfilename : The -o option specifies the base name
of an output file. Files outfilename, outfilename.fit,
outfilename.pheno will be produced. For the parity checker,
outfilename.pheno will be blank.
Read an explanation of the code and how to run
the genetic algorithm
Turning it in
Please turn in a graph of fitness versus number of generations for the
run of the GA that produced a correct circuit. Also turn in the binary
representation of the circuit as well as a corresponding circuit diagram.
Turn in a diff listing of files that you changed (%diff file1 file2 lists
all differences between file1 and file2). Finally, answer the question:
How does your circuit work?
Sushil Louis Last
modified: Wed Oct 5 11:15:46 PST 2005