Package edu.gmu.seor.prognos.unbbayesplugin.cps.datastructure

Examples of edu.gmu.seor.prognos.unbbayesplugin.cps.datastructure.EDBUnit


   * @param mapCondition the map condition
   * @param ifEUnit the if e unit
   */
  public void findEUnitOnCondition( EDBUnit cptEUnit, HashMap<String, String> mapCondition, ArrayList<EDBUnit> ifEUnit ){
    ifEUnit.clear();
    EDBUnit ISA = cptEUnit.getRel("ISA");
    if( ISA != null ){
      for(String str : ISA.getMap().keySet()){
        EDBUnit child = ISA.map.get(str)
        findEUnitOnCondition2(child, mapCondition, ifEUnit, 0);
     
    } else{
      ifEUnit.add(cptEUnit);
    }
View Full Code Here


   * @param existedCount the existed count
   */
  public void findEUnitOnCondition2( EDBUnit cptNext, HashMap<String, String> mapCondition, ArrayList<EDBUnit> ifEUnit, int existedCount ){
     String strNode = cptNext.getData();
    String strState = mapCondition.get(strNode);
    EDBUnit finded = null;
    if( strState != null )
      finded = cptNext.find(strState, strNode);
   
    if( finded != null ){
      //finded.print("");
      existedCount++;
    }
   
    EDBUnit ISA = cptNext.getRel("ISA");
    if( ISA != null ){
      for(String str : ISA.getMap().keySet()){
        EDBUnit child = ISA.map.get(str)
        findEUnitOnCondition2(child, mapCondition, ifEUnit, existedCount);
     
    }else{
      if( existedCount == mapCondition.size() ){
        ifEUnit.add(cptNext);
View Full Code Here

    // check parent
    if( strParent.equalsIgnoreCase("setSampleSize") ){
      size_sampling = Integer.valueOf(strCurrent)
    }else
    if( strParent.equalsIgnoreCase("createCPT") ){
      EDBUnit kind = EDB.This().get("ROOT.NODES."+strCurrent+".INFO.KIND");
    
      if( kind.getData().equalsIgnoreCase("Probability") ){
        createCPT(EDB.This().get("ROOT.NODES."+strCurrent));
        createCPTbyEquation(strCurrent);
      }
      else
      if( kind.getData().equalsIgnoreCase("Deterministic") ){
        createCPT(EDB.This().get("ROOT.NODES."+strCurrent));
        createCPTbyDeterministicEquation(strCurrent);
      }
     
      //this node is changed to Discrete node
      EDBUnit type = EDB.This().get("ROOT.NODES."+strCurrent+".INFO.TYPE");
      if( type.getData().equalsIgnoreCase("Continuous") )
        type.setData("Discretized");
    }
       
    return strCurrent;
  }
View Full Code Here

   * Creates the cpt by equation.
   *
   * @param name the name
   */
  public void createCPTbyEquation( String name ){
    EDBUnit type = EDB.This().get("ROOT.NODES."+name+".INFO.TYPE");
     EDBUnit eqList = EDB.This().get("ROOT.NODES."+name+".EQUATION");
    EDBUnit cpt = EDB.This().get("ROOT.NODES."+name+".CPT");
    //eqList.print("");
    if( eqList == null )
      return;
   
    //if( name.equalsIgnoreCase("C2")){
    //  eqList.print("");
    //}
   
    ArrayList<DiscreteNodesCombination> listDiscreteNodeCombination = new ArrayList<DiscreteNodesCombination>();
    get_DiscreteNode_combination(cpt, listDiscreteNodeCombination, eqList );
       
    EDBUnit eq = null;
    if( !listDiscreteNodeCombination.isEmpty() ){
      for( DiscreteNodesCombination dc: listDiscreteNodeCombination){
         eq = dc.getEquation();
         //cpt.print("");
         //eq.print("");
View Full Code Here

     Object dParameter1 = null;
     Object dParameter2 = null;
      
    //iteration 
    int i = 0;
    EDBUnit ISA = eq.getRel("ISA");
    if( ISA != null ){
      for( String str : ISA.getMap().keySet() ){
        EDBUnit child = ISA.map.get(str);
       
        if( i == 0 )
          dParameter1 = createCPTbyEquation( i, child, cptOne )
        else
          dParameter2 = createCPTbyEquation( i, child, cptOne )
View Full Code Here

   * Creates the cpt by deterministic equation.
   *
   * @param name the name
   */
  public void createCPTbyDeterministicEquation( String name ){
    EDBUnit type = EDB.This().get("ROOT.NODES."+name+".INFO.TYPE");
     EDBUnit eqList = EDB.This().get("ROOT.NODES."+name+".EQUATION");
    EDBUnit cpt = EDB.This().get("ROOT.NODES."+name+".CPT");
    EDBUnit states = EDB.This().get("ROOT.NODES."+name+".STATES");
   
    if( eqList == null )
      return;
    
    Map<EDBUnit, Object> mapResultsByEq = new HashMap<EDBUnit, Object>();
    ArrayList<DiscreteNodesCombination> listDiscreteNodeCombination = new ArrayList<DiscreteNodesCombination>();
    get_DiscreteNode_combination(cpt, listDiscreteNodeCombination, eqList );
       
    EDBUnit eq = null;
    if( !listDiscreteNodeCombination.isEmpty() ){
      for( DiscreteNodesCombination dc: listDiscreteNodeCombination){
         eq = dc.getEquation();
         ArrayList<EDBUnit> ifEUnit = new ArrayList<EDBUnit>();
         findEUnitOnCondition(cpt, dc.mapValuesForAssingnment, ifEUnit );
         for( EDBUnit cptOne : ifEUnit ){
           //eq.print("");
           if( !eq.hasChildren() )
             eq = eqList;
           createCPTbyManyDeterministicEquation(eq, cptOne, type, mapResultsByEq, dc.mapValuesForAssingnment);
        
      } 
    }else{
      createCPTbyOneDeterministicEquation(eqList, cpt, type, mapResultsByEq);
    }
   
    //create new state space based on deterministic calculation.
    ArrayList<Double> arrayNewStates = new ArrayList<Double>();
    for(EDBUnit e: mapResultsByEq.keySet()){
      Object d = mapResultsByEq.get(e);
      if( !arrayNewStates.contains(d) ){
        arrayNewStates.add((Double)d);
      }
    }
   
    Collections.sort(arrayNewStates);
   
    states.removeAllChildren();
    for(Double d: arrayNewStates){
      states.createNext(d.toString());
    }
   
    for(EDBUnit e: mapResultsByEq.keySet()){
      Object finded = mapResultsByEq.get(e);
    //  e.print("");
      e.removeAllNEXTChildren();
    //  e.print("");
      EDBUnit t = e;
      for(Double d: arrayNewStates){
        t = t.createNext(d.toString());
        if( finded.equals(d) ){
          t.setData("1");
        }else{
          t.setData("0");
        }
      }
      //e.print("");
    }
  }
View Full Code Here

   * @param cptOne the cpt one
   * @param type the type
   * @param mapResultsByEq the map results by equation
   */
  public void createCPTbyOneDeterministicEquation(EDBUnit eq, EDBUnit cptOne, EDBUnit type, Map<EDBUnit, Object> mapResultsByEq){
    EDBUnit lastCPTISA = cptOne.getRel("ISA");
     if(lastCPTISA != null && lastCPTISA.map.size() != 0 ){
      for( String str : lastCPTISA.map.keySet() ){
        EDBUnit t = lastCPTISA.map.get(str);
        Map<String, String> mapValuesForAssingnment = new HashMap<String, String>();
        //t.print("");
        getCasesForcreateCPTbyOneDeterministicEquation(eq, t, type, mapResultsByEq, mapValuesForAssingnment);
      }
    }    
View Full Code Here

   * @return the cases for creating cpt by one deterministic equation
   */
  public void getCasesForcreateCPTbyOneDeterministicEquation(EDBUnit eq, EDBUnit cpt, EDBUnit type, Map<EDBUnit, Object> mapResultsByEq, Map<String, String> mapValuesForAssingnment){ 
    mapValuesForAssingnment.put(cpt.getData(), cpt.getName());
   
    EDBUnit lastCPTISA = cpt.getRel("ISA");
     if(lastCPTISA != null && lastCPTISA.map.size() != 0 ){
      for( String str : lastCPTISA.map.keySet() ){
        EDBUnit t = lastCPTISA.map.get(str);
        //t.print("");
        getCasesForcreateCPTbyOneDeterministicEquation(eq, t, type, mapResultsByEq, mapValuesForAssingnment);
      }
    }   
     else{
View Full Code Here

     Object dParameter1 = Double.NaN;
    Object dParameter2 = Double.NaN;
      
    //iteration 
    int i = 0;
    EDBUnit ISA = eq.getRel("ISA");
    if( ISA != null ){
      for( String str : ISA.getMap().keySet() ){
        EDBUnit child = ISA.map.get(str);
       
        if( i == 0 )
          dParameter1 = createCPTbyDeterministicEquation( i, child, mapValuesForAssingnment, cptOne )
        else
          dParameter2 = createCPTbyDeterministicEquation( i, child, mapValuesForAssingnment, cptOne )
View Full Code Here

      // ifResultTUnit would be CPT EUnit or its EUnit
      // EX) CPT.P1.P2.P3
      //       ^or^or^or^
     
      //EDB.This().get("ROOT.NODES."+strCurrentNode).print("");
      EDBUnit cptEUnit = EDB.This().get("ROOT.NODES."+strCurrentNode+".CPT");
      findEUnitOnCondition(cptEUnit, mapCondition, ifEUnit );
      //System.out.println(ifEUnit.toString());
    }else
    //SLIST is a last part of if-statement
    if( strCurrent.equals("SLIST") ){ 
View Full Code Here

TOP

Related Classes of edu.gmu.seor.prognos.unbbayesplugin.cps.datastructure.EDBUnit

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.