Skip to content

Fix simplex and finance bugs, repair broken test suites, add CI#3

Open
shehio wants to merge 4 commits into
developfrom
claude/improvements
Open

Fix simplex and finance bugs, repair broken test suites, add CI#3
shehio wants to merge 4 commits into
developfrom
claude/improvements

Conversation

@shehio

@shehio shehio commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Improvements

Bug fixes (verified with reproducible cases)

  • Simplex pivot-column bug (src/linear-programming/simplex.js): the optimality check and pivot-column search only scanned the first rows entries of the objective row, so LPs with more decision variables than tableau rows returned a wrong optimum — e.g. max x + 2y + 3z s.t. x + y + z <= 10 returned 20 instead of 30. Both loops now scan every coefficient column.
  • Arithmetic returns (finance/stock.ts): calculateArithmaticReturnsForAdjClose divided the price change by the current price instead of the previous one, so a 100 → 110 move reported ~9.09% instead of 10%.

Test suite repairs (2 of 10 suites failed to run on develop)

  • src/linear-programming/test/simplex.test.ts was an empty file (jest errors on it). simplex() also never returned a result and ran its demo at module load — it now returns the final tableau, exports matrix/simplex, and keeps the demo behind a require.main guard. New tests cover the Richland example (P = 330), the regression case above, and input validation.
  • finance/test/stock.test.ts imported stockHelper (export is StockHelper) and its only test called the long-dead Yahoo Finance API with empty dates. Replaced with deterministic unit tests for the return calculation and getStats.

CI

  • Replaced the dead Travis config (travis-ci.org is shut down; it targeted Node 12 + gulp) with a GitHub Actions workflow running npm install + npm test on Node 20 for pushes to develop/master and PRs.

Docs & metadata

  • README: getting-started (install/test), a directory → algorithm map, and a CI badge.
  • package.json: repository/bugs/homepage URLs pointed at the repo's old name (shehio/nash); now shehio/Project-Nash.

Result: npx jest goes from 8/10 suites (29 tests, 2 suites failing to run) to 10/10 suites, 34 tests passing.

Note (not addressed here, flagging only): npm install reports 51 vulnerabilities in the aging dependency tree; several deps (yahoo-finance, sync-request, mathjs 3.x) are unmaintained. Upgrading is a larger, behavior-affecting change.

🤖 Generated with Claude Code

https://claude.ai/code/session_014qGzgE6vMaqymzipNFYTDT

shehio and others added 4 commits July 5, 2026 15:54
The pivot-column search and the optimality check only scanned the
first `rows` entries of the objective row, so problems with more
decision variables than tableau rows terminated early with a wrong
optimum (e.g. max x+2y+3z s.t. x+y+z<=10 returned 20 instead of 30).
Both loops now scan every coefficient column.

simplex() also never returned its result and ran the demo example at
module load. It now returns the final tableau, exports matrix/simplex,
and keeps the demo behind a require.main guard. The previously empty
simplex.test.ts (which failed the jest run) now covers the Richland
example (P=330), the regression case above, and input validation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
calculateArithmaticReturnsForAdjClose divided the price change by the
current price instead of the previous one; a 100 -> 110 move should be
a 10% return, not ~9.09%.

The test suite failed to even run: it imported `stockHelper` while the
export is `StockHelper`, and its only test called the long-dead Yahoo
Finance API with empty dates. Replaced with deterministic unit tests
for the return calculation and getStats.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
travis-ci.org shut down and the config targeted Node 12 with the gulp
pipeline. The new workflow runs npm install + npm test (jest) on
Node 20 for pushes to develop/master and all pull requests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
README now shows how to install and run the tests, maps each directory
to the algorithms it contains, and carries the CI badge. package.json
repository/bugs/homepage URLs pointed at the repo's old name
(shehio/nash); they now point at shehio/Project-Nash.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant