-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formula chain exceeded the 1000 limit #7
Comments
For now, to circumvent the error, you can calculate unit_reserve_after_charges at shorter steps first before calculating unit_reserve_after_charges[300] to avoid long recursive reference. I plan to extend modelx to allow infinite length of recursion in future release. |
http://docs.modelx.io/en/latest/reference/generated/modelx.set_recursion.html#modelx.set_recursion You can increase the max recursion from 1000 but Python may crash due to callstack being too deep. |
I use to project the a whole life policy cashflow by month,the callstack Could be more than 1000. So I want to ask if there is any good ways to avoid python crash? Or you will solve this problem in the future? |
Please see #7 (comment). Is this answer not sufficient? |
I did not explain my problem clearly. Your answer is clearly. I means that my python crash due to the deep callstack(recursion about 2000 or more).Now I use thread to run the model. By setting “threading.stack_size”, It works. |
Thanks for reporting another workaround. |
Since I run the model in windows platform, and I find there is no resource module in windows version’s python. Maybe there is some other module which can set the stack size. But I’m not sure. By the way, your module is really great for Actuary’s work. |
You're right. It's not available on Windows platform. There doesn't seem any way to change the stack size on Windows platform other than creating a new thread as you suggested. I think I'm going to reflect your suggestion. Can you post a very simple script to show how you use |
sys.setrecursionlimit(30000) seemed to work for me. I'm on a Mac. |
|
6a0fcd1 Implements cells formula execution in a single thread with the max stack size. |
I tried using modelx to similar a unit account deducting charges, applying growth. I wanted to project up to 720 months but there seems to be a limit that causes and error. The code I'm running is below:
The text was updated successfully, but these errors were encountered: