-
Notifications
You must be signed in to change notification settings - Fork 69
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
infinite loop in dynamic-programming with 'max_input' memory limit #153
Comments
I would have thought checking something about the lengths in Out of interest what's your use-case? My thinking these days is that generally its best to not put the restriction on memory within the path finding, especially one as strict as
|
Thanks for the suggestions, I "solved" my problem by removing the restriction - I was just testing what the memory limit did :) I am evaluating einsum-based calculations of finite element matrices to be included in sfepy. Also thank you for mentioning the slicing, I was going to ask about it... For the moment I am doing that manually using an outer for loop in Python, when needed. In the finite element evaluations, it is often preferable to proceed element-by-element (but not always!). As for this issue, the main problem was that the optimization did not fail, so timing tests never finished (before removing the memory limit). It took me some time to discover the reason (was it really cycling infinitely, or just taking a long time?), so having an exception thrown quickly would be nice. I was looking at the items in |
Ah yes, well
And agreed the silent failure is an issue, and I see your point about the
|
Nice!
So |
Oh yes naive flops is probably fine. I'm happy to put a quick PR together unless you want to @rc . Just for interest to be a bit clearer about the tighter bound I suggested, if you consider the set of all contractions with Then following the logic:
Suggesting that the maximum cost for any contraction of |
Thanks for the clarification! That would be great if you find time to make the PR - I do not know the code-base much, so while I am willing to give it a shot, having it done by an expert is better. |
Thanks for the fix! |
Hi,
first, thank you for your excellent package!
Lately I have been playing with various optimization methods and stumbled on a problem demonstrated by the following snippet:
The 'dynamic-programming' optimization loops "infinitely" when the 'max_input' memory limit (or other limit that cannot be satisfied when doing pair-wise contractions) is given.
Is it possible to modify
DynamicProgramming.__call__()
to detect and report such cases? My idea was to comparex
to previous ones to detect stagnation, butcost_cap
increase complicates things. Maybe impose a limit to max.cost_cap
? I am willing to give it a try, if somebody knowledgeable of DynamicProgramming confirms that limitingcost_cap
would be feasible.The text was updated successfully, but these errors were encountered: