Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Using Genetic Algorithms to Evolve Cellular Automata Rules - Assignment 2 | CS 591, Assignments of Programming Languages

Material Type: Assignment; Professor: Moses; Class: ST: Prog Analy &Mechanization; Subject: Computer Science; University: University of New Mexico; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 07/22/2009

koofers-user-kxl
koofers-user-kxl 🇺🇸

5

(1)

10 documents

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download Using Genetic Algorithms to Evolve Cellular Automata Rules - Assignment 2 | CS 591 and more Assignments Programming Languages in PDF only on Docsity! Using
Genetic
Algorithms
to
Evolve
Cellular
Automata
Rules
 Complex
Adaptive
Systems,
CS
591
 Assignment
2
 Due
March
31,
2008
 
 Introduction
&
Setup
 In
this
assignment
you
will
use
a
genetic
algorithm
(GA)
to
evolve
rules
for
a
SIR
CA
 that
maximizes
the
fitness
of
a
virus.
You
may
work
in
pairs.
 
 The
CA
 The
CA
has
4
states:
(0=
EMPTY,
1=
SUSCEPTIBLE,
2=INFECTED,
3=RECOVERED).
 One
rule
set
for
such
a
CA
is
described
in
Assignment
1,
part
2.2.
There
are
 constraints
on
the
transition
rules
such
that
the
cells
have
a
predetermined
cycle
of
 states;
they
can
go
from
0
‐>1
‐>
2
‐>
3
‐>0,
so
that
cells
can
potentially
cycle
 indefinitely.
Assignment
1
Rule
Set
2
gives
one
set
of
transition
rules:
 1.
A
cell
transitions
from
state
0
to
1
if
2
or
more
neighbors
are
in
state
0
(birth)
 2.
A
cell
transitions
from
state
1
to
2
if
2
or
more
neighbors
are
in
state
2
(infection)
 3.
A
cell
transitions
from
2
to
3
if
4
or
fewer
neighbors
are
in
state
2
(recovery)
 4.
A
cell
transitions
from
state
3
to
0
if
3
or
more
neighbors
are
in
state
3
(death)
 If
these
conditions
are
not
met,
the
cell
stays
in
its
current
state.
 Your
job
in
this
assignment
is
to
evolve
a
new
set
of
rules,
that
have
the
same
 structure
as
the
4
rules
above,
in
order
to
maximize
the
number
of
infections
that
 the
virus
can
create.
Preserve
the
transition
cycle
(0
‐>1
‐>
2
‐>
3
‐>0),
and
the
 dependencies
of
the
states
(e.g.,
the
transition
from
0
to
1
depends
on
the
number
of
 neighbors
in
state
0,
and
neighbors
in
other
states
are
irrelevant.)
You
should
also
 preserve
the
>=
condition
in
rules
1,2
and
4
and
the
<=
relationship
in
rule
3.
 To
do
this,
you
will
need
to
‘evolve’
4
separate
numbers:
 A=
the
min
number
of
neighbors
in
state
0
that
cause
a
cell
to
transition
from
0
to
1

 B=
the
min
number
of
neighbors
in
state
2
that
cause
a
cell
to
transition
from
1
to
2
 C=
the
max
number
of
neighbors
in
state
2
that
cause
a
cell
to
transition
from
2
to
3

 D=
the
min
number
of
neighbors
in
state
3
that
cause
a
cell
to
transition
from
3
to
0
 
 The
CA
should
use
a
Moore
neighborhood,
so
there
are
8
possible
neighbors.
Use
a
3
 bit
string
to
represent
the
number
of
neighbors,
and
use
Gray
codes
to
avoid
the
 Hamming
cliff.
(There
are
actually
9
possible
conditions
to
consider
since
0
to
8
 neighbors
could
be
in
the
relevant
state.
To
make
things
easier,
don’t
allow
your
 rules
to
cause
a
transition
with
0
neighbors.
Then
you
have
8
numbers
to
consider
 and
can
use
a
3
bit
gray
code
for
each
number.)
For
this
simple
case,
you
will
have
a
 very
short
(12
bit)
string
to
evolve.

 
 The
GA
 Sample
Matlab
code
for
a
GA
(created
by
George
Bezerra)
is
posted
online.
That
 code
uses
tournament
selection,
mutation
and
2
point
cross‐over
to
evolve
a
string
 with
the
maximum
number
of
ones.
You
may
start
with
this
code
and
modify
it,
or
 you
may
find
other
code
online,
or
you
may
write
your
own.
Your
GA
should
evolve
 a
string
which
forms
the
rule
set
of
the
CA
described
above.
 
 Your
fitness
function
(f)
is
simply
f
=
I,
where
I
is
the
number
of
new
infections
 produced
over
a
run
of
the
CA.
That
is,
you
should
calculate
the
fitness
of
the
string
 by
passing
that
string
to
your
CA,
running
the
CA,
and
measuring
the
number
of
 infections
produced.
Be
aware
that
you
cannot
simply
add
up
the
number
of
infected
 cells
at
each
time
step.
If
a
cell
is
infected
for
10
time
steps,
it
only
counts
as
1
 infection.
I
is
the
number
of
transitions
from
state
1
to
state
2.
You
can
use
that
raw
 value
as
your
fitness
function,
and
with
tournament
selection
there
is
no
need
to
 normalize
the
fitness
values
(e.g.
if
1700
infections
occur
using
the
rule
set
encoded
 by
string1,
then
f(string1)
=
1700.)
This
approach
is
valid
if
you
run
the
CA
with
a
 fixed
grid
size
for
a
fixed
number
of
iterations
for
each
run
of
your
GA.
You
will
want
 to
run
your
CA
as
efficiently
as
possible
(with
no
extraneous
functionality
like
 displaying
the
state
of
the
CA
to
the
screen),
since
you
will
have
to
run
the
CA
many
 times
for
each
tournament
for
many
generations
of
the
GA.
 
 
 Initial
conditions
 Initialize
your
CA
with
a
fully
susceptible
population
with
no
empty
spaces,
and
all
 cells
in
state
1,
EXCEPT,
set
8
cells
in
a
row
in
the
center
of
your
CA
to
be
infected.
 This
represents
a
new
virus
infecting
a
fully
susceptible
population.
(You
need
8
 initially
infected
cells
in
order
to
allow
B
to
equal
any
value
up
to
8.)
 
 Set
your
CA
to
a
20x20
grid.
The
number
of
iterations
is
up
to
you,
but
be
sure
to
run
 your
CA
long
enough
for
new
births
to
significantly
increase
the
number
of
 infections
(without
births,
there
are
only
400
possible
infections
no
matter
how
long
 you
run
the
CA.)
 
 First
initialize
your
GA
by
following
suggestions
made
in
Dr.
Forrest’s
lecture
for
the
 size
of
the
tournament,
the
number
of
generations
for
the
GA,
mutation
rates
and
 cross
over
rates
(given
that
you
have
a
small
string
of
only
12
bits).

 

Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved