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
Contact: Manios Krasanakis (maniospas@hotmail.com)
License: Apache 2

:rocket: Quickstart

First create a discrete environment for spawning and executing operations on numeric fuzzy sets. Provide a GPU torch device to the environment to parallelize execution. The device is used as one logical core.

import torch
from dufuz import DiscreteEnvironment
from dufuz import tnorm

env = DiscreteEnvironment(tnorm=tnorm.lukasiewicz,
                          tol=0.01, breadth=1,
                          device=torch.device('cuda:0'))

You can write algorithms involving normal Python operations. If-then-else statements that involve fuzzy comparisons take the form condition.choose(result if true, result if false) and fuzzy boolean arithmetics use the &,| operations.

As a demonstration. the following code implements the bubblesort algorithm for a list of fuzzy numbers.

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] = comparison.choose(vali, valj)
            values[j] = comparison.choose(valj, vali)

The list can be defined to hold triangle fuzzy numbers per:

values = list(range(8))
values = env.number(values)

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.0.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dufuz-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 18a3920b978c6f0def9a1d83e00ecc6c91b93106be3500c30d55215940eb46f3
MD5 ea09a3504acb157d75f5e8035122aed5
BLAKE2b-256 efdb23ba5ed6d45d910804fc389301b7c217d82a149630d6d72153e9fb13ec0a

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