question: public double probConstraint ( OP constraint , int x , int y , int [ ] z ) { double p = 0 ; logfact [ 0 ] = 0 ; for ( int i = 1 ; i < logfact . length ; i ++ ) { logfact [ i ] = log ( i ) + logfact [ i - 1 ] ; } logfact [ 0 ] = 0 ; if ( z . length > maxParents ) { int maxConditioningNodes = z . length ; maxParents = maxConditioningNodes ; int [ ] _nodeDimension = Arrays . copyOf ( nodeDimension , nodeDimension . length ) ; Arrays . sort ( _nodeDimension ) ; int g1 = _nodeDimension [ _nodeDimension . length - 1 ] ; int g2 = _nodeDimension [ _nodeDimension . length - 2 ] ; maxCells = maxParents * g1 * g2 * maxCases ; parents = new int [ maxNodes + 2 ] [ maxParents + 1 ] ; countsTree = new int [ maxCells + 1 ] ; counts = new int [ maxCells + 1 ] ; } int n = z [ 0 ] ; parents [ x ] [ 0 ] = n ; for ( int i = 1 ; i <= n ; i ++ ) { parents [ x ] [ i ] = z [ i ] ; } double lnMarginalLikelihood_X = scoreNode ( x , 1 ) ; parents [ y ] [ 0 ] = n ; for ( int i = 1 ; i <= n ; i ++ ) { parents [ y ] [ i ] = z [ i ] ; } double lnMarginalLikelihood_Y = scoreNode ( y , 2 ) ; double lnMarginalLikelihood_X_Y = lnMarginalLikelihood_X + lnMarginalLikelihood_Y ; p = priorIndependent ( x , y , z ) ; double lnPrior_X_Y = Math . log ( p ) ; double score_X_Y = lnMarginalLikelihood_X_Y + lnPrior_X_Y ; numberOfNodes ++ ; int xy = numberOfNodes ; for ( int casei = 1 ; casei <= numberOfCases ; casei ++ ) { int xValue = cases [ casei ] [ x ] ; int yValue = cases [ casei ] [ y ] ; cases [ casei ] [ xy ] = ( xValue - 1 ) * nodeDimension [ y ] + yValue ; } nodeDimension [ xy ] = nodeDimension [ x ] * nodeDimension [ y ] ; parents [ xy ] [ 0 ] = n ; for ( int i = 1 ; i <= n ; i ++ ) { parents [ xy ] [ i ] = z [ i ] ; } double lnMarginalLikelihood_XY = scoreNode ( xy , 3 ) ; numberOfNodes -- ; double lnTermPrior_X_Y = Math . log ( p ) / numberOfScores ; double lnTermPrior_XY = Math . log ( 1 - Math . exp ( lnTermPrior_X_Y ) ) ; double scoreAll = 0 ; for ( int i = 1 ; i <= numberOfScores ; i ++ ) { scoreAll += lnXpluslnY ( lnTermPrior_X_Y + ( scores [ i ] [ 1 ] + scores [ i ] [ 2 ] ) , lnTermPrior_XY + scores [ i ] [ 3 ] ) ; } double probInd = Math . exp ( score_X_Y - scoreAll ) ; if ( constraint == OP . independent ) { p = probInd ; } else { p = 1.0 - probInd ; } return p ; }
target:  This function takes a constraint, which has a value of either OP.dependent or OP.independent, of the form "X independent Y given Z" or "X dependent Y given Z" and returns a probability for that constraint given the data in cases and assumed prior probability for that constraint given the data in cases and assumed prior probabilities. Currently, it assumes uniform parameter priors and a structure prior of 0.5. A structure prior of 0.5 means taht a priori we have that P(X independent Y given Z) = P(X dependent Y given Z) = 0.5. <p/> Z[0] is the length of the set represented by array Z. For an example, Z[0] = 1 represents the set Z of size 1. Z&lsqb;0&rsqb; = 0 represents an empty set. <p/> Set Z with two elements: Z = &lcub;3, 2&rcub; Z&lsqb;0&rsqb; = 2 // set Z has two elements (length of 2) Z[1] = 3 // first element Z[2] = 2 // second element. <p/> Empty set: Z = &lcub;&rcub; Z&lsqb;0&rsqb; = 0