{"id":32229223,"url":"https://github.com/jwally/jslpsolver","last_synced_at":"2026-01-24T15:08:22.312Z","repository":{"id":10273540,"uuid":"12387548","full_name":"JWally/jsLPSolver","owner":"JWally","description":"Simple OOP javaScript library to solve linear programs, and mixed integer linear programs","archived":false,"fork":false,"pushed_at":"2023-05-05T13:47:27.000Z","size":8235,"stargazers_count":433,"open_issues_count":34,"forks_count":69,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-10-22T10:02:21.151Z","etag":null,"topics":["constraint-optimization","integer-linear-programming","linear-programming","simplex-algorithm"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JWally.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-08-26T19:16:18.000Z","updated_at":"2025-10-10T11:55:56.000Z","dependencies_parsed_at":"2022-09-03T06:22:23.099Z","dependency_job_id":"7c8d9845-4920-4a10-b9c5-15d9a6d6949b","html_url":"https://github.com/JWally/jsLPSolver","commit_stats":{"total_commits":288,"total_committers":17,"mean_commits":"16.941176470588236","dds":0.625,"last_synced_commit":"2f067bc134d720f1900e291f4ef4d8b004599904"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/JWally/jsLPSolver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWally%2FjsLPSolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWally%2FjsLPSolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWally%2FjsLPSolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWally%2FjsLPSolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JWally","download_url":"https://codeload.github.com/JWally/jsLPSolver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWally%2FjsLPSolver/sbom","scorecard":{"id":69366,"data":{"date":"2025-08-11","repo":{"name":"github.com/JWally/jsLPSolver","commit":"e0c0e73f00ab795d6f55af2773b1fc0282c04068"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/27 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: The Unlicense: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T03:28:05.683Z","repository_id":10273540,"created_at":"2025-08-15T03:28:05.683Z","updated_at":"2025-08-15T03:28:05.683Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280417307,"owners_count":26327206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["constraint-optimization","integer-linear-programming","linear-programming","simplex-algorithm"],"created_at":"2025-10-22T10:02:18.738Z","updated_at":"2026-01-24T15:08:22.298Z","avatar_url":"https://github.com/JWally.png","language":"JavaScript","readme":"# jsLPSolver\n\n[![npm version](https://badge.fury.io/js/javascript-lp-solver.svg)](https://www.npmjs.com/package/javascript-lp-solver)\n[![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](http://unlicense.org/)\n\n[A linear programming solver for the rest of us!](https://youtu.be/LbfMmCf5-ds?t=51)\n\n## Features\n\n- **Linear Programming (LP)**: Solve continuous optimization problems using the simplex algorithm\n- **Mixed-Integer Programming (MIP)**: Handle integer and binary variables via branch-and-cut\n- **Multi-Objective Optimization**: Find compromise solutions across multiple objectives\n- **JSON Model Format**: Define problems as simple JavaScript objects\n- **Zero Dependencies**: Pure JavaScript/TypeScript with no external solver required\n- **Universal**: Works in Node.js, browsers, and Web Workers\n\n## Installation\n\n**Node.js:**\n\n```bash\nnpm install javascript-lp-solver\n```\n\n**Browser (CDN):**\n\n```html\n\u003cscript src=\"https://unpkg.com/javascript-lp-solver/dist/solver.global.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    // The solver is available as a global variable\n    var model = {\n        optimize: \"profit\",\n        opType: \"max\",\n        constraints: { capacity: { max: 100 } },\n        variables: { x: { capacity: 10, profit: 5 } },\n    };\n    var result = solver.Solve(model);\n    console.log(result); // { feasible: true, result: 50, x: 10 }\n\u003c/script\u003e\n```\n\n**ES Modules:**\n\n```javascript\nimport solver from \"javascript-lp-solver\";\n```\n\n## Quick Start\n\nHere's the classic [Berlin Airlift](http://math.stackexchange.com/questions/59429/berlin-airlift-linear-optimization-problem) problem:\n\n\u003e Maximize cargo capacity using American planes (30,000 cu ft, 16 personnel, $9,000/flight) and British planes (20,000 cu ft, 8 personnel, $5,000/flight), subject to: max 44 planes, max 512 personnel, max $300,000 weekly cost.\n\n```javascript\nconst solver = require(\"javascript-lp-solver\");\n\nconst model = {\n    optimize: \"capacity\",\n    opType: \"max\",\n    constraints: {\n        plane: { max: 44 },\n        person: { max: 512 },\n        cost: { max: 300000 },\n    },\n    variables: {\n        brit: { capacity: 20000, plane: 1, person: 8, cost: 5000 },\n        yank: { capacity: 30000, plane: 1, person: 16, cost: 9000 },\n    },\n};\n\nconst result = solver.Solve(model);\nconsole.log(result);\n// { feasible: true, result: 1080000, brit: 24, yank: 20 }\n```\n\n## Constraint Types\n\nConstraints support three bound types:\n\n```javascript\nconstraints: {\n    resource_a: { max: 100 },      // resource_a \u003c= 100\n    resource_b: { min: 10 },       // resource_b \u003e= 10\n    resource_c: { equal: 50 },     // resource_c == 50\n    resource_d: { min: 20, max: 80 }, // 20 \u003c= resource_d \u003c= 80\n}\n```\n\n## Variable Bounds\n\nBy default, all variables are **non-negative** (≥ 0). This is standard LP solver behavior.\n\nTo allow negative values, use the `unrestricted` property:\n\n```javascript\nconst model = {\n    optimize: \"profit\",\n    opType: \"max\",\n    constraints: {\n        balance: { equal: 0 },\n    },\n    variables: {\n        income: { profit: 1, balance: 1 },\n        expense: { profit: -1, balance: -1 },\n    },\n    unrestricted: { income: 1, expense: 1 }, // Allow negative values\n};\n```\n\nTo set upper bounds on variables, add them as constraints:\n\n```javascript\nconst model = {\n    optimize: \"output\",\n    opType: \"max\",\n    constraints: {\n        x_upper: { max: 100 }, // x \u003c= 100\n        y_upper: { max: 50 }, // y \u003c= 50\n    },\n    variables: {\n        x: { output: 10, x_upper: 1 },\n        y: { output: 15, y_upper: 1 },\n    },\n};\n```\n\n## Integer Programming\n\nAdd `ints` or `binaries` to restrict variables to integer/binary values:\n\n```javascript\nconst model = {\n    optimize: \"profit\",\n    opType: \"max\",\n    constraints: {\n        wood: { max: 300 },\n        labor: { max: 110 },\n    },\n    variables: {\n        table: { wood: 30, labor: 5, profit: 1200 },\n        dresser: { wood: 20, labor: 10, profit: 1600 },\n    },\n    ints: { table: 1, dresser: 1 },\n};\n\nconsole.log(solver.Solve(model));\n// { feasible: true, result: 14400, table: 8, dresser: 3 }\n```\n\n## Web Workers\n\nFor large problems, run the solver in a Web Worker to avoid blocking the UI:\n\n```javascript\n// worker.js\nimportScripts(\"https://unpkg.com/javascript-lp-solver/dist/solver.global.js\");\n\nonmessage = function (e) {\n    postMessage(solver.Solve(e.data));\n};\n```\n\n```javascript\n// main.js\nconst worker = new Worker(\"worker.js\");\nworker.onmessage = (e) =\u003e console.log(e.data);\nworker.postMessage(model);\n```\n\n## Performance\n\nRepresentative benchmarks (Intel i5-10400 @ 2.9GHz, Node.js 22, 10 runs averaged):\n\n| Problem          | Variables | Constraints | Integers | Avg Time |\n| ---------------- | --------- | ----------- | -------- | -------- |\n| Large Farm MIP   | 100       | 35          | 100      | 61ms     |\n| Monster LP       | 552       | 600         | 0        | 6ms      |\n| Monster II MIP   | 924       | 888         | 112      | 136ms    |\n| Stock Cutting    | 31        | 5           | 31       | 3ms      |\n| Vendor Selection | 1640      | 1641        | 40       | 656ms    |\n\n## Documentation\n\nFor complete API documentation, see [API.md](./API.md).\n\nKey options include:\n\n- `timeout`: Maximum solve time in milliseconds\n- `tolerance`: Accept solutions within X% of optimal (for faster MIP solving)\n- `options.presolve`: Enable/disable problem preprocessing\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Run tests in watch mode\nnpm run test:watch\n\n# Run tests with coverage report\nnpm run test:coverage\n\n# Run stress tests (generated problems)\nnpm run test:stress\n\n# Run linter\nnpm run lint\n\n# Format code\nnpm run format\n\n# Type check\nnpm run typecheck\n\n# Build distribution\nnpm run build\n\n# Generate API docs\nnpm run docs\n```\n\n### Testing\n\nThe test suite uses [Vitest](https://vitest.dev/) and includes:\n\n- **Unit tests**: Cover utilities, data structures, and isolated components\n- **Integration tests**: Run the solver against 47 real-world problems (Berlin Airlift, Knapsack, Farm MIP, etc.)\n- **Stress tests**: Use seeded random problem generation (LP, MIP, knapsack, set cover, transportation) to test solver robustness without large static test files\n\nCoverage thresholds are enforced: 60% statements/lines/functions, 45% branches.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues and pull requests.\n\n## License\n\n[Unlicense](http://unlicense.org/) - Public Domain\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwally%2Fjslpsolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwally%2Fjslpsolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwally%2Fjslpsolver/lists"}