Package

Source Code of JT_Test

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

public class JT_Test {
  String CLG_example01_WS  = new String(
    "defineNode(A, DescriptionA);"+
    "{ defineState(Discrete, a1, a2);" +
    "p( A ) = { a1:0.8; a2:0.2; } }" +
    
    "defineNode(B, DescriptionB);"+
    "{ defineState(Discrete, b1, b2);" +
    "p( B ) = { b1:0.5; b2:0.5; } }" +
     
    "defineNode(C, DescriptionC);"+
    "{ defineState(Discrete, c1, c2);" +
    "p( C | B ) = if( B == b1 ){ c1:0.5; c2:0.5; } " +
    " else if( B == b2  ){ c1:0.3; c2:0.7; } " +
    "}"  +
   
    "defineNode(U, DescriptionU);"+
    "{ defineState(Continuous);" +
    "p( U ) = NormalDist(30, 2); " +
    "}" +
   
    "defineNode(X, DescriptionX);"+
    "{ defineState(Continuous);" +
    "p( X | A, U ) = if( A == a1  ){ 1*U + NormalDist( -5, 1 ); } " +
    " else if( A == a2  ){ 1*U + NormalDist( 5, 1 ); } " +
    "}"  +
 
    "defineNode(Y, DescriptionY);"+
      "{ defineState(Continuous);" +
      "p( Y | X ) = -2*X + NormalDist( 0, 1 ); " +
      "}" +
   
    "defineNode(W, DescriptionW);"+
    "{ defineState(Continuous);" +
    "p( W | B, Y ) = if( B == b1  ){ 1*Y + NormalDist( 5, 1 ); } " +
    " else if( B == b2 ){ 2*Y + NormalDist( 20, 2 ); } " +
    "}"  +
        
    "defineNode(Z, DescriptionZ);"+
      "{ defineState(Continuous);" +
      "p( Z | W ) = 0.5*W + NormalDist( 0, 1 ); " +
      "}"  
     );
 
  public void test() { 
    CPSCompilerMain cpsCompiler = new CPSCompilerMain();
        cpsCompiler.InitCompiler();
        cpsCompiler.compile( CLG_example01_WS  +
                   //"defineEvidence( C, c2 );"+
                   "defineEvidence( Z, -33 );"+
                  //"defineEvidence( X, 20 );"+
                         "run(JT);" );          
    }
 
  public static void main(String[] args) throws Exception {
    JT_Test JT = new JT_Test();
    JT.test()
  }
}
TOP

Related Classes of JT_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.