Simple genetic algorithm problem

View: New views
4 Messages — Rating Filter:   Alert me  

Simple genetic algorithm problem

by Berlin Brown :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am working on a simple problem and not familiar with jgap.

http://www.c-sharpcorner.com/UploadFile/mgold/GAAdderDesign09242005053429AM/GAAdderDesign.aspx
"Using Genetic Algorithms to Design Logic Circuits in C#"

I was trying to build a full adder (two 2 bit inputs to generate a 3
bit output, the addition of the 2 input bits).

In this example, the goal is to build a set of logic gates.   For the
first bit of the adder, the final solution is to have a gate that
takes "d XOR b".  To map to that solution, the program is given a
truth table to map to and some other logic.

{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 1},
{0, 0, 1, 0, 0, 0, 1, 0},
{0, 0, 1, 1, 0, 0, 1, 1},
{0, 1, 0, 0, 0, 0, 0, 1},
{0, 1, 0, 1, 0, 0, 1, 0},
{0, 1, 1, 0, 0, 0, 1, 1},
{0, 1, 1, 1, 0, 1, 0, 0},
{1, 0, 0, 0, 0, 0, 1, 0},
{1, 0, 0, 1, 0, 0, 1, 1},
{1, 0, 1, 0, 0, 1, 0, 0},
{1, 0, 1, 1, 0, 1, 0, 1},
{1, 1, 0, 0, 0, 0, 1, 1},
{1, 1, 0, 1, 0, 1, 0, 0},
{1, 1, 1, 0, 0, 1, 0, 1},
{1, 1, 1, 1, 0, 1, 1, 0},

My question is, what solution do you think I could use with jgap.  It
looks like the Boolean alleles is all I would need?

--
Berlin Brown (berlin dot brown at gmail.com)
http://botnode.com
http://berlinbrowndev.blogspot.com/

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users

Re: Simple genetic algorithm problem

by Klaus Meffert-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Berlin,

It seems you could use a BooleanGene as you only need two states. Besides, a
FixedBinaryGene could be useful as well as it represents a fixed length data
container with each atomic information being 0 or 1.

Best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: Berlin Brown [mailto:berlin.brown@...]
> Sent: Thursday, April 16, 2009 1:34 PM
> To: jgap-users@...
> Subject: [jgap-users] Simple genetic algorithm problem
>
> I am working on a simple problem and not familiar with jgap.
>
> http://www.c-sharpcorner.com/UploadFile/mgold/GAAdderDesign092
> 42005053429AM/GAAdderDesign.aspx
> "Using Genetic Algorithms to Design Logic Circuits in C#"
>
> I was trying to build a full adder (two 2 bit inputs to
> generate a 3 bit output, the addition of the 2 input bits).
>
> In this example, the goal is to build a set of logic gates.   For the
> first bit of the adder, the final solution is to have a gate
> that takes "d XOR b".  To map to that solution, the program
> is given a truth table to map to and some other logic.
>
> {0, 0, 0, 0, 0, 0, 0, 0},
> {0, 0, 0, 1, 0, 0, 0, 1},
> {0, 0, 1, 0, 0, 0, 1, 0},
> {0, 0, 1, 1, 0, 0, 1, 1},
> {0, 1, 0, 0, 0, 0, 0, 1},
> {0, 1, 0, 1, 0, 0, 1, 0},
> {0, 1, 1, 0, 0, 0, 1, 1},
> {0, 1, 1, 1, 0, 1, 0, 0},
> {1, 0, 0, 0, 0, 0, 1, 0},
> {1, 0, 0, 1, 0, 0, 1, 1},
> {1, 0, 1, 0, 0, 1, 0, 0},
> {1, 0, 1, 1, 0, 1, 0, 1},
> {1, 1, 0, 0, 0, 0, 1, 1},
> {1, 1, 0, 1, 0, 1, 0, 0},
> {1, 1, 1, 0, 0, 1, 0, 1},
> {1, 1, 1, 1, 0, 1, 1, 0},
>
> My question is, what solution do you think I could use with
> jgap.  It looks like the Boolean alleles is all I would need?
>
> --
> Berlin Brown (berlin dot brown at gmail.com)
> http://botnode.com http://berlinbrowndev.blogspot.com/


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users

