Comments (10)
Very very thank you for your support :-)
from amoeba.
You see I'm considering writing a Swift wrapper and this seems to be my biggest concern so far.
from amoeba.
the assert() means never raise error, if assert() occurs, it's the coding bug and not a programming runtime error. any assertion failure should not occurs in production scene.
I have added auto test and coverage test, it's not 100%, that's the way I will work. for now in coverage amoeba should never crash on any input data.
from amoeba.
Great!
from amoeba.
Overconstraining a variable fails with
Assertion failed: (exit.id != 0), function am_remove, file ./amoeba.h, line 963.
Example code
static void test_twice(void) {
am_Solver *s7 = am_newsolver(debug_allocf, NULL);
am_Constraint *c15 = am_newconstraint(s7, 1000000000.0);
am_setstrength(c15, 1000000000.0);
am_setrelation(c15, 2);
am_Variable *v14 = am_newvariable(s7);
am_addterm(c15, v14, 1.0);
am_addconstant(c15, -10.0);
am_add(c15);
am_Constraint *c16 = am_newconstraint(s7, 1000000000.0);
am_setstrength(c16, 1000000000.0);
am_setrelation(c16, 2);
am_addterm(c16, v14, 1.0);
am_addconstant(c16, -10.0);
am_add(c16);
}
It seems better if it instead
- returns a proper error code e.g. AM_FAILED
- leaves the solver as if
am_add(c16)
didn't happen at all
from amoeba.
I will test it.
from amoeba.
to add a new constraint, we have several ways to try (via Cassowary algorithm):
- add it directly, if we find a subject.
- use a artificial variable to add.
if we cannot find a subject and all terms are dummy variable, and constant is not zero (means some constraint like x >= 10
when x <= 0
), it's unsatisfied.
then, if we can not add it with a artificial variable, the constraint may unbound.
but, all other implements just throw errors in all these situations, I just try to restore the state of solver and return the proper error code. So I must remove the added constraint if needed, I need may test case on adding, because all other implement not do this.
If I'm not real add the constraint into solver and I try to remove it, this assertion failure will trigger, this is the source of this failure. I will improve it, but I need more test case to fix every the one case.
from amoeba.
I just try to restore the state of solver and return the proper error code
Music to my ears!
I will improve it
Fantastic!
but I need more test case to fix every the one case
I can create more test cases. The test_twice
test was created using my swift wrapper. I can enable logging of all actions to the c-api of amoeba so that it is easy to reproduce any errors I get. That's why the solver is named s7
:)
Your library is very easy to use. Your style of writing c code is very clean. I'm very impressed with your skills!
from amoeba.
I have fixed this assertion failure, you could try the latest version.
from amoeba.
Perfect!
from amoeba.
Related Issues (11)
- Assertion failed at amoeba.h line 935 HOT 6
- Cycling dependencies reported as AM_UNBOUND HOT 4
- License
- Lack of documentation for the API HOT 4
- How do I create a DLL for this library? HOT 4
- Read access violation at amoeba.h line 289 HOT 15
- Swift wrapper HOT 27
- Is there a way of telling when a variable is underconstrained? HOT 26
- Assertion in am_dual_optimize() with valid constraint set HOT 5
- Minor: typo "clear_constrants" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amoeba.