Package heart.alsvfd

Examples of heart.alsvfd.Expression


        System.out.println("THEN ");
       
        for(Decision d: r.getDecisions()){
          System.out.print("\t"+d.getAttribute().getName()+" is set to ");
         
          Expression e = d.getDecision();
          System.out.print(e);
         
        }
        System.out.println();
       
      }
      System.out.println();
      System.out.println("=============================");
     
     
    }
   
   
    StateElement weatherE = new StateElement();
      StateElement activityE = new StateElement();
      StateElement userProfileE = new StateElement();
     
      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);
     
     
     
      State XTTstate = new State();
      XTTstate.addStateElement(activityE);
      XTTstate.addStateElement(weatherE);
      XTTstate.addStateElement(userProfileE);
     
   
    System.out.println("Printing current state");
    State current = HeaRT.getWm().getCurrentState(model);
    for(StateElement se : current){
      System.out.println("Attribute "+se.getAttributeName()+" = "+se.getValue());
    }
      //TODO -
      try{
        HeaRT.fixedOrderInference(model, new String[]{"Recommendations"}
            new Configuration.Builder()
            .setUte(new CertaintyFactorsEvaluator())
            .setInitialState(XTTstate)
            .build());
   
      }catch(UnsupportedOperationException e){
        e.printStackTrace();
      } catch (AttributeNotRegisteredException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
   

    System.out.println("Printing current state (after inference");
    current = HeaRT.getWm().getCurrentState(model);
    for(StateElement se : current){
      System.out.println("Attribute "+se.getAttributeName()+" = "+se.getValue());
    }
   
 
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (BuilderException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (UnsupportedOperationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (NotInTheDomainException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (RangeFormatException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
View Full Code Here


            System.out.println("THEN ");
           
            for(Decision d: r.getDecisions()){
              System.out.print("\t"+d.getAttribute().getName()+"is set to ");
             
              Expression e = d.getDecision();
              System.out.print(e);
            }
            System.out.println();
           
          }
          System.out.println();
          System.out.println("=============================");
         
         
        }
       
       
        StateElement hourE = new StateElement();
          StateElement dayE = new StateElement();
          StateElement locationE = new StateElement();
          StateElement activityE = new StateElement();
         
          hourE.setAttributeName("hour");
          hourE.setValue(new SimpleNumeric(16d));
         
          dayE.setAttributeName("day");
          dayE.setValue(new SimpleSymbolic("mon",1));
         
          locationE.setAttributeName("location");
          locationE.setValue(new SimpleSymbolic("work"));
         
          activityE.setAttributeName("activity");
          activityE.setValue(new SimpleSymbolic("walking"));
         
         
          State XTTstate = new State();
          XTTstate.addStateElement(hourE);
          XTTstate.addStateElement(dayE);
          XTTstate.addStateElement(locationE);
          XTTstate.addStateElement(activityE);
         
       
        System.out.println("Printing current state");
        State current = HeaRT.getWm().getCurrentState(model);
        for(StateElement se : current){
          System.out.println("Attribute "+se.getAttributeName()+" = "+se.getValue());
        }
         
          try{
            HeaRT.fixedOrderInference(model, new String[]{"DayTime","Today","Actions","Threats"},
                new Configuration.Builder()
                  .setInitialState(XTTstate)
                  .build());
       
          }catch(UnsupportedOperationException e){
            e.printStackTrace();
          } catch (AttributeNotRegisteredException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
       
   
        System.out.println("Printing current state (after inference");
        current = HeaRT.getWm().getCurrentState(model);
        for(StateElement se : current){
          System.out.println("Attribute "+se.getAttributeName()+" = "+se.getValue());
       
    
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (BuilderException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (UnsupportedOperationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (NotInTheDomainException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (RangeFormatException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
  }
View Full Code Here

TOP

Related Classes of heart.alsvfd.Expression

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.