PuLP


NamePuLP JSON
Version 2.8.0 PyPI version JSON
download
home_pagehttps://github.com/coin-or/pulp
SummaryPuLP is an LP modeler written in python. PuLP can generate MPS or LP files and call GLPK, COIN CLP/CBC, CPLEX, and GUROBI to solve linear problems.
upload_time2024-01-12 10:07:00
maintainer
docs_urlNone
authorJ.S. Roy and S.A. Mitchell and F. Peschiera
requires_python>=3.7
license
keywords optimization linear programming operations research
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            pulp
**************************

.. image:: https://travis-ci.org/coin-or/pulp.svg?branch=master
    :target: https://travis-ci.org/coin-or/pulp
.. image:: https://img.shields.io/pypi/v/pulp
    :target: https://pypi.org/project/PuLP/
    :alt: PyPI
.. image:: https://img.shields.io/pypi/dm/pulp
    :target: https://pypi.org/project/PuLP/
    :alt: PyPI - Downloads

PuLP is an LP modeler written in Python. PuLP can generate MPS or LP files and call GLPK_, COIN-OR CLP/`CBC`_, CPLEX_, GUROBI_, MOSEK_, XPRESS_, CHOCO_, MIPCL_, HiGHS_, SCIP_/FSCIP_ to solve linear problems.

Installation
================

The easiest way to install pulp is via `PyPi <https://pypi.python.org/pypi/PuLP>`_

If pip is available on your system::

     python -m pip install pulp

Otherwise follow the download instructions on the PyPi page.


If you want to install the latest version from github you can run the following::

    python -m pip install -U git+https://github.com/coin-or/pulp


On Linux and OSX systems the tests must be run to make the default
solver executable.

::

     sudo pulptest

Examples
================

See the examples directory for examples.

PuLP requires Python 3.7 or newer.

The examples use the default solver (CBC). To use other solvers they must be available (installed and accessible). For more information on how to do that, see the `guide on configuring solvers <https://coin-or.github.io/pulp/guides/how_to_configure_solvers.html>`_.

Documentation
================

Documentation is found on https://coin-or.github.io/pulp/.


Use LpVariable() to create new variables. To create a variable 0 <= x <= 3::

     x = LpVariable("x", 0, 3)

To create a variable 0 <= y <= 1::

     y = LpVariable("y", 0, 1)

Use LpProblem() to create new problems. Create "myProblem"::

     prob = LpProblem("myProblem", LpMinimize)

Combine variables to create expressions and constraints, then add them to the
problem::

     prob += x + y <= 2

If you add an expression (not a constraint), it will
become the objective::

     prob += -4*x + y

To solve with the default included solver::

     status = prob.solve()

To use another sovler to solve the problem::

     status = prob.solve(GLPK(msg = 0))

Display the status of the solution::

     LpStatus[status]
     > 'Optimal'

You can get the value of the variables using value(). ex::

     value(x)
     > 2.0

Exported Classes:

* ``LpProblem`` -- Container class for a Linear programming problem
* ``LpVariable`` -- Variables that are added to constraints in the LP
* ``LpConstraint`` -- A constraint of the general form

      a1x1+a2x2 ...anxn (<=, =, >=) b

*  ``LpConstraintVar`` -- Used to construct a column of the model in column-wise modelling

Exported Functions:

* ``value()`` -- Finds the value of a variable or expression
* ``lpSum()`` -- given a list of the form [a1*x1, a2x2, ..., anxn] will construct a linear expression to be used as a constraint or variable
* ``lpDot()`` --given two lists of the form [a1, a2, ..., an] and [ x1, x2, ..., xn] will construct a linear expression to be used as a constraint or variable


Building the documentation
--------------------------

The PuLP documentation is built with `Sphinx <https://www.sphinx-doc.org>`_.  We recommended using a
`virtual environment <https://docs.python.org/3/library/venv.html>`_ to build the documentation locally.

To build, run the following in a terminal window, in the PuLP root directory

::

    cd pulp
    python -m pip install -r requirements-dev.txt
    cd doc
    make html

A folder named html will be created inside the ``build/`` directory.
The home page for the documentation is ``doc/build/html/index.html`` which can be opened in a browser.






**Comments, bug reports, patches and suggestions are welcome.**

