Package heart.alsvfd

Examples of heart.alsvfd.Value



  @Override
  public UncertainTrue evaluateUncertainSupset(Attribute at, Value v, WorkingMemory wm)
      throws UnsupportedOperationException,  NotInTheDomainException {
    Value attributeValue = wm.getAttributeValue(at);
    // It means that once we consider evaluation in terms of uncertainty,
    // If the value is completely unknown everything is possible.
    if(attributeValue instanceof Null && !(v instanceof Null)){
      return new UncertainTrue(0.0f);
    }
   
    boolean logicalValue = attributeValue.supset(v, at.getType());
    return evaluateUncertainTrueValue(at, v,wm, Formulae.OP_SUPSET, logicalValue);
  }
View Full Code Here



  @Override
  public UncertainTrue evaluateUncertainSim(Attribute at, Value v, WorkingMemory wm)
      throws UnsupportedOperationException, NotInTheDomainException {
    Value attributeValue = wm.getAttributeValue(at);
    // It means that once we consider evaluation in terms of uncertainty,
    // If the value is completely unknown everything is possible.
    if(attributeValue instanceof Null && !(v instanceof Null)){
      return new UncertainTrue(0.0f);
    }
   
    boolean logicalValue = attributeValue.sim(v, at.getType());
    return evaluateUncertainTrueValue(at, v,wm, Formulae.OP_SIM, logicalValue);
  }
View Full Code Here


  @Override
  public UncertainTrue evaluateUncertainNotsim(Attribute at, Value v, WorkingMemory wm)
      throws UnsupportedOperationException,NotInTheDomainException {
    Value attributeValue = wm.getAttributeValue(at);
    // It means that once we consider evaluation in terms of uncertainty,
    // If the value is completely unknown everything is possible.
    if(attributeValue instanceof Null && !(v instanceof Null)){
      return new UncertainTrue(0.0f);
    }
   
    boolean logicalValue = attributeValue.notsim(v, at.getType());
    return evaluateUncertainTrueValue(at, v,wm, Formulae.OP_NOTSIM, logicalValue);
  }
View Full Code Here

  }
 
  @Override
  public UncertainTrue evaluateUncertainLt(Attribute at, Value v, WorkingMemory wm)
      throws UnsupportedOperationException, NotInTheDomainException {
    Value attributeValue = wm.getAttributeValue(at);
    // It means that once we consider evaluation in terms of uncertainty,
    // If the value is completely unknown everything is possible.
    if(attributeValue instanceof Null && !(v instanceof Null)){
      return new UncertainTrue(0.0f);
    }
   
    boolean logicalValue = attributeValue.lt(v, at.getType());
    return evaluateUncertainTrueValue(at, v,wm, Formulae.OP_LT, logicalValue);
  }
View Full Code Here

 

  @Override
  public UncertainTrue evaluateUncertainLte(Attribute at, Value v, WorkingMemory wm)
      throws UnsupportedOperationException, NotInTheDomainException {
    Value attributeValue = wm.getAttributeValue(at);
    // It means that once we consider evaluation in terms of uncertainty,
    // If the value is completely unknown everything is possible.
    if(attributeValue instanceof Null && !(v instanceof Null)){
      return new UncertainTrue(0.0f);
    }
   
    boolean logicalValue = attributeValue.lte(v, at.getType());
    return evaluateUncertainTrueValue(at, v,wm, Formulae.OP_LTE, logicalValue);
  }
View Full Code Here


  @Override
  public UncertainTrue evaluateUncertainGt(Attribute at, Value v, WorkingMemory wm)
      throws UnsupportedOperationException, NotInTheDomainException {
    Value attributeValue = wm.getAttributeValue(at);
    // It means that once we consider evaluation in terms of uncertainty,
    // If the value is completely unknown everything is possible.
    if(attributeValue instanceof Null && !(v instanceof Null)){
      return new UncertainTrue(0.0f);
    }
   
    boolean logicalValue = attributeValue.gt(v, at.getType());
    return evaluateUncertainTrueValue(at, v,wm, Formulae.OP_GT, logicalValue);
  }
