Package

Source Code of Deterministic_Test

import edu.gmu.seor.prognos.unbbayesplugin.cps.CPSCompilerMain;
import edu.gmu.seor.prognos.unbbayesplugin.cps.datastructure.EDB;


public class Deterministic_Test extends Test{

  public Deterministic_Test() { }
 
  //*** This works well at 6/16/2011 *** 
  public void test1() {
    CPSCompilerMain cpsCompiler = new CPSCompilerMain();
        cpsCompiler.InitCompiler();
    cpsCompiler.compile(
          "defineNode(C0, DescriptionC0);"+
        "{defineState(Discrete, 1, 2, 3, 4, 5, 6);" +
        "p( C0 ) = PoissonDist( 2 );"+
        "}"+
       
        "defineNode(C1, DescriptionC0);"+
        "{defineState(Discrete, 1, 2, 3, 4, 5, 6);" +
        "p( C1 ) = PoissonDist( 2 );"+
        "}"+
               
        "defineNode(C2, DescriptionC0);"+
        "{defineState(Discrete, 1, 2, 3, 4, 5, 6);" +
        "f( C2 | C0, C1 ) = C0 + C1;" +
        "}" +
        
        "createCPT( C0, C1, C2 );"
      );
       
      EDB.This().print("ROOT");
    }
 
  //*** This works well at 6/16/2011 ***
  public void test2() {
    CPSCompilerMain cpsCompiler = new CPSCompilerMain();
        cpsCompiler.InitCompiler();
    cpsCompiler.compile(
        "defineNode(C1, DescriptionC0);"+
        "{defineState(Discrete, 1, 2, 3, 4, 5, 6);" +
        "p( C1 ) = PoissonDist( 2 );"+
        "}"+
       
        "defineNode(C2, DescriptionC0);"+
        "{defineState(Discrete);" +
        "f( C2 | C1 ) = if ( C1 == 1 ){ C1*2;  } " +
        "else if ( C1 == 2 ) { C1*3; } " +
        "else if ( C1 == 3 ) { C1*4; } " +
        "else if ( C1 == 4 ) { C1*5; } " +
        "else if ( C1 == 5 ) { C1*6; } " +
        "else if ( C1 == 6 ) { C1*7; } " +
        "}" +
        
        "createCPT( C1, C2 );"
      );
       
      EDB.This().print("ROOT");
    }
    
 
  /**
   * @param args
   */
  public static void main(String[] args) {
    Deterministic_Test t = new Deterministic_Test();
    t.test1();  
    //t.test2();
  }

}
TOP

Related Classes of Deterministic_Test

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.