Question

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

Was it helpful?

Solution

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) { ... }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top