Re: Simple genetic algorithm problem

by berlinbrown :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am sorry, but I am new to this.

I could use the BooleanGene, and maybe have 16 sets of BooleanGenes.

There are two 2-bit inputs and one 3-bit output (these represent the
columns) and there are 16 rows.

I think I know how to represent each row (say 2*2 + 3 = 7/8 BooleanGenes
per row) but I don't know how to have a collection of rows in the
truthtable.

I know this is an easy problem, I just don't have a good idea on how to
represent it (maybe the best thing is to to better go through the
examples) unless someone sees an easy answer to the complete problem.

And jgap is a great tool by the way.

-----Original Message-----
From: Klaus Meffert [mailto:jgap@...]
Sent: Saturday, April 18, 2009 5:52 AM
To: 'Berlin Brown'; jgap-users@...
Subject: Re: [jgap-users] Simple genetic algorithm problem

Berlin,

It seems you could use a BooleanGene as you only need two states.
Besides, a FixedBinaryGene could be useful as well as it represents a
fixed length data container with each atomic information being 0 or 1.

Best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: Berlin Brown [mailto:berlin.brown@...]
> Sent: Thursday, April 16, 2009 1:34 PM
> To: jgap-users@...
> Subject: [jgap-users] Simple genetic algorithm problem
>
> I am working on a simple problem and not familiar with jgap.
>
> http://www.c-sharpcorner.com/UploadFile/mgold/GAAdderDesign092
> 42005053429AM/GAAdderDesign.aspx
> "Using Genetic Algorithms to Design Logic Circuits in C#"
>
> I was trying to build a full adder (two 2 bit inputs to generate a 3
> bit output, the addition of the 2 input bits).
>
> In this example, the goal is to build a set of logic gates.   For the
> first bit of the adder, the final solution is to have a gate that
> takes "d XOR b".  To map to that solution, the program is given a
> truth table to map to and some other logic.
>
> {0, 0, 0, 0, 0, 0, 0, 0},
> {0, 0, 0, 1, 0, 0, 0, 1},
> {0, 0, 1, 0, 0, 0, 1, 0},
> {0, 0, 1, 1, 0, 0, 1, 1},
> {0, 1, 0, 0, 0, 0, 0, 1},
> {0, 1, 0, 1, 0, 0, 1, 0},
> {0, 1, 1, 0, 0, 0, 1, 1},
> {0, 1, 1, 1, 0, 1, 0, 0},
> {1, 0, 0, 0, 0, 0, 1, 0},
> {1, 0, 0, 1, 0, 0, 1, 1},
> {1, 0, 1, 0, 0, 1, 0, 0},
> {1, 0, 1, 1, 0, 1, 0, 1},
> {1, 1, 0, 0, 0, 0, 1, 1},
> {1, 1, 0, 1, 0, 1, 0, 0},
> {1, 1, 1, 0, 0, 1, 0, 1},
> {1, 1, 1, 1, 0, 1, 1, 0},
>
> My question is, what solution do you think I could use with jgap.  It
> looks like the Boolean alleles is all I would need?
>
> --
> Berlin Brown (berlin dot brown at gmail.com) http://botnode.com 
> http://berlinbrowndev.blogspot.com/


