lippy


Namelippy JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/ispaneli/lippy
SummaryLippy - solving linear programming problems.
upload_time2023-03-22 17:33:53
maintainer
docs_urlNone
authorIlya Antonov
requires_python<4,>=3.8
license
keywords lippy algorithm algorithms game theory game_theory primal dual linear programming primal_linear_programming primal_lp dual_linear_programming dual_lp simplex simplex_method simplex_table branch_and_bound brute_force cutting_plane cutting_plane_method zero_sum_game
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <a href="https://pypi.org/project/lippy">
    <img src="https://raw.githubusercontent.com/ispaneli/lippy/master/docs/img/logo.png" alt="Lippy">
  </a>
</p>
<p align="center">
  <em>Lippy - solving linear programming problems.</em>
</p>
<p align="center">
  <a href="https://github.com/ispaneli/lippy/actions?query=workflow%3ATests+event%3Apush+branch%3Amaster" target="_blank">
      <img src="https://github.com/ispaneli/lippy/workflows/Tests/badge.svg?event=push&branch=master" alt="Tests">
  </a>
  <a href="https://pypi.org/project/lippy" target="_blank">
    <img src="https://img.shields.io/pypi/v/lippy?color=%2334D058&label=pypi%20package" alt="Package version">
  </a>
  <a href="https://pypi.org/project/lippy" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/lippy.svg?color=%2334D058" alt="Supported Python versions">
  </a>
  <a href="https://pypi.org/project/lippy" target="_blank">
    <img src="https://static.pepy.tech/personalized-badge/lippy?period=total&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads" alt="Total downloads">
  </a>
</p>

---

**Source Code**:
<a href="https://github.com/ispaneli/lippy" target="_blank">
  https://github.com/ispaneli/lippy
</a>

---

**Lippy** is a module for solving **linear programming problems** on Python.

