Problem generating population

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem generating population

Bruno Fernández Gonzalez
Hello. I'm using genetic programming with jgap and I have a problem while generating the initial population. I have a type which is output of only one function but it's input of many of them and there are no terminals of this type. The problem is, when I try to generate the initial population with "GPGenotype.randomInitialGenotype", it can't find suitable nets and clone only a few. As a result, I have no enough variability.

The problem seems to be that it can't close the net if one node with the problematic type as an input appears in the (maxInitDepth-1) level. The bigger the maxInitDepth constant is, the bigger is the time it takes to generate the population and with worst results.

Is there any posibility to make laxer the condition so, if this situation happens, it will try to close the branch as soon as possible even if it breaks the max depth restriction? Any other solution will be welcome too.

Thank you very much.

Sorry if my english is not good enough, I hope the message were understandable.


     

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem generating population

Klaus Meffert-5
Bruno,

sorry for the late reply.

Is it possible in your case to increase the maxInitDepth?
Do you believe there is a program error or bad program behaviour?

Is it possible to get the configuration of your problem to dig in deeper and
develop a good solution for your issue?

Best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: Bruno Fernández [mailto:[hidden email]]
> Sent: Monday, October 26, 2009 5:49 PM
> To: [hidden email]
> Subject: [jgap-users] Problem generating population
>
> Hello. I'm using genetic programming with jgap and I have a
> problem while generating the initial population. I have a
> type which is output of only one function but it's input of
> many of them and there are no terminals of this type. The
> problem is, when I try to generate the initial population
> with "GPGenotype.randomInitialGenotype", it can't find
> suitable nets and clone only a few. As a result, I have no
> enough variability.
>
> The problem seems to be that it can't close the net if one
> node with the problematic type as an input appears in the
> (maxInitDepth-1) level. The bigger the maxInitDepth constant
> is, the bigger is the time it takes to generate the
> population and with worst results.
>
> Is there any posibility to make laxer the condition so, if
> this situation happens, it will try to close the branch as
> soon as possible even if it breaks the max depth restriction?
> Any other solution will be welcome too.
>
> Thank you very much.
>
> Sorry if my english is not good enough, I hope the message
> were understandable.
>
>
>      
>
> --------------------------------------------------------------
> ----------------
> Come build with us! The BlackBerry(R) Developer Conference in
> SF, CA is the only developer event you need to attend this
> year. Jumpstart your developing skills, take BlackBerry
> mobile applications to market and stay ahead of the curve.
> Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> jgap-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jgap-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem generating population

Bruno Fernández Gonzalez
Sorry I didn't thank you but I saw your response yesterday. Finally I made an algorithm to create my own population because I couldn't solve this problem. it's easy, I only made a method called asSoon which closes a branch as soon as it's possible. now, if it finds in the max-1 level a function that does not accept terminals it calls this function to find the shortest branch to close the tree. The only problem is that the programs can exceed the max depth in 1-3 levels, but it works ok.

Klaus Meffert-5 wrote
Bruno,

sorry for the late reply.

Is it possible in your case to increase the maxInitDepth?
Do you believe there is a program error or bad program behaviour?

Is it possible to get the configuration of your problem to dig in deeper and
develop a good solution for your issue?

Best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: Bruno Fernández [mailto:bfg84@yahoo.es]
> Sent: Monday, October 26, 2009 5:49 PM
> To: jgap-users@lists.sourceforge.net
> Subject: [jgap-users] Problem generating population
>
> Hello. I'm using genetic programming with jgap and I have a
> problem while generating the initial population. I have a
> type which is output of only one function but it's input of
> many of them and there are no terminals of this type. The
> problem is, when I try to generate the initial population
> with "GPGenotype.randomInitialGenotype", it can't find
> suitable nets and clone only a few. As a result, I have no
> enough variability.
>
> The problem seems to be that it can't close the net if one
> node with the problematic type as an input appears in the
> (maxInitDepth-1) level. The bigger the maxInitDepth constant
> is, the bigger is the time it takes to generate the
> population and with worst results.
>
> Is there any posibility to make laxer the condition so, if
> this situation happens, it will try to close the branch as
> soon as possible even if it breaks the max depth restriction?
> Any other solution will be welcome too.
>
> Thank you very much.
>
> Sorry if my english is not good enough, I hope the message
> were understandable.
>
>
>      
>
> --------------------------------------------------------------
> ----------------
> Come build with us! The BlackBerry(R) Developer Conference in
> SF, CA is the only developer event you need to attend this
> year. Jumpstart your developing skills, take BlackBerry
> mobile applications to market and stay ahead of the curve.
> Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> jgap-users mailing list
> jgap-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jgap-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
jgap-users mailing list
jgap-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jgap-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem generating population

Klaus Meffert-5
Bruno,

great to hear that you solved the problem. I think that your solution would
be of general interest.
Would you be willing to share your solution?

Best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: Bruno Fernández Gonzalez [mailto:[hidden email]]
> Sent: Wednesday, December 30, 2009 12:23 PM
> To: [hidden email]
> Subject: Re: [jgap-users] Problem generating population
>
>
> Sorry I didn't thank you but I saw your response yesterday.
> Finally I made an algorithm to create my own population
> because I couldn't solve this problem.
> it's easy, I only made a method called asSoon which closes a
> branch as soon as it's possible. now, if it finds in the
> max-1 level a function that does not accept terminals it
> calls this function to find the shortest branch to close the
> tree. The only problem is that the programs can exceed the
> max depth in 1-3 levels, but it works ok.
>
>
> Klaus Meffert-5 wrote:
> >
> > Bruno,
> >
> > sorry for the late reply.
> >
> > Is it possible in your case to increase the maxInitDepth?
> > Do you believe there is a program error or bad program behaviour?
> >
> > Is it possible to get the configuration of your problem to dig in
> > deeper and develop a good solution for your issue?
> >
> > Best
> >
> > Klaus
> > www.klaus-meffert.com
> >
> >  
> >
> >> -----Original Message-----
> >> From: Bruno Fernández [mailto:[hidden email]]
> >> Sent: Monday, October 26, 2009 5:49 PM
> >> To: [hidden email]
> >> Subject: [jgap-users] Problem generating population
> >>
> >> Hello. I'm using genetic programming with jgap and I have
> a problem
> >> while generating the initial population. I have a type which is
> >> output of only one function but it's input of many of them
> and there
> >> are no terminals of this type. The problem is, when I try
> to generate
> >> the initial population with "GPGenotype.randomInitialGenotype", it
> >> can't find suitable nets and clone only a few. As a
> result, I have no
> >> enough variability.
> >>
> >> The problem seems to be that it can't close the net if one
> node with
> >> the problematic type as an input appears in the
> >> (maxInitDepth-1) level. The bigger the maxInitDepth
> constant is, the
> >> bigger is the time it takes to generate the population and
> with worst
> >> results.
> >>
> >> Is there any posibility to make laxer the condition so, if this
> >> situation happens, it will try to close the branch as soon as
> >> possible even if it breaks the max depth restriction?
> >> Any other solution will be welcome too.
> >>
> >> Thank you very much.
> >>
> >> Sorry if my english is not good enough, I hope the message were
> >> understandable.
> >>
> >>
> >>      
> >>
> >> --------------------------------------------------------------
> >> ----------------
> >> Come build with us! The BlackBerry(R) Developer Conference
> in SF, CA
> >> is the only developer event you need to attend this year.
> Jumpstart
> >> your developing skills, take BlackBerry mobile
> applications to market
> >> and stay ahead of the curve.
> >> Join us from November 9 - 12, 2009. Register now!
> >> http://p.sf.net/sfu/devconference
> >> _______________________________________________
> >> jgap-users mailing list
> >> [hidden email]
> >> https://lists.sourceforge.net/lists/listinfo/jgap-users
> >
> >
> >
> ----------------------------------------------------------------------
> > -------- Let Crystal Reports handle the reporting - Free Crystal
> > Reports 2008 30-Day trial. Simplify your report design, integration
> > and deployment - and focus on what you do best, core application
> > coding. Discover what's new with Crystal Reports now.  
> > http://p.sf.net/sfu/bobj-july 
> > _______________________________________________
> > jgap-users mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/jgap-users
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Problem-generating-population-tp26075453
> p26965937.html
> Sent from the jgap-users mailing list archive at Nabble.com.
>
>
> --------------------------------------------------------------
> ----------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app
> distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> jgap-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jgap-users
>


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem generating population

Bruno Fernández Gonzalez
OK. Here's my solution. I'll expose my problem again to be clear enough. I hope this could help in a different context than mine. I hope I'll be able of giving a good explanation, but I'm not very good at english.

The problem:

There are a type of witch there are no terminals and only one node provides it as an output(let's call it node A) but there are many nodes that have it as an input (let's call them nodes B). If the algorithm is creating the population, in the max depth level -1 (let's call it n-1 ) there are many chances that a node B could appear. If this occurs, the only possibility is put a node A in the level n. But A is not a terminal, so the program is not valid. In my code, the 80% of the population used to be a clon because of this, and only with maximum depth 3 or 4. For higher depths it couldn't find any suitable program (because there where more branches to close).

The solution

I made weaker the "maxDepthLevel" condition. If the problem above appears, the branch will be closed as soon as possible. Now, the depth can exceed the maximum but it works.

- I made a test function called "isCloseable(TypeClass t)" that returns true if there are at least a terminal of type t.
- I put a boolean called "asSoon". If it's true, the branch will be closed as soon as possible. This is: you can't use a node if one of it inputs is non-closeable.

Pseudo-code

I choose to attach it to make the reading easy. It's not very complex, only the main things that are independent of my project.

Well, this is it. As you can see is a very easy solution but it works perfect for me. I think it could be useful for other people that might have the same problem, and that it could be adapted to he main jgap code. I tried to explain it as good as I could. If you have any question you can email me, I have no problem in solve anyone's questions.code.txt




Klaus Meffert-5 wrote
Bruno,

great to hear that you solved the problem. I think that your solution would
be of general interest.
Would you be willing to share your solution?

Best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: Bruno Fernández Gonzalez [mailto:bfg84@yahoo.es]
> Sent: Wednesday, December 30, 2009 12:23 PM
> To: jgap-users@lists.sourceforge.net
> Subject: Re: [jgap-users] Problem generating population
>
>
> Sorry I didn't thank you but I saw your response yesterday.
> Finally I made an algorithm to create my own population
> because I couldn't solve this problem.
> it's easy, I only made a method called asSoon which closes a
> branch as soon as it's possible. now, if it finds in the
> max-1 level a function that does not accept terminals it
> calls this function to find the shortest branch to close the
> tree. The only problem is that the programs can exceed the
> max depth in 1-3 levels, but it works ok.
>
>
> Klaus Meffert-5 wrote:
> >
> > Bruno,
> >
> > sorry for the late reply.
> >
> > Is it possible in your case to increase the maxInitDepth?
> > Do you believe there is a program error or bad program behaviour?
> >
> > Is it possible to get the configuration of your problem to dig in
> > deeper and develop a good solution for your issue?
> >
> > Best
> >
> > Klaus
> > www.klaus-meffert.com
> >
> >  
> >
> >> -----Original Message-----
> >> From: Bruno Fernández [mailto:bfg84@yahoo.es]
> >> Sent: Monday, October 26, 2009 5:49 PM
> >> To: jgap-users@lists.sourceforge.net
> >> Subject: [jgap-users] Problem generating population
> >>
> >> Hello. I'm using genetic programming with jgap and I have
> a problem
> >> while generating the initial population. I have a type which is
> >> output of only one function but it's input of many of them
> and there
> >> are no terminals of this type. The problem is, when I try
> to generate
> >> the initial population with "GPGenotype.randomInitialGenotype", it
> >> can't find suitable nets and clone only a few. As a
> result, I have no
> >> enough variability.
> >>
> >> The problem seems to be that it can't close the net if one
> node with
> >> the problematic type as an input appears in the
> >> (maxInitDepth-1) level. The bigger the maxInitDepth
> constant is, the
> >> bigger is the time it takes to generate the population and
> with worst
> >> results.
> >>
> >> Is there any posibility to make laxer the condition so, if this
> >> situation happens, it will try to close the branch as soon as
> >> possible even if it breaks the max depth restriction?
> >> Any other solution will be welcome too.
> >>
> >> Thank you very much.
> >>
> >> Sorry if my english is not good enough, I hope the message were
> >> understandable.
> >>
> >>
> >>      
> >>
> >> --------------------------------------------------------------
> >> ----------------
> >> Come build with us! The BlackBerry(R) Developer Conference
> in SF, CA
> >> is the only developer event you need to attend this year.
> Jumpstart
> >> your developing skills, take BlackBerry mobile
> applications to market
> >> and stay ahead of the curve.
> >> Join us from November 9 - 12, 2009. Register now!
> >> http://p.sf.net/sfu/devconference
> >> _______________________________________________
> >> jgap-users mailing list
> >> jgap-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/jgap-users
> >
> >
> >
> ----------------------------------------------------------------------
> > -------- Let Crystal Reports handle the reporting - Free Crystal
> > Reports 2008 30-Day trial. Simplify your report design, integration
> > and deployment - and focus on what you do best, core application
> > coding. Discover what's new with Crystal Reports now.  
> > http://p.sf.net/sfu/bobj-july 
> > _______________________________________________
> > jgap-users mailing list
> > jgap-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jgap-users
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Problem-generating-population-tp26075453
> p26965937.html
> Sent from the jgap-users mailing list archive at Nabble.com.
>
>
> --------------------------------------------------------------
> ----------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app
> distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> jgap-users mailing list
> jgap-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jgap-users
>


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
jgap-users mailing list
jgap-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jgap-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem generating population

Klaus Meffert-5
Bruno,

thanx a lot for sharing your solution and for the detailled description!
Could you kindly give me a hint where in the JGAP the call of your new code
should happen?

I will definitively add your solution to the core, eventually with one or
two test cases to ensure its functionality.

Thanx again and best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: Bruno Fernández Gonzalez [mailto:[hidden email]]
> Sent: Saturday, January 02, 2010 11:34 AM
> To: [hidden email]
> Subject: Re: [jgap-users] Problem generating population
>
>
> OK. Here's my solution. I'll expose my problem again to be
> clear enough. I hope this could help in a different context
> than mine. I hope I'll be able of giving a good explanation,
> but I'm not very good at english.
>
> The problem:
>
> There are a type of witch there are no terminals and only one
> node provides it as an output(let's call it node A) but there
> are many nodes that have it as an input (let's call them
> nodes B). If the algorithm is creating the population, in the
> max depth level -1 (let's call it n-1 ) there are many
> chances that a node B could appear. If this occurs, the only
> possibility is put a node A in the level n. But A is not a
> terminal, so the program is not valid. In my code, the 80% of
> the population used to be a clon because of this, and only
> with maximum depth 3 or 4. For higher depths it couldn't find
> any suitable program (because there where more branches to close).
>
> The solution
>
> I made weaker the "maxDepthLevel" condition. If the problem
> above appears, the branch will be closed as soon as possible.
> Now, the depth can exceed the maximum but it works.
>
> - I made a test function called "isCloseable(TypeClass t)"
> that returns true if there are at least a terminal of type t.
> - I put a boolean called "asSoon". If it's true, the branch
> will be closed as soon as possible. This is: you can't use a
> node if one of it inputs is non-closeable.
>
> Pseudo-code
>
> I choose to attach it to make the reading easy. It's not very
> complex, only the main things that are independent of my project.
>
> Well, this is it. As you can see is a very easy solution but
> it works perfect for me. I think it could be useful for other
> people that might have the same problem, and that it could be
> adapted to he main jgap code. I tried to explain it as good
> as I could. If you have any question you can email me, I have
> no problem in solve anyone's questions.
> http://old.nabble.com/file/p26991885/code.txt code.txt
>
>
>
>
>
> Klaus Meffert-5 wrote:
> >
> > Bruno,
> >
> > great to hear that you solved the problem. I think that
> your solution
> > would be of general interest.
> > Would you be willing to share your solution?
> >
> > Best
> >
> > Klaus
> > www.klaus-meffert.com
> >
> >  
> >
> >> -----Original Message-----
> >> From: Bruno Fernández Gonzalez [mailto:[hidden email]]
> >> Sent: Wednesday, December 30, 2009 12:23 PM
> >> To: [hidden email]
> >> Subject: Re: [jgap-users] Problem generating population
> >>
> >>
> >> Sorry I didn't thank you but I saw your response yesterday.
> >> Finally I made an algorithm to create my own population because I
> >> couldn't solve this problem.
> >> it's easy, I only made a method called asSoon which closes
> a branch
> >> as soon as it's possible. now, if it finds in the
> >> max-1 level a function that does not accept terminals it
> calls this
> >> function to find the shortest branch to close the tree. The only
> >> problem is that the programs can exceed the max depth in
> 1-3 levels,
> >> but it works ok.
> >>
> >>
> >> Klaus Meffert-5 wrote:
> >> >
> >> > Bruno,
> >> >
> >> > sorry for the late reply.
> >> >
> >> > Is it possible in your case to increase the maxInitDepth?
> >> > Do you believe there is a program error or bad program behaviour?
> >> >
> >> > Is it possible to get the configuration of your problem
> to dig in
> >> > deeper and develop a good solution for your issue?
> >> >
> >> > Best
> >> >
> >> > Klaus
> >> > www.klaus-meffert.com
> >> >
> >> >  
> >> >
> >> >> -----Original Message-----
> >> >> From: Bruno Fernández [mailto:[hidden email]]
> >> >> Sent: Monday, October 26, 2009 5:49 PM
> >> >> To: [hidden email]
> >> >> Subject: [jgap-users] Problem generating population
> >> >>
> >> >> Hello. I'm using genetic programming with jgap and I have
> >> a problem
> >> >> while generating the initial population. I have a type which is
> >> >> output of only one function but it's input of many of them
> >> and there
> >> >> are no terminals of this type. The problem is, when I try
> >> to generate
> >> >> the initial population with
> "GPGenotype.randomInitialGenotype", it
> >> >> can't find suitable nets and clone only a few. As a
> >> result, I have no
> >> >> enough variability.
> >> >>
> >> >> The problem seems to be that it can't close the net if one
> >> node with
> >> >> the problematic type as an input appears in the
> >> >> (maxInitDepth-1) level. The bigger the maxInitDepth
> >> constant is, the
> >> >> bigger is the time it takes to generate the population and
> >> with worst
> >> >> results.
> >> >>
> >> >> Is there any posibility to make laxer the condition so, if this
> >> >> situation happens, it will try to close the branch as soon as
> >> >> possible even if it breaks the max depth restriction?
> >> >> Any other solution will be welcome too.
> >> >>
> >> >> Thank you very much.
> >> >>
> >> >> Sorry if my english is not good enough, I hope the message were
> >> >> understandable.
> >> >>
> >> >>
> >> >>      
> >> >>
> >> >> --------------------------------------------------------------
> >> >> ----------------
> >> >> Come build with us! The BlackBerry(R) Developer Conference
> >> in SF, CA
> >> >> is the only developer event you need to attend this year.
> >> Jumpstart
> >> >> your developing skills, take BlackBerry mobile
> >> applications to market
> >> >> and stay ahead of the curve.
> >> >> Join us from November 9 - 12, 2009. Register now!
> >> >> http://p.sf.net/sfu/devconference
> >> >> _______________________________________________
> >> >> jgap-users mailing list
> >> >> [hidden email]
> >> >> https://lists.sourceforge.net/lists/listinfo/jgap-users
> >> >
> >> >
> >> >
> >>
> ---------------------------------------------------------------------
> >> -
> >> > -------- Let Crystal Reports handle the reporting - Free Crystal
> >> > Reports 2008 30-Day trial. Simplify your report design,
> integration
> >> > and deployment - and focus on what you do best, core application
> >> > coding. Discover what's new with Crystal Reports now.
> >> > http://p.sf.net/sfu/bobj-july
> >> > _______________________________________________
> >> > jgap-users mailing list
> >> > [hidden email]
> >> > https://lists.sourceforge.net/lists/listinfo/jgap-users
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://old.nabble.com/Problem-generating-population-tp26075453
> >> p26965937.html
> >> Sent from the jgap-users mailing list archive at Nabble.com.
> >>
> >>
> >> --------------------------------------------------------------
> >> ----------------
> >> This SF.Net email is sponsored by the Verizon Developer Community
> >> Take advantage of Verizon's best-in-class app development
> support A
> >> streamlined, 14 day to market process makes app
> distribution fast and
> >> easy Join now and get one step closer to millions of Verizon
> >> customers http://p.sf.net/sfu/verizon-dev2dev
> >> _______________________________________________
> >> jgap-users mailing list
> >> [hidden email]
> >> https://lists.sourceforge.net/lists/listinfo/jgap-users
> >>
> >
> >
> >
> ----------------------------------------------------------------------
> > -------- This SF.Net email is sponsored by the Verizon Developer
> > Community Take advantage of Verizon's best-in-class app development
> > support A streamlined, 14 day to market process makes app
> distribution
> > fast and easy Join now and get one step closer to millions
> of Verizon
> > customers http://p.sf.net/sfu/verizon-dev2dev
> > _______________________________________________
> > jgap-users mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/jgap-users
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Problem-generating-population-tp26075453
p26991885.html

> Sent from the jgap-users mailing list archive at Nabble.com.
>
>
> --------------------------------------------------------------
> ----------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app
> distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> jgap-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jgap-users
>


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem generating population

Bruno Fernández Gonzalez
Sure I will. But I have to think a little about it because I did it a couple of months ago. I'll try to give you a hint and, if you need it, I'll give you a detailed description as soon as I can. January is gonna be a hard month for me.

All should happen in "ProgramChromosome.java". I think the easier way would be make the "isCloseableTest" at the beginning of the "GrowOrFull" function whith the rest of the tests to say if we have to close asSoon or not. Maybe the "selectNode" function could have a boolean param to select a closeable node inside (like the "for" loop i put in the code attached in the last mail). So, if we have to close as soon as possible, you have to choose a closeable node and don't care about the max depth

I don't know very well the JGAP code so I can't be sure this is ok, It's just a first idea. If any problem, do not hesitate in asking.


Klaus Meffert-5 wrote
Bruno,

thanx a lot for sharing your solution and for the detailled description!
Could you kindly give me a hint where in the JGAP the call of your new code
should happen?

I will definitively add your solution to the core, eventually with one or
two test cases to ensure its functionality.

Thanx again and best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: Bruno Fernández Gonzalez [mailto:bfg84@yahoo.es]
> Sent: Saturday, January 02, 2010 11:34 AM
> To: jgap-users@lists.sourceforge.net
> Subject: Re: [jgap-users] Problem generating population
>
>
> OK. Here's my solution. I'll expose my problem again to be
> clear enough. I hope this could help in a different context
> than mine. I hope I'll be able of giving a good explanation,
> but I'm not very good at english.
>
> The problem:
>
> There are a type of witch there are no terminals and only one
> node provides it as an output(let's call it node A) but there
> are many nodes that have it as an input (let's call them
> nodes B). If the algorithm is creating the population, in the
> max depth level -1 (let's call it n-1 ) there are many
> chances that a node B could appear. If this occurs, the only
> possibility is put a node A in the level n. But A is not a
> terminal, so the program is not valid. In my code, the 80% of
> the population used to be a clon because of this, and only
> with maximum depth 3 or 4. For higher depths it couldn't find
> any suitable program (because there where more branches to close).
>
> The solution
>
> I made weaker the "maxDepthLevel" condition. If the problem
> above appears, the branch will be closed as soon as possible.
> Now, the depth can exceed the maximum but it works.
>
> - I made a test function called "isCloseable(TypeClass t)"
> that returns true if there are at least a terminal of type t.
> - I put a boolean called "asSoon". If it's true, the branch
> will be closed as soon as possible. This is: you can't use a
> node if one of it inputs is non-closeable.
>
> Pseudo-code
>
> I choose to attach it to make the reading easy. It's not very
> complex, only the main things that are independent of my project.
>
> Well, this is it. As you can see is a very easy solution but
> it works perfect for me. I think it could be useful for other
> people that might have the same problem, and that it could be
> adapted to he main jgap code. I tried to explain it as good
> as I could. If you have any question you can email me, I have
> no problem in solve anyone's questions.
> http://old.nabble.com/file/p26991885/code.txt code.txt
>
>
>
>
>
> Klaus Meffert-5 wrote:
> >
> > Bruno,
> >
> > great to hear that you solved the problem. I think that
> your solution
> > would be of general interest.
> > Would you be willing to share your solution?
> >
> > Best
> >
> > Klaus
> > www.klaus-meffert.com
> >
> >  
> >
> >> -----Original Message-----
> >> From: Bruno Fernández Gonzalez [mailto:bfg84@yahoo.es]
> >> Sent: Wednesday, December 30, 2009 12:23 PM
> >> To: jgap-users@lists.sourceforge.net
> >> Subject: Re: [jgap-users] Problem generating population
> >>
> >>
> >> Sorry I didn't thank you but I saw your response yesterday.
> >> Finally I made an algorithm to create my own population because I
> >> couldn't solve this problem.
> >> it's easy, I only made a method called asSoon which closes
> a branch
> >> as soon as it's possible. now, if it finds in the
> >> max-1 level a function that does not accept terminals it
> calls this
> >> function to find the shortest branch to close the tree. The only
> >> problem is that the programs can exceed the max depth in
> 1-3 levels,
> >> but it works ok.
> >>
> >>
> >> Klaus Meffert-5 wrote:
> >> >
> >> > Bruno,
> >> >
> >> > sorry for the late reply.
> >> >
> >> > Is it possible in your case to increase the maxInitDepth?
> >> > Do you believe there is a program error or bad program behaviour?
> >> >
> >> > Is it possible to get the configuration of your problem
> to dig in
> >> > deeper and develop a good solution for your issue?
> >> >
> >> > Best
> >> >
> >> > Klaus
> >> > www.klaus-meffert.com
> >> >
> >> >  
> >> >
> >> >> -----Original Message-----
> >> >> From: Bruno Fernández [mailto:bfg84@yahoo.es]
> >> >> Sent: Monday, October 26, 2009 5:49 PM
> >> >> To: jgap-users@lists.sourceforge.net
> >> >> Subject: [jgap-users] Problem generating population
> >> >>
> >> >> Hello. I'm using genetic programming with jgap and I have
> >> a problem
> >> >> while generating the initial population. I have a type which is
> >> >> output of only one function but it's input of many of them
> >> and there
> >> >> are no terminals of this type. The problem is, when I try
> >> to generate
> >> >> the initial population with
> "GPGenotype.randomInitialGenotype", it
> >> >> can't find suitable nets and clone only a few. As a
> >> result, I have no
> >> >> enough variability.
> >> >>
> >> >> The problem seems to be that it can't close the net if one
> >> node with
> >> >> the problematic type as an input appears in the
> >> >> (maxInitDepth-1) level. The bigger the maxInitDepth
> >> constant is, the
> >> >> bigger is the time it takes to generate the population and
> >> with worst
> >> >> results.
> >> >>
> >> >> Is there any posibility to make laxer the condition so, if this
> >> >> situation happens, it will try to close the branch as soon as
> >> >> possible even if it breaks the max depth restriction?
> >> >> Any other solution will be welcome too.
> >> >>
> >> >> Thank you very much.
> >> >>
> >> >> Sorry if my english is not good enough, I hope the message were
> >> >> understandable.
> >> >>
> >> >>
> >> >>      
> >> >>
> >> >> --------------------------------------------------------------
> >> >> ----------------
> >> >> Come build with us! The BlackBerry(R) Developer Conference
> >> in SF, CA
> >> >> is the only developer event you need to attend this year.
> >> Jumpstart
> >> >> your developing skills, take BlackBerry mobile
> >> applications to market
> >> >> and stay ahead of the curve.
> >> >> Join us from November 9 - 12, 2009. Register now!
> >> >> http://p.sf.net/sfu/devconference
> >> >> _______________________________________________
> >> >> jgap-users mailing list
> >> >> jgap-users@lists.sourceforge.net
> >> >> https://lists.sourceforge.net/lists/listinfo/jgap-users
> >> >
> >> >
> >> >
> >>
> ---------------------------------------------------------------------
> >> -
> >> > -------- Let Crystal Reports handle the reporting - Free Crystal
> >> > Reports 2008 30-Day trial. Simplify your report design,
> integration
> >> > and deployment - and focus on what you do best, core application
> >> > coding. Discover what's new with Crystal Reports now.
> >> > http://p.sf.net/sfu/bobj-july
> >> > _______________________________________________
> >> > jgap-users mailing list
> >> > jgap-users@lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/jgap-users
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://old.nabble.com/Problem-generating-population-tp26075453
> >> p26965937.html
> >> Sent from the jgap-users mailing list archive at Nabble.com.
> >>
> >>
> >> --------------------------------------------------------------
> >> ----------------
> >> This SF.Net email is sponsored by the Verizon Developer Community
> >> Take advantage of Verizon's best-in-class app development
> support A
> >> streamlined, 14 day to market process makes app
> distribution fast and
> >> easy Join now and get one step closer to millions of Verizon
> >> customers http://p.sf.net/sfu/verizon-dev2dev
> >> _______________________________________________
> >> jgap-users mailing list
> >> jgap-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/jgap-users
> >>
> >
> >
> >
> ----------------------------------------------------------------------
> > -------- This SF.Net email is sponsored by the Verizon Developer
> > Community Take advantage of Verizon's best-in-class app development
> > support A streamlined, 14 day to market process makes app
> distribution
> > fast and easy Join now and get one step closer to millions
> of Verizon
> > customers http://p.sf.net/sfu/verizon-dev2dev
> > _______________________________________________
> > jgap-users mailing list
> > jgap-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jgap-users
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Problem-generating-population-tp26075453
p26991885.html
> Sent from the jgap-users mailing list archive at Nabble.com.
>
>
> --------------------------------------------------------------
> ----------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app
> distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> jgap-users mailing list
> jgap-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jgap-users
>


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
jgap-users mailing list
jgap-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jgap-users