* Comments and suggestions: https://github.com/coin-or/pulp/discussions
* Bug reports: https://github.com/coin-or/pulp/issues
* Patches: https://github.com/coin-or/pulp/pulls

     Copyright J.S. Roy, 2003-2005
     Copyright Stuart A. Mitchell
     See the LICENSE file for copyright information.

.. _Python: http://www.python.org/

.. _GLPK: http://www.gnu.org/software/glpk/glpk.html
.. _CBC: https://github.com/coin-or/Cbc
.. _CPLEX: http://www.cplex.com/
.. _GUROBI: http://www.gurobi.com/
.. _MOSEK: https://www.mosek.com/
.. _XPRESS: https://www.fico.com/es/products/fico-xpress-solver
.. _CHOCO: https://choco-solver.org/
.. _MIPCL: http://mipcl-cpp.appspot.com/
.. _SCIP: https://www.scipopt.org/
.. _HiGHS: https://highs.dev
.. _FSCIP: https://ug.zib.de

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/coin-or/pulp",
    "name": "PuLP",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "Optimization,Linear Programming,Operations Research",
    "author": "J.S. Roy and S.A. Mitchell and F. Peschiera",
    "author_email": "pulp@stuartmitchell.com",
    "download_url": "https://files.pythonhosted.org/packages/2c/e0/683a36567b0a396961192dc9ec477ba1f88be56d968ca26688bd6e02f23b/PuLP-2.8.0.tar.gz",
    "platform": null,
    "description": "pulp\n**************************\n\n.. image:: https://travis-ci.org/coin-or/pulp.svg?branch=master\n    :target: https://travis-ci.org/coin-or/pulp\n.. image:: https://img.shields.io/pypi/v/pulp\n    :target: https://pypi.org/project/PuLP/\n    :alt: PyPI\n.. image:: https://img.shields.io/pypi/dm/pulp\n    :target: https://pypi.org/project/PuLP/\n    :alt: PyPI - Downloads\n\nPuLP is an LP modeler written in Python. PuLP can generate MPS or LP files and call GLPK_, COIN-OR CLP/`CBC`_, CPLEX_, GUROBI_, MOSEK_, XPRESS_, CHOCO_, MIPCL_, HiGHS_, SCIP_/FSCIP_ to solve linear problems.\n\nInstallation\n================\n\nThe easiest way to install pulp is via `PyPi <https://pypi.python.org/pypi/PuLP>`_\n\nIf pip is available on your system::\n\n     python -m pip install pulp\n\nOtherwise follow the download instructions on the PyPi page.\n\n\nIf you want to install the latest version from github you can run the following::\n\n    python -m pip install -U git+https://github.com/coin-or/pulp\n\n\nOn Linux and OSX systems the tests must be run to make the default\nsolver executable.\n\n::\n\n     sudo pulptest\n\nExamples\n================\n\nSee the examples directory for examples.\n\nPuLP requires Python 3.7 or newer.\n\nThe examples use the default solver (CBC). To use other solvers they must be available (installed and accessible). For more information on how to do that, see the `guide on configuring solvers <https://coin-or.github.io/pulp/guides/how_to_configure_solvers.html>`_.\n\nDocumentation\n================\n\nDocumentation is found on https://coin-or.github.io/pulp/.\n\n\nUse LpVariable() to create new variables. To create a variable 0 <= x <= 3::\n\n     x = LpVariable(\"x\", 0, 3)\n\nTo create a variable 0 <= y <= 1::\n\n     y = LpVariable(\"y\", 0, 1)\n\nUse LpProblem() to create new problems. Create \"myProblem\"::\n\n     prob = LpProblem(\"myProblem\", LpMinimize)\n\nCombine variables to create expressions and constraints, then add them to the\nproblem::\n\n     prob += x + y <= 2\n\nIf you add an expression (not a constraint), it will\nbecome the objective::\n\n     prob += -4*x + y\n\nTo solve with the default included solver::\n\n     status = prob.solve()\n\nTo use another sovler to solve the problem::\n\n     status = prob.solve(GLPK(msg = 0))\n\nDisplay the status of the solution::\n\n     LpStatus[status]\n     > 'Optimal'\n\nYou can get the value of the variables using value(). ex::\n\n     value(x)\n     > 2.0\n\nExported Classes:\n\n* ``LpProblem`` -- Container class for a Linear programming problem\n* ``LpVariable`` -- Variables that are added to constraints in the LP\n* ``LpConstraint`` -- A constraint of the general form\n\n      a1x1+a2x2 ...anxn (<=, =, >=) b\n\n*  ``LpConstraintVar`` -- Used to construct a column of the model in column-wise modelling\n\nExported Functions:\n\n* ``value()`` -- Finds the value of a variable or expression\n* ``lpSum()`` -- given a list of the form [a1*x1, a2x2, ..., anxn] will construct a linear expression to be used as a constraint or variable\n* ``lpDot()`` --given two lists of the form [a1, a2, ..., an] and [ x1, x2, ..., xn] will construct a linear expression to be used as a constraint or variable\n\n\nBuilding the documentation\n--------------------------\n\nThe PuLP documentation is built with `Sphinx <https://www.sphinx-doc.org>`_.  We recommended using a\n`virtual environment <https://docs.python.org/3/library/venv.html>`_ to build the documentation locally.\n\nTo build, run the following in a terminal window, in the PuLP root directory\n\n::\n\n    cd pulp\n    python -m pip install -r requirements-dev.txt\n    cd doc\n    make html\n\nA folder named html will be created inside the ``build/`` directory.\nThe home page for the documentation is ``doc/build/html/index.html`` which can be opened in a browser.\n\n\n\n\n\n\n**Comments, bug reports, patches and suggestions are welcome.**\n\n* Comments and suggestions: https://github.com/coin-or/pulp/discussions\n* Bug reports: https://github.com/coin-or/pulp/issues\n* Patches: https://github.com/coin-or/pulp/pulls\n\n     Copyright J.S. Roy, 2003-2005\n     Copyright Stuart A. Mitchell\n     See the LICENSE file for copyright information.\n\n.. _Python: http://www.python.org/\n\n.. _GLPK: http://www.gnu.org/software/glpk/glpk.html\n.. _CBC: https://github.com/coin-or/Cbc\n.. _CPLEX: http://www.cplex.com/\n.. _GUROBI: http://www.gurobi.com/\n.. _MOSEK: https://www.mosek.com/\n.. _XPRESS: https://www.fico.com/es/products/fico-xpress-solver\n.. _CHOCO: https://choco-solver.org/\n.. _MIPCL: http://mipcl-cpp.appspot.com/\n.. _SCIP: https://www.scipopt.org/\n.. _HiGHS: https://highs.dev\n.. _FSCIP: https://ug.zib.de\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "PuLP is an LP modeler written in python. PuLP can generate MPS or LP files and call GLPK, COIN CLP/CBC, CPLEX, and GUROBI to solve linear problems.",
    "version": "2.8.0",
    "project_urls": {
        "Homepage": "https://github.com/coin-or/pulp"
    },
    "split_keywords": [
        "optimization",
        "linear programming",
        "operations research"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "09d757e71e11108203039c895643368c0d1a99fe719a6a80184edf240c33d25f",
                "md5": "c1298340512ae14f1d298ea200832029",
                "sha256": "4a19814a5b0a4392d788ac2315263435293579b0583c3469943fe0c6a586f263"
            },
            "downloads": -1,
            "filename": "PuLP-2.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c1298340512ae14f1d298ea200832029",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 17678623,
            "upload_time": "2024-01-12T10:06:57",
            "upload_time_iso_8601": "2024-01-12T10:06:57.514920Z",
            "url": "https://files.pythonhosted.org/packages/09/d7/57e71e11108203039c895643368c0d1a99fe719a6a80184edf240c33d25f/PuLP-2.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2ce0683a36567b0a396961192dc9ec477ba1f88be56d968ca26688bd6e02f23b",
                "md5": "d9901057b757dc197ed1b84aa4d22ebb",
                "sha256": "4903bf96110bbab8ed2c68533f90565ebb76aa367d9e4df38e51bf727927c125"
            },
            "downloads": -1,
            "filename": "PuLP-2.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d9901057b757dc197ed1b84aa4d22ebb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 17610412,
            "upload_time": "2024-01-12T10:07:00",
            "upload_time_iso_8601": "2024-01-12T10:07:00.720086Z",
            "url": "https://files.pythonhosted.org/packages/2c/e0/683a36567b0a396961192dc9ec477ba1f88be56d968ca26688bd6e02f23b/PuLP-2.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-12 10:07:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "coin-or",
    "github_project": "pulp",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pulp"
}
        
Elapsed time: 0.52196s