Posted by
Piter Dias-3 on
Nov 19, 2006; 9:23pm
URL: http://quantlib.414.s1.nabble.com/Market-Models-TODOs-scripting-tp11365p11369.html
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