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 hashes)

Uploaded Python 3

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