starwing / amoeba

a Cassowary constraint solving algorithm implements in pure C.
MIT License
177 stars 24 forks source link

Assertion failed at amoeba.h line 935 #1

Closed hsa-online closed 7 years ago

hsa-online commented 7 years ago

I made a quite simple test of the constraint solver which tries to distribute nodes of the binary tree on the plane (like mentioned at the section 3.2 of the article written Cassowary authors).

And on adding "Unsatisfied" constraint the library causes "Assertion failed at amoeba.h line 935"

I created a gist with the test code: https://gist.github.com/hsa-online/bd69ddb7147eb20d55ce7fc95faa80d5

P.S. When all constraints are "correct" solver seems to be working properly

starwing commented 7 years ago

I will look into this, thx for report ^_^

starwing commented 7 years ago

good catch! I think i find the issue: when add a unsatisfied constraint, I needn't remove the constraint, because it doesn't add into solver yet! I have pushed the solution, you can try it out.

Thanks for reporting this :)

starwing commented 7 years ago

I'm not sure this change is correct, I will look it again tomorrow, and add some test case to confirm it.

hsa-online commented 7 years ago

Ok, good! Thank you.

starwing commented 7 years ago

I made another changes and added back the assert(). fallback am_add() changes should just remove error variables in objective, without other operations.

you can close this issue now :)

hsa-online commented 7 years ago

Yes, it now returns AM_UNSATISFIED as I expected. Thank you!