From ddaedb5ee34758020fb56d113213210709a5883e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 17 May 2013 14:14:15 +0200 Subject: [PATCH] Document how functions with a kink are differentiated Also add a warning in the documentation and in the preprocessor about the usage of some functions (max, min, abs, sign, comparison operators) in a stochastic context. Closes #355 --- ModFile.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ModFile.cc b/ModFile.cc index 503c9e20..a966c353 100644 --- a/ModFile.cc +++ b/ModFile.cc @@ -250,6 +250,19 @@ ModFile::checkPass() cerr << "ERROR: marking equations as [static] or [dynamic] is not possible with ramsey_policy or discretionary_policy" << endl; exit(EXIT_FAILURE); } + + if (stochastic_statement_present && + (dynamic_model.isUnaryOpUsed(oSign) + || dynamic_model.isUnaryOpUsed(oAbs) + || dynamic_model.isBinaryOpUsed(oMax) + || dynamic_model.isBinaryOpUsed(oMin) + || dynamic_model.isBinaryOpUsed(oGreater) + || dynamic_model.isBinaryOpUsed(oLess) + || dynamic_model.isBinaryOpUsed(oGreaterEqual) + || dynamic_model.isBinaryOpUsed(oLessEqual) + || dynamic_model.isBinaryOpUsed(oEqualEqual) + || dynamic_model.isBinaryOpUsed(oDifferent))) + warnings << "WARNING: you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which is unsuitable for a stochastic context; see the reference manual, section about \"Expressions\", for more details." << endl; } void