This project features a simple solution of a fuzzy-logic problem. The inputs are numerical values representing the weight of the laundry in kilograms and the dirtyness level from 1 to 10. The output is the set of washing parameters, namely the amount of powder in grams being used for washing.
Run python -u laundry.py
and enter the input parameters for washing. The
program will output the used washing parameters (numerical values).
The implemented fuzzy logic maps the numerical input values to their fuzzy descriptions and then performs the fuzzy logic operation with the following set of expert rules:
expert_rule_map = {
(Quantity.SMALL, Level.LOW): Quantity.SMALL,
(Quantity.MEDIUM, Level.LOW): Quantity.MEDIUM,
(Quantity.LARGE, Level.LOW): Quantity.MEDIUM,
(Quantity.SMALL, Level.HIGH): Quantity.MEDIUM,
(Quantity.MEDIUM, Level.HIGH): Quantity.LARGE,
(Quantity.LARGE, Level.HIGH): Quantity.LARGE}
"""Maps the expert rules as:
(laundry_amount_fuzzy, dirt_level_fuzzy) -> powder_amount_fuzzy"""
As the final step, the resulting fuzzy decription of the amount of powder is decoded into a numerical value (required powder amount in grams) used by the simulated washing machine program.
Problem author is Dr.sc. Marko Horvat, dipl. ing.
Run the evaluate.py
script to get a sense of how inputs map to outputs,
you can also see this data on a 3d graph.
You can recreate the graph using PlotLy or view the existing graph.