Coder Social home page Coder Social logo

fregkos / lpp-py Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 46 KB

Smart linear problem parser and dual converter in Python.

License: MIT License

TeX 0.80% Python 99.20%
parser linear-programming simplex primal-dual json python converter primal dual linear

lpp-py's Introduction

lpp-py

Linear problem parser and dual converter in Python.

YOU NEED numpy FOR THE PROGRAM TO WORK. INSTALL IT WITH pip install numpy

Usage

python3 lpp.py -i <inputFile> [options]

Example usage:

python3 lpp.py -i LP01.LTX

Options

    -i, --input  <inputFile>  : define input file name (mutually exclusive with -l)
    -l, --load   <inputFile>  : define input JSON file name to load
    -j, --json                : export problem in JSON format
    -o, --output <outputFile> : define output file name
                                (Default: '(LP-2)<inputFile>')
    -p, --print               : print the human readable output in the console
    -s, --simple              : export the simple human readable format
    -d, --dual                : convert the problem from primal to dual form

For help, use:

python3 lpp.py -h

or

python3 lpp.py --help

About input files:

You can either load an already saved json file, created with this program via -l or --load, but should be used instead of -i or --input.

Otherwise, the input file should follow some specific rules. Take a look below about what is true as well.

  • Start with the type of problem, min or max.
  • Follow up with the objective function, preferably on the same line.
  • Variable names must have specific names, like x1, x2, ..., xN. More specifically x and a number exactly after it.
  • Capitalization does NOT matter, in anything.
  • The order each variable is stated in an expression also does NOT matter.
  • After objective function you must use the keyword(s) s.t. or subject to and state each one per line.
  • Whitespace is irrelevant.
  • Optionally, you can use the keyword with and state the natural constraints per line. To do so, state the variable name, then type free or >=0 or <=0.
  • You must ALWAYS type the end keyword when you are done.
  • You can potentially write whatever else you like in the file and the parser will do it's utmost best to ignore them and only parse what it cares about. Take a look at the examples folder, there are some examples that cover most cases and answer additional questions you might have.

lpp-py's People

Contributors

fregkos avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.