------------------------------------------------------------------------
------
Stay on top of everything new and different, both inside and around Java
(TM) technology - register by April 22, and save $200 on the JavaOne
(SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users



------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users

Re: Simple genetic algorithm problem

by Klaus Meffert-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Berlin,

Maybe have a look at the following examples:
Package examples, main class is MinimizingMakeChange: Here, four input genes
are used. Although they are IntegerGene's, you should be able adapting the
example easily to BooleanGene's.
Package examples.math, main class is MathRunner: Here, a mathematical
formula is evolved. Maybe this is sort of interesting, too.

Please pay special attention to the configurations and the fitness functions
and how the latter is implemented in the above examples.

Is somethigng remains unclear please come back.

Best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: Brown, Berlin [GCG-PFS] [mailto:Berlin.Brown@...]
> Sent: Monday, April 20, 2009 3:28 PM
> To: Klaus Meffert; Berlin Brown; jgap-users@...
> Subject: RE: [jgap-users] Simple genetic algorithm problem
>
> I am sorry, but I am new to this.
>
> I could use the BooleanGene, and maybe have 16 sets of BooleanGenes.
>
> There are two 2-bit inputs and one 3-bit output (these represent the
> columns) and there are 16 rows.
>
> I think I know how to represent each row (say 2*2 + 3 = 7/8
> BooleanGenes per row) but I don't know how to have a
> collection of rows in the truthtable.
>
> I know this is an easy problem, I just don't have a good idea
> on how to represent it (maybe the best thing is to to better
> go through the
> examples) unless someone sees an easy answer to the complete problem.
>
> And jgap is a great tool by the way.
>
> -----Original Message-----
> From: Klaus Meffert [mailto:jgap@...]
> Sent: Saturday, April 18, 2009 5:52 AM
> To: 'Berlin Brown'; jgap-users@...
> Subject: Re: [jgap-users] Simple genetic algorithm problem
>
> Berlin,
>
> It seems you could use a BooleanGene as you only need two states.
> Besides, a FixedBinaryGene could be useful as well as it
> represents a fixed length data container with each atomic
> information being 0 or 1.
>
> Best
>
> Klaus
> www.klaus-meffert.com
>
>  
>
> > -----Original Message-----
> > From: Berlin Brown [mailto:berlin.brown@...]
> > Sent: Thursday, April 16, 2009 1:34 PM
> > To: jgap-users@...
> > Subject: [jgap-users] Simple genetic algorithm problem
> >
> > I am working on a simple problem and not familiar with jgap.
> >
> > http://www.c-sharpcorner.com/UploadFile/mgold/GAAdderDesign092
> > 42005053429AM/GAAdderDesign.aspx
> > "Using Genetic Algorithms to Design Logic Circuits in C#"
> >
> > I was trying to build a full adder (two 2 bit inputs to
> generate a 3
> > bit output, the addition of the 2 input bits).
> >
> > In this example, the goal is to build a set of logic gates.
>   For the
> > first bit of the adder, the final solution is to have a gate that
> > takes "d XOR b".  To map to that solution, the program is given a
> > truth table to map to and some other logic.
> >
> > {0, 0, 0, 0, 0, 0, 0, 0},
> > {0, 0, 0, 1, 0, 0, 0, 1},
> > {0, 0, 1, 0, 0, 0, 1, 0},
> > {0, 0, 1, 1, 0, 0, 1, 1},
> > {0, 1, 0, 0, 0, 0, 0, 1},
> > {0, 1, 0, 1, 0, 0, 1, 0},
> > {0, 1, 1, 0, 0, 0, 1, 1},
> > {0, 1, 1, 1, 0, 1, 0, 0},
> > {1, 0, 0, 0, 0, 0, 1, 0},
> > {1, 0, 0, 1, 0, 0, 1, 1},
> > {1, 0, 1, 0, 0, 1, 0, 0},
> > {1, 0, 1, 1, 0, 1, 0, 1},
> > {1, 1, 0, 0, 0, 0, 1, 1},
> > {1, 1, 0, 1, 0, 1, 0, 0},
> > {1, 1, 1, 0, 0, 1, 0, 1},
> > {1, 1, 1, 1, 0, 1, 1, 0},
> >
> > My question is, what solution do you think I could use with
> jgap.  It
> > looks like the Boolean alleles is all I would need?
> >
> > --
> > Berlin Brown (berlin dot brown at gmail.com) http://botnode.com 
> > http://berlinbrowndev.blogspot.com/
>
>
> --------------------------------------------------------------
> ----------
> ------
> Stay on top of everything new and different, both inside and
> around Java
> (TM) technology - register by April 22, and save $200 on the JavaOne
> (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p 
> _______________________________________________
> jgap-users mailing list
> jgap-users@...
> https://lists.sourceforge.net/lists/listinfo/jgap-users
>
>
> Eingehende eMail ist virenfrei.
> Von AVG überprüft - www.avg.de
> Version: 8.5.287 / Virendatenbank: 270.12.1/2071 -
> Ausgabedatum: 04/21/09 08:30:00
>


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users