reasoner
Class Quantifier

java.lang.Object
  extended by reasoner.Trapezoid
      extended by reasoner.Quantifier
All Implemented Interfaces:
FuzzySet

public class Quantifier
extends Trapezoid

This class represents a trapezoidal quantifier, with non negative values only

Author:
marco furlan

Field Summary
protected  KnowledgeBase kb
          the KnowledgeBase
protected  double maxval
          the max value
protected  double minval
          the min value is set to 0.0
private  java.lang.String name
          the name
private  double NOW
          the constant NOW
private  boolean relative
          set to true if this Quantifier is relative, to false otherwise
private  double SELF
          the constant SELF
private static double v1
           
private static double v2
           
 
Fields inherited from class reasoner.Trapezoid
formatter, meaning, patternAround, patternBetween
 
Constructor Summary
Quantifier(java.lang.Double a1, java.lang.Double b1, java.lang.Double c1, java.lang.Double d1, java.lang.Double max, KnowledgeBase kb)
          Constructor by vertices, max and KnowledgeBase
Quantifier(java.lang.String name, java.lang.Double a1, java.lang.Double b1, java.lang.Double c1, java.lang.Double d1, java.lang.Double max, KnowledgeBase kb)
          Constructor by name, vertices, max and KnowledgeBase
Quantifier(java.lang.String name, KnowledgeBase kb)
          Constructor by name and KnowledgeBase
 
Method Summary
 Quantifier diff(Quantifier t)
          Difference between this Quantifier and a second one.
 double eval(Role r, Concept c)
          Evaluates expression (Q)R.C = Q(R_intersection_C / R), with Q this relative Quantifier, R a Role and C a Concept.
 KnowledgeBase getKb()
           
 java.util.TreeSet<java.lang.Double> getLambda()
          Gives Lambda, the alpha level set for membership values
 double getMaxval()
           
 double getMinval()
           
 java.lang.String getName()
           
 double getNOW()
           
 double getSELF()
           
 Quantifier intersection(FuzzySet f)
          Intersection with a FuzzySet
 boolean isRelative()
           
 void print()
          Prints on the standard output a String representation for this Trapezoid
 void print(java.util.TreeSet<java.lang.Double> lambda2)
          Prints Lambda, the alpha level set for membership values, as a TreeSet
 Quantifier prod(Quantifier t)
          Product between this Quantifier and a second one.
 Quantifier ratio(Quantifier t)
          Ratio between this Quantifier and a second one.
 void setKb(KnowledgeBase kb)
          Sets the KnowledgeBase and constants NOW and SELF
 void setMaxval(double maxval)
           
 void setMinval(double minval)
           
protected  void setName()
          Sets the name by the shape, for some cases
 void setName(java.lang.String name1)
           
 void setNOW(double now)
           
 void setRelative(boolean relative)
          Sets the relative attribute.
 void setSELF(double self)
           
protected  void setVertices(java.lang.Double a1, java.lang.Double b1, java.lang.Double c1, java.lang.Double d1, java.lang.Double max)
          Sets vertices and max value.
 Quantifier sum(Quantifier t)
          Sum between this Quantifier and a second one.
 java.lang.String toString()
          return a String representation for this Trapezoid as a sequence of vertices
 Quantifier union(FuzzySet f)
          Union with a FuzzySet
 
Methods inherited from class reasoner.Trapezoid
card, diff, fixVertices, geta, getAroundValue, getb, getBetweenValue, getc, getd, getKeys, getMeaning, getVertValues, prod, qvalue, ratio, seta, setb, setc, setd, setMeaning, setMeaning, setVertices, sum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name
the name


v1

private static double v1

v2

private static double v2

maxval

protected double maxval
the max value


minval

protected double minval
the min value is set to 0.0


kb

protected KnowledgeBase kb
the KnowledgeBase


SELF

private double SELF
the constant SELF


NOW

private double NOW
the constant NOW


relative

private boolean relative
set to true if this Quantifier is relative, to false otherwise

Constructor Detail

Quantifier

public Quantifier(java.lang.Double a1,
                  java.lang.Double b1,
                  java.lang.Double c1,
                  java.lang.Double d1,
                  java.lang.Double max,
                  KnowledgeBase kb)
Constructor by vertices, max and KnowledgeBase

Parameters:
a1 - first vertice
b1 - second vertice
c1 - third vertice
d1 - forth vertice
max - the max value
kb - the KnowledgeBase

Quantifier

public Quantifier(java.lang.String name,
                  java.lang.Double a1,
                  java.lang.Double b1,
                  java.lang.Double c1,
                  java.lang.Double d1,
                  java.lang.Double max,
                  KnowledgeBase kb)
