flowty


Nameflowty JSON
Version 1.1.7 PyPI version JSON
download
home_pagehttps://flowty.ai
SummaryFlowty Network Optimization Solver
upload_time2021-03-04 10:11:40
maintainer
docs_urlNone
authorFlowty
requires_python>=3.6
license
keywords optimization nework optimization combinatorial optimization linear programming integer programming operations research mathematical programming
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Flowty

Install with

```sh
pip install flowty
```

## Windows

Install the [64-bit version of python](https://docs.python.org/3/using/windows.html).

## Linux

Install [Fortran](https://gcc.gnu.org/fortran/) to work with the [BLAS](https://www.netlib.org/blas/) and [LAPACK](https://www.netlib.org/lapack/).

On `apt-get` compatible distributions do

```sh
apt-get update
apt-get install libgfortran5
```

## Quick Start

Let's solve [the vehicle routing problem with time windows](https://docs.flowty.ai/examples/vrptw/). 

The objective is to minimize the total cost of routing vehicles from a central depot to a set of customers. Each customer must be visited exactly once within a specified time window to deliver their required demand, each customer has a service time it takes to unload the vehicle (modeled within the out-going travel time), and each vehicle has a maximum capacity of goods to deliver. If a vehicle arrives early it is allowed to wait for the customer's time window to start.

```python
# Vehicle Routing Problem with Time Windows

from flowty import Model, xsum
from flowty.datasets import vrp_rep

bunch = vrp_rep.fetch_vrp_rep("solomon-1987-r1", instance="R102_025")
name, n, es, c, d, Q, t, a, b, x, y = bunch["instance"]

m = Model()

# one graph, it is identical for all vehicles
g = m.addGraph(obj=c, edges=es, source=0, sink=n - 1, L=1, U=n - 2, type="B")

# adds resources variables to the graph.
# demand and capacity
m.addResourceDisposable(
    graph=g, consumptionType="V", weight=d, boundsType="V", lb=0, ub=Q, name="d"
)

# travel time and customer time windows
m.addResourceDisposable(
    graph=g, consumptionType="E", weight=t, boundsType="V", lb=a, ub=b, name="t"
)

# set partition constriants ensure customers are only visited once
for i in range(n)[1:-1]:
    m += xsum(x * 1 for x in g.vars if i == x.source) == 1

# packing set - at most one of these variables can be set. Helps the algorithm
for i in range(n)[1:-1]:
    m.addPackingSet([x for x in g.vars if i == x.source])

status = m.optimize()
print(f"ObjectiveValue {m.objectiveValue}")

# get the variable values
for var in m.vars:
    if var.x > 0:
        print(f"{var.name} = {var.x}")
```

Visit [docs.flowy.ai](https://docs.flowty.ai) to get to know more.

## License

The community license is a license to the general community which may have limited
features and additional restrictions. For an unlimited commercial, academic or trial
license contact Flowty at [info@flowty.ai](mailto:info@flowty.ai).



            

Raw data

            {
    "_id": null,
    "home_page": "https://flowty.ai",
    "name": "flowty",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "Optimization,Nework Optimization,Combinatorial Optimization,Linear Programming,Integer Programming,Operations Research,Mathematical Programming",
    "author": "Flowty",
    "author_email": "info@flowty.ai",
    "download_url": "",
    "platform": "",
    "description": "# Flowty\n\nInstall with\n\n```sh\npip install flowty\n```\n\n## Windows\n\nInstall the [64-bit version of python](https://docs.python.org/3/using/windows.html).\n\n## Linux\n\nInstall [Fortran](https://gcc.gnu.org/fortran/) to work with the [BLAS](https://www.netlib.org/blas/) and [LAPACK](https://www.netlib.org/lapack/).\n\nOn `apt-get` compatible distributions do\n\n```sh\napt-get update\napt-get install libgfortran5\n```\n\n## Quick Start\n\nLet's solve [the vehicle routing problem with time windows](https://docs.flowty.ai/examples/vrptw/). \n\nThe objective is to minimize the total cost of routing vehicles from a central depot to a set of customers. Each customer must be visited exactly once within a specified time window to deliver their required demand, each customer has a service time it takes to unload the vehicle (modeled within the out-going travel time), and each vehicle has a maximum capacity of goods to deliver. If a vehicle arrives early it is allowed to wait for the customer's time window to start.\n\n```python\n# Vehicle Routing Problem with Time Windows\n\nfrom flowty import Model, xsum\nfrom flowty.datasets import vrp_rep\n\nbunch = vrp_rep.fetch_vrp_rep(\"solomon-1987-r1\", instance=\"R102_025\")\nname, n, es, c, d, Q, t, a, b, x, y = bunch[\"instance\"]\n\nm = Model()\n\n# one graph, it is identical for all vehicles\ng = m.addGraph(obj=c, edges=es, source=0, sink=n - 1, L=1, U=n - 2, type=\"B\")\n\n# adds resources variables to the graph.\n# demand and capacity\nm.addResourceDisposable(\n    graph=g, consumptionType=\"V\", weight=d, boundsType=\"V\", lb=0, ub=Q, name=\"d\"\n)\n\n# travel time and customer time windows\nm.addResourceDisposable(\n    graph=g, consumptionType=\"E\", weight=t, boundsType=\"V\", lb=a, ub=b, name=\"t\"\n)\n\n# set partition constriants ensure customers are only visited once\nfor i in range(n)[1:-1]:\n    m += xsum(x * 1 for x in g.vars if i == x.source) == 1\n\n# packing set - at most one of these variables can be set. Helps the algorithm\nfor i in range(n)[1:-1]:\n    m.addPackingSet([x for x in g.vars if i == x.source])\n\nstatus = m.optimize()\nprint(f\"ObjectiveValue {m.objectiveValue}\")\n\n# get the variable values\nfor var in m.vars:\n    if var.x > 0:\n        print(f\"{var.name} = {var.x}\")\n```\n\nVisit [docs.flowy.ai](https://docs.flowty.ai) to get to know more.\n\n## License\n\nThe community license is a license to the general community which may have limited\nfeatures and additional restrictions. For an unlimited commercial, academic or trial\nlicense contact Flowty at [info@flowty.ai](mailto:info@flowty.ai).\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Flowty Network Optimization Solver",
    "version": "1.1.7",
    "split_keywords": [
        "optimization",
        "nework optimization",
        "combinatorial optimization",
        "linear programming",
        "integer programming",
        "operations research",
        "mathematical programming"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "b36b3467b9172aa06385a77a8050b5f1",
                "sha256": "335753951d8c4015e5ed9f3359dc3f1e9d2ebb7a8a25950ced4b778f6e091aa7"
            },
            "downloads": -1,
            "filename": "flowty-1.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b36b3467b9172aa06385a77a8050b5f1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6459479,
            "upload_time": "2021-03-04T10:11:40",
            "upload_time_iso_8601": "2021-03-04T10:11:40.836213Z",
            "url": "https://files.pythonhosted.org/packages/ad/d8/e77671e25f66547d7aca137e589ab935f886174e396e28f107be8d4f9123/flowty-1.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-03-04 10:11:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "flowty"
}
        
Elapsed time: 0.26855s