Skip to main content

Library for ULOWA operations, given fuzzy numbers

Project description

ULOWA MODULE

Please, read carefully before using this library.

This module has been made for academic purposes. If you want to use it, cite the author.

1. Installation

First, you can simpy install it by using the pip comand: pip install ulowa

2. Usage

2.1. ULOWA

It is necessary to define a fuzzy set, each one with 4 points, e.g: fuzzyNumbers = [[0.0, 0.0, 1.0, 2.0], [1.0, 2.0, 4.0, 5.0], [4.0, 5.0, 5.0, 6.0], [5.0, 6.0, 6.0, 7.0], [6.0, 7.0, 8.0, 8.5], [8.0, 8.5, 9.0, 9.5], [9.0, 9.5, 10.0, 10.0]]

Note that the scale may vary, it isn't compulsory to be from 0 to 10

Then, you must define the weights and the labels for the scale, e.g: weights = [0.6, 0.2, 0.2, 0.0, 0.0] labels = ["VL", "L", "M", "AH", "H", "VH", "P"]

Note that the weights must sum up to 1, and the scale must be ordered from worst to best tag.

Now, we should define the labels for our specific problem, e.g: problem_labels = ["VL", "VL", "L", "M", "L"]

Eventually, we call the ULOWA function: ulowaOperation(problem_labels, weights, fuzzyNumbers, labels)

In case you need to analyze more alternatives, you may need to establish a performance table e.g: performance_table in which you will include several problem labels, such as: performance_table = [["VL", "VL", "P", "H", "VL"], ["VL", "VL", "H", "P", "P"], ["VL", "VL", "L", "M", "L"], ["VH", "L", "H", "H", "AH"], ["P", "L", "H", "L", "AH"]]

Note that the tags doesn't need to be sorted, since a specific method will do so.

Now, in order to get a table with all the results, you should execute a code like the following:

performance_table = [["VL", "VL", "P", "H", "VL"], ["VL", "VL", "H", "P", "P"], ["VL", "VL", "L", "M", "L"],
                     ["VH", "L", "H", "H", "AH"], ["P", "L", "H", "L", "AH"]]
results = []
for alternative in performance_table:
    weights = [0.6, 0.2, 0.2, 0.0, 0.0] 
    results.append(ulowaOperation(alternative, weights, fuzzyNumbers, labels))
print(results)

It is really important to redefine the weights inside the loop, since the vector will be modified by the ULOWA function

2.2. Specificity and Fuzziness

This module also allows you to calculate the specificity and fuzziness of a given fuzzy set. In this case, a code like the shown below must be executed:

a = fuzzyNumbers[0][0]
b = fuzzyNumbers[len(fuzzyNumbers) - 1][3]
order=1
for i in fuzzyNumbers:
    print(f"\nThe specificity of the {order} fuzzy set is: {specificity(i, a, b)}")
    print(f"\nThe fuzziness of the {order} fuzzy set is: {fuzziness(i, a, b)}")
    order = order + 1

2.3. Defuzzification

There are three methods that can be used in this package: getCOG(fuzzyNumber), getOrdinal(scale, tag) and getCOM(fuzzyNumber). Here is an example code of their usage:

fuzzyNumbers = [[0.0, 0.0, 1.0, 2.0], [1.0, 2.0, 4.0, 5.0], [4.0, 5.0, 5.0, 6.0], [5.0, 6.0, 6.0, 7.0],
                [6.0, 7.0, 8.0, 8.5], [8.0, 8.5, 9.0, 9.5], [9.0, 9.5, 10.0, 10.0]]
                
print(f"The center of gravity of the first fuzzy set is: {getCOG(fuzzyNumbers[0])}")
print(f"The center of maximum of the first fuzzy set is: {getCOM(fuzzyNumbers[0])}")

# Those will give us the COG and COM of the first fuzzy number

labels = ["VL", "L", "M", "AH", "H", "VH", "P"]
tag = "VL"
print(f"The ordinal value for tag {tag} is {getOrdinal(labels, tag)}")

The code shown above can be done in a loop so that we can get for example the ordinal values for all the results of the ULOWA operation.

Author: Ignacio Miguel Rodríguez - ITAKA research group (URV)

Contact: Send e-mail

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

ulowa-0.0.6.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

ulowa-0.0.6-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file ulowa-0.0.6.tar.gz.

File metadata

  • Download URL: ulowa-0.0.6.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.13

File hashes

Hashes for ulowa-0.0.6.tar.gz
Algorithm Hash digest
SHA256 913a689678fda7ee146ae03e3e42b6c37196456ed518517b7176cdcc477fee89
MD5 ad31acec4cabc0bc955a793d8b01c379
BLAKE2b-256 fcb220eb16ff75420d5d379c6734e0e17e1b24c6c531aca1f84e2b58d9a81db3

See more details on using hashes here.

File details

Details for the file ulowa-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: ulowa-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.13

File hashes

Hashes for ulowa-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 69b106d322124ad1f5c69ac5d8b7ca369de8bf9914a40d719ff3153b1d9d3497
MD5 4b253fb2611e553f221a44e5bdf4cdd8
BLAKE2b-256 2d7226a839094709d35cd156087b12441983e1b7e6522735413a2eae05942c0f

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