[galib] Tree genome and traversal.

Daniel McGreal D.J.McGreal at exeter.ac.uk
Tue Jul 4 04:38:50 EDT 2006


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
>







More information about the galib mailing list