View Full Code Here


  @Override
  public UncertainTrue evaluateUncertainGte(Attribute at, Value v, WorkingMemory wm)
      throws UnsupportedOperationException, NotInTheDomainException {
    Value attributeValue = wm.getAttributeValue(at);
    // It means that once we consider evaluation in terms of uncertainty,
    // If the value is completely unknown everything is possible.
    if(attributeValue instanceof Null && !(v instanceof Null)){
      return new UncertainTrue(0.0f);
    }
   
    boolean logicalValue = attributeValue.gte(v, at.getType());
    return evaluateUncertainTrueValue(at, v,wm, Formulae.OP_GTE, logicalValue);
  }
View Full Code Here

        return new UncertainTrue(getMinCertainty());
      else
        return new UncertainTrue(getMaxCertainty());
    }else{
      float formulaCertainty = 0;
      Value attributeValue = wm.getAttributeValue(at);
      //For simple attributes just return the certainty value of an attribute
      if(attributeValue instanceof SimpleSymbolic || attributeValue instanceof SimpleNumeric){
        formulaCertainty = attributeValue.getCertaintyFactor();
        formulaCertainty = (logicalValue==true ? formulaCertainty : -formulaCertainty );
      }else{
        if(op.equals(Formulae.OP_SIM)) {
          if( logicalValue == true){
            formulaCertainty = sim(at, v, wm);
          }else{
            formulaCertainty = -sim(at,getComplement(at, v, wm),wm);
          }

        }else if(op.equals(Formulae.OP_NOTSIM)){
          if(logicalValue == true){
            sim(at,getComplement(at, v, wm),wm);
          }else{
            formulaCertainty = -sim(at, v,wm);
          }
         
        }else if(op.equals(Formulae.OP_EQ)){
          if(logicalValue == true){
            formulaCertainty = getMinCF(((SetValue)attributeValue).getValues());
          }
          else{
            SetValue diff = getDifference(at, v, wm);
            formulaCertainty = -sim(at,diff, wm);
          }
       
        }else if(op.equals(Formulae.OP_NEQ)){
          if(logicalValue == true){
            SetValue diff = getDifference(at, v, wm);
            formulaCertainty = sim(at,diff, wm);
          }
          else{
            formulaCertainty = -getMinCF(((SetValue)attributeValue).getValues());
          }
        }else if(op.equals(Formulae.OP_SUPSET)){
          if(logicalValue == true){
            //return the weakest chain element that makes it superset
            SetValue intersection = (SetValue) attributeValue.intersect( v,at.getType());
            formulaCertainty = getMinCF(intersection.getValues());
          }else{
            SetValue comp = getComplement(at, v, wm);
            SetValue intersect = (SetValue) attributeValue.intersect( comp,at.getType());
            // return  how the {Domain\value} is similar to the attribute value
            formulaCertainty = -sim(at,intersect, wm);
          }
        }else if(op.equals(Formulae.OP_SUBSET)){
          if(logicalValue == true){
            formulaCertainty = getMinCF(((SetValue)attributeValue).getValues());
          }else{
            SetValue comp = getComplement(at, v, wm);
            SetValue intersect = (SetValue) attributeValue.intersect( comp,at.getType());
            // return  how the {Domain\value} is similar to the attribute value
            formulaCertainty = -sim(at,intersect, wm);
          }
       
        }
View Full Code Here

     
    }
  }
 
  private static float sim(Attribute at, Value v, WorkingMemory wm) throws UnsupportedOperationException, NotInTheDomainException {
    Value attributeValue = wm.getAttributeValue(at);
    float formulaCertainty = 0;

      SetValue intersection = (SetValue) attributeValue.intersect(v, at.getType());
      if(!intersection.getValues().isEmpty()){
        List<Value> vals = intersection.getValues();
        float ci=intersection.getValues().get(0).getCertaintyFactor();
        for(int j=1; j < vals.size();j++){
          float cj = vals.get(j).getCertaintyFactor();
View Full Code Here

    return cf;
  }
 
  private static SetValue getComplement(Attribute at, Value v, WorkingMemory wm) throws UnsupportedOperationException, NotInTheDomainException{
    SetValue complement = (SetValue)at.getType().getDomain().except(v, at.getType());
    Value attributeValue = wm.getAttributeValue(at);
    for(Value atValue: ((SetValue)attributeValue).getValues()){
      for(Value compValue: complement.getValues()){
        if(atValue.eq(compValue, at.getType())){
          compValue.setCertaintyFactor(atValue.getCertaintyFactor());
        }
View Full Code Here

TOP

Related Classes of heart.alsvfd.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.