0

I've been working on a project involving Fuzzy Logic Controller, and so far everything has gone well.

I've successfully modeled and implemented Norms (S and T norms), complements, fuzzy propositions and membership functions.

However, I now face the challenge to model FuzzyVariable, which includes FuzzySet, which includes UniversalSet.

My project works over discrete values, but I would still like to add some support for continuous ones.

In the other words, I'd like to have a hierarchy similar to this one:

public interface UniversalSet {
}

public abstract class DiscreteUniversalSet implements UniversalSet {
}

public abstract class ContinuousUniversalSet implements UniversalSet {
}

public interface FuzzySet {
}

public abstract class DiscreteFuzzySet implements FuzzySet {
    private DiscreteUniversalSet universalSet;
}

public abstract class ContinuousFuzzySet implements FuzzySet {
    private ContinuouUniversalSet universalSet;
}

The problem is, I would like for discrete universal sets to be able to return a list of discrete values, but for continuous universal sets to return the ranges (lower and upper bounds).

Same goes for alpha-intersections. I would like method getAlphaIntersection(double alpha) to return a list of discrete values for discrete fuzzy sets, and list of ranges for continuous ones.

At the moment, this issue slightly reminds me of a square-rectangle (or circle-ellipse) problem, but I'm not really sure on how to proceed.

Any help is appreciated :D

ioreskovic
  • 5,531
  • 5
  • 39
  • 70
  • 2
    I'm not familiar with the fuzzy logic domain, however I also don't quite understand your question. Maybe showing more of what you have so far would be helpful. It seems that to support both discrete and continuous sets you can declare an abstraction of a return value which would have both discrete and continuous implementations. – eulerfx Dec 07 '12 at 19:07
  • 1
    and if all of your operations return either range or discrete values, you could make your `FuzzySet` interface generic to that type – Sebastian Piu Dec 08 '12 at 11:38

1 Answers1

1

Use generics:

public interface UniversalSet {
}

public abstract class DiscreteUniversalSet implements UniversalSet {
    public double[] getValues() {...}
}

public abstract class ContinuousUniversalSet implements UniversalSet {
    public double getLowerBound() {...}
    public double getUpperBound() {...}
}

public interface FuzzySet<T extends UniversalSet> {
    T getAlphaIntersection(double alpha);
}

public abstract class DiscreteFuzzySet implements FuzzySet<DiscreteUniversalSet> {
    public DiscreteUniversalSet getAlphaIntersection(double alpha) { ... }
}

public abstract class ContinuousFuzzySet implements FuzzySet<ContinuousUniversalSet> {
    public ContinuousUniversalSet getAlphaIntersection(double alpha) { ... }
}
mantrid
  • 2,830
  • 21
  • 18