Skip to main content

Project description

Mypulp is a wrapper module for PuLP. It supports to call PuLP using the same functions and classes as in Gurobi, a commercial mixed integer optimization solver. For more details, see the Gurobi HP http://www.gurobi.com/.

from mypulp import *
model = Model("lo1")
J, v = multidict({1:16, 2:19, 3:23, 4:28})
x1 = model.addVar(vtype=GRB.CONTINUOUS, name="x1")
x2 = model.addVar(vtype="C", name="x2")
x3 = model.addVar(lb=0, ub=30, vtype="C", name="x3")
model.update()
model.addSOS(2, [x1, x2, x3])
L1 = LinExpr([2, 1, 1], [x1, x2, x3])
model.addConstr(lhs=L1, sense="<=", rhs=60)
model.addConstr(x1 + 2*x2 + x3 <= 60)
model.setObjective(15*x1 + 18*x2 + 30*x3, GRB.MAXIMIZE)
model.write("mypulp1.mps")
model.write("mypulp1.lp")
model.optimize()
if model.Status == GRB.Status.OPTIMAL:
    print("Opt. Value =", model.ObjVal)
    for v in model.getVars():
        print(v.VarName, v.X)
    for c in model.getConstrs():
        print(c.ConstrName, c.Pi)

Requirements

  • Python 3.7, pulp

Features

  • nothing

Setup

$ pip install mypulp

History

  • 0.0.1 (2015-05-04) first release
  • 0.0.8 (2016-02-03)

Metadata

Release files for mypulp 0.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for mypulp 0.0.12
File Interpreter ABI Platform
mypulp-0.0.12-py3-none-any.whl Python 3 none any Details

Release files / mypulp-0.0.12-py3-none-any.whl

Download URL mypulp-0.0.12-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
febb0e3a443f2e6b0f3208d7a3eb36ff3da01fe8b8f91f20207b7f9746cfc7e1
BLAKE2b-256 checksum
How to use checksums
39ae0812d072cdfff9d77ddf467250bc98a3f90216874f1fef9633b8000a4f14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.6 Darwin/23.1.0

Release history Release notifications | RSS feed

This release

0.0.12 This release

1 release file

0.0.11

1 release file

0.0.10

2 release files

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page