Constructor by name, vertices, max and KnowledgeBase

Parameters:
name - the name
a1 - first vertice
b1 - second vertice
c1 - third vertice
d1 - forth vertice
max - the max value
kb - the KnowledgeBase

Quantifier

public Quantifier(java.lang.String name,
                  KnowledgeBase kb)
Constructor by name and KnowledgeBase

Parameters:
name - the name
kb - the KnowledgeBase
Method Detail

setName

public void setName(java.lang.String name1)
Overrides:
setName in class Trapezoid
Parameters:
name1 - the name to set

setName

protected void setName()
Sets the name by the shape, for some cases


getName

public java.lang.String getName()
Overrides:
getName in class Trapezoid
Returns:
the name

setVertices

protected void setVertices(java.lang.Double a1,
                           java.lang.Double b1,
                           java.lang.Double c1,
                           java.lang.Double d1,
                           java.lang.Double max)
Sets vertices and max value.

Parameters:
a1 - first vertice
b1 - second vertice
c1 - third vertice
d1 - forth vertice
max - the max value

print

public void print()
Description copied from class: Trapezoid
Prints on the standard output a String representation for this Trapezoid

Overrides:
print in class Trapezoid

toString

public java.lang.String toString()
Description copied from class: Trapezoid
return a String representation for this Trapezoid as a sequence of vertices

Overrides:
toString in class Trapezoid
See Also:
Object.toString()

sum

public Quantifier sum(Quantifier t)
Sum between this Quantifier and a second one. Possible for absolute quantifier only!

Parameters:
t - the second Quantifier
Returns:
the sum

diff

public Quantifier diff(Quantifier t)
Difference between this Quantifier and a second one. Possible for absolute quantifier only!

Parameters:
t - the second Quantifier
Returns:
the difference

prod

public Quantifier prod(Quantifier t)
Product between this Quantifier and a second one.

Parameters:
t - the second Quantifier
Returns:
the product

ratio

public Quantifier ratio(Quantifier t)
Ratio between this Quantifier and a second one. Possible for divisor not containing zero only!

Parameters:
t - the second Quantifier
Returns:
the ratio

intersection

public Quantifier intersection(FuzzySet f)
Description copied from class: Trapezoid
Intersection with a FuzzySet

Overrides:
intersection in class Trapezoid
Parameters:
f - the FuzzySet
Returns:
the intersection

union

public Quantifier union(FuzzySet f)
Description copied from class: Trapezoid
Union with a FuzzySet

Overrides:
union in class Trapezoid
Parameters:
f - the FuzzySet
Returns:
the union

eval

public double eval(Role r,
                   Concept c)
Evaluates expression (Q)R.C = Q(R_intersection_C / R), with Q this relative Quantifier, R a Role and C a Concept.

Parameters:
r - the Role
c - the Concept
Returns:
the result

print

public void print(java.util.TreeSet<java.lang.Double> lambda2)
Prints Lambda, the alpha level set for membership values, as a TreeSet

Parameters:
lambda2 - the Lambda

getLambda

public java.util.TreeSet<java.lang.Double> getLambda()
Description copied from class: Trapezoid
Gives Lambda, the alpha level set for membership values

Specified by:
getLambda in interface FuzzySet
Overrides:
getLambda in class Trapezoid
Returns:
Lambda as a TreeSet

isRelative

public boolean isRelative()
Returns:
the relative

setRelative

public void setRelative(boolean relative)
Sets the relative attribute. If true, then set minval to 0.0 and maxval to 1.0.

Parameters:
relative - the relative to set

getKb

public KnowledgeBase getKb()
Returns:
the kb

setKb

public void setKb(KnowledgeBase kb)
Sets the KnowledgeBase and constants NOW and SELF

Parameters:
kb - the kb to set

getMaxval

public double getMaxval()
Overrides:
getMaxval in class Trapezoid
Returns:
the maxval

setMaxval

public void setMaxval(double maxval)
Overrides:
setMaxval in class Trapezoid
Parameters:
maxval - the maxval to set

getMinval

public double getMinval()
Overrides:
getMinval in class Trapezoid
Returns:
the minval

setMinval

public void setMinval(double minval)
Overrides:
setMinval in class Trapezoid
Parameters:
minval - the minval to set

getNOW

public double getNOW()
Returns:
the NOW

setNOW

public void setNOW(double now)
Parameters:
now - the NOW to set

getSELF

public double getSELF()
Returns:
the SELF

setSELF

public void setSELF(double self)
Parameters:
self - the SELF to set