This included removing some internal version constraints. It would be
nice if package A could say "use B@2.0.0" (when both have changed), but
when they're both in the release, we need to make a release that has a
B@2.0.0-rc in it, which doesn't match that constraint. Fortunately,
constraints aren't necessary within a release anyway.
check that the second argument is present
generate better variable names. the generated
names don't have to be magic -- we will probably
document what they are -- but they should be a
little better than just appending a number.
it's reasonable to give variables names like
"1,1", and appending a 0 to that would make
"1,10", which is weird. "1,1$0" is better.
The dependency on "check" was a real buzz-kill, especially when we
think of this package as something someone might run outside Meteor:
* `check` is really slow (mainly due to using exceptions for control
flow, I think), giving you a choice of *either* argument-checking or
good performance out of the box
* `check` pulls in the `ejson` and `base64` packages
Type testers are functions like `Logic.isTerm`, which are much more
useful to have as part of the public API than "matchers" like
`Logic.Term` in the old code.
The constraint-solver now uses the logic-solver in such a way that
accessing variables that weren't part of the problem statement will
never throw an error. That way, we don't have to worry about
present and future cases where we don't generate any logical formulas
involving a package "foo" and then we say to minimize some weighted
sum over packages including "foo".
Turn recursive addClauses->useFormulaTerm->addClauses into iterative.
Also do a couple tweaks that seem to improve performance.
The "stack overflow bug" case is now hovering around 10-20 seconds.
(It's a failure case, but it sure takes a while to fail.)
From running benchmarks while changing the code:
* It doesn't seem to slow things down to *always* try to "hit 0"
when minimizing
* It does seem to slow things down if the "<= 0" constraint is
expressed using <= instead of "forbid the terms with non-zero
weights"
This change also fixes a bug where we required terms with zero
weights to be 0.
I thought it would help me write a test for a bug that turned
up in code review, but it doesn't. Still, I'm sure it will be
useful.
Also, Logic.Solution#getFormula is something I've been wanting
to write for a while.