Package heart.alsvfd

Examples of heart.alsvfd.SetValue


      weatherE.setAttributeName("weather");
      Value rainy = new SimpleSymbolic("rainy", null, 0.6f);
      weatherE.setValue(rainy);
     
      userProfileE.setAttributeName("user_profile");
      SetValue profile = new SetValue();
      Value[] prifleElements  = {
          new SimpleSymbolic("eating",null,0.6f),
          new SimpleSymbolic("culture",null,0.2f),
          new SimpleSymbolic("entertainment", null, 0.8f),
          new SimpleSymbolic("sightseeing",null,0.2f)
          };
      profile.setValues(Arrays.asList(prifleElements));
      userProfileE.setValue(profile);
     
      activityE.setAttributeName("activity");
      SimpleSymbolic walking = new SimpleSymbolic("walking",null,0.8f);
      activityE.setValue(walking);
View Full Code Here


        }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();
          if(ci >= 0 && cj >= 0){
            ci = ci+cj-ci*cj;
          }else if(ci < 0 && cj < 0){
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

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

TOP

Related Classes of heart.alsvfd.SetValue

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.