Newsgroups: comp.ai.genetic
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!delmarva.com!news.internetMCI.com!newsfeed.internetmci.com!in1.uu.net!halon!sybase!usenet
From: George Van Treeck <treeck@sybase.com>
Subject: Re: Extra bits
Content-Type: text/plain; charset=us-ascii
Message-ID: <30BB7FB3.246C@sybase.com>
Sender: usenet@sybase.com
Content-Transfer-Encoding: 7bit
Organization: Sybase, Inc.
References: <81757448934n12@news.cecer.army.mil>
Mime-Version: 1.0
Date: Tue, 28 Nov 1995 21:31:31 GMT
X-Mailer: Mozilla 2.0b2 (X11; I; SunOS 5.3 sun4m)
Lines: 28

Michael=J=Fuerst%PL-B%USACERL@leo.cecer.army.mil wrote:
> 
> When coding a GA, how might one handle
> a problem which contains an integer
> variable which can take only say
> 5 values.   One needs 3 bits to represent it,
> but this leaves three unused bit combinations.
> 
> Does one arbitrarily assign a valid value
> to each of the otherwise unsued values,
> or is their a better scheme?

What I generally do is take the mod of the integer, e.g.,

	y = x % 5;

This returns a value on the closed interval, 0 to 4 (five
values).

This does not make "hill climbing" possible. But, for such a small
value the number of possible combinations is small enough
that all possible combinations can be tested quickly.

If you do need a hill climbing effect than spread the 5 values
over the 8 possible bit values, e.g., 000 and 001 both translate
to 0; 010 and 011 both translate to 1; etc.

-George
