{"id":19595982,"url":"https://github.com/neil-lindquist/linear-programming","last_synced_at":"2026-02-19T13:01:56.728Z","repository":{"id":37779433,"uuid":"193188575","full_name":"neil-lindquist/linear-programming","owner":"neil-lindquist","description":"A Common Lisp library for solving linear programming problems","archived":false,"fork":false,"pushed_at":"2025-06-16T01:05:35.000Z","size":356,"stargazers_count":110,"open_issues_count":4,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-11T14:43:23.099Z","etag":null,"topics":["common-lisp","linear-programming"],"latest_commit_sha":null,"homepage":"https://neil-lindquist.github.io/linear-programming/","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neil-lindquist.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-06-22T03:56:02.000Z","updated_at":"2025-10-27T18:36:52.000Z","dependencies_parsed_at":"2024-01-31T12:05:01.551Z","dependency_job_id":"35edafb1-ad6a-4b7b-b854-255742342301","html_url":"https://github.com/neil-lindquist/linear-programming","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/neil-lindquist/linear-programming","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neil-lindquist%2Flinear-programming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neil-lindquist%2Flinear-programming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neil-lindquist%2Flinear-programming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neil-lindquist%2Flinear-programming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neil-lindquist","download_url":"https://codeload.github.com/neil-lindquist/linear-programming/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neil-lindquist%2Flinear-programming/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29614591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T10:52:55.328Z","status":"ssl_error","status_checked_at":"2026-02-19T10:52:26.323Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["common-lisp","linear-programming"],"created_at":"2024-11-11T08:51:35.943Z","updated_at":"2026-02-19T13:01:56.710Z","avatar_url":"https://github.com/neil-lindquist.png","language":"Common Lisp","readme":"# Common Lisp Linear Programming\n[![Github Actions Status](https://img.shields.io/github/actions/workflow/status/neil-lindquist/linear-programming/ci.yml?logo=github)](https://github.com/neil-lindquist/linear-programming/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/neil-lindquist/linear-programming/badge.svg?branch=master)](https://coveralls.io/github/neil-lindquist/linear-programming?branch=master)\n\n![MIT License](https://img.shields.io/github/license/neil-lindquist/linear-programming.svg?color=informational)\n[![GitHub release](https://img.shields.io/github/release/neil-lindquist/linear-programming.svg)](https://github.com/neil-lindquist/linear-programming/releases)\n[![Current documentation](https://img.shields.io/badge/docs-current-informational.svg)](https://neil-lindquist.github.io/linear-programming/)\n\n\n\nThis is a Common Lisp library for solving linear programming problems.\nIt's designed to provide a high-level and ergonomic API for specifying linear programming problems as lisp expressions.\n\nThe core library is implemented purely in Common Lisp with only a few community-standard libraries as dependencies (ASDF, Alexandria, Iterate).\nHowever, the solver is designed to support alternative backends without any change to the user's code.\nCurrently, there is a [backend for the GNU Linear Programming Kit (GLPK)](https://github.com/neil-lindquist/linear-programming-glpk).\n\n## Installation\nThe linear-programming library is avalible in both the main Quicklisp distribution and Ultralisp, so it can loaded with with `(ql:quickload :linear-programming)`.\nYou can check that it works by running `(asdf:test-system :linear-programming)`.\n\nIf you are not using Quicklisp, place this repository, Alexandria, and Iterate somewhere where ASDF can find them.\nThen, it can be loaded with `(asdf:load-system :linear-programming)` and tested as above.\n\n\n## Usage\nSee [neil-lindquist.github.io/linear-programming/](https://neil-lindquist.github.io/linear-programming/) for further documentation.\n\nConsider the following linear programming problem.\n\u003e maximize  x + 4y + 3z  \n\u003e such that  \n\u003e * 2x + y \u0026#x2264; 8  \n\u003e * y + z \u0026#x2264; 7\n\u003e * x, y, z \u0026#x2265; 0\n\nFirst, the problem needs to be specified.\nProblems are specified with a simple DSL, as described in the [syntax reference](https://neil-lindquist.github.io/linear-programming/linear-problem-syntax).\n```common-lisp\n(use-package :linear-programming)\n\n(defvar problem (parse-linear-problem '(max (= w (+ x (* 4 y) (* 3 z))))\n                                      '((\u003c= (+ (* 2 x) y) 8)\n                                        (\u003c= (+ y z) 7))))\n```\nOnce the problem is created, it can be solved with the simplex method.\n```common-lisp\n(defvar solution (solve-problem problem))\n```\nFinally, the optimal tableau can be inspected to get the resulting objective function, decision variables, and reduced-costs (i.e. the shadow prices for the variable's lower bounds).\n```common-lisp\n(format t \"Objective value solution: ~A~%\" (solution-variable solution 'w))\n(format t \"x = ~A (reduced cost: ~A)~%\" (solution-variable solution 'x) (solution-reduced-cost solution 'x))\n(format t \"y = ~A (reduced cost: ~A)~%\" (solution-variable solution 'y) (solution-reduced-cost solution 'y))\n(format t \"z = ~A (reduced cost: ~A)~%\" (solution-variable solution 'z) (solution-reduced-cost solution 'z))\n\n;; ==\u003e\n;; Objective value solution: 57/2\n;; x = 1/2 (reduced cost: 0)\n;; y = 7 (reduced cost: 0)\n;; z = 0 (reduced cost: 1/2)\n```\nAlternatively, the `with-solution-variables` and `with-solved-problem` macros simplify some steps and binds the solution variables in their bodies.\n\n```common-lisp\n(with-solution-variables (w x y z) solution\n  (format t \"Objective value solution: ~A~%\" w)\n  (format t \"x = ~A (reduced cost: ~A)~%\" x (reduced-cost x))\n  (format t \"y = ~A (reduced cost: ~A)~%\" y (reduced-cost y))\n  (format t \"z = ~A (reduced cost: ~A)~%\" z (reduced-cost z)))\n\n;; ==\u003e\n;; Objective value solution: 57/2\n;; x = 1/2 (reduced cost: 0)\n;; y = 7 (reduced cost: 0)\n;; z = 0 (reduced cost: 1/2)\n\n\n(with-solved-problem ((max (= w (+ x (* 4 y) (* 3 z))))\n                      (\u003c= (+ (* 2 x) y) 8)\n                      (\u003c= (+ y z) 7))\n  (format t \"Objective value solution: ~A~%\" w)\n  (format t \"x = ~A (reduced cost: ~A)~%\" x (reduced-cost x))\n  (format t \"y = ~A (reduced cost: ~A)~%\" y (reduced-cost y))\n  (format t \"z = ~A (reduced cost: ~A)~%\" z (reduced-cost z)))\n\n;; ==\u003e\n;; Objective value solution: 57/2\n;; x = 1/2 (reduced cost: 0)\n;; y = 7 (reduced cost: 0)\n;; z = 0 (reduced cost: 1/2)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneil-lindquist%2Flinear-programming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneil-lindquist%2Flinear-programming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneil-lindquist%2Flinear-programming/lists"}