Skip to content

Commit

Permalink
New Release
Browse files Browse the repository at this point in the history
  • Loading branch information
ktafakkori committed Oct 26, 2022
1 parent abffbcf commit dadc41d
Show file tree
Hide file tree
Showing 111 changed files with 5,409 additions and 1,279 deletions.
12 changes: 6 additions & 6 deletions .eggs/pytest_runner-6.0.0-py3.10.egg/EGG-INFO/requires.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

[docs]
sphinx
jaraco.packaging>=9
jaraco.tidelift>=1.4
rst.linker>=1.9
sphinx
jaraco.tidelift>=1.4

[testing]
pytest-black>=0.3.7
pytest>=6
pytest-checkdocs>=2.4
pytest-flake8
pytest-cov
pytest-enabler>=1.0.1
pytest-flake8
pytest-mypy>=0.9.1
pytest-virtualenv
pytest>=6
types-setuptools
pytest-black>=0.3.7
pytest-mypy>=0.9.1
13 changes: 13 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CHANGELOG (SINCE 24 SEPTEMBER 2022).

====================================
* Version 0.1.1 (26 October 2022)
====================================
Stated to support heuristic algorithms.
Started to support sensitvity analysis.
Started to support extensible coding.

====================================
* Version 0.1 (24 September 2022)
===============================
Initial realse of FelooPy
7 changes: 0 additions & 7 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ MIT License

Copyright (c) 2022 Keivan Tafakkori & FELOOP (https://ktafakkori.github.io/)

'FelooPy' uses the following packages and their copyright notices are as follows:

- Copyright (c) 2022 pyomo (https://github.com/Pyomo/pyomo/blob/main/LICENSE.txt)
- Copyright (c) 2022 pulp (https://github.com/coin-or/pulp/blob/master/LICENSE)
- Copyright (c) 2022 ortools (https://github.com/google/or-tools/blob/stable/LICENSE)
- Copyright (c) 2022 gekko (https://github.com/BYU-PRISM/GEKKO/blob/master/LICENSE)

Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:

Expand Down
125 changes: 9 additions & 116 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@

![](images/feloopy.png)

An integrated optimization environment (IOE) for AutoOR!
An integrated optimization environment (IOE) for AutoOR in Python!

## 🐍Introduction

FelooPy (FEasible, LOgical & OPtimal + Python) is a hyper-optimization interface that allows operations research scientists to build, develop, and test optimization models with almost all open-source and commercial solvers available. With FelooPy, the users would be able to benchmark the solvers to see if they meet the requirements.

Motivated by the AutoML era, which is "the process of automating the time-consuming, iterative tasks of machine learning model development," FelooPy is the first package that is going to provide an AutoOR tool for automating the time-consuming tasks of modeling, implementing, and analyzing an optimization model by providing an integrated (exact and heuristic) optimization environment in Python. Accordingly, FelooPy would also support multiple features such as sensitivity analysis, visualization, and more!

⚠️ Please note that the FelooPy project is in its infancy. Therefore, the package is not very stable. However, the interested users can still use the popular optimization interfaces such as `ortools,` `pulp,` `pyomo` and `gekko` through it!

License: MIT

## 🔝 Advantages:
Expand All @@ -28,9 +26,11 @@ License: MIT
- Having access to multiple optimization interfaces all at once.
- Using almost all solvers available.
- Getting execution time of your optimization model.
- (Upcoming) possibility for sensitivity analysis.
- (Upcoming) possibility for benchmarking all optimizers for your_model.
- (Scope) possibility for heuristic optimization with the same syntax.
- Native support for sensitivity analysis.
- Native support for benchmarking all optimizers for your_model.
- Native support for heuristic optimization with the same syntax.
- Native support for solver interfaces (Coming soon)
- Native support for multi-objective optimization (Coming soon)
- ...

## ⬇️ Installation
Expand Down Expand Up @@ -60,118 +60,11 @@ def install(package):
install('feloopy')
```

## 📄 Documentation

Still, no documentation is provided.

## 👤 Usage

Some examples are provided as follows:

### Solving a simple MILP with FelooPy by Pyomo:

```python
import feloopy.interfaces.pyomo_int as pyomo

m = pyomo.interface(direction="max")
x = m.pvar('x')
y = m.ivar('y')

m.obj(2*x+5*y)
m.con(5*x+3*y <= 10)
m.con(2*x+7*y <= 9)

m.solve('glpk')
m.display(x, y)
```

Results:

```
Pyomo solved 'your_model' with glpk solver | CPT= 411416.3999984157 (μs) 00:00:00 (h:m:s)
x: 1.0
y: 1.0
obj: 7.0
```

### Solving a simple MILP with FelooPy by Gekko:

```python
import feloopy.interfaces.gekko_int as gekko

m = gekko.interface(direction="max")
x = m.pvar('x')
y = m.ivar('y')

m.obj(2*x+5*y)
m.con(5*x+3*y <= 10)
m.con(2*x+7*y <= 9)

m.solve('apopt')
m.display(x, y)
```

Results:

- Using the package provided in the release section.

```
Gekko solved 'your_model' with apopt solver | CPT= 505112.3000012012 (μs) 00:00:00 (h:m:s)
v1: [1.0]
int_v2: [1.0]
obj: 7.0
```

### Solving a simple MILP with FelooPy by Ortools:

```python
import feloopy.interfaces.ortools_int as ortools

m = ortools.interface(direction="max")
x = m.pvar('x')
y = m.ivar('y')

m.obj(2*x+5*y)
m.con(5*x+3*y <= 10)
m.con(2*x+7*y <= 9)

m.solve('glpk')
m.display(x, y)
```

Results:

```
ORTOOLs solved 'your_model' with glpk solver | CPT= 3619.700000854209 (μs) 00:00:00 (h:m:s)
x: 1.0
y: 1.0
obj: 7.0
```

### Solving a simple MILP with FelooPy by PuLP:

```python
import feloopy.interfaces.pulp_int as pulp

m = pulp.interface(direction="max")
x = m.pvar('x')
y = m.ivar('y')

m.obj(2*x+5*y)
m.con(5*x+3*y <= 10)
m.con(2*x+7*y <= 9)

m.solve('glpk')
m.display(x, y)
```

Results:
## 📄 Documentation

```
PuLP solved 'your_model' with <pulp.apis.glpk_api.GLPK_CMD object at 0x000001DDC0021750> solver | CPT= 1706935.9999986773 (μs) 00:00:01 (h:m:s)
x: 1.0
y: 1
obj: 7.0
```
A short documentation is provided in the repository. Please refer to it for more information on installation and the usage of the FelooPy package.

## 🆘 Contributions

Expand Down
Binary file added Tafakkori-FelooPy-v0.1.1.pdf
Binary file not shown.
27 changes: 27 additions & 0 deletions build/lib/feloopy/Untitled-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class model:
def __init__(self, val=0):
self.val = val

def var1(self,val):
self.var1 = val
return self.var1+self.val

def var2(self, val):
self.var2 = val
return self.var2+self.val

def solve(self,val):
return self.__init__(val)

m = model(2)
x = m.var1(0)
y = m.var2(2)

print(x)
print(y)

m.solve(100)

print(x)
print(y)

30 changes: 30 additions & 0 deletions build/lib/feloopy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''
FelooPy version 0.1.1
Release: 26 October 2022
'''

'''
MIT License
Copyright (c) 2022 Keivan Tafakkori & FELOOP (https://ktafakkori.github.io/)
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''

from .main import *
44 changes: 44 additions & 0 deletions build/lib/feloopy/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
'''
FelooPy version 0.1.1
Release: 26 October 2022
'''

'''
MIT License
Copyright (c) 2022 Keivan Tafakkori & FELOOP (https://ktafakkori.github.io/)
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''

from .age import *
from .ben import *
from .bvar import *
from .dis import *
from .env import *
from .fvar import *
from .get import *
from .inf import *
from .ivar import *
from .oper import *
from .pvar import *
from .sol import *
from .svar import *
from .opt import *
from .sens import *
79 changes: 79 additions & 0 deletions build/lib/feloopy/core/age.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

'''
FelooPy version 0.1.1
Release: 26 October 2022
'''

'''
MIT License
Copyright (c) 2022 Keivan Tafakkori & FELOOP (https://ktafakkori.github.io/)
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''

import numpy as np
import math as mt

class singleagent:
def __init__(self, var_name, val, dim, type=None):
self.var_name = var_name
self.val = val
self.dim = dim
self.type = type

def __call__(self, *args):
if self.type == 'pvar':
return self.val[sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))]
elif self.type == 'svar':
return np.argsort(self.val[sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))])
else:
return np.round(self.val[sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))])

def __getitem__(self, *args):
if self.type == 'pvar':
return self.val[sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))]
elif self.type == 'svar':
return np.argsort(self.val[sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))])
else:
return np.round(self.val[sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))])


class multiagent:
def __init__(self, var_name, val, dim, type=None):
self.var_name = var_name
self.val = val
self.dim = dim
self.type = type

def __call__(self, *args):
if self.type == 'pvar':
return self.val[:, sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))]
elif self.type == 'svar':
return np.argsort(self.val[:, sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))])
else:
return np.round(self.val[:, sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))])

def __getitem__(self, *args):
if self.type == 'pvar':
return self.val[:, sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))]
elif self.type == 'svar':
return np.argsort(self.val[:, sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))])
else:
return np.round(self.val[:, sum(args[i]*mt.prod(len(self.dim[j]) for j in range(i+1, len(self.dim))) for i in range(len(self.dim)))])

0 comments on commit dadc41d

Please sign in to comment.