https://github.com/calebwin/lin
a higher-level DSL for linear programming
https://github.com/calebwin/lin
lin linear-programming linear-programming-solver racket rosette solver
Last synced: 7 months ago
JSON representation
a higher-level DSL for linear programming
- Host: GitHub
- URL: https://github.com/calebwin/lin
- Owner: calebwin
- Created: 2019-02-07T06:10:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-02T02:44:22.000Z (almost 7 years ago)
- Last Synced: 2025-03-23T18:50:54.418Z (10 months ago)
- Topics: lin, linear-programming, linear-programming-solver, racket, rosette, solver
- Language: Racket
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lin
lin is a minimalist [Rosette](http://emina.github.io/rosette/)-based DSL for linear programming. Here's an example...
```racket
; declare variables
(def desirability)
(def supply)
(def cost)
(def price)
(def profit)
; constrain variables
(let (> price 0))
(let (> cost 0))
(let (equal? profit (+ (* 1 price) (* -1 cost))))
(let (> supply 0))
; set variables
(set desirability 90)
(set supply 50)
(set cost 5)
; maximize
(max profit)
; solution
(get price)
```
lin compiles your code to Rosette code applying one of [a variety of solvers](https://docs.racket-lang.org/rosette-guide/sec_solvers-and-solutions.html#%28def._%28%28lib._rosette%2Fquery%2Fcore..rkt%29._current-solver%29%29) to compute satisfiable solutions.