From: Sara S. <sa...@de...> - 2005-07-13 13:49:31
|
Hi again, I'm not sure if you are following the latest developments on the problem. Here is the MATLAB newsgroup thread link: http://newsreader.mathworks.com/WebX?14@LK1Ca8Bf0b4@.ef0d8ca I think there may be a solution in sight... :) Cheers, Sara Sara Silva wrote: > > > Aurélien Boffy wrote: > >> ... >> So, it is us who thank you for your wonderful library and long live >> GPLab! > > > Well, thank you! > I am glad GPLAB has been useful to you, not just a source of problems. :) > >> Concerning the problem with the "eval" function: >> >> Someone has already replied to your message in the MATLAB newsgroup >> and has >> suggested to pass strings for the function names. >> We had already tried this idea and that works. >> ... > > > Yes, it works for the artificial ant problem, but it ruins the > evaluation of simple symbolic regression problems, or boolean problems, > or any other problems that use MATLAB's built-in functions. > > For example: > s1='plus(plus(2,2),times(3,1))' > s2='plus(''plus(''2'',''2'')'',''times(''3'',''1'')'')' > > s2 is how s1 would have to be coded if using strings for the function > names. While s1 evaluates nicely and fast, without the need to code > anything else, s2 requires that plus and times are rewritten and > overloaded so they can be evaluated. Otherwise it doesn't work. > > >> eval(s1) > ans = 7 > > >> eval(s2) > ??? Error: ")" expected, "numeric value" found. > > So you understand why this is not a good solution either. The string > must be used as it is built, with no further modifications. If that is > not possible, I would rather perform the evaluation using the tree > instead of the string, as you did. I think it may be possible to use it > while avoiding any "hard-coding" of the function names (so that new > functions can be added one day without causing problems). > > I am going to try a few other things (I am not expecting any miracle > answers from the MATLAB newsgroup) and if I conclude it is not possible > to use the string without causing problems, I will code the evaluation > using the tree (something using both your code and my code). This way > only the ant evaluation will be afected, although I may need to add a > few arguments to other related functions. > > Boy, this has made me realize a really important feature of MATLAB that > I was totally unaware of! > > Thanks for all your help and suggestions. Do you want to become GPLAB > developers? :-) > > Sara > > PS - Sorry to all the mailing list subscribers that are not interested > in the artificial ant. But others may be interested in the developments > of this problem. > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the 'Do More With Dual!' webinar > happening > July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual > core and dual graphics technology at this free one hour event hosted by > HP, AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar > _______________________________________________ > gplab-users mailing list > gpl...@li... > https://lists.sourceforge.net/lists/listinfo/gplab-users > > |