[galib] Tree genome and traversal.

Laurent Steffan galib at laurentsteffan.com
Tue Jul 4 09:39:02 EDT 2006


Looking briefly at your code snippet, I have two questions and a remark:

1) do you know at which step the program crashes ? (e.g. through
debugger output, or printed traces...)

2) what is the configuration you're using (OS, compiler version, etc.) ?

And I don't see a returned value for the objective function, even though
you have the "standard" "float" declaration : could that be part of the
problem ? I think you do have to specify a returned value.

In the meantime I'll keep looking at it...

Please copy me on your answer, I think that might be faster.

Best regards,
Laurent

On 04.07.2006 10:38, Daniel McGreal wrote:
> Hello, and thanks for the reply Laurent!
> 
> Ideally I was hoping for someone to further discuss the problem with,
> which I'm sure is a trivial one.
> 
> Here's my attempt:
> 
> float objective(GAGenome & t){
> 	GATreeGenome<Node> & tree= (GATreeGenome<Node> &)t;
> 	visitPost(tree);
> }
> 
> string visitPost(GATreeGenome<Node> &t){
> 	stringstream ret;
> 	if(t.child()) ret << visitPost(t) << " ";
> 	if(t.next()) ret << visitPost(t) << " ";
> 
> 	ret << *t.current() << " ";
> 	return ret.str();
> }
> 
> Which results in perfect compilation but produces Segementation Faults at
> runtime.
> 
> Thank you in advance,
> Dan.
> 
>> Hello Dan,
>>
>> I'm not sure I understood exactly where you need help : do you request a
>> nice proven algorithm ? or do you want to debug your own ? or do you
>> want us to replicate your code to see where the problem might be ? in
>> the latter two cases, please send more details. (In the first case, a
>> reference that comes to mind is Knuth's "The Art Of Computer
>> Programming" - chapter (I)2.3.1 would probably do), but of course you
>> won't get a working implementation in C++).
>>
>> Best regards,
>> Laurent
>>
>> On 03.07.2006 13:19, Daniel McGreal wrote:
>>> Dear Sirs and Madams,
>>>
>>> I'm using a Tree genome in a project to represent Reverse Polish
>>> notation.
>>> I was wondering if someone could help me with a post-order tree
>>> traversal
>>> algorithm to score the candidate solution. My own attempts have led to
>>> rather mysterious segmentation faults.
>>>
>>> All the best,
>>> Dan.
>>>
>> --
>> Laurent Steffan, Dr.-Ing.
>> Chercheur associé au LAMSADE (Université Paris Dauphine)
>> Consultant scientifique
>> +33 (0) 6 85 92 08 51
>>
>>
>> _______________________________________________
>> galib mailing list
>> galib at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/galib
>>
> 
> 
> 
> 
> _______________________________________________
> galib mailing list
> galib at mit.edu
> http://mailman.mit.edu/mailman/listinfo/galib
> 
> 

-- 
Laurent Steffan, Dr.-Ing.
Chercheur associé au LAMSADE (Université Paris Dauphine)
Consultant scientifique
+33 (0) 6 85 92 08 51





More information about the galib mailing list