# linear-program-parser

> Library to parse a Linear Program text

Latest version **1.0.11** (published 2019-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install linear-program-parser
pnpm add linear-program-parser
yarn add linear-program-parser
bun add linear-program-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2019-11-28 |
| First published | 2019-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 115.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jerônimo Nunes Rocha |
| Maintainers | jeronimonunes |

## Links

- npm: https://www.npmjs.com/package/linear-program-parser
- Repository: https://github.com/jeronimonunes/linear-program-parser
- Homepage: https://github.com/jeronimonunes/linear-program-parser#readme
- Issues: https://github.com/jeronimonunes/linear-program-parser/issues
- npm.io page: https://npm.io/package/linear-program-parser

## Dependencies (2)

- [pegjs](https://npm.io/package/pegjs.md) ^0.10.0
- [@types/pegjs](https://npm.io/package/@types/pegjs.md) ^0.10.1

## Recent versions

- 1.0.11 (latest) — 2019-11-28
- 1.0.10 — 2019-11-28
- 1.0.9 — 2019-11-27
- 1.0.8 — 2019-11-26
- 1.0.7 — 2019-11-23
- 1.0.6 — 2019-11-23
- 1.0.5 — 2019-11-23
- 1.0.4 — 2019-11-23
- 1.0.3 — 2019-11-23
- 1.0.2 — 2019-11-23
- 1.0.1 — 2019-11-23
- 1.0.0 — 2019-11-23

## README

# Linear Program Parser

A Library to parse a Linear Program text.

This library is built upon [Pegjs](https://pegjs.org/) and is able to transform the Linear Programming text representation in a JavaScript object. The object is an instance of a class that can be able to evaluate some of the math present in the representation and return the FPI (portuguese initials for Standard Form of Equality).

To use this library first install it by running `npm install linear-program-parser` import the `parse` function and you're ready to go.

Example:

```js
import { parse } from 'linear-program-parser';

const linearProgram = parse(`max(-3a -4b +5c -5d)
    st:
        +1a +1b +0c +0d <= +5;
        -1a +0b -5c +5d <= -10;
        +2a +1b +1c -1d <= +10;
        -2a -1b -1c +1d <= -10;
        a >= 0;
        b >= 0;
        c >= 0;
        d >= 0;
`);

const fpi = linearProgram.toFPI();

const { a, b, c, vars } = fpi.toMatrix();
```

Go to [Simplex Web](https://jeronimonunes.github.io/simplex-web) and see this library being used to prepare input for the [Simplex](https://github.com/jeronimonunes/simplex) program to compute its optimal value.

---
_Source: https://npm.io/package/linear-program-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
