slightlyoff / cassowary.js

Cassowary/JS, better, faster, future-ready
Other
1.69k stars 107 forks source link

Code and comments disagree #56

Open simoncozens opened 10 years ago

simoncozens commented 10 years ago

Lines 758-768 of SimplexSolver.js read like this:

      // Find the most negative coefficient in the objective function (ignoring
      // the non-pivotable dummy variables). If all coefficients are positive
      // we're done
      terms.escapingEach(function(v, c) {
        if (v.isPivotable && c < objectiveCoeff) {
          objectiveCoeff = c;
          entryVar = v;
          // Break on success
          return { brk: 1 };
        }
      }, this);

Unless I'm misreading the code, this find the first negative coefficient and then breaks, not the most negative coefficient.