Skip to main content

FreeWheel Linear Programming Interface for Python

Project description

Flipy

flipy_logo_60pt

supported Build Status Coverage

Flipy is a Python linear programming interface library, originally developed by FreeWheel. It currently supports Gurobi and CBC as the backend solver.

To use Gurobi, make sure you have a Gurobi license file, and gurobipy is installed in your Python environment. You can find details from Gurobi’s documentation.

Flipy requires Python 3.6 or newer.

Installation

The latest offical version of Flipy can be installed with pip:

pip install flipy

The latest development version can be get with Git:

git clone https://github.com/freewheel/flipy.git
cd flipy
python setup.py install

Quickstart

Here is a simple example for Flipy:

import flipy

# 1 <= x <= 3.5
x = flipy.LpVariable('x', low_bound=1, up_bound=3.5)
# 2 <= y <= 4
y = flipy.LpVariable('y', low_bound=2, up_bound=4)

# 5x + y <= 12
lhs = flipy.LpExpression('lhs', {x: 2.5, y: 1})
rhs = flipy.LpExpression('rhs', constant=12) 
constraint = flipy.LpConstraint(lhs, 'leq', rhs)

# maximize: 3x + 2y
objective = flipy.LpObjective('test_obj', {x: 3, y: 2}, sense=flipy.Maximize)
problem = flipy.LpProblem('test', objective, [constraint])

solver = flipy.CBCSolver()
status = solver.solve(problem)

Get the solution

After solving, a status is returned to indicate whether the solver has found a optimal solution for the problem:

print(status)
# <SolutionStatus.Optimal: 1>

The objective value can be retrieved with objective.evaluate():

print(objective.evaluate())
# 17.6

The value of variables can be retrieved with .evaluate() as well:

print(x.evaluate())
# 3.2
print(y.evaluate())
# 4.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flipy-0.0.5.tar.gz (13.3 MB view details)

Uploaded Source

Built Distribution

flipy-0.0.5-py3-none-any.whl (13.5 MB view details)

Uploaded Python 3

File details

Details for the file flipy-0.0.5.tar.gz.

File metadata

  • Download URL: flipy-0.0.5.tar.gz
  • Upload date:
  • Size: 13.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for flipy-0.0.5.tar.gz
Algorithm Hash digest
SHA256 937152f4d54dbd258819d290aee8a2b9e5d229c9c176326ba73d26b9b93483dc
MD5 d0e1f2e4b251c9e6439e85150fbb0539
BLAKE2b-256 0cb41918b129020adfa97296e91d3da0bfb82ac9eeab5ddd743607020cc7b4f3

See more details on using hashes here.

File details

Details for the file flipy-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: flipy-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 13.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for flipy-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8722acf8009937a020a241fe9508ee716842c9b86f050457c4738203bc1f4f53
MD5 ea0e7b846b6b5e9d6e70edf38a17e438
BLAKE2b-256 fbfd1089a918ba1334fd63248119a88fd11a21a529ffb980d28f0bd93f4fc6ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page