Hello Market Model team,
I have read the TODOs in the Market Models section and saw the item on scripting, specify new payoffs "without code recompilation". I am not sure whether this helps in this exercise - I came across a free/open mathematical expression parser written by Yann Ollivier (http://www.eleves.ens.fr/home/ollivier), wrapped and used it with some minor extensions so that it understands max, min, step functions in addition to the bulk that Yann had already coded. For example, I evaluate formulas as follows: ... #define LENGTH(a) (sizeof(a)/sizeof(a[0])) string name[] = { "a", "b", "c" }; double value[] = { 1, 2, 3 }; string formula = "sqrt (max (step(5a-10) + min(3b, 4c), 0)) * 15"; vector<string> variableNames; vector<double> variableValues; for (int i = 0; i < LENGTH(name); i++) { variableNames.push_back(name[i]); variableValues.push_back(value[i]); } Formula form (formula, variableNames, variableValues); cout << "formula = " << formula << " = " << form.eval() << endl; ... and changing the variableValue vector after creating the formula object allows revaluing the formula with the amended variable input, calling form.eval() again. That might be useful, not only for the Market Models. Yann's license is currently not compatible with the QuantLib license, as far as I understand - he does not allow selling the code unless one contacts him. Maybe he is willing to change the license if you are interested in including his code or a modified version of it in the library? Regards, Roland |
Guys,
Roland´s idea is very interesting. I used myself a math expression parser (Warp´s one) when I worked to Algorithmics in order to make a Balance Sheet simulator for some clients (pension funds). If you want the idea, could you please check this link http://muparser.sourceforge.net/mup_license.html in order to see if the license is in line with QuantLib? I know I can always use it myself while coding, but I think a standard wat inside QuantLib would be better. Regards. ---- Mensagem Original ---- From: "Roland Lichters" <[hidden email]> To: "quantlib-dev" <[hidden email]> Sent: Dom, Novembro 19, 2006 5:23 pm Subject: [Quantlib-dev] Market Models, TODOs, scripting Hello Market Model team, I have read the TODOs in the Market Models section and saw the item on scripting, specify new payoffs "without code recompilation". I am not sure whether this helps in this exercise - I came across a free/open mathematical expression parser written by Yann Ollivier (http://www.eleves.ens.fr/home/ollivier), wrapped and used it with some minor extensions so that it understands max, min, step functions in addition to the bulk that Yann had already coded. For example, I evaluate formulas as follows: ... #define LENGTH(a) (sizeof(a)/sizeof(a[0])) string name[] = { "a", "b", "c" }; double value[] = { 1, 2, 3 }; string formula = "sqrt (max (step(5a-10) + min(3b, 4c), 0)) * 15"; vector<string> variableNames; vector<double> variableValues; for (int i = 0; i < LENGTH(name); i++) { variableNames.push_back(name[i]); variableValues.push_back(value[i]); } Formula form (formula, variableNames, variableValues); cout << "formula = " << formula << " = " << form.eval() << endl; ... and changing the variableValue vector after creating the formula object allows revaluing the formula with the amended variable input, calling form.eval() again. That might be useful, not only for the Market Models. Yann's license is currently not compatible with the QuantLib license, as far as I understand - he does not allow selling the code unless one contacts him. Maybe he is willing to change the license if you are interested in including his code or a modified version of it in the library? Regards, Roland ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Roland Lichters-2
Hi Peter,
I had not seen muParser so far, will check it out. The MIT license seems to me compatible with QuantLib's.
Thanks for this interesting hint!
Roland On 11/19/06, Piter Dias <[hidden email]> wrote:
Guys, |
On 11/20/06, Roland Lichters <[hidden email]> wrote:
> The MIT license seems to me compatible with QuantLib's. there might be few details to check out, but yes, the MIT license is compatible with QuantLib's. Even better: they're (in) the same (family) ciao -- Nando |
Hi, The muParser is pretty good. I have used it myself within my QuantTools libraries for MonteCarlo, Tree and PDE payoff constructions. It's pretty fast and you have the option of converting the string expression to bytecode thus eliminating further string parsing... Adding new functions is a snap. The only thing to worry about is that during a function call, a lot of internal static structures are used and thus you cannot parse functions under a multi-user environment. Toy out. www.QuantTools.com >From: "Ferdinando Ametrano" <[hidden email]> >To: [hidden email] >CC: [hidden email], [hidden email] >Subject: Re: [Quantlib-dev] Market Models, TODOs, scripting >Date: Wed, 22 Nov 2006 14:49:08 +0100 > >On 11/20/06, Roland Lichters <[hidden email]> wrote: > > The MIT license seems to me compatible with QuantLib's. >there might be few details to check out, but yes, the MIT license is >compatible with QuantLib's. >Even better: they're (in) the same (family) > >ciao -- Nando > >------------------------------------------------------------------------- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to share >your >opinions on IT & business topics through brief surveys - and earn cash >http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >_______________________________________________ >QuantLib-dev mailing list >[hidden email] >https://lists.sourceforge.net/lists/listinfo/quantlib-dev _________________________________________________________________ Download the new Windows Live Toolbar, including Desktop search! http://toolbar.live.com/?mkt=en-gb |
Free forum by Nabble | Edit this page |