Package unbbayes.util.extension.bn.inference

Examples of unbbayes.util.extension.bn.inference.IInferenceAlgorithm


    System.out.println("*** JT ***");
   
    discretizedNet.setCreateLog(false);
    long time = System.nanoTime();
   
    IInferenceAlgorithm algorithm = new JunctionTreeAlgorithm();
    algorithm.setNetwork(discretizedNet);
    algorithm.run()
   
    for (String key : mapEvindeces.keySet()){
      String e = mapEvindeces.get(key);
      ProbabilisticNode findingNode = (ProbabilisticNode)discretizedNet.getNode(key);
      if (e.equalsIgnoreCase("True"))
View Full Code Here


   * @param ssbn
   * @throws Exception : this exception is inherent from the {@link ProbabilisticNetwork#updateEvidences()}
   */
  public void compileSSBNAndPropagateFindings(SSBN ssbn) throws Exception {
    // use DMP instead of Junction tree.
    IInferenceAlgorithm dmp = getBNInferenceAlgorithm();
   
    // if we are calling this algorithm from GUI, set up the whole BN module instead of just the inference algorithm
    NetworkWindow bnModule = null// this is going to hold the BN module (NetworkWindow is a UnBBayesModule)
    if (getMediator() != null) {
      // Instantiate a new BN module
      bnModule = new NetworkWindow(ssbn.getNetwork());
     
      // extract controller from BN module
      NetworkController controller = bnModule.getController();
      dmp.setMediator(controller);
      controller.setInferenceAlgorithm(dmp);
     
      // Make sure the tree (JTree in the left side of compilation panel) is updated with the network changes, if there is any.
      controller.getScreen().getEvidenceTree().resetTree();
    }
   
    if (this.isToCompileFinalSSBN() ) {
     
      // this is the actual BN (i.e. SSBN) to compile
      Network bn = ssbn.getNetwork();
     
      // If it is a SingleEntityNetwork, make sure all variables are properly initialized
      if (bn instanceof SingleEntityNetwork) {
        SingleEntityNetwork singleEntityNetwork = (SingleEntityNetwork) bn;
        singleEntityNetwork.resetNodesCopy();
        singleEntityNetwork.resetEvidences();
      }
     
      // actually compile network using dmp
      dmp.setNetwork(bn);
      dmp.run();
     
      if (dmp.getNetwork() != null && (dmp.getNetwork() instanceof Network)) {
        // dmp creates new network. SSBN must be linked to the new network
        ssbn.setNetwork((Network) dmp.getNetwork())
      }
     
      // if we instantiated a BN module previously, then change it to the "compiled" view instead of "edit" view
      if (bnModule != null) {
        bnModule.changeToPNCompilationPane();
View Full Code Here

    System.out.println("test_JT");
   
    pn.setCreateLog(false);
    long time = System.nanoTime();
   
    IInferenceAlgorithm algorithm = new JunctionTreeAlgorithm();
    algorithm.setNetwork(pn);
    algorithm.run();
    System.out.println("compileJT:  " + (System.nanoTime()- time) + "  nano sec");
    // insert evidence (finding)
  //  int indexFirstNode = 0;
  //  ProbabilisticNode findingNode = (ProbabilisticNode)pn.getNodes().get(indexFirstNode);
  //  int indexFirstState = 0;
View Full Code Here

   }
  
  public void test_JT(){
    pn.setCreateLog(false);
   
    IInferenceAlgorithm algorithm = new JunctionTreeAlgorithm();
    algorithm.setNetwork(pn);
    algorithm.run();
     
    try {
          pn.updateEvidences();
           
        } catch (Exception exc) {
View Full Code Here

    System.out.println("*** JT ***");
   
    pn.setCreateLog(false);
    long time = System.nanoTime();
   
    IInferenceAlgorithm algorithm = new JunctionTreeAlgorithm();
    algorithm.setNetwork(pn);
    algorithm.run();
   
    // insert evidence (finding)
    ProbabilisticNode findingNode = (ProbabilisticNode)pn.getNode("isJettisoningCargo_ship1");
    findingNode.addFinding(0);
    findingNode = (ProbabilisticNode)pn.getNode("hasWeaponVisible_ship1");
View Full Code Here

TOP

Related Classes of unbbayes.util.extension.bn.inference.IInferenceAlgorithm

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.