Examples of PotentialTable


Examples of edu.gmu.seor.prognos.unbbayesplugin.jt.prs.bn.PotentialTable

        super.absorb(clique1, clique2);
//        clique1.absorb(clique2, separator.getPotentialTable());
        ArrayList<Node> toDie = SetToolkit.clone(clique2.getNodes());
        toDie.removeAll(separator.getNodes());

        PotentialTable originalSeparatorUtilityTable = (PotentialTable) separator.getUtilityTable().clone();

        PotentialTable dummyTable = (PotentialTable) clique2.getUtilityTable().clone();
        dummyTable.directOpTab(clique2.getPotentialTable(), PotentialTable.PRODUCT_OPERATOR);
        for (int i = 0; i < toDie.size(); i++) {
            dummyTable.removeVariable(toDie.get(i));
        }

        for (int i = separator.getUtilityTable().tableSize()-1; i >= 0; i--) {
            separator.getUtilityTable().setValue(i, dummyTable.getValue(i));
        }
        separator.getUtilityTable().directOpTab(separator.getPotentialTable(), PotentialTable.DIVISION_OPERATOR);
        dummyTable = (PotentialTable) separator.getUtilityTable().clone();
        dummyTable.directOpTab(originalSeparatorUtilityTable, PotentialTable.MINUS_OPERATOR);
        clique1.getUtilityTable().opTab(dummyTable, PotentialTable.PLUS_OPERATOR);
    }
View Full Code Here

Examples of edu.gmu.seor.prognos.unbbayesplugin.jt.prs.bn.PotentialTable

        color = new Color(rgb);
    }
     
    protected void marginal() {
        marginalList = new float[getStatesSize()];
        PotentialTable auxTab = (PotentialTable)((Clique)cliqueAssociado).getUtilityTable().clone();
        auxTab.directOpTab(cliqueAssociado.getPotentialTable(), PotentialTable.PRODUCT_OPERATOR);
   /*     int index = auxTab.indexOfVariable(this);
        for (int i = 0; i < cliqueAssociado.getPotentialTable().variableCount(); i++) {
            if (i != index) {
                auxTab.removeVariable(cliqueAssociado.getPotentialTable().getVariableAt(i));
            }
View Full Code Here

Examples of edu.gmu.seor.prognos.unbbayesplugin.jt.prs.bn.PotentialTable

      uNode.setDescription(sNode.getName());
    }
     
    //initialize Potential Table
    if (uNode instanceof ITabledVariable) {
      PotentialTable potTable = ((ITabledVariable)uNode).getPotentialTable();
      potTable.addVariable(uNode);
    }
   
    rede.addNode(uNode);
  }
View Full Code Here

Examples of edu.gmu.seor.prognos.unbbayesplugin.jt.prs.bn.PotentialTable

      }
     
      /////////////////////////////////////////////////////////////////////////////////////
      //3. fill zero on table 
      ITabledVariable aux = null;
      PotentialTable auxTab = null;
      if (uNode instanceof ITabledVariable) {
        aux = (ITabledVariable) uNode;
        auxTab = aux.getPotentialTable() ;
      }
      
      int curStateSize = uNode.getStatesSize()
     
      for( INode parent : uNode.getParentNodes() )
        curStateSize *= parent.getStatesSize();
     
      for( int i = 0; i < curStateSize; i++ )
        auxTab.addValueAt(i, 0);
     
      auxTab.setTableSize(curStateSize);
   
      /////////////////////////////////////////////////////////////////////////////////////
      //4. add new values in the states of BN
      // EX]
      // CPT[Isa]parent1.state1{parent1.Name}[Isa]parent2.state1{parent2.Name}[Next]cur.state1[Next]cur.state2
View Full Code Here

Examples of edu.gmu.seor.prognos.unbbayesplugin.jt.prs.bn.PotentialTable

    edge.getOriginNode().addChild(edge.getDestinationNode());
    edge.getDestinationNode().addParent(edge.getOriginNode());
      edgeList.add(edge);
      if (edge.getDestinationNode() instanceof ITabledVariable) {
      ITabledVariable v2 = (ITabledVariable) edge.getDestinationNode();
      PotentialTable auxTab = v2.getPotentialTable();
      auxTab.addVariable(edge.getOriginNode());
    }
  }
View Full Code Here

Examples of edu.gmu.seor.prognos.unbbayesplugin.jt.prs.bn.PotentialTable

   *@param  elemento  edge to be removed
   */
  private void removeArco(Edge elemento) {
      Node auxNo;
      ITabledVariable auxTabledVariable;
      PotentialTable auxPotentialTable;
 
      edgeList.remove(elemento);
 
      auxNo = elemento.getDestinationNode();
      if (auxNo instanceof ITabledVariable) {
          auxTabledVariable = (ITabledVariable)auxNo;
          auxPotentialTable = auxTabledVariable.getPotentialTable();
          auxPotentialTable.removeVariable(elemento.getOriginNode(), true);
      }
  }
View Full Code Here

Examples of unbbayes.prs.bn.PotentialTable

    int areMeetingState = 0;
    ProbabilisticNode parent = (ProbabilisticNode) pn
        .getNode("hasExchangeIllicitCargoPartition_ship1");
    ProbabilisticNode child = (ProbabilisticNode) pn
        .getNode("areMeeting_ship1_ship2");
    PotentialTable table = ((PotentialTable) child.getProbabilityFunction());
    int[] coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    coord[table.getVariableIndex(parent)] = hasExchangeIllicitCargoPartitionState;
    if (Math.random() <= table.getValue(coord))
      areMeetingState = 0;
    else
      areMeetingState = 1;

    // Define if ship has a normal change in destination
    int hasNormalChangeInDestinationState;
    parent = (ProbabilisticNode) pn.getNode("hasTypeOfShip_ship1");
    child = (ProbabilisticNode) pn
        .getNode("hasNormalChangeInDestination_ship1");
    table = ((PotentialTable) child.getProbabilityFunction());
    coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    coord[table.getVariableIndex(parent)] = hasTypeOfShipState;
    if (Math.random() <= table.getValue(coord)) {
      hasNormalChangeInDestinationState = 0;
      ship.setHasNormalChangeInDestination(true);
    } else {
      hasNormalChangeInDestinationState = 1;
      ship.setHasNormalChangeInDestination(false);
    }

    // Define if ship has unusual route
    child = (ProbabilisticNode) pn.getNode("hasUnusualRoute_ship1");
    table = ((PotentialTable) child.getProbabilityFunction());
    coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    parent = (ProbabilisticNode) pn.getNode("areMeeting_ship1_ship2");
    coord[table.getVariableIndex(parent)] = areMeetingState;
    parent = (ProbabilisticNode) pn.getNode("hasBombingPlan_ship1");
    coord[table.getVariableIndex(parent)] = hasBombingPlanState;
    parent = (ProbabilisticNode) pn
        .getNode("hasNormalChangeInDestination_ship1");
    coord[table.getVariableIndex(parent)] = hasNormalChangeInDestinationState;
    if (Math.random() <= table.getValue(coord)) {
      ship.setOnUnusualRoute(true);
      ship.setOnUsualRoute(false);
    } else {
      ship.setOnUnusualRoute(false);
      ship.setOnUsualRoute(true);
View Full Code Here

Examples of unbbayes.prs.bn.PotentialTable

    int hasEvasiveBehaviorState = 0;
    ProbabilisticNode parent = (ProbabilisticNode) pn
        .getNode("hasExchangeIllicitCargoPartition_ship1");
    ProbabilisticNode child = (ProbabilisticNode) pn
        .getNode("hasEvasiveBehavior_ship1");
    PotentialTable table = ((PotentialTable) child.getProbabilityFunction());
    int[] coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    coord[table.getVariableIndex(parent)] = hasExchangeIllicitCargoPartitionState;
    if (Math.random() <= table.getValue(coord))
      hasEvasiveBehaviorState = 0;
    else
      hasEvasiveBehaviorState = 1;

    // Define if ship's electronicis is working
    int isElectronicsWorkingState = 0;
    child = (ProbabilisticNode) pn.getNode("isElectronicsWorking_ship1");
    table = ((PotentialTable) child.getProbabilityFunction());
    coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    if (Math.random() <= table.getValue(coord)) {
      isElectronicsWorkingState = 0;
      ship.setElectronicsWorking(true);
    } else {
      isElectronicsWorkingState = 1;
      ship.setElectronicsWorking(false);
    }

    // Define if ship has responsive AIS
    child = (ProbabilisticNode) pn.getNode("hasResponsiveAIS_ship1");
    table = ((PotentialTable) child.getProbabilityFunction());
    coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    parent = (ProbabilisticNode) pn.getNode("hasEvasiveBehavior_ship1");
    coord[table.getVariableIndex(parent)] = hasEvasiveBehaviorState;
    parent = (ProbabilisticNode) pn.getNode("isElectronicsWorking_ship1");
    coord[table.getVariableIndex(parent)] = isElectronicsWorkingState;
    if (Math.random() <= table.getValue(coord)) {
      ship.setHasResponsiveAIS(true);
    } else {
      ship.setHasResponsiveAIS(false);
    }

    // Define if ship has responsive radio
    child = (ProbabilisticNode) pn.getNode("hasResponsiveRadio_ship1");
    table = ((PotentialTable) child.getProbabilityFunction());
    coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    parent = (ProbabilisticNode) pn.getNode("hasEvasiveBehavior_ship1");
    coord[table.getVariableIndex(parent)] = hasEvasiveBehaviorState;
    parent = (ProbabilisticNode) pn.getNode("isElectronicsWorking_ship1");
    coord[table.getVariableIndex(parent)] = isElectronicsWorkingState;
    if (Math.random() <= table.getValue(coord)) {
      ship.setHasResponsiveRadio(true);
    } else {
      ship.setHasResponsiveRadio(false);
    }
  }
View Full Code Here

Examples of unbbayes.prs.bn.PotentialTable

    int hasErraticBehaviorState = 0;
    ProbabilisticNode parent = (ProbabilisticNode) pn
        .getNode("hasExchangeIllicitCargoPartition_ship1");
    ProbabilisticNode child = (ProbabilisticNode) pn
        .getNode("hasErraticBehavior_ship1");
    PotentialTable table = ((PotentialTable) child.getProbabilityFunction());
    int[] coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    coord[table.getVariableIndex(parent)] = hasExchangeIllicitCargoPartitionState;
    if (Math.random() <= table.getValue(coord))
      hasErraticBehaviorState = 0;
    else
      hasErraticBehaviorState = 1;

    // Define if ship has equipment failure
    int hasEquipmentFailureState = 0;
    child = (ProbabilisticNode) pn.getNode("hasEquipmentFailure_ship1");
    table = ((PotentialTable) child.getProbabilityFunction());
    coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    if (Math.random() <= table.getValue(coord)) {
      hasEquipmentFailureState = 0;
      ship.setHasEquipmentFailure(true);
    } else {
      hasEquipmentFailureState = 1;
      ship.setHasEquipmentFailure(false);
    }

    // Define if ship has crew visible
    child = (ProbabilisticNode) pn.getNode("isCrewVisible_ship1");
    table = ((PotentialTable) child.getProbabilityFunction());
    coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    parent = (ProbabilisticNode) pn.getNode("hasErraticBehavior_ship1");
    coord[table.getVariableIndex(parent)] = hasErraticBehaviorState;
    parent = (ProbabilisticNode) pn.getNode("hasEquipmentFailure_ship1");
    coord[table.getVariableIndex(parent)] = hasEquipmentFailureState;
    if (Math.random() <= table.getValue(coord)) {
      ship.setCrewVisible(true);
    } else {
      ship.setCrewVisible(false);
    }
View Full Code Here

Examples of unbbayes.prs.bn.PotentialTable

    // Define if ship has aggressive behavior
    int hasAggressiveBehaviorState = 0;
    ProbabilisticNode child = (ProbabilisticNode) pn
        .getNode("hasAggressiveBehavior_ship1");
    PotentialTable table = ((PotentialTable) child.getProbabilityFunction());
    int[] coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    ProbabilisticNode parent = (ProbabilisticNode) pn
        .getNode("hasExchangeIllicitCargoPartition_ship1");
    coord[table.getVariableIndex(parent)] = hasExchangeIllicitCargoPartitionState;
    parent = (ProbabilisticNode) pn.getNode("hasBombingPlan_ship1");
    coord[table.getVariableIndex(parent)] = hasBombingPlanState;
    float f = table.getValue(coord);
    if (Math.random() <= f){
      ship.setHasAggressiveBehaviorState(true);
      hasAggressiveBehaviorState = 0;
    }
    else{
      ship.setHasAggressiveBehaviorState(false);
      hasAggressiveBehaviorState = 1
    }
   
    // Define if ship weapon visible
    child = (ProbabilisticNode) pn.getNode("hasWeaponVisible_ship1");
    table = ((PotentialTable) child.getProbabilityFunction());
    coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    parent = (ProbabilisticNode) pn.getNode("hasAggressiveBehavior_ship1");
    coord[table.getVariableIndex(parent)] = hasAggressiveBehaviorState;
    if (Math.random() <= table.getValue(coord)) {
      ship.setHasWeaponVisible(true);
    } else {
      ship.setHasWeaponVisible(false);
    }

    // Define if ship is jettisoning cargo
    child = (ProbabilisticNode) pn.getNode("isJettisoningCargo_ship1");
    table = ((PotentialTable) child.getProbabilityFunction());
    coord = new int[child.getParents().size() + 1];
    coord[0] = 0;
    parent = (ProbabilisticNode) pn.getNode("hasAggressiveBehavior_ship1");
    coord[table.getVariableIndex(parent)] = hasAggressiveBehaviorState;
    if (Math.random() <= table.getValue(coord)) {
      ship.setJettisoningCargo(true);
    } else {
      ship.setJettisoningCargo(false);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.