Package unbbayes.prs.mebn.ssbn.exception

Examples of unbbayes.prs.mebn.ssbn.exception.SSBNNodeGeneralException


    for(int i = 0; i < node.getOvArray().length; i++){
      try {
        mFragInstance.addOVValue(node.getOvArray()[i], node.getEntityArray()[i].getInstanceName());
      } catch (MFragContextFailException e) {
        //this is a bug... the context can't fail here.
        throw new SSBNNodeGeneralException(e.getMessage());
      }
    }
   
    node.setMFragInstance(mFragInstance);
   
View Full Code Here


                ovFaultForNewNodeList.get(index).getValueType()));
      }
     
      if(numberNodes > maxNumberNodes){
        //TODO define exception
        throw new SSBNNodeGeneralException("Max of nodes created: " + numberNodes);
      }
     
      // check whether we should create chains in order to limit the quantity of parents per node
      if (node.getResidentNode().isToLimitQuantityOfParentsInstances()
          && (childOfChain.getParentNodes().size() + 1 >= MAX_NUM_PARENTS_IN_CHAIN)
View Full Code Here

      }
    }
   
    // check limit of nodes
    if(numberNodes > maxNumberNodes){
      throw new SSBNNodeGeneralException("Max of nodes created: " + numberNodes);
    }
   
    newNode = addNodeToMFragInstance(childOfChain, newNode);
   
    return newNode;
View Full Code Here

 
    LiteralEntityInstance ovOrdereableActualValue = node.getEntityForOv(ovOrdereable);
    OVInstance ovInstanceOrdereable = OVInstance.getInstance(ovOrdereable, ovOrdereableActualValue);
   
    if(ovInstanceOrdereable == null){
      throw new SSBNNodeGeneralException();
    }
   
    String nameEntity = ovInstanceOrdereable.getEntity().getInstanceName();
   
    ObjectEntityInstanceOrdereable objectEntityInstanceOrdereable =
      (ObjectEntityInstanceOrdereable)objectEntityOrdereable.getInstanceByName(nameEntity);
   
    if(objectEntityInstanceOrdereable == null){
      throw new SSBNNodeGeneralException();
    }
   
    ObjectEntityInstanceOrdereable prev = objectEntityInstanceOrdereable.getPrev();

    if(prev != null){

      level5 = new IdentationLevel(level4);
      if (ssbn.getLogManager() != null) {
        ssbn.getLogManager().printText(level5, false, "Previous node = " + prev + " (" + objectEntityInstanceOrdereable + ")");
      }
     
      LiteralEntityInstance ovOrdereablePreviusValue =
        LiteralEntityInstance.getInstance(prev.getName(), ovOrdereable.getValueType());

      //3) Mount the father

      /*
       * Nota: uma pequena restrição aqui (fácil de ser retirada entretanto):
       * Consideramos que o nó pai e o nó filho possuem os mesmos argumentos com
       * excessão do argumento recursivo. Isto mantém a compatibilidade com as
       * considerações feitas no algoritmo anterior. 
       */

      SimpleSSBNNode newNode = SimpleSSBNNode.getInstance(residentNode);
      for(int i = 0; i < node.getOvArray().length; i++){
        if(node.getOvArray()[i].equals(ovOrdereable)){
          newNode.setEntityForOv(node.getOvArray()[i], ovOrdereablePreviusValue);
        }else{
          newNode.setEntityForOv(node.getOvArray()[i], node.getEntityArray()[i]);
        }
      }

      if(numberNodes > maxNumberNodes){
        //TODO define exception
        throw new SSBNNodeGeneralException("Max of nodes created: " + numberNodes);
      }
      newNode = addNodeToMFragInstance(node, newNode);

      return newNode;
   
View Full Code Here

        if (logManager != null) {
        logManager.printText(level2, false, "Generate CPT for the SSBNNodes");
        }
        build.generateCPTForAllSSBNNodes(ssbn);
      }else{
        throw new SSBNNodeGeneralException(getHybridResource().getString("NotNodeInSSBN"));
      }
     
  }
View Full Code Here

   * @throws SSBNNodeGeneralException
   */
  protected void setUpFindings(SSBN ssbn, IInferenceAlgorithm algorithm) throws SSBNNodeGeneralException {
    // initial assertion
    if (ssbn == null || algorithm == null) {
      throw new SSBNNodeGeneralException(new NullPointerException(this.getClass() + ": SSBN == null; algorithm == null."));
    }
    if (algorithm instanceof DMPInference) {
      DMPInference dmp = (DMPInference) algorithm;
     
      // dmp needs a reset, because it uses static db and previous findings may still be in the system.
      // TODO fix dmp so that it stops using static db
      dmp.reset();
     
      // findings of discrete nodes may be directly inserted to the network treated by the algorithm
      Graph g = dmp.getNetwork()// net to add findings
      if (g == null) {
        throw new SSBNNodeGeneralException(new IllegalStateException(ssbn + " and " + algorithm + " should be compiled before this method."));
      }
      if (g instanceof ProbabilisticNetwork) {
        ProbabilisticNetwork net = (ProbabilisticNetwork) g;
        for(SimpleSSBNNode ssbnFindingNode: ssbn.getFindingList()){
          //Not all findings nodes are at the network.
          if(ssbnFindingNode.getProbNode()!= null){
            // extract node and finding state from the network managed by the algorithm
            TreeVariable node = (TreeVariable)net.getNode(ssbnFindingNode.getProbNode().getName());
            String stateName = ssbnFindingNode.getState().getName();
           
            // TODO avoid usage of instanceof
            // TODO stop using static instance of DMP DB
            if ((node instanceof ContinuousNode)
                || (node instanceof GmmNodePluginStub)) {
              // findings to continuous nodes should be added directly to the DMP database.
              EDBUnit edbNode = EDB.This().get("ROOT.NODES." + node.getName());
                EDBUnit Evidence = edbNode.create("EVIDENCE");
                Evidence.setData(stateName);
            } else {
              // add discrete findings directly to the network managed by the inference algorithm
              // unfortunately, the network managed by the algorithm and the one linked to the SSBN may not be the same (because algorithm may instantiate another network)
              boolean isStateInNode = false;   // indicates if node contains the specified state (true if evidence is to a valid state)
              for(int i = 0; i < node.getStatesSize(); i++){
                // check if the name of the state in the SSBN node is the same in the node in actual network managed by the algorithm
                if(node.getStateAt(i).equals(stateName)){
                  node.addFinding(i);
//                ssbnFindingNode.getProbNode().addFinding(i);  // add to original node as well, just to make sure
                  isStateInNode = true;
                  break;
                }
              }
              if(!isStateInNode){
                throw new SSBNNodeGeneralException(node + " has no state for finding: " + stateName);
              }
            }
           

          }
View Full Code Here

TOP

Related Classes of unbbayes.prs.mebn.ssbn.exception.SSBNNodeGeneralException

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.