Instability in part-design / solver

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
jrtonkin
Posts: 14
Joined: Sun Apr 13, 2014 8:49 pm

Instability in part-design / solver

Post by jrtonkin »

Playing around with freecad, and found something that seems just-not-right; since the bug-tracker
seems to encourage posting here first, here I am....

I have a sketch (attached), shows as fully constrained, but when I change a dimension, it will often get into a state
where it complains about "Conflicting constraints, remove ##", change it back to the original value, and it
still complains.

CTRL-Z twice, back to the original state (solver is not showing an error message), make a smaller change
and it will be ok. Change it again to the value that first caused the problem, and it's still ok.

For example, starting with the 13mm constraint, change it to 14 and there's a problem. Back to 13 and the
problem persists. CTRL-Z twice back to 13 (ok), change to 13.5, ok, change to 14, ok.

Problem is present on changes to any of the linear dimensions (didn't try the radial ones)

Not sure if I should bug-report this, if it's a known issue, or if more details (beyond the usual FC version and OS info)
are needed.

It actually took several attempts to create the sketch without it getting in to this sort of instability in the
first place. Often I would be attempting to sketch the inner wall, and after adding a constraint that did not
overconstrain the drawing, the solver would start complaining, but about constraints not related to the one
just added.

-- James
Attachments
unstable constraints.FCStd
(4.77 KiB) Downloaded 105 times
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Instability in part-design / solver

Post by triplus »

Well if you are using older Development Release or latest Production Release on Linux (and maybe Mac too) you could be affected by already fixed Eigen issue discussed here:

viewtopic.php?f=3&t=4651&start=40#p36731

Windows versions where never affected by this issue for now. In latest Development Build on Ubuntu i can open your attached .FCstd file and change Constraint28 (13 mm) to Constraint28 (14 mm) without issues.
jrtonkin
Posts: 14
Joined: Sun Apr 13, 2014 8:49 pm

Re: Instability in part-design / solver

Post by jrtonkin »

Version is FreeCad 0.14, build 3389 (just downloaded a few days ago) for Windows.
help->about lists it as a 32-bit platform, whereas this is a 64-bit Win7 OS. Don't know
if that's relevant or not.

Skimmed the stuff you linked very briefly... whee, LU factorization and eigenvalues... Been a long
time since I took a numerical methods course. But yes, this sort of "worked this time, didn't work
the next" and "works if you do it slowly, but not if you make larger changes" is the sort of thing that
I would expect if the system is ill-conditioned / running in to problems with accumulated rounding
errors / etc.

On my machine the problem happens for any of the linear dimensions, but not any given change...
I'd be curious if you can make it fail on your end by playing with it a bit. Go back and forth between
a couple of values a few times and see if it ever craps out.

-- James
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Instability in part-design / solver

Post by bejant »

jrtonkin wrote:For example, starting with the 13mm constraint, change it to 14 and there's a problem.
Greetings James,
No problems here, changing the constraint from 13mm to 14mm works fine. But FreeCAD gave a Conflicting Constraints error message when trying to change it from 14mm to 15mm (which was not allowed).
jrtonkin wrote:Problem is present on changes to any of the linear dimensions
No problem either changing the bottom constraint from 22mm to 23, 25, 15, or 12.
at 12 mm
at 12 mm
20140413au_jrtonkin.jpg (10.78 KiB) Viewed 3451 times
The sketch did get funky at 11mm but I didn't try to figure out the geometry.
20140413bu_jrtonkin_at_11mm.jpg
20140413bu_jrtonkin_at_11mm.jpg (12.01 KiB) Viewed 3451 times
I'm not sure this is a FreeCAD bug but rather the manner in which the Sketch is constrained. Maybe instead of having the top arc constrained tangent to the construction line, the radius and the vertical distance from the X-axis to the origin could be constrained instead, giving better results?

OS: Ubuntu 12.04.4 LTS
Platform: 32-bit
Version: 0.14.3397 (Git)
Branch: master
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.7.0
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Instability in part-design / solver

Post by triplus »

jrtonkin wrote:Version is FreeCad 0.14, build 3389 (just downloaded a few days ago) for Windows.
help->about lists it as a 32-bit platform, whereas this is a 64-bit Win7 OS. Don't know
if that's relevant or not.

Skimmed the stuff you linked very briefly... whee, LU factorization and eigenvalues... Been a long
time since I took a numerical methods course. But yes, this sort of "worked this time, didn't work
the next" and "works if you do it slowly, but not if you make larger changes" is the sort of thing that
I would expect if the system is ill-conditioned / running in to problems with accumulated rounding
errors / etc.

On my machine the problem happens for any of the linear dimensions, but not any given change...
I'd be curious if you can make it fail on your end by playing with it a bit. Go back and forth between
a couple of values a few times and see if it ever craps out.

-- James
Well i played with it a bit more today on latest Development Release and could not reproduce what you are seeing. Probably somebody using Windows should test too. That link i gave you only affected Linux for example and if i am not mistaken Windows did get new libpack a while ago and i guess different Eigen library is used now? But that is just thinking out loud what could happen in the end it could be something else.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Instability in part-design / solver

Post by bejant »

triplus wrote:Probably somebody using Windows should test too.
Things are different on my Windows FC versions.
  • Changing the lower horizontal constraint from 22mm to anything else causes a redundant constraint message instructing me to delete Constraint 52, an Equality Constraint.
  • Changing the lower horizontal constraint from 22mm to 12mm causes the Sketch to look as it did when that constraint was changed to 11mm on my Ubuntu build, the picture and Help -> about FreeCAD for that build is in my earlier post.
Tried on these windows FC versions:

OS: Windows XP
Platform: 32-bit
Version: 0.14.3343 (Git)
Branch: libpack
Python version: 2.7.6
Qt version: 4.8.5
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.7.0

and

OS: Windows XP
Platform: 32-bit
Version: 0.14.2370 (Git)
Branch: master
Python version: 2.6.2
Qt version: 4.5.2
Coin version: 3.1.0
SoQt version: 1.4.1
OCC version: 6.5.1
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Instability in part-design / solver

Post by triplus »

Changing the lower horizontal constraint from 22mm to anything else causes a redundant constraint message instructing me to delete Constraint 52, an Equality Constraint.
Yes i forgot to mention that happens on Ubuntu 13.10 for me too but i do not see this as an issue described by jrtonkin. For any other issues jrtonkin described you are not seeing?

I do not know what is affecting you and why jrtonkin. It sounds quite similar to that mentioned Eigen issue we had on the Linux in the past. Where do you get/download FreeCAD installer from?
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Instability in part-design / solver

Post by bejant »

triplus wrote:For any other issues jrtonkin described you are not seeing?
jrtonkin wrote:For example, starting with the 13mm constraint, change it to 14 and there's a problem.
To recap: no problem with my windows FC builds.
jrtonkin wrote: Back to 13 and the problem persists. CTRL-Z twice back to 13 (ok), change to 13.5, ok, change to 14, ok.
I'm unable to test this portion because changing from 13mm to 14mm doesn't cause a problem for me.
jrtonkin wrote:Problem is present on changes to any of the linear dimensions
Changing leftmost Vertical Distance Constraint (#28) from
20mm to 21mm = no problem
20mm to 22mm = no problem
20mm to 23mm = no problem
20mm to 24mm = no problem
20mm to 25mm = similar to changing 20mm to 26mm (without looking into this further I don't believe this is a Solver problem)
20mm to 26mm = the following:
20140415a_jrtonkin.jpg
20140415a_jrtonkin.jpg (15.4 KiB) Viewed 3349 times
jrtonkin wrote:the radial ones
no problem with realistic changes but of course it's possible to increase the radii to break the Sketch.
triplus wrote:Where do you get/download FreeCAD installer from?
Ubuntu v0.14.3397 was one of the daily builds,
Windows v0.14.3343 was courtesy of peterl94, available here,
Windows v0.14.2370 was from the SourceForge page, unstable
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Instability in part-design / solver

Post by triplus »

Windows v0.14.3343 was courtesy of peterl94, available here,
Windows v0.14.2370 was from the SourceForge page, unstable
Now we are getting somewhere yes. What would probably make sense is for you bejant to test the same version jrtonkin said he uses:
Version is FreeCad 0.14, build 3389 (just downloaded a few days ago) for Windows.
He downloaded it from SF indeed:

http://sourceforge.net/projects/free-ca ... 0unstable/

By testing this version i guess we will be able to confirm if latest (official) libpack used by FreeCAD could be the culprit because v0.14.2370 you used for testing doesn't use it. It uses older one. For you jrtonkin it would make sense to test the version from peterl94, where he uses custom libpack he crated himself:

viewtopic.php?f=4&t=6091&p=49877#p48535
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Instability in part-design / solver

Post by bejant »

triplus wrote:What would probably make sense is for you bejant to test the same version jrtonkin said he uses
OK, I'll give it a try and will post back. It may not be until 15 hours or so from the time of this post but I will try to do it tonight (It's still Tuesday here for a little while) or early in the a.m. Wednesday.
Post Reply