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

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


   *
   * @param n the n
   */
  public void createEDBNodesFromUnBBayeNode(Node n){  
   
    EDBUnit cNode = null;
   
    cNode = EDB.This().get("ROOT.NODES."+n.getName());
    if( cNode != null ) return;
     
    // create EDB node
View Full Code Here


   * Creates the parent edb nodes.
   *
   * @param n the n
   */
  public void createParentEDBNodes(Node n){  
    EDBUnit cNode = EDB.This().get("ROOT.NODES."+n.getName());
    EDBUnit nodeFlag = cNode.get("INFO.SEARCH_FLAG");
    
    if( nodeFlag.getData().equals("TRUE") ) return;
     
    // set flag
    nodeFlag.setData("TRUE");
   
    //create parents
    ArrayList<Node> nodeParents = n.getParents();
    for( Node pNode : nodeParents ){
      CPSCompilerMain.This().createPARENT(EDB.This().get("ROOT.NODES."+n.getName()), pNode.getName());
View Full Code Here

   * Creates the edb nodes cpt.
   *
   * @param n the n
   */
  public void createEDBNodesCPT(Node n){  
    EDBUnit cNode = EDB.This().get("ROOT.NODES."+n.getName());
    EDBUnit nodeFlag = cNode.get("INFO.SEARCH_FLAG");
    
    if( nodeFlag.getData().equals("TRUE") ) return;
     
    // set flag
    nodeFlag.setData("TRUE");
     
    if( n.getType() == Node.PROBABILISTIC_NODE_TYPE ) {
      //create cpt
      CPSCompilerMain.This().createCPT(EDB.This().get("ROOT.NODES."+n.getName()));  
     
      int coord[] = new int[n.getParentNodes().size()+1];
      EDBUnit cpt = EDB.This().get("ROOT.NODES."+n.getName()+".CPT");
      PotentialTable auxTab = (PotentialTable) ((IRandomVariable) n).getProbabilityFunction();
     
      getNewStatesValueToBNNode( n, cpt,  coord, auxTab );
     
      //set script from BN to EDB
View Full Code Here

   * @param coord the coord
   * @param auxTab the aux tab
   * @return the new states value to bn node
   */
  public void getNewStatesValueToBNNode(Node cNode, EDBUnit lastCPT, int coord[], PotentialTable auxTab){ 
    EDBUnit lastCPTISA = lastCPT.getRel("ISA");
     if(lastCPTISA != null && lastCPTISA.map.size() != 0 ){
      for( String str : lastCPTISA.map.keySet() ){
        EDBUnit t = lastCPTISA.map.get(str)
       
        int variableIndex = auxTab.indexOfVariable(t.getData());
        Node n = (Node)auxTab.getVariableAt(variableIndex);
        coord[variableIndex] = getStateIndexFromBN(n, t.getName());
       
        getNewStatesValueToBNNode(cNode, t, coord, auxTab);
      }
    }
    else{   
View Full Code Here

       
    String strFirstStateName = nextNode.getName();

    // if this node is Continuous, it don't need to add the last state. The last state will be ignored.
    if( type.equals("Continuous") || type.equals("Discretized") ){
      EDBUnit stateSecond = nextNode.getNext();
      if( stateSecond == null )
        return;

      strFirstStateName = "[" + nextNode.getName() +", "+ stateSecond.getName() + "]";
     
   
     
    cNode.appendState(strFirstStateName)
   
View Full Code Here

   * @param stateIndexMap the state index map
   * @param auxTab the aux tab
   */
  public void AddNewStatesValueToBNNode(String type, EDBUnit lastCPT, int coord[], ArrayMap<Object, Integer> stateIndexMap, PotentialTable auxTab){ 
    //finding last row of CPT            EX) ROOT.NODES.Child.CPT.5.[DATA]:Number.high.[DATA]:Height.
    EDBUnit lastCPTISA = lastCPT.getRel("ISA");
     if(lastCPTISA != null && lastCPTISA.map.size() != 0 ){
      for( String str : lastCPTISA.map.keySet() ){
        EDBUnit t = lastCPTISA.map.get(str);
        //t.print("");
        //System.out.println(auxTab);
        int variableIndex = auxTab.indexOfVariable( t.getData() );
        Node n = (Node)auxTab.getVariableAt(variableIndex);
        coord[variableIndex] = getStateIndexFromBN( n, t.getName() );
       
        AddNewStatesValueToBNNode(type, t, coord, stateIndexMap, auxTab);
      }
    }
    else{   
View Full Code Here

      return;
   
    String strFirstStateName = state.getName();
    // if this node is Continuous, it don't need to add the last state. The last state will be ignored.
    if( type.equals("Continuous") || type.equals("Discretized") ){
      EDBUnit stateSecond = state.getNext();
      if( stateSecond == null )
        return;

      strFirstStateName = "[" + state.getName() +", "+ stateSecond.getName() + "]";
     
   
   
    state.print("");
    coord[0] = stateIndexMap.get( strFirstStateName );
View Full Code Here

  /**
   * Reset search flag.
   */
  public void resetSearchFlag()
  {
    EDBUnit nodes = EDB.This().get("ROOT.NODES");
    //reset all nodes' search flags
    EDBUnit lastCPTISA = nodes.getRel("ISA");
     if(lastCPTISA != null && lastCPTISA.map.size() != 0 ){
      for( String str : lastCPTISA.map.keySet() ){
        EDBUnit node = lastCPTISA.map.get(str);
        EDBUnit nodeFlag = node.get("INFO.SEARCH_FLAG");
        nodeFlag.setData("FALSE");
              tempENode = node;
      }
     }
  }
View Full Code Here

    CPSDialog.This().insertTextOut("Inference Results:");
    countTree = 0;
    sizeTree = 0;
   
    if( str != null && !str.equals("") && curNode != null ){
      EDBUnit nodeEQ = EDB.This().get("ROOT.NODES."+curNode.getName()+".SCRIPT");
      nodeEQ.setData(str);
    }
     
    resetSearchFlag();
    SearchAvailableNodeAndCompile(tempENode);
    resetSearchFlag()
View Full Code Here

  public void SearchAvailableNodeAndCompile(EDBUnit nodeNext)
  {  
    if( nodeNext == null )
      return;
   
    EDBUnit node = EDB.This().get("ROOT.NODES."+nodeNext.getName());
       
    if( node == null )
      return;
   
    EDBUnit nodeFlag;
    EDBUnit nodeEQ;
    nodeFlag = node.get("INFO.SEARCH_FLAG");
    nodeEQ = node.get("SCRIPT");
    
    EDBUnit parents = node.get("PARENTS");
    SearchAvailableNodeAndCompile(parents.getNext());
   
    if( nodeFlag.getData().equals("TRUE") ){
      SearchAvailableNodeAndCompile(nodeNext.getNext());
      return;
    }
  
    nodeFlag.setData("TRUE");
    //1. set current node to compiler
    CPSCompilerMain.This().setCurrentNode(node.getName());
   
    //text
    CPSDialog.This().insertTextOut("Compiling (" + node.getName() + ")", 1);
    
    //2. Compile node
    CPSCompilerMain.This().compile(nodeEQ.getData());

    //text
    CPSDialog.This().insertTextOut("Compiling (" + node.getName() + ") was done.", 1);
    
    //3. Convert node to UnBBayes'node
     convertEDBToBN(mapBNNodes.get(node));
      
    EDBUnit children = node.get("CHILDREN");
    SearchAvailableNodeAndCompile(children.getNext());
  }
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.