1

I am working on a project for my Applied Mathematics major, basically I have a number class (triangular fuzzy numbers) and I have a function that uses similarity method on fuzzy numbers I give as input.

Problem is, this is a Fuzzy Linear Programming problem, so what I do is let's say:

For fuzzy numbers A, B and C:

Max Z = (2, 3, 4)A (+) (3, 5, 7)B (+) (2, 4, 6)C

To find Max Z, I have to turn this into the following:

Max Z = Sqrt((1/3)((2Ax + 3Ay + 4Az)^2 + (3Bx + 5By + 7Bz)^2 + (2Cx + 4Cy + 6Cz)^2))

There is also ranking function, which takes x, y and z of a fuzzy number and gives back (x+2y+z)/4

So for fuzzy number (3, 5, 7)A it has to give back:

(3Ax + 10Ay + 7Az)/4

What is the best approach to this?

I decided to give my "Triangular Fuzzy" or Trifuz class called __type, which is "Defined" as default but it has a try/expect method that tries to convert input parameters to create a triangular fuzzy number (like Trifuz([3, 5, 7])) into int and if it is unable, it assigns itself as "Undefined" so I can know if a fuzzy numbers is defined as numbers or defined as unknowns.

Problem is, operation on a Fuzzy Number A = (Ax, Ay, Az) is easy, operating on fuzzy number A = (3Ax, 5Ay, 7Az) is hard because I need to be able to operate on these numbers like 3, 5 and 7, while Ax, Ay and Az are reassigned to new values.

What is the best approach to this?

Edit: Also I am talking about operating on numeric part of the unknown number, not operating on unknown part. I want to sqrt(2x) to return 1.414√x.

Forgot to mention that I am trying to do this without using any additional libraries, especially any math related libraries, even Math itself.

EvilTak
  • 7,091
  • 27
  • 36

1 Answers1

0

Okay I found a solution to what I am trying to achieve:

Basically I will split inputs like 3x + 4y + z that are used to create a fuzzy number into an array, split as (3x, 4y, z) and will store this inside Trifuz class as "__parameters" of (3, 4, 1) and (x, y, z) as "__unknowns"

To do this I will use the following script I did:

def splitNumber(word):
    split = list(word)
    number = []
    k = 0
    while(True):
        for i in split:
            try:
                number.append(int(i))
                k = k + 1
            except ValueError:
                break
        break
    for i in range(0, k):
        del split[i]
    if(k == 0):
        number.append(1)
    number = "".join(str(x) for x in number)
    split = "".join(split)
    return [number, split]

Which just like I wanted, uses no additional libraries and lets me pick the first integer part of a word, split it in two, and get the second part as an "unknown" so I can operate easier on the number part of something like 3x1 + 4x2 + 5x3 because it doesn't grab '3' in x3, just assigned number to it.

As for any number that are simply "x1" or "Ax" etc. it will return 1.