Provides:
1. [Simplex method in primal linear programming](#simplex-method-in-primal-linear-programming)
2. [Simplex method in dual linear programming](#simplex-method-in-dual-linear-programming)
3. [Branch and bound in integer linear programming](#branch-and-bound-in-integer-linear-programming)
4. [Brute force method in integer linear programming](#brute-force-method-in-integer-linear-programming)
5. [Cutting-plane method in integer linear programming](#cutting-plane-method-in-integer-linear-programming)
6. [Zero-sum game in game theory using Simplex method](#zero-sum-game-in-game-theory-using-simplex-method)

---

## Simplex method in primal linear programming

```python
import lippy as lp


c_vec = [6, 6, 6]
a_matrix = [
    [4, 1, 1],
    [1, 2, 0],
    [0, 0.5, 4]
]
b_vec = [5, 3, 8]

simplex = lp.SimplexMethod(c_vec, a_matrix, b_vec)
solution, func_value = simplex.solve()
```

---

## Simplex method in dual linear programming

```python
import lippy as lp


c_vec = [6, 6, 6]
a_matrix = [
    [4, 1, 1],
    [1, 2, 0],
    [0, 0.5, 4]
]
b_vec = [5, 3, 8]

c_vec, a_matrix, b_vec = lp.primal_to_dual_lp(c_vec, a_matrix, b_vec)
simplex = lp.SimplexMethod(c_vec, a_matrix, b_vec)
solution, func_value = simplex.solve()
```

---

## Branch and bound in integer linear programming

```python
import lippy as lp


c_vec = [3, 3, 7]
a_matrix = [
    [1, 1, 1],
    [1, 4, 0],
    [0, 0.5, 3]
]
b_vec = [3, 5, 7]

bab = lp.BranchAndBound(c_vec, a_matrix, b_vec)
solution, func_value = bab.solve()
```

---

## Brute force method in integer linear programming

```python
import lippy as lp


c_vec = [3, 3, 7]
a_matrix = [
    [1, 1, 1],
    [1, 4, 0],
    [0, 0.5, 3]
]
b_vec = [3, 5, 7]

force = lp.BruteForce(c_vec, a_matrix, b_vec)
solution, func_value = force.solve()
```

---

## Cutting-plane method in integer linear programming

```python
import lippy as lp


c_vec = [3, 3, 7]
a_matrix = [
    [1, 1, 1],
    [1, 4, 0],
    [0, 0.5, 3]
]
b_vec = [3, 5, 7]

gomory = lp.CuttingPlaneMethod(c_vec, a_matrix, b_vec)
gomory.solve()
```

---

## Zero-sum game in game theory using Simplex method

```python
import lippy as lp


game_matrix = [
    [8, 1, 17, 8, 1],
    [12, 6, 11, 10, 16],
    [4, 19, 11, 15, 2],
    [17, 19, 6, 17, 16]
]

game = lp.ZeroSumGame(game_matrix)
strategies = game.solve()
```

---

## Logging

Existing logging modes:
1. FULL_LOG
2. MEDIUM_LOG
3. LOG_OFF *(default)*

Logging is set when initializing a class object.

For example:

```python
simplex = lp.SimplexMethod(c_vec, a_matrix, b_vec, log_mode=lp.LogMode.FULL_LOG)
```

```python
bab = lp.BranchAndBound(c_vec, a_matrix, b_vec, log_mode=lp.LogMode.MEDIUM_LOG)
```

---

## License

This project is licensed under the terms of the [MIT license](https://github.com/ispaneli/lippy/blob/master/LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ispaneli/lippy",
    "name": "lippy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "<4,>=3.8",
    "maintainer_email": "",
    "keywords": "lippy,algorithm,algorithms,game,theory,game_theory,primal,dual,linear,programming,primal_linear_programming,primal_lp,dual_linear_programming,dual_lp,simplex,simplex_method,simplex_table,branch_and_bound,brute_force,cutting_plane,cutting_plane_method,zero_sum_game",
    "author": "Ilya Antonov",
    "author_email": "ispanelki@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/1d/1678e00420522710d34d6d1767a3e0516837d0b374a897917bc3bd6ccade/lippy-0.0.5.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <a href=\"https://pypi.org/project/lippy\">\n    <img src=\"https://raw.githubusercontent.com/ispaneli/lippy/master/docs/img/logo.png\" alt=\"Lippy\">\n  </a>\n</p>\n<p align=\"center\">\n  <em>Lippy - solving linear programming problems.</em>\n</p>\n<p align=\"center\">\n  <a href=\"https://github.com/ispaneli/lippy/actions?query=workflow%3ATests+event%3Apush+branch%3Amaster\" target=\"_blank\">\n      <img src=\"https://github.com/ispaneli/lippy/workflows/Tests/badge.svg?event=push&branch=master\" alt=\"Tests\">\n  </a>\n  <a href=\"https://pypi.org/project/lippy\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/v/lippy?color=%2334D058&label=pypi%20package\" alt=\"Package version\">\n  </a>\n  <a href=\"https://pypi.org/project/lippy\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/pyversions/lippy.svg?color=%2334D058\" alt=\"Supported Python versions\">\n  </a>\n  <a href=\"https://pypi.org/project/lippy\" target=\"_blank\">\n    <img src=\"https://static.pepy.tech/personalized-badge/lippy?period=total&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads\" alt=\"Total downloads\">\n  </a>\n</p>\n\n---\n\n**Source Code**:\n<a href=\"https://github.com/ispaneli/lippy\" target=\"_blank\">\n  https://github.com/ispaneli/lippy\n</a>\n\n---\n\n**Lippy** is a module for solving **linear programming problems** on Python.\n\nProvides:\n1. [Simplex method in primal linear programming](#simplex-method-in-primal-linear-programming)\n2. [Simplex method in dual linear programming](#simplex-method-in-dual-linear-programming)\n3. [Branch and bound in integer linear programming](#branch-and-bound-in-integer-linear-programming)\n4. [Brute force method in integer linear programming](#brute-force-method-in-integer-linear-programming)\n5. [Cutting-plane method in integer linear programming](#cutting-plane-method-in-integer-linear-programming)\n6. [Zero-sum game in game theory using Simplex method](#zero-sum-game-in-game-theory-using-simplex-method)\n\n---\n\n## Simplex method in primal linear programming\n\n```python\nimport lippy as lp\n\n\nc_vec = [6, 6, 6]\na_matrix = [\n    [4, 1, 1],\n    [1, 2, 0],\n    [0, 0.5, 4]\n]\nb_vec = [5, 3, 8]\n\nsimplex = lp.SimplexMethod(c_vec, a_matrix, b_vec)\nsolution, func_value = simplex.solve()\n```\n\n---\n\n## Simplex method in dual linear programming\n\n```python\nimport lippy as lp\n\n\nc_vec = [6, 6, 6]\na_matrix = [\n    [4, 1, 1],\n    [1, 2, 0],\n    [0, 0.5, 4]\n]\nb_vec = [5, 3, 8]\n\nc_vec, a_matrix, b_vec = lp.primal_to_dual_lp(c_vec, a_matrix, b_vec)\nsimplex = lp.SimplexMethod(c_vec, a_matrix, b_vec)\nsolution, func_value = simplex.solve()\n```\n\n---\n\n## Branch and bound in integer linear programming\n\n```python\nimport lippy as lp\n\n\nc_vec = [3, 3, 7]\na_matrix = [\n    [1, 1, 1],\n    [1, 4, 0],\n    [0, 0.5, 3]\n]\nb_vec = [3, 5, 7]\n\nbab = lp.BranchAndBound(c_vec, a_matrix, b_vec)\nsolution, func_value = bab.solve()\n```\n\n---\n\n## Brute force method in integer linear programming\n\n```python\nimport lippy as lp\n\n\nc_vec = [3, 3, 7]\na_matrix = [\n    [1, 1, 1],\n    [1, 4, 0],\n    [0, 0.5, 3]\n]\nb_vec = [3, 5, 7]\n\nforce = lp.BruteForce(c_vec, a_matrix, b_vec)\nsolution, func_value = force.solve()\n```\n\n---\n\n## Cutting-plane method in integer linear programming\n\n```python\nimport lippy as lp\n\n\nc_vec = [3, 3, 7]\na_matrix = [\n    [1, 1, 1],\n    [1, 4, 0],\n    [0, 0.5, 3]\n]\nb_vec = [3, 5, 7]\n\ngomory = lp.CuttingPlaneMethod(c_vec, a_matrix, b_vec)\ngomory.solve()\n```\n\n---\n\n## Zero-sum game in game theory using Simplex method\n\n```python\nimport lippy as lp\n\n\ngame_matrix = [\n    [8, 1, 17, 8, 1],\n    [12, 6, 11, 10, 16],\n    [4, 19, 11, 15, 2],\n    [17, 19, 6, 17, 16]\n]\n\ngame = lp.ZeroSumGame(game_matrix)\nstrategies = game.solve()\n```\n\n---\n\n## Logging\n\nExisting logging modes:\n1. FULL_LOG\n2. MEDIUM_LOG\n3. LOG_OFF *(default)*\n\nLogging is set when initializing a class object.\n\nFor example:\n\n```python\nsimplex = lp.SimplexMethod(c_vec, a_matrix, b_vec, log_mode=lp.LogMode.FULL_LOG)\n```\n\n```python\nbab = lp.BranchAndBound(c_vec, a_matrix, b_vec, log_mode=lp.LogMode.MEDIUM_LOG)\n```\n\n---\n\n## License\n\nThis project is licensed under the terms of the [MIT license](https://github.com/ispaneli/lippy/blob/master/LICENSE).\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Lippy - solving linear programming problems.",
    "version": "0.0.5",
    "split_keywords": [
        "lippy",
        "algorithm",
        "algorithms",
        "game",
        "theory",
        "game_theory",
        "primal",
        "dual",
        "linear",
        "programming",
        "primal_linear_programming",
        "primal_lp",
        "dual_linear_programming",
        "dual_lp",
        "simplex",
        "simplex_method",
        "simplex_table",
        "branch_and_bound",
        "brute_force",
        "cutting_plane",
        "cutting_plane_method",
        "zero_sum_game"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8b78aca6df391ca0e593cc6e47a629f41cd619a6efeb8844eb7e82a1ba1418af",
                "md5": "e4bd8a25e041e4d102f626eaa76056f8",
                "sha256": "8a1a92f0c0e6e84251c70278595003a44f06ebd3197742ee6ffdec4380032ea4"
            },
            "downloads": -1,
            "filename": "lippy-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e4bd8a25e041e4d102f626eaa76056f8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.8",
            "size": 17704,
            "upload_time": "2023-03-22T17:33:51",
            "upload_time_iso_8601": "2023-03-22T17:33:51.493095Z",
            "url": "https://files.pythonhosted.org/packages/8b/78/aca6df391ca0e593cc6e47a629f41cd619a6efeb8844eb7e82a1ba1418af/lippy-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b71d1678e00420522710d34d6d1767a3e0516837d0b374a897917bc3bd6ccade",
                "md5": "12d0c233cce60ca5c08cb7b3f31fc7c3",
                "sha256": "ac8b4782eb852a45fce1413c4844502cdc59faf688289cb0d9e4561e11938bae"
            },
            "downloads": -1,
            "filename": "lippy-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "12d0c233cce60ca5c08cb7b3f31fc7c3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.8",
            "size": 14831,
            "upload_time": "2023-03-22T17:33:53",
            "upload_time_iso_8601": "2023-03-22T17:33:53.389656Z",
            "url": "https://files.pythonhosted.org/packages/b7/1d/1678e00420522710d34d6d1767a3e0516837d0b374a897917bc3bd6ccade/lippy-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-22 17:33:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "ispaneli",
    "github_project": "lippy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lippy"
}
        
Elapsed time: 0.04586s