https://github.com/connor-makowski/gloop
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.5%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: connor-makowski
- License: mit
- Language: Python
- Default Branch: main
- Size: 585 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 2
Metadata Files
README.md
Gloop
Generalized Linear Object Oriented Programming (GLOOP) as a simple pythonic interface for OOP access to PULP. It features simple objects, helpful methods, and additional error checking that simplifies code and streamlines development.
Gloop also happens to be synonymous with the word "pulp" in the English language.
Why use Gloop?
- Simple: Gloop is simple and easy to use.
- Object Oriented: Gloop is object oriented by design.
- Error Checking: Gloop has additional error checking to help you catch mistakes early.
- This includes checking for duplicate names, invalid constraints, passed types, and more.
- Intuitive: Gloop is intuitive
- Unique: Gloops is unique in nature and can help you think differently about how you code for linear programming.
Setup
pip install gloop
Getting Started
gloop is a package designed for object oriented linear programming access to pulp. Technical docs can be found here.
Bare Bones Example
```py import gloop
Create a variable
myvariable = gloop.Variable(name='myvariable_name', lowBound=0)
Create a model
mymodel = gloop.Model(name="mymodel_name", sense="maximize")
Add an objective for the model
mymodel.addobjective(fn=my_variable)
Add a constraint to the model
mymodel.addconstraint(name="myconstraintname", fn=my_variable <= 5)
Solve the model
my_model.solve()
Get the results
mymodel.showoutputs()
=> {'status': 'Optimal', 'objective': 5.0, 'variables': {'myvariablename': 5.0}}
```
Example
Transportation Problem
A product is manufactured in two assembly plants and sold in three regions. Monthly demand per region is shared in Table 1. Currently, assembly plants have no capacity restrictions and can source as many items as needed. Transportation costs (USD)0.12 per unit per mile.
Table 1: Demand in units
| Demand | Region 1 | Region 2 | Region 3 |
| Units per month | 2500 | 4350 | 3296 |
Table 2: Distance in Miles
| Miles | Region 1 | Region 2 | Region 3 |
| Assembly Plant 1 | 105 | 256 | 108 |
| Assembly Plant 2 | 240 | 136 | 198 |
Formulate a model using the available information. Your goal is to minimize the total transportation cost.
```py
Transportation Problem
import gloop
############# DATA
Transportation data
transport = [ {"originname": "A1", "destinationname": "R1", "distance": 105}, {"originname": "A1", "destinationname": "R2", "distance": 256}, {"originname": "A1", "destinationname": "R3", "distance": 108}, {"originname": "A2", "destinationname": "R1", "distance": 240}, {"originname": "A2", "destinationname": "R2", "distance": 136}, {"originname": "A2", "destinationname": "R3", "distance": 198}, ]
Loop through the transport data to create variables and calculate cost
for t in transport: # Create decision variables for each item in transport t["amt"] = gloop.Variable( name=f"{t['originname']}{t['destinationname']}__amt", lowBound=0 ) # Calculate the variable cost of shipping for each item in tranport t["cost"] = t["distance"] * 0.12
Demand data
demand = [ {"name": "R1", "demand": 2500}, {"name": "R2", "demand": 4350}, {"name": "R3", "demand": 3296}, ]
############# Model
Initialize the model
mymodel = gloop.Model(name="transportationexample", sense="minimize")
Add the Objective Fn
mymodel.addobjective(fn=gloop.Sum([t["amt"] * t["cost"] for t in transport]))
Add Constraints
Demand Constraint
for d in demand: mymodel.addconstraint( name=f"{d['name']}_demand", fn=gloop.Sum( [t["amt"] for t in transport if t["destinationname"] == d["name"]] ) >= d["demand"], )
Solve the model
my_model.solve()
############# OUTPUT
Show the outputs
mymodel.showoutputs() #=>
{'objective': 145208.16,
'status': 'Optimal',
'variables': {'A1R1amt': 2500.0,
'A1R2amt': 0.0,
'A1R3amt': 3296.0,
'A2R1amt': 0.0,
'A2R2amt': 4350.0,
'A2R3amt': 0.0}}
```
Owner
- Name: Connor Makowski
- Login: connor-makowski
- Kind: user
- Location: Cambridge, MA
- Repositories: 12
- Profile: https://github.com/connor-makowski
Cave Lab Project Manager and Digital Learning Lead at MIT
GitHub Events
Total
- Create event: 6
- Release event: 2
- Issues event: 1
- Delete event: 2
- Push event: 11
- Pull request event: 3
Last Year
- Create event: 6
- Release event: 2
- Issues event: 1
- Delete event: 2
- Push event: 11
- Pull request event: 3
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Connor Makowski | c****8@g****m | 14 |
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 1
- Total pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- connor-makowski (1)
Pull Request Authors
- connor-makowski (4)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 17 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
- Total maintainers: 1
pypi.org: gloop
Generalized Linear Object Oriented Programming (GLOOP)
- Homepage: https://github.com/connor-makowski/gloop
- Documentation: https://connor-makowski.github.io/gloop/index.html
- License: MIT License
-
Latest release: 1.0.1
published over 1 year ago