Skip to content
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

FindWhichToRemoveToFixJacobian can be very slow #131

Closed
whitequark opened this issue Dec 12, 2016 · 18 comments
Closed

FindWhichToRemoveToFixJacobian can be very slow #131

whitequark opened this issue Dec 12, 2016 · 18 comments

Comments

@whitequark
Copy link
Contributor

whitequark commented Dec 12, 2016

See constrainfreeze.zip--try adding a redundant constraint.

From http://solvespace.com/forum.pl?action=viewthread&parent=1705.

@Evil-Spirit
Copy link
Collaborator

Evil-Spirit commented Dec 12, 2016

@whitequark, we can limit number of constraints when FindWhichToRemoveToFixJacobian should be performed, if greater, we just report an error without "fixing" constraints list.

@whitequark
Copy link
Contributor Author

@Evil-Spirit is there no faster way than just bruteforce?

@Evil-Spirit
Copy link
Collaborator

Evil-Spirit commented Dec 12, 2016

@whitequark, Yes, we can be a little bit faster now (~3 times faster with the current example) if we just rewrite SolveBySubstitution for linear complexity instead of square. I actually done this for NotSolveSpace and this is huge speedup when we have a large amount of h,v,pc. The other two hot functions WriteJacobian and CalculateRank. The first can be performed once and used for many times, and the second can be low-level optimized or replaced in future by external linear system solver functions.

@whitequark
Copy link
Contributor Author

@Evil-Spirit OK, this sounds like something useful to be done. For now it is low priority though.

Evil-Spirit added a commit to Evil-Spirit/solvespace-master that referenced this issue Dec 12, 2016
@Evil-Spirit
Copy link
Collaborator

Evil-Spirit commented Dec 12, 2016

@whitequark,
I've made attempt to make some optimization, mostly because we have to exclude SolveBySubstitution because of #208. But this still O(n^4)....(((((

@Evil-Spirit
Copy link
Collaborator

@whitequark
One more imporvement.
But we can't avoid SolveBySubsitution because constrainfreeze.zip without it and even with optimizations is dead slow (~60sec). I think we need to analyze redundant h/v/pc not using RankTest, just comparing constraints.

@Evil-Spirit
Copy link
Collaborator

@whitequark
Copy link
Contributor Author

Doesn't apply on master anymore.

@Evil-Spirit
Copy link
Collaborator

@whitequark, OK I am rebasing

Evil-Spirit added a commit to Evil-Spirit/solvespace-master that referenced this issue Jan 14, 2017
# Conflicts:
#	src/solvespace.h
#	src/system.cpp
Evil-Spirit added a commit to Evil-Spirit/solvespace-master that referenced this issue Jan 14, 2017
@Evil-Spirit
Copy link
Collaborator

@Evil-Spirit
Copy link
Collaborator

@whitequark, but this is works bad after we add forceDofCheck. try to comment forceDofCheck inside FindWhichToRemoveToFixJacobian to allow SolveBySubstitution run. It will be fast for constraintfreeze.slvs. But this will not consider some cases with double-hvpc

@whitequark
Copy link
Contributor Author

@Evil-Spirit how to fix this?

@Evil-Spirit
Copy link
Collaborator

@whitequark, For now I only can suggest to limit FindWhichToRemoveToFixJacobian by time. For constraintfreeze it's over 600 equations if we don't appy solvebysubstitution, so we can just give up until we involve sparse-matix algorithms. The second way - is to find double constraints like hvpc

@whitequark
Copy link
Contributor Author

@Evil-Spirit ok. is there any benefit from your updated patch?

@Evil-Spirit
Copy link
Collaborator

Evil-Spirit commented Jan 14, 2017

@whitequark, only if we choose "finding the same multiple hvpc". if we bound by time, there is no point.
only benefit is from loop unrolling, but this is something like x2-x3 for rank calculating

@whitequark
Copy link
Contributor Author

@Evil-Spirit ok. let's add a 1000ms time limit, and indicate in the text window if it was reached.

@Evil-Spirit
Copy link
Collaborator

@whitequark, acc.

Evil-Spirit added a commit to Evil-Spirit/solvespace-master that referenced this issue Jan 14, 2017
@Evil-Spirit
Copy link
Collaborator

@whitequark, implemented here

phkahler added a commit to phkahler/solvespace that referenced this issue Sep 10, 2020
Add a timeout when listing redundant constraints is taking too long.
phkahler added a commit to phkahler/solvespace that referenced this issue Sep 11, 2020
…g which constraints can be removed to fix jacobian.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Evil-Spirit tasks
done, ready for integration
Development

No branches or pull requests

3 participants