Skip to search.
openbeagle · Open BEAGLE

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

  Messages Help
Advanced
mutation of ephemeral constants   Message List  
Reply Message #1461 of 1561 |
Re: [OpenBEAGLE] mutation of ephemeral constants [SOLVED!]

Finally this works! I seem to be successfully doing "constant jiggling" on my
three classes of "ranged Doubles". I tried two version of where this new mutate
method should go. First I tried putting it on the ephemeral constant class
(like EphemeralDouble), decided the modularity was messy, and moved it to the
wrapped number class (like Double, "T" in the code below). I modified just a
portion of Beagle::GP::MutationJiggleEphemeralOpT<T>::mutate. Where it used to
say:


// Mutate parameter value.
GP::Primitive::Handle lSelectedPrimit =
(*lSelectedTree)[lPotentialParam[lSelectedParam].second].mPrimitive;
typename GP::EphemeralT<T>::Handle lSelectedEphemeral =
castHandleT<typename GP::EphemeralT<T> >(lSelectedPrimit);
GP::Primitive::Handle lGeneratedPrimit =
lSelectedEphemeral->generate(mEphemeralName->getWrappedValue(), lContext);
(*lSelectedTree)[lPotentialParam[lSelectedParam].second].mPrimitive =
lGeneratedPrimit;

Beagle_LogVerboseM(
ioContext.getSystem().getLogger(),
"mutation", "Beagle::GP::MutationJiggleEphemeralOpT",
string("Changing the ephemeral from ")+lSelectedPrimit->serialize()+
string(" to ")+lGeneratedPrimit->serialize()
);


it now says:


// Mutate parameter value.
GP::Primitive::Handle lSelectedPrimit =
(*lSelectedTree)[lPotentialParam[lSelectedParam].second].mPrimitive;
typename GP::EphemeralT<T>::Handle lSelectedEphemeral =
castHandleT<typename GP::EphemeralT<T> >(lSelectedPrimit);
std::cout << "Jiggle mutation -- before: " << lSelectedEphemeral->serialize();
T temp;
lSelectedEphemeral->getValue (temp);
temp.setWrappedValue(temp.mutate(lContext));
lSelectedEphemeral->setValue (temp);
std::cout << " after: " << lSelectedEphemeral->serialize() << std::endl;

// Beagle_LogVerboseM(
// ioContext.getSystem().getLogger(),
// "mutation", "Beagle::GP::MutationJiggleEphemeralOpT",
// string("Changing the ephemeral from ")+lSelectedPrimit->serialize()+
// string(" to ")+lGeneratedPrimit->serialize()
// );


those print outs convince me that it is working correctly, but I am easily
fooled:
Jiggle mutation -- before: <SmallFloat value="-0.644849"/> after: <SmallFloat
value="-0.418695"/>
Jiggle mutation -- before: <Fraction value="0.0677889"/> after: <Fraction
value="0.111499"/>
Jiggle mutation -- before: <Fraction value="0.0910494"/> after: <Fraction
value="0.0992486"/>
Jiggle mutation -- before: <Fraction value="0.655258"/> after: <Fraction
value="0.628954"/>
Jiggle mutation -- before: <SmallFloat value="1.27035"/> after: <SmallFloat
value="1.28836"/>
Jiggle mutation -- before: <SmallPosFloat value="3.10858"/> after:
<SmallPosFloat value="2.83929"/>

My only problem at this point is that I broke the Beagle_LogVerboseM at the end
of that code fragment. I would appreciate suggestions on how to repair it. I
would also appreciate a review of my code for doing things "the OB way"


Thanks for all the help,
Craig



Wed Nov 4, 2009 2:35 am

cwr_gp
Offline Offline
Send Email Send Email

Message #1461 of 1561 |
Expand Messages Author Sort by Date

Thanks to a lot of helpful advice on this forum I'm starting to make a little progress. I've implemented some "toy" problems as stepping stones toward my...
Craig Reynolds
cwr_gp Offline Send Email
Oct 6, 2009
2:22 am

Hi, take a look at MutationEphemeralOpT.hpp in GP. It's a base class for Ephemeral mutations. I think you will have to extend EphemeralT and overload...
Sergiy Dubovik
Dubik_KH_UKR Offline Send Email
Oct 6, 2009
5:38 am

I'm still slogging through this. A couple of issues have come up. First I wanted to examine in detail the way MutationEphemeralDoubleOp works. So I switched...
Craig Reynolds
cwr_gp Offline Send Email
Oct 7, 2009
7:27 pm

I just modified config of my GP application and got GP-MutationEphemeralDoubleOp in log file.<?xml version="1.0" encoding="ISO-8859-1"?> <Beagle> <Evolver> ...
Sergiy Dubovik
Dubik_KH_UKR Offline Send Email
Oct 7, 2009
8:28 pm

I started to prototype this approach, adding a generic "adjust ephemeral constants" operator that calls a virtual mutation method on a variant of EphemeralT....
Craig Reynolds
cwr_gp Offline Send Email
Oct 9, 2009
5:27 pm

Hi Craig, I was about to answer you on that topic. I agree that current mutation of ephemeral random variables may look not optimal, that slightly changing...
Christian Gagné
raspingoo Offline Send Email
Oct 9, 2009
5:39 pm

In my STGP application I now have 3 kinds of "ranged numeric values" (Fraction, SmallFloat and SmallPosFloat (actually double not float)). For each I define...
Craig Reynolds
cwr_gp Offline Send Email
Nov 3, 2009
5:44 pm

Hi Craig, ... It is difficult to tell being where I am. That's true that the MutationEphemeralOpT looks for primitives of a certain name, by default "E". That...
Christian Gagné
raspingoo Offline Send Email
Nov 3, 2009
6:21 pm

Thanks Christian, with your comments I found my problem. I needed to add 3 items for the ".primit" names to my configuration file: <Entry...
Craig Reynolds
cwr_gp Offline Send Email
Nov 3, 2009
7:04 pm

Finally this works! I seem to be successfully doing "constant jiggling" on my three classes of "ranged Doubles". I tried two version of where this new mutate...
Craig Reynolds
cwr_gp Offline Send Email
Nov 4, 2009
2:35 am

Hi Craig, Ok, so you added a mutate() method to the T type, that is the Doubles, Fraction, etc. It seems to work well for your case, so that's fine for your...
Christian Gagné
raspingoo Offline Send Email
Nov 4, 2009
1:47 pm

To be clear, my goal was to get my application working as quickly as possible. Your concern is the design integrity of Open BEAGLE. (Well and supporting your...
Craig Reynolds
cwr_gp Offline Send Email
Nov 5, 2009
6:18 pm

I'm sorry that this issue has come back. Sorry also to add to Prof Gagné's queue. I had convinced myself that my jiggle mutation was working in conjunction...
Craig Reynolds
cwr_gp Offline Send Email
Nov 13, 2009
7:40 pm

Hi Craig, ... It looks like the cause of your problem is that you are modifying the value of a ephemeral random "in place" in the GP tree, without cloning it...
Christian Gagné
raspingoo Offline Send Email
Nov 15, 2009
4:40 am
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help