1.0.11 • Published 4 years ago

linear-program-parser v1.0.11

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Linear Program Parser

A Library to parse a Linear Program text.

This library is built upon Pegjs 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:

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 and see this library being used to prepare input for the Simplex program to compute its optimal value.

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago