Skip to main content

A Python Package for Fuzzy Linear Programming with the Lexicographic Method

Project description

PyLexFLP

PyLexFLP is a Python package for solving Fuzzy Linear Programming problems using the Lexicographic Method. This tool is designed to help researchers and practitioners in Operations Research and Fuzzy Optimization to model and solve fuzzy optimization problems effectively.

Features

  • Solves fuzzy linear programming models in which the coefficients are arbitrary triangular fuzzy numbers and the decision variables are non-negative triangular fuzzy numbers.
  • Utilizes Lexicographic Ranking criteria for ordering triangular fuzzy numbers.
  • Built on top of the PuLP optimization framework.

Installation

You can install PyLexFLP from GitHub:

pip install git+https://github.com/bpcanedo/pylexflp.git

Or, from PyPI:

pip install pylexflp

Requirements

  • Python >= 3.7
  • PuLP >= 2.6
  • SciPy >= 1.21

Usage

Here's a simple example of how to use PyLexFLP:

from pylexflp import FLP, TFN_Var, TFN, flpMaximize, getSolver

# Lexicographic ranking method
def f1(x): return (x.al+2*x.am+x.au)/4
def f2(x): return x.am
def f3(x): return x.au-x.al
criteria = [f1, f2, f3]

# The problem
p = FLP(criteria=criteria, sense=flpMaximize)

# Variable definition
x1, x2, I1, I2, I3 = TFN_Var("x1"), TFN_Var("x2"), TFN_Var("I1"), TFN_Var("I2"), TFN_Var("I3")

# Let PyLexFLP know the variables
p += x1
p += x2
p += I1
p += I2
p += I3

# Insert the constraints
p += I1 + TFN(0.15,0.20,0.25)*I1 == x1+I2
p += I2 + TFN(0.10,0.15,0.20)*I2 == x2+I3
p += I1 == TFN(950, 1000, 1050)
p += I3 >= TFN(622, 624, 627)

# The last expression or variable entered becomes the objective function
p += x1 + x2

# Select the linear programming solver
# msg = True if you want verbosity
solver = getSolver("COIN_CMD", msg=False)

# Solve the problem
# status = [1, 1, 1] means the three criteria were successfully optimized
status = p.solve(solver=solver)

# Fuzzy proposition example
## Membership function
def High(x): return max(0, min(1, (x-500)/500))

# Print the solution
solution = f"""
Status: {status}
Solution:
    x1 = {x1}
    x2 = {x2}
    obj = {x1+x2}
    I1 = {I1}
    I2 = {I2}
    I3 = {I3}
    # Fuzzy proposition
    x2 is High = {x2.IS(High)}
"""
print(solution)

Documentation

Detailed documentation and examples can be found on the GitHub repository.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests to the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Authors

Boris Pérez-Cañedo

Email: bpcanedo@gmail.com

GitHub: bpcanedo

Eduardo René Concepción-Morales

Email: econcep@ucf.edu.cu

José Luis Verdegay

Email: verdegay@decsai.ugr.es

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

pylexflp-0.1.3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylexflp-0.1.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pylexflp-0.1.3.tar.gz.

File metadata

  • Download URL: pylexflp-0.1.3.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for pylexflp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 67efc306d24f1f376f652478e07eb0ddc83a7b09a8d35295b184bd3688908117
MD5 4fe28fbd849f1642afe8ba201b894ce9
BLAKE2b-256 ad70dc97e9336bb381a218ba5ffb98a0cdf5fc1041efe8224e562a4ddee7a626

See more details on using hashes here.

File details

Details for the file pylexflp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pylexflp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for pylexflp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 472c30b58bf916b21f8f7312b4a5cb1f0e112c84956c57b2ea8e90a1978bc10f
MD5 f23f5d7adf55e55a9ca47ad809e97c5b
BLAKE2b-256 6e496085b87233d2bb1aab8585448a0c3ad61eda714842c84772e2b7febd493f

See more details on using hashes here.

Supported by

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