Skip to main content

Discrete numeric fuzzy sets in Python algorithms.

Project description

DUFuz

Incorporating discrete numeric fuzzy sets in Python algorithms. These sets are more general than fuzzy numbers.

Dependencies: numpy, torch, matplotlib, ply
Contact: Manios Krasanakis (maniospas@hotmail.com)
License: Apache 2

:rocket: Quickstart

The code below demonstrates a bubblesort algorithm that runs on fuzzy inputs on the DUFuz interpreter. A similar implementation can be written with the Python API.

import random
from timeit import default_timer as time
import matplotlib.pyplot as plt

values = [1, 2, 4? or 3.5?1.5, 5?]  # 1 and 2 are not fuzzy
random.shuffle(values)

def bubblesort(values):
    for i in range(len(values)):
        for j in range(i+1, len(values)):
            vali = values[i]
            valj = values[j]
            comparison = vali < valj
            values[i] = vali if comparison else valj
            values[j] = valj if comparison else vali
            
start_time = time()
bubblesort(values)
print("Completed in", time()-start_time, "sec")

axs = plt.subplots(len(values), 1)[1]
for ax, val in zip(axs, values):
    val.plot(ax, True)
plt.show()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

dufuz-0.1.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file dufuz-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dufuz-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for dufuz-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f29b8782b0b49273d0086f26d5deaf9603988ea8bbe3d0e79a3ee6b340d2b5b
MD5 88333fd2b91d5a77a056c41e66a11ce5
BLAKE2b-256 9e26153ddb93e529e61ce84c67046c0f4294b9efac6aee755ff82b2165bf71dc

See more details on using hashes here.

Supported by

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