UNPKG

bayes-server

Version:

Bayes Server JavaScript API

3 lines 234 kB
'use strict';var __extends=this&&this['__extends']||function(){var c=Object['setPrototypeOf']||{'__proto__':[]}instanceof Array&&function(d,e){d['__proto__']=e;}||function(f,g){for(var h in g)if(g['hasOwnProperty'](h))f[h]=g[h];};return function(i,j){c(i,j);function k(){this['constructor']=i;}i['prototype']=j===null?Object['create'](j):(k['prototype']=j['prototype'],new k());};}();var __values=this&&this['__values']||function(l){var m=typeof Symbol==='function'&&l[Symbol['iterator']],n=0x0;if(m)return m['call'](l);return{'next':function(){if(l&&n>=l['length'])l=void 0x0;return{'value':l&&l[n++],'done':!l};}};};var __read=this&&this['__read']||function(o,p){var q=typeof Symbol==='function'&&o[Symbol['iterator']];if(!q)return o;var r=q['call'](o),s,t=[],u;try{while((p===void 0x0||p-->0x0)&&!(s=r['next']())['done'])t['push'](s['value']);}catch(v){u={'error':v};}finally{try{if(s&&!s['done']&&(q=r['return']))q['call'](r);}finally{if(u)throw u['error'];}}return t;};var __spread=this&&this['__spread']||function(){for(var w=[],x=0x0;x<arguments['length'];x++)w=w['concat'](__read(arguments[x]));return w;};Object['defineProperty'](exports,'__esModule',{'value':!![]});// javascript-obfuscator:disable var core_1=require('./core');var statistics_1=require('./statistics');// javascript-obfuscator:enable var TypeScriptUtils=function(){function y(){}y['isWhiteSpace']=function(z){if(z=='\x20'||z>='09'&&z<='0d'||z=='a0'||z=='85'){return!![];}return![];};y['compareTo']=function(A,B){if(A<B)return-0x1;else if(A>B)return 0x1;else return 0x0;};y['copyFromIterator']=function(C,D){var E=0x0;try{for(var F=__values(C),G=F['next']();!G['done'];G=F['next']()){var H=G['value'];D[E]=H;E++;}}catch(I){J={'error':I};}finally{try{if(G&&!G['done']&&(K=F['return']))K['call'](F);}finally{if(J)throw J['error'];}}var J,K;};y['copyFromList']=function(L,M){var N=0x0;try{for(var O=__values(L),P=O['next']();!P['done'];P=O['next']()){var Q=P['value'];M[N]=Q;N++;}}catch(R){S={'error':R};}finally{try{if(P&&!P['done']&&(T=O['return']))T['call'](O);}finally{if(S)throw S['error'];}}var S,T;};y['isIList']=function(U){if(U===null)return![];return U['_2ad2e5f4b2884a52bf8bfc07ce8953d3']!==undefined;};y['isIDistribution']=function(V){if(V===null)return![];return V['_39d9d5f7317c4bb79bd3c1e43b2b4a43']!==undefined;};y['cloneArray2D']=function(W){var X=y['createArray2D'](W['length']);for(var Y=0x0;Y<W['length'];Y++){var Z=W[Y];X[Y]=Z;if(Z!=null&&Z!=undefined){X[Y]=y['createArray'](Z['length'],null);var a0=X[Y];for(var a1=0x0;a1<Z['length'];a1++){a0[a1]=Z[a1];}}}return X;};y['cloneArray3D']=function(a2){var a3=y['createArray3D'](a2['length']);for(var a4=0x0;a4<a2['length'];a4++){var a5=a2[a4];a3[a4]=a5;if(a5!=null&&a5!=undefined){a3[a4]=y['createArray2D'](a5['length']);var a6=a3[a4];for(var a7=0x0;a7<a5['length'];a7++){var a8=a5[a7];a6[a7]=a8;if(a8!=null&&a8!=undefined){a6[a7]=y['createArray'](a8['length'],null);var a9=a6[a7];for(var aa=0x0;aa<a8['length'];aa++){a9[aa]=a8[aa];}}}}}return a3;};y['arrayClear']=function(ab,ac,ad){var ae=ac+ad;for(var af=ac;af<ae;af++){ab[af]=null;}};y['arrayCopy3']=function(ag,ah,ai){for(var aj=0x0;aj<ai;aj++){ah[aj]=ag[aj];}};y['arrayCopy5']=function(ak,al,am,an,ao){for(var ap=0x0;ap<ao;ap++){am[an+ap]=ak[al+ap];}};y['isInfinity']=function(aq){return aq===Number['POSITIVE_INFINITY']||aq===Number['NEGATIVE_INFINITY'];};y['isNegativeInfinity']=function(ar){return ar===Number['NEGATIVE_INFINITY'];};y['isPositiveInfinity']=function(as){return as===Number['POSITIVE_INFINITY'];};y['pushList']=function(at,au){for(var av=0x0;av<au['length'];av++){at['push'](au[av]);}};y['sealed']=function(aw){Object['seal'](aw);Object['seal'](aw['prototype']);};y['memberwiseClone']=function(ax,ay){Object['assign'](ay,ax);};y['createArray2D']=function(az){var aA=[];for(var aB=az-0x1;aB>=0x0;aB--){aA[aB]=null;}return aA;};y['createArray3D']=function(aC){var aD=[];for(var aE=aC-0x1;aE>=0x0;aE--){aD[aE]=null;}return aD;};y['isNullOrEmpty']=function(aF){if(aF==null)return!![];if(aF===undefined)return!![];if(aF['length']===0x0)return!![];return![];};y['createArray']=function(aG,aH){var aI=new Array(aG);if(aI['length']!=aG)throw new Error('Unexpected\x20error\x20in\x20createArray');for(var aJ=0x0;aJ<aI['length'];aJ++){aI[aJ]=aH;}if(aI['length']!=aG)throw new Error('Unexpected\x20error\x20in\x20createArray');return aI;};return y;}();var W_x_=function(){function aK(){}aK['q_x_']=function(aL){if(aL['cancellation']==null)return;if(aL['cancellation']['cancel'])throw new Error();};return aK;}();var X_x_=function(){function aM(aN,aO){this['_A_x_']=null;this['_B_x_']=null;this['_C_x_']=null;this['_D_x_']=null;this['_E_x_']=null;this['_A_x_']=aN;this['_B_x_']=aO;}aM['prototype']['_r_x_']=function(){if(this['_C_x_']==null){this['_C_x_']=this['_B_x_']['createInferenceEngine'](this['_A_x_']);this['_D_x_']=this['_B_x_']['createQueryOptions']();this['_E_x_']=this['_B_x_']['createQueryOutput']();}};aM['prototype']['s_x_']=function(aP,aQ,aR){var aS=null;for(var aT=0x0;aT<aP['size'];aT++){var aU=aP['get'](aT);if(!aU['isEnabled']){continue;}if(aU['comparison']===QueryComparison['None']&&aU['queryDistance']===QueryDistance['None']){continue;}var aV=aU['distribution'];if(aV['sortedVariables']['size']===0x0){continue;}var aW=aV['copy']();if(aS==null){this['_r_x_']();this['_C_x_']['queryDistributions']['clear']();aS=new Map();}this['_C_x_']['queryDistributions']['pushDistribution'](aW);aS['set'](aU,aW);}if(aS==null){return;}if(aQ['propagation']===core_1['PropagationMethod']['Max']){throw new Error('Comparison\x20queries\x20and\x20distance\x20queries\x20are\x20not\x20supported\x20with\x20max\x20propagation\x20(Most\x20Probable\x20Explanation,\x20MPE).');}this['_D_x_']['queryEvidenceMode']=aQ['queryEvidenceMode'];if(aR!=null){this['_C_x_']['evidence']['copy'](aR);}else{this['_C_x_']['evidence']['clear']();}this['_D_x_']['terminalTime']=aQ['terminalTime'];this['_C_x_']['query'](this['_D_x_'],this['_E_x_']);try{for(var aX=__values(aS),aY=aX['next']();!aY['done'];aY=aX['next']()){var aZ=aY['value'];var b0=aZ[0x0];var b1=b0['distribution'];var b2=aZ[0x1];var b3=b1 instanceof core_1['CLGaussian']?b1:null;var b4=b2 instanceof core_1['CLGaussian']?b2:null;{switch(b0['queryDistance']){case QueryDistance['None']:b0['distance']=null;break;case QueryDistance['KLDivergence']:try{b0['distance']=statistics_1['KullbackLeibler']['divergence'](b2,b1,statistics_1['LogarithmBase']['Natural']);}catch(b5){b0['distance']=null;}break;default:throw new Error();}}if(b0['comparison']!=QueryComparison['None']){for(var b6=0x0;b6<b1['table']['size'];b6++){var b7=b1['table']['get'](b6);var b8=b2['table']['get'](b6);b1['table']['set'](b6,aM['_t_x_'](b7,b8,b0['comparison']));if(b3!=null){for(var b9=0x0;b9<b3['sortedContinuousHead']['size'];b9++){var ba=b3['getMean'](b6,b9);var bb=b4['getMean'](b6,b9);b3['setMean'](b6,b9,aM['_t_x_'](ba,bb,b0['comparison']));for(var bc=0x0;bc<b3['sortedContinuousHead']['size'];bc++){var bd=b3['getCovariance'](b6,b9,bc);var be=b4['getCovariance'](b6,b9,bc);b3['setCovariance'](b6,b9,bc,aM['_t_x_'](bd,be,b0['comparison']));}for(var bf=0x0;bf<b3['sortedContinuousTail']['size'];bf++){var bg=b3['getWeight'](b6,b9,bf);var bh=b4['getWeight'](b6,b9,bf);b3['setWeight'](b6,b9,bf,aM['_t_x_'](bg,bh,b0['comparison']));}}}}}}}catch(bi){bj={'error':bi};}finally{try{if(aY&&!aY['done']&&(bk=aX['return']))bk['call'](aX);}finally{if(bj)throw bj['error'];}}this['_C_x_']['queryDistributions']['clear']();var bj,bk;};aM['_t_x_']=function(bl,bm,bn){switch(bn){case QueryComparison['Difference']:{return bl-bm;}case QueryComparison['Lift']:{return bl/bm;}default:throw new Error();}};return aM;}();var Y_x_=function(){function bo(){this['F_x_']=null;this['G_x_']=null;this['H_x_']=null;}return bo;}();var Z_x_=function(){function bp(){}bp['u_x_']=function(bq){var br=![];var bs=new List();var bt=![];try{for(var bu=__values(bq['distribution']['sortedVariables']),bv=bu['next']();!bv['done'];bv=bu['next']()){var bw=bv['value'];var bx=bw['variable']['valueType']===core_1['VariableValueType']['Continuous'];if(bx){br=!![];}if(bw['headTail']===core_1['HeadTail']['Tail']){bs['push'](bw);if(bx){bt=!![];}}}}catch(by){bC={'error':by};}finally{try{if(bv&&!bv['done']&&(bD=bu['return']))bD['call'](bu);}finally{if(bC)throw bC['error'];}}if(bs['size']===0x0)return null;var bz=br?new core_1['CLGaussian'](bq['distribution']['sortedVariables'],core_1['HeadTail']['Head']):new core_1['Table'](bq['distribution']['sortedVariables'],core_1['HeadTail']['Head']);var bA=bt?new core_1['CLGaussian'](bs,core_1['HeadTail']['Head']):new core_1['Table'](bs,core_1['HeadTail']['Head']);var bB=new Y_x_();bB['F_x_']=new QueryDistribution(bz);Yzw_x_['_srr_x_'](bq,bB['F_x_']);bB['G_x_']=bq;bB['H_x_']=bA;return bB;var bC,bD;};bp['v_x_']=function(bE,bF,bG){bF['marginalize'](bE['distribution']);var bH=bE['distribution']['divide'](bF);bp['_rq_x_'](bH,bG['distribution']);Yzw_x_['_srq_x_'](bE,bG);};bp['_rq_x_']=function(bI,bJ){bI['table']['copyTo'](bJ['table']);var bK=bI instanceof core_1['CLGaussian']?bI:null;if(bK!=null){var bL=bJ;for(var bM=0x0;bM<bK['table']['size'];bM++){for(var bN=0x0;bN<bK['sortedContinuousHead']['size'];bN++){bL['setMean'](bM,bN,bK['getMean'](bM,bN));for(var bO=bN;bO<bK['sortedContinuousHead']['size'];bO++){bL['setCovariance'](bM,bN,bO,bK['getCovariance'](bM,bN,bO));}for(var bP=0x0;bP<bK['sortedContinuousTail']['size'];bP++){bL['setWeight'](bM,bN,bP,bK['getWeight'](bM,bN,bP));}}}}};bp['_rr_x_']=function(bQ){try{for(var bR=__values(bQ['sortedVariables']),bS=bR['next']();!bS['done'];bS=bR['next']()){var bT=bS['value'];if(bT['headTail']===core_1['HeadTail']['Tail'])return!![];}}catch(bU){bV={'error':bU};}finally{try{if(bS&&!bS['done']&&(bW=bR['return']))bW['call'](bR);}finally{if(bV)throw bV['error'];}}return![];var bV,bW;};return bp;}();var Xw_x_=function(){function bX(bY){this['_Ba_x_']=null;this['_Bb_x_']=null;this['_Ba_x_']=bY;}bX['prototype']['rt_x_']=function(bZ,c0,c1){if(this['_Bb_x_']==null){if(bX['_rs_x_'](bZ['queryDistributions'])){this['_Bb_x_']=this['_Ba_x_']['createInferenceEngine'](bZ['network']);}else{return![];}}this['_Bb_x_']['queryDistributions']['clear']();var c2=null;try{for(var c3=__values(bZ['queryDistributions']),c4=c3['next']();!c4['done'];c4=c3['next']()){var c5=c4['value'];if(!c5['isEnabled'])continue;var c6=Z_x_['u_x_'](c5);if(c6!=null){if(c2==null)c2=new List();c2['push'](c6);this['_Bb_x_']['queryDistributions']['push'](c6['F_x_']);}else{this['_Bb_x_']['queryDistributions']['push'](c5);}}}catch(c7){cc={'error':c7};}finally{try{if(c4&&!c4['done']&&(cd=c3['return']))cd['call'](c3);}finally{if(cc)throw cc['error'];}}if(c2==null){return![];}else{this['_Bb_x_']['evidence']['copy'](bZ['evidence']);this['_Bb_x_']['query'](c0,c1);try{for(var c8=__values(c2),c9=c8['next']();!c9['done'];c9=c8['next']()){var ca=c9['value'];Z_x_['v_x_'](ca['F_x_'],ca['H_x_'],ca['G_x_']);}}catch(cb){ce={'error':cb};}finally{try{if(c9&&!c9['done']&&(cf=c8['return']))cf['call'](c8);}finally{if(ce)throw ce['error'];}}return!![];}var cc,cd,ce,cf;};bX['_rs_x_']=function(cg){try{for(var ch=__values(cg),ci=ch['next']();!ci['done'];ci=ch['next']()){var cj=ci['value'];if(!cj['isEnabled'])continue;if(Z_x_['_rr_x_'](cj['distribution'])){return!![];}}}catch(ck){cl={'error':ck};}finally{try{if(ci&&!ci['done']&&(cm=ch['return']))cm['call'](ch);}finally{if(cl)throw cl['error'];}}return![];var cl,cm;};return bX;}();var Xx_x_=function(){function cn(co,cp){this['_Bc_x_']=null;this['_Bd_x_']=null;this['_Be_x_']=null;this['_Bf_x_']=null;this['_Bg_x_']=null;this['_Bh_x_']=null;this['_Ca_x_']=null;this['_Cb_x_']=null;this['_Bc_x_']=co;this['_Bd_x_']=cp;this['_Bc_x_']['addMonitor'](this);this['_ts_x_']();}cn['prototype']['ru_x_']=function(cq,cr,cs,ct,cu){if(this['_Be_x_']==null){this['_Be_x_']=TypeScriptUtils['createArray'](this['_Bc_x_']['variables']['size'],null);this['_Bf_x_']=TypeScriptUtils['createArray2D'](this['_Bc_x_']['variables']['size']);}if(TypeScriptUtils['isNegativeInfinity'](cq)){throw new InconsistentEvidenceError('Inconsistent\x20evidence\x20was\x20detected,\x20or\x20underflow/overflow\x20occurred\x20during\x20the\x20calculation\x20of\x20the\x20conflict\x20measure.');}var cv=cu['terminalTime'];if(cu['propagation']===core_1['PropagationMethod']['Max']){throw new Error('Conflict\x20is\x20not\x20supported\x20with\x20max\x20propagation\x20(Most\x20probable\x20explanation,\x20MPE).');}var cw=-(cq/cr['weight']);if(this['_Ca_x_']==null){this['_Ca_x_']=this['_Bd_x_']['createInferenceEngine'](this['_Bc_x_']);this['_Bg_x_']=this['_Bd_x_']['createQueryOptions']();this['_Bh_x_']=this['_Bd_x_']['createQueryOutput']();}this['_Bg_x_']['terminalTime']=cv;this['_rv_x_'](cs,ct,cr,cv);for(var cx=0x0;cx<ct;cx++){var cy=cs[cx];var cz=cy['node']['temporalType'];if(cz===core_1['TemporalType']['Terminal']){cw+=this['_st_x_'](cr,cy,null);}else if(cz===core_1['TemporalType']['Temporal']){var cA=cr['getMaxTime'](cy);if(!(cA!=null)){throw new Error();}for(var cB=0x0;cB<=cA;cB++){if(cr['getEvidenceType'](cy,cB)!=EvidenceType['None']){cw+=this['_st_x_'](cr,cy,cB);}}}else{cw+=this['_st_x_'](cr,cy,null);}}return cw;};cn['prototype']['_rv_x_']=function(cC,cD,cE,cF){this['_Ca_x_']['queryDistributions']['clear']();var cG=new List();for(var cH=0x0;cH<cD;cH++){var cI=cC[cH];var cJ=cI['node']['temporalType'];if(cJ===core_1['TemporalType']['Temporal']){var cK=cE['getMaxTime'](cI);if(!(cK!=null)){throw new Error();}for(var cL=0x0;cL<=cK;cL++){if(cE['getEvidenceType'](cI,cL)===EvidenceType['None'])continue;if(this['sr_x_'](cI,cL)!=null)continue;if(cI['valueType']===core_1['VariableValueType']['Discrete']){var cM=cn['_sq_x_'](cI,cL);this['_Ca_x_']['queryDistributions']['pushDistribution'](cM);cG['push'](new Xy_x_(cI,cL,cM));}else{}}}else{if(this['sr_x_'](cI,null)!=null)continue;if(cI['valueType']===core_1['VariableValueType']['Discrete']){var cN=cn['_sq_x_'](cI,null);this['_Ca_x_']['queryDistributions']['pushDistribution'](cN);var cO=Xywx_x_['vvs_x_'](cI,null,this['_Bc_x_']['variables']['size']);cG['push'](new Xy_x_(cI,null,cN));}else{}}}this['_Bg_x_']['logLikelihood']=![];this['_Bg_x_']['conflict']=![];if(this['_Ca_x_']['evidence']['size']!=0x0)throw new Error('evidence\x20count\x20should\x20be\x20zero');if(cG['size']>0x0){this['_Ca_x_']['query'](this['_Bg_x_'],this['_Bh_x_']);try{for(var cP=__values(cG),cQ=cP['next']();!cQ['done'];cQ=cP['next']()){var cR=cQ['value'];this['ss_x_'](cR['Cc_x_'],cR['Cd_x_'],cR['Ce_x_']);}}catch(cS){cT={'error':cS};}finally{try{if(cQ&&!cQ['done']&&(cU=cP['return']))cU['call'](cP);}finally{if(cT)throw cT['error'];}}this['_Ca_x_']['queryDistributions']['clear']();}{}var cT,cU;};cn['prototype']['sr_x_']=function(cV,cW){var cX=cW;var cY=cV['node']['temporalType'];if(cY===core_1['TemporalType']['Terminal']){cX=this['_Bg_x_']['terminalTime'];}if(cY===core_1['TemporalType']['Contemporal']||cY===core_1['TemporalType']['Initial']){return this['_Be_x_'][cV['index']];}var cZ=this['_Bf_x_'][cV['index']];if(cZ==null)return null;if(cZ['length']<=cX)return null;return cZ[cX];};cn['prototype']['ss_x_']=function(d0,d1,d2){var d3=d1;var d4=d0['node']['temporalType'];if(d4===core_1['TemporalType']['Terminal']){d3=this['_Bg_x_']['terminalTime'];}if(d4===core_1['TemporalType']['Contemporal']||d4===core_1['TemporalType']['Initial']){this['_Be_x_'][d0['index']]=d2;return;}var d5=this['_Bf_x_'][d0['index']];if(d5==null||d5['length']<=d3){var d6=TypeScriptUtils['createArray'](Math['max'](d3+0x1,0xa),null);if(d5!=null){TypeScriptUtils['arrayCopy5'](d5,0x0,d6,0x0,d5['length']);}this['_Bf_x_'][d0['index']]=d6;d5=d6;}d5[d3]=d2;};cn['prototype']['_st_x_']=function(d7,d8,d9){var da=d7['getEvidenceType'](d8,d9);if(d8['valueType']===core_1['VariableValueType']['Discrete']){return this['_tr_x_'](d7,d8,d9,da);}else{return this['_su_x_'](d7,d8,d9);}};cn['prototype']['_su_x_']=function(db,dc,dd){var de=this['sr_x_'](dc,dd);if(de==null){return this['_sv_x_'](db,dc,dd);}else{var df=de;return cn['_tq_x_'](db,dc,dd,df);}};cn['prototype']['_sv_x_']=function(dg,dh,di){if(this['_Ca_x_']['evidence']['size']!=0x0)throw new Error();try{this['_Ca_x_']['evidence']['copy'](dg,dh,di);if(this['_Cb_x_']==null){this['_Cb_x_']=new Zzy_x_(this['_Bc_x_']['nodes']['size']);}var dj=new Xzyw_x_(0x0);var dk=new Xzyy_x_(0x0);var dl=[dh];var dm=Ywz_x_['rvu_x_'](this['_Ca_x_']['evidence'],dl,0x1,this['_Bg_x_']['terminalTime']);Yww_x_['rvq_x_'](this['_Ca_x_']['evidence'],dl,0x1,dm,dj,dk,this['_Bc_x_'],this['_Bg_x_']['propagation']);return Xzz_x_['ruv_x_'](this['_Bc_x_'],this['_Bg_x_'],this['_Cb_x_'],this['_Ca_x_']['evidence'],new Xyx_x_(this['_Bc_x_']['nodes']['size']),dj['Egf_x_'],dk['Ehb_x_'],dj['Egg_x_'],dm,!![]);}finally{this['_Ca_x_']['evidence']['clear'](dh,di);}};cn['prototype']['_tr_x_']=function(dn,dp,dq,dr){var ds=this['sr_x_'](dp,dq);if(ds==null)throw new Error();if(dr===EvidenceType['Hard']){return Math['log'](ds['table']['get'](dn['getState'](dp,dq)));}else if(dr===EvidenceType['Soft']){var dt=0x0;var du=TypeScriptUtils['createArray'](dp['states']['size'],0x0);dn['getStates'](dp,du,dq);for(var dv=0x0;dv<ds['table']['size'];dv++){dt+=du[dv]*ds['table']['get'](dv);}return Math['log'](dt);}else{throw new Error();}};cn['prototype']['_ts_x_']=function(){this['_Be_x_']=null;this['_Bf_x_']=null;};cn['prototype']['nodeCollectionChange']=function(dw,dx,dy,dz,dA){this['_ts_x_']();};cn['prototype']['variableCollectionChange']=function(dB,dC,dD,dE,dF){this['_ts_x_']();};cn['prototype']['linkCollectionChange']=function(dG,dH,dI,dJ,dK){this['_ts_x_']();};cn['prototype']['statesCollectionChange']=function(dL,dM,dN,dO,dP,dQ){this['_ts_x_']();};cn['prototype']['distributionChanged']=function(dR,dS,dT,dU,dV){this['_ts_x_']();};cn['prototype']['noisyNodeTypeChanged']=function(dW,dX,dY){this['_ts_x_']();};cn['prototype']['noisyOrderChanged']=function(dZ,e0,e1){this['_ts_x_']();};cn['_sq_x_']=function(e2,e3){if(e2['valueType']===core_1['VariableValueType']['Discrete']){return new core_1['Table'](e2,e3);}var e4=e2['node'];var e5=e3!=null?e4['distributions']['findForTime'](e3):e4['distribution'];var e6=new core_1['CLGaussian'](e5['sortedVariables'],core_1['HeadTail']['Head']);if(e3!=null){e6['timeShift'](e3);}return e6;};cn['_tq_x_']=function(e7,e8,e9,ea){var eb=e7['get'](e8,e9);var ec=new Outputs2();var ed=Xyw_x_['rur_x_'](ea,ec,e8,e9,eb);var ee=ec['Out1'];var ef=ec['Out2'];return ef-Math['log'](ed['table']['sum']());};return cn;}();var Xy_x_=function(){function eg(eh,ei,ej){this['Cc_x_']=null;this['Cd_x_']=null;this['Ce_x_']=null;this['Cc_x_']=eh;this['Cd_x_']=ei;this['Ce_x_']=ej;}return eg;}();var Xz_x_=function(){function ek(){}ek['_tt_x_']=function(el,em,en,eo){eo['Out1']=0x0;var ep=em['sortedVariables'];var eq=ep['size'];var er=![];for(var es=0x0;es<eq;es++){var et=ep['get'](es)['variable'];if(et['node']['variables']['size']!=0x1){er=!![];break;}if(et['valueType']!=core_1['VariableValueType']['Discrete']){er=!![];break;}}if(!er)return el;var eu=new List(el);el=null;for(var ev=0x0;ev<eq;ev++){var ew=ep['get'](ev)['variable'];var ex=ew['node'];if(ex['variables']['size']===0x1&&ew['valueType']===core_1['VariableValueType']['Discrete'])continue;var ey=ep['get'](ev)['time'];var ez=null;if(ey!=null){ez=TypeScriptUtils['createArray'](ex['variables']['size'],null);for(var eA=0x0;eA<ez['length'];eA++){ez[eA]=ey;}}var eB=new List();for(var eC=eu['size']-0x1;eC>=0x0;eC--){var eD=eu['get'](eC)instanceof core_1['CLGaussian']?eu['get'](eC):null;if(eD==null)continue;if(eD['sortedVariables']['includesAny'](ex['variables'],ez==null?null:new ArrayList(ez))){eu['removeAt'](eC);eB['push'](eD);}}if(eB['size']===0x1){eu['push'](eB['get'](0x0));}else if(eB['size']>0x1){var eE=eB['get'](0x0);for(var eF=0x1;eF<eB['size'];eF++){eE=eE['multiply'](eB['get'](eF));}var eG=0x0;var eH=new Outputs1();eu['push'](Yx_x_['tu_x_'](eE,en,eH));eG=eH['Out1'];eo['Out1']+=eG;}}return eu['toArray']();};return ek;}();var DecisionAlgorithm=function(){function eI(){}eI['SinglePolicyUpdating']=new eI();eI['None']=new eI();eI['Default']=new eI();return eI;}();exports['DecisionAlgorithm']=DecisionAlgorithm;var Yx_x_=function(){function eJ(){}eJ['tu_x_']=function(eK,eL,eM){eM['Out1']=0x0;if(eL['size']===0x0)return eK;if(eK['sortedContinuousTail']['size']!=0x0)return eK;var eN=eK['sortedContinuousHead'];var eO=eN['size'];for(var eP=0x0;eP<eO;eP++){var eQ=eN['get'](eP);var eR=eQ['variable'];var eS=eQ['time'];var eT=eL['get'](eR,eS);if(eT!=null){var eU=void 0x0;var eV=void 0x0;var eW=new Outputs2();eK=Xyw_x_['rur_x_'](eK,eW,eR,eS,eT);eU=eW['Out1'];eV=eW['Out2'];eM['Out1']+=eV;}}return eK;};return eJ;}();var Yy_x_=function(){function eX(){}eX['tv_x_']=function(eY,eZ,f0){for(var f1=0x0;f1<eY['size'];f1++){var f2=eY['get'](f1);var f3=f2['distribution'];var f4=eZ['get'](f1);var f5=f4['distribution'];Xxzy_x_['vuq_x_'](f5,f3,f0);Yzw_x_['_srq_x_'](f4,f2);}};eX['uq_x_']=function(f6,f7,f8){f7['clear']();var f9=TypeScriptUtils['createArray'](f6['size'],null);if(f9['length']>0x0){f6['getVariables'](f9);for(var fa=0x0;fa<f9['length'];fa++){var fb=f9[fa];var fc=f8['get'](fb);if(fb['node']['temporalType']===core_1['TemporalType']['Temporal']){var fd=f6['getMaxTime'](fb);for(var fe=0x0;fe<=fd;fe++){var ff=f6['getEvidenceType'](fb,fe);switch(ff){case EvidenceType['Hard']:var fg=f6['get'](fb,fe);f7['set'](fc,fg,fe);break;case EvidenceType['Soft']:var fh=TypeScriptUtils['createArray'](fb['states']['size'],0x0);f6['getStates'](fb,fh,fe);f7['setStates'](fc,fh,fe);break;default:throw new Error();}}}else{var fi=f6['getEvidenceType'](fb);switch(fi){case EvidenceType['Hard']:var fj=f6['get'](fb);f7['set'](fc,fj);break;case EvidenceType['Soft']:var fk=TypeScriptUtils['createArray'](fb['states']['size'],0x0);f6['getStates'](fb,fk);f7['setStates'](fc,fk);break;default:throw new Error();}}}}};eX['ur_x_']=function(fl,fm,fn){fm['clear']();for(var fo=0x0;fo<fl['size'];fo++){var fp=new List();var fq=fl['get'](fo);var fr=fq['distribution'];var fs=![];for(var ft=0x0;ft<fr['sortedVariables']['size'];ft++){var fu=fr['sortedVariables']['get'](ft);if(fu['variable']['valueType']===core_1['VariableValueType']['Continuous']){fs=!![];}var fv=new core_1['VariableContext'](fn['get'](fu['variable']),fu['time'],fu['headTail']);fp['push'](fv);}var fw=fs?new core_1['CLGaussian'](fp):new core_1['Table'](fp);var fx=new QueryDistribution(fw,fq['isEnabled']);fx['queryLogLikelihood']=fq['queryLogLikelihood'];fx['comparison']=fq['comparison'];fm['push'](fx);}};return eX;}();var Evidence=function(){function fy(fz){this['_1b3c77a7ef11437c93c3830de82e7500']=null;this['_Cf_x_']=new LinkedList(Number);this['_Cg_x_']=null;this['_Ch_x_']=null;this['_Da_x_']=null;this['_Db_x_']=0x0;this['_Dc_x_']=0x0;this['_Dd_x_']=new Zz_x_(0x1);if(fz!==undefined){if(fz instanceof core_1['Network']){this['_cons_autogen0'](fz);}else if(fz instanceof fy){this['_cons_autogen2'](fz);}else if(TypeScriptInferenceUtils['isIEvidence'](fz)){var fA=fz;this['_cons_autogen0'](fA['network']);this['_cons_autogen1'](fz);}else{throw new Error('Invalid\x20constructor\x20arguments.');}}else{throw new Error('Invalid\x20constructor\x20arguments.');}}fy['prototype']['_cons_autogen0']=function(fB){this['_rqv_x_'](fB);};fy['prototype']['_cons_autogen1']=function(fC){if(fC==null){throw new ReferenceError('evidence');}this['copy'](fC);};fy['prototype']['_cons_autogen2']=function(fD){if(fD==null){throw new ReferenceError('evidence');}this['_rqv_x_'](fD['_Da_x_']);this['_rqs_x_'](fD);};Object['defineProperty'](fy['prototype'],'size',{'get':function(){return this['_Cf_x_']['size'];},'enumerable':!![],'configurable':!![]});Object['defineProperty'](fy['prototype'],'network',{'get':function(){return this['_Da_x_'];},'enumerable':!![],'configurable':!![]});Object['defineProperty'](fy['prototype'],'weight',{'get':function(){return this['_Dd_x_']['k_x_'];},'set':function(fE){if(this['_Dd_x_']['k_x_']===fE){return;}this['_Dd_x_']['k_x_']=fE;},'enumerable':!![],'configurable':!![]});Object['defineProperty'](fy['prototype'],'logWeight',{'get':function(){return this['_Dd_x_']['l_x_'];},'set':function(fF){if(this['_Dd_x_']['l_x_']===fF){return;}this['_Dd_x_']['l_x_']=fF;},'enumerable':!![],'configurable':!![]});fy['prototype']['beginUpdate']=function(){this['_Db_x_']++;};fy['prototype']['clear']=function(fG,fH){if(fH!==undefined){if(fG instanceof core_1['Variable']){this['_Clear_autogen0'](fG,fH);}else if(fG instanceof core_1['Node']){this['_Clear_autogen1'](fG,fH);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(fG!==undefined){if(fG instanceof core_1['Variable']){this['_Clear_autogen2'](fG);}else if(fG instanceof core_1['Node']){this['_Clear_autogen3'](fG);}else{throw new Error('Invalid\x20method\x20arguments.');}}else{this['_Clear_autogen4']();}};fy['prototype']['_Clear_autogen0']=function(fI,fJ){this['_rrr_x_'](fI,![]);if(fJ==null){this['_rqq_x_'](fI['index'],![]);}else{var fK=this['_Cg_x_'][fI['index']];if(fK['Bed_x_']['list']==null){}else{fK['Bea_x_']['svs_x_'](fJ);if(fK['Bea_x_']['lk_x_']===0x0){this['_Cf_x_']['remove'](fK['Bed_x_']);fK['Beb_x_']=EvidenceType['None'];}}}};fy['prototype']['_Clear_autogen1']=function(fL,fM){if(fL==null)throw new ReferenceError('node');if(fL['variables']['size']!=0x1)throw new Error('Method\x20only\x20supports\x20nodes\x20with\x20one\x20variable.');this['clear'](fL['variables']['get'](0x0),fM);};fy['prototype']['_Clear_autogen2']=function(fN){this['clear'](fN,null);};fy['prototype']['_Clear_autogen3']=function(fO){if(fO==null)throw new ReferenceError('node');var fP=fO['variables'];var fQ=fP['size'];for(var fR=0x0;fR<fQ;fR++){this['clear'](fP['get'](fR));}};fy['prototype']['_Clear_autogen4']=function(){this['_rqr_x_'](!![]);};fy['prototype']['copy']=function(fS,fT,fU){if(fU!==undefined){this['_Copy_autogen2'](fS,fT,fU);}else if(fT!==undefined){this['_Copy_autogen1'](fS,fT);}else if(fS!==undefined){this['_Copy_autogen0'](fS);}else{throw new Error('Invalid\x20method\x20arguments.');}};fy['prototype']['_Copy_autogen0']=function(fV){if(fV==null)throw new ReferenceError('evidence');this['_rqr_x_'](![]);var fW=fV instanceof fy?fV:null;if(fW!=null){this['_rqs_x_'](fW);}else{this['_Dd_x_']['l_x_']=fV['logWeight'];var fX=TypeScriptUtils['createArray'](fV['size'],null);fV['getVariables'](fX);for(var fY=0x0;fY<fX['length'];fY++){var fZ=fX[fY];this['_rqt_x_'](fV,fZ,![]);}}};fy['prototype']['_Copy_autogen1']=function(g0,g1){this['_rqt_x_'](g0,g1,!![]);};fy['prototype']['_Copy_autogen2']=function(g2,g3,g4){this['_rqu_x_'](g2,g3,g4,!![]);};fy['prototype']['endUpdate']=function(){this['_Db_x_']--;var g5=this['_Db_x_'];if(g5===0x0){}};fy['prototype']['get']=function(g6,g7,g8,g9,ga){if(ga!==undefined){if(g6 instanceof core_1['Variable']){this['_Get_autogen3'](g6,g7,g8,g9,ga);}else if(g6 instanceof core_1['Node']){this['_Get_autogen4'](g6,g7,g8,g9,ga);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(g9!==undefined){throw new Error('Invalid\x20method\x20arguments.');}else if(g8!==undefined){throw new Error('Invalid\x20method\x20arguments.');}else if(g7!==undefined){if(g6 instanceof core_1['Variable']){return this['_Get_autogen1'](g6,g7);}else if(g6 instanceof core_1['Node']){return this['_Get_autogen2'](g6,g7);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(g6!==undefined){if(g6 instanceof core_1['Variable']){return this['_Get_autogen0'](g6);}else if(g6 instanceof core_1['Node']){return this['_Get_autogen5'](g6);}else{throw new Error('Invalid\x20method\x20arguments.');}}else{throw new Error('Invalid\x20method\x20arguments.');}};fy['prototype']['_Get_autogen0']=function(gb){return this['get'](gb,null);};fy['prototype']['_Get_autogen1']=function(gc,gd){this['_rrr_x_'](gc,![]);fy['_vt_x_'](gc,gd);var ge=this['_Cg_x_'][gc['index']];if(gd==null){var gf=gc['index'];if(ge['Beb_x_']!=EvidenceType['Hard']){return null;}return ge['Bdg_x_'];}else{return ge['Bea_x_']['get'](gd);}};fy['prototype']['_Get_autogen2']=function(gg,gh){if(gg==null)throw new ReferenceError('node');if(gg['variables']['size']!=0x1)throw new Error('Method\x20only\x20supports\x20nodes\x20with\x20one\x20variable');return this['get'](gg['variables']['get'](0x0),gh);};fy['prototype']['_Get_autogen3']=function(gi,gj,gk,gl,gm){if(gi==null){throw new ReferenceError('variable');}if(gi['node']['temporalType']!=core_1['TemporalType']['Temporal']){throw new Error('Method\x20can\x20only\x20be\x20called\x20for\x20temporal\x20nodes/variables.');}this['_Cg_x_'][gi['index']]['Bea_x_']['tqq_x_'](gj,gk,gl,gm);};fy['prototype']['_Get_autogen4']=function(gn,go,gp,gq,gr){if(gn==null)throw new ReferenceError('node');if(gn['variables']['size']!=0x1)throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');this['get'](gn['variables']['get'](0x0),go,gp,gq,gr);};fy['prototype']['_Get_autogen5']=function(gs){if(gs==null)throw new ReferenceError('node');if(gs['variables']['size']!=0x1)throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');return this['get'](gs['variables']['get'](0x0));};fy['prototype']['getEvidenceType']=function(gt,gu){if(gu!==undefined){if(gt instanceof core_1['Node']){return this['_GetEvidenceType_autogen2'](gt,gu);}else if(gt instanceof core_1['Variable']){return this['_GetEvidenceType_autogen3'](gt,gu);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(gt!==undefined){if(gt instanceof core_1['Variable']){return this['_GetEvidenceType_autogen0'](gt);}else if(gt instanceof core_1['Node']){return this['_GetEvidenceType_autogen1'](gt);}else{throw new Error('Invalid\x20method\x20arguments.');}}else{throw new Error('Invalid\x20method\x20arguments.');}};fy['prototype']['_GetEvidenceType_autogen0']=function(gv){if(gv==null){throw new ReferenceError('variable');}return this['_Cg_x_'][gv['index']]['Beb_x_'];};fy['prototype']['_GetEvidenceType_autogen1']=function(gw){if(gw==null)throw new ReferenceError('node');if(gw['variables']['size']!=0x1)throw new Error('Method\x20only\x20supports\x20nodes\x20with\x20a\x20single\x20variable.\x20\x20See\x20overloads.');return this['getEvidenceType'](gw['variables']['get'](0x0));};fy['prototype']['_GetEvidenceType_autogen2']=function(gx,gy){if(gx==null)throw new ReferenceError('node');if(gx['variables']['size']!=0x1)throw new Error('Method\x20only\x20supports\x20nodes\x20with\x20a\x20single\x20variable.\x20\x20See\x20overloads.');return this['getEvidenceType'](gx['variables']['get'](0x0),gy);};fy['prototype']['_GetEvidenceType_autogen3']=function(gz,gA){this['_rrr_x_'](gz,![]);if(gA==null){return this['getEvidenceType'](gz);}fy['_vt_x_'](gz,gA);return this['_Cg_x_'][gz['index']]['Bea_x_']['svq_x_'](gA);};fy['prototype']['getMaxTime']=function(gB){if(gB!==undefined){return this['_GetMaxTime_autogen0'](gB);}else{return this['_GetMaxTime_autogen1']();}};fy['prototype']['_GetMaxTime_autogen0']=function(gC){if(gC==null){throw new ReferenceError('variable');}if(gC['node']==null){throw new Error('variable\x20does\x20not\x20belong\x20to\x20a\x20node.');}if(gC['node']['temporalType']!=core_1['TemporalType']['Temporal']){return null;}return this['_Cg_x_'][gC['index']]['Bea_x_']['tqs_x_']();};fy['prototype']['_GetMaxTime_autogen1']=function(){var gD=null;var gE=this['_Da_x_']['variables'];for(var gF=0x0;gF<gE['size'];gF++){var gG=this['getMaxTime'](gE['get'](gF));if(gG!=null){if(gD==null){gD=gG;}else{gD=Math['max'](gD,gG);}}}return gD;};fy['prototype']['getState']=function(gH,gI){if(gI!==undefined){if(gH instanceof core_1['Variable']){return this['_GetState_autogen1'](gH,gI);}else if(gH instanceof core_1['Node']){return this['_GetState_autogen3'](gH,gI);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(gH!==undefined){if(gH instanceof core_1['Variable']){return this['_GetState_autogen0'](gH);}else if(gH instanceof core_1['Node']){return this['_GetState_autogen2'](gH);}else{throw new Error('Invalid\x20method\x20arguments.');}}else{throw new Error('Invalid\x20method\x20arguments.');}};fy['prototype']['_GetState_autogen0']=function(gJ){return this['getState'](gJ,null);};fy['prototype']['_GetState_autogen1']=function(gK,gL){this['_rrr_x_'](gK,![]);fy['_vt_x_'](gK,gL);if(gK['valueType']!=core_1['VariableValueType']['Discrete']){throw new Error('variable\x20is\x20not\x20discrete.');}var gM=this['_Cg_x_'][gK['index']];if(gL!=null){var gN=gM['Bea_x_']['get'](gL);if(gN!=null){return gN;}else{return null;}}else{if(gM['Beb_x_']!=EvidenceType['Hard']){return null;}return gM['Bdg_x_'];}};fy['prototype']['_GetState_autogen2']=function(gO){if(gO==null){throw new ReferenceError('node');}if(gO['variables']['size']!=0x1){throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');}return this['getState'](gO['variables']['get'](0x0));};fy['prototype']['_GetState_autogen3']=function(gP,gQ){if(gP==null){throw new ReferenceError('node');}if(gP['variables']['size']!=0x1){throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');}return this['getState'](gP['variables']['get'](0x0),gQ);};fy['prototype']['getStates']=function(gR,gS,gT){if(gT!==undefined){if(gR instanceof core_1['Node']){this['_GetStates_autogen3'](gR,gS,gT);}else if(gR instanceof core_1['Variable']){this['_GetStates_autogen4'](gR,gS,gT);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(gS!==undefined){if(gR instanceof core_1['Variable']){this['_GetStates_autogen0'](gR,gS);}else if(gR instanceof core_1['Node']){this['_GetStates_autogen1'](gR,gS);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(gR!==undefined){this['_GetStates_autogen2'](gR);}else{throw new Error('Invalid\x20method\x20arguments.');}};fy['prototype']['_GetStates_autogen0']=function(gU,gV){this['_us_x_'](gU,gV,null);};fy['prototype']['_GetStates_autogen1']=function(gW,gX){if(gW['variables']['size']!=0x1)throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');this['getStates'](gW['variables']['get'](0x0),gX);};fy['prototype']['_GetStates_autogen2']=function(gY){if(gY['sortedVariables']['size']!=0x1)throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20table');var gZ=TypeScriptUtils['createArray'](gY['size'],0x0);this['_us_x_'](gY['sortedVariables']['get'](0x0)['variable'],gZ,gY['sortedVariables']['get'](0x0)['time']);gY['copyFrom'](gZ);};fy['prototype']['_GetStates_autogen3']=function(h0,h1,h2){if(h0['variables']['size']!=0x1){throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');}this['_us_x_'](h0['variables']['get'](0x0),h1,h2);};fy['prototype']['_GetStates_autogen4']=function(h3,h4,h5){this['_us_x_'](h3,h4,h5);};fy['prototype']['_us_x_']=function(h6,h7,h8){this['_rrr_x_'](h6,![]);fy['_vt_x_'](h6,h8);if(h7==null){throw new ReferenceError('buffer');}if(h6['valueType']!=core_1['VariableValueType']['Discrete']){throw new Error('variable\x20is\x20not\x20discrete');}var h9=this['_Cg_x_'][h6['index']];if(h6['node']['temporalType']===core_1['TemporalType']['Temporal']){h9['Bea_x_']['svu_x_'](h7,h8);}else{var ha=h9['Beb_x_'];if(ha===EvidenceType['Soft']){TypeScriptUtils['arrayCopy3'](h9['Bdh_x_'],h7,h6['states']['size']);}else if(ha===EvidenceType['Hard']){var hb=h9['Bdg_x_'];var hc=h6['states']['size'];for(var hd=0x0;hd<hc;hd++){h7[hd]=hd===hb?0x1:0x0;}}else{var he=h6['states']['size'];for(var hf=0x0;hf<he;hf++){h7[hf]=0x1;}}}};fy['prototype']['getVariables']=function(hg){if(hg['length']<this['_Cf_x_']['size']){throw new Error('buffer\x20must\x20have\x20length\x20of\x20at\x20least\x20count.');}var hh=this['_Cf_x_']['first'];var hi=0x0;while(hh!=null){var hj=hh['value']['valueOf']();hg[hi++]=this['_Da_x_']['variables']['get'](hj);hh=hh['next'];}};fy['prototype']['set']=function(hk,hl,hm,hn,ho){if(ho!==undefined){if(hk instanceof core_1['Variable']){this['_Set_autogen0'](hk,hl,hm,hn,ho);}else if(hk instanceof core_1['Node']){this['_Set_autogen1'](hk,hl,hm,hn,ho);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(hn!==undefined){throw new Error('Invalid\x20method\x20arguments.');}else if(hm!==undefined){if(hk instanceof core_1['Node']){this['_Set_autogen3'](hk,hl,hm);}else if(hk instanceof core_1['Variable']){this['_Set_autogen4'](hk,hl,hm);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(hl!==undefined){if(hk instanceof core_1['Variable']){this['_Set_autogen2'](hk,hl);}else if(hk instanceof core_1['Node']){this['_Set_autogen5'](hk,hl);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(hk!==undefined){throw new Error('Invalid\x20method\x20arguments.');}else{throw new Error('Invalid\x20method\x20arguments.');}};fy['prototype']['_Set_autogen0']=function(hp,hq,hr,hs,ht){if(hp==null){throw new ReferenceError('variable');}if(hp['node']['temporalType']!=core_1['TemporalType']['Temporal']){throw new Error('Method\x20can\x20only\x20be\x20called\x20for\x20temporal\x20nodes/variables.');}var hu=this['_Cg_x_'][hp['index']];hu['Bea_x_']['tqr_x_'](hq,hr,hs,ht);hu['Beb_x_']=hu['Bea_x_']['lk_x_']>0x0?EvidenceType['Temporal']:EvidenceType['None'];this['_rrq_x_'](hp['index'],hu['Bea_x_']['lk_x_']>0x0);};fy['prototype']['_Set_autogen1']=function(hv,hw,hx,hy,hz){if(hv==null){throw new ReferenceError('node');}if(hv['variables']['size']!=0x1){throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');}this['set'](hv['variables']['get'](0x0),hw,hx,hy,hz);};fy['prototype']['_Set_autogen2']=function(hA,hB){this['set'](hA,hB,null);};fy['prototype']['_Set_autogen3']=function(hC,hD,hE){if(hC==null){throw new ReferenceError('node');}if(hC['variables']['size']!=0x1){throw new Error('Method\x20only\x20supports\x20nodes\x20with\x20a\x20single\x20variable.');}this['set'](hC['variables']['get'](0x0),hD,hE);};fy['prototype']['_Set_autogen4']=function(hF,hG,hH){this['_rrr_x_'](hF,!![]);fy['_vt_x_'](hF,hH);fy['_ut_x_'](hF,hG);var hI=this['_Cg_x_'][hF['index']];if(hH==null){var hJ=hI['Bed_x_'];if(hG!=null){if(hJ['list']==null){if(hH==null){hI['Bdg_x_']=hG;this['_Cf_x_']['addLast'](hJ);}else{throw new Error();}}else{if(hH==null){hI['Bdg_x_']=hG;hI['Bdh_x_']=null;}else{throw new Error();}}hI['Beb_x_']=EvidenceType['Hard'];}else{this['clear'](hF);}}else{hI['Bea_x_']['set'](hH,hG);var hK=hI['Bea_x_']['lk_x_']>0x0?EvidenceType['Temporal']:EvidenceType['None'];hI['Beb_x_']=hK;this['_rrq_x_'](hF['index'],hK!=EvidenceType['None']);}};fy['prototype']['_Set_autogen5']=function(hL,hM){if(hL==null){throw new ReferenceError('node');}if(hL['variables']['size']!=0x1){throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');}this['set'](hL['variables']['get'](0x0),hM);};fy['prototype']['setState']=function(hN,hO,hP){if(hP!==undefined){if(hN instanceof core_1['Variable']){this['_SetState_autogen1'](hN,hO,hP);}else if(hN instanceof core_1['Node']){this['_SetState_autogen5'](hN,hO,hP);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(hO!==undefined){if(hN instanceof core_1['Variable']){this['_SetState_autogen0'](hN,hO);}else if(hN instanceof core_1['State']){this['_SetState_autogen3'](hN,hO);}else if(hN instanceof core_1['Node']){this['_SetState_autogen4'](hN,hO);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(hN!==undefined){this['_SetState_autogen2'](hN);}else{throw new Error('Invalid\x20method\x20arguments.');}};fy['prototype']['_SetState_autogen0']=function(hQ,hR){this['set'](hQ,hR);};fy['prototype']['_SetState_autogen1']=function(hS,hT,hU){this['set'](hS,hT,hU);};fy['prototype']['_SetState_autogen2']=function(hV){if(hV==null)throw new ReferenceError('state');if(hV['variable']==null)throw new Error('state\x20does\x20not\x20belong\x20to\x20a\x20variable');this['setState'](hV['variable'],hV['index']);};fy['prototype']['_SetState_autogen3']=function(hW,hX){if(hW==null)throw new ReferenceError('state');if(hW['variable']==null)throw new Error('state\x20does\x20not\x20belong\x20to\x20a\x20variable');this['setState'](hW['variable'],hW['index'],hX);};fy['prototype']['_SetState_autogen4']=function(hY,hZ){if(hY==null)throw new ReferenceError('node');if(hY['variables']['size']!=0x1)throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');this['setState'](hY['variables']['get'](0x0),hZ);};fy['prototype']['_SetState_autogen5']=function(i0,i1,i2){if(i0==null)throw new ReferenceError('node');if(i0['variables']['size']!=0x1)throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');this['setState'](i0['variables']['get'](0x0),i1,i2);};fy['prototype']['setStates']=function(i3,i4,i5){if(i5!==undefined){if(i3 instanceof core_1['Node']){this['_SetStates_autogen2'](i3,i4,i5);}else if(i3 instanceof core_1['Variable']){this['_SetStates_autogen3'](i3,i4,i5);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(i4!==undefined){if(i3 instanceof core_1['Variable']){this['_SetStates_autogen0'](i3,i4);}else if(i3 instanceof core_1['Node']){this['_SetStates_autogen1'](i3,i4);}else{throw new Error('Invalid\x20method\x20arguments.');}}else if(i3!==undefined){throw new Error('Invalid\x20method\x20arguments.');}else{throw new Error('Invalid\x20method\x20arguments.');}};fy['prototype']['_SetStates_autogen0']=function(i6,i7){this['setStates'](i6,i7,null);};fy['prototype']['_SetStates_autogen1']=function(i8,i9){if(i8==null)throw new ReferenceError('node');if(i8['variables']['size']!=0x1)throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');this['setStates'](i8['variables']['get'](0x0),i9);};fy['prototype']['_SetStates_autogen2']=function(ia,ib,ic){if(ia==null)throw new ReferenceError('node');if(ia['variables']['size']!=0x1)throw new Error('This\x20method\x20can\x20only\x20be\x20called\x20with\x20a\x20single\x20variable\x20node');this['setStates'](ia['variables']['get'](0x0),ib,ic);};fy['prototype']['_SetStates_autogen3']=function(id,ie,ig){this['_rrr_x_'](id,!![]);fy['_vt_x_'](id,ig);if(id['valueType']!=core_1['VariableValueType']['Discrete']){throw new Error('variable\x20is\x20not\x20discrete.');}var ih=this['_Cg_x_'][id['index']];if(ie!=null){if(ie['length']!=id['states']['size']){throw new Error('values\x20length\x20must\x20match\x20variable\x20state\x20count.');}var ii=!![];var ij=!![];var ik=null;var il=ie['length'];for(var im=0x0;im<il;im++){var io=ie[im];if(io<0x0){throw new Error('Soft\x20evidence\x20cannot\x20be\x20negative.');}if(io!=0x1){ii=![];}if(io!=0x0){if(ik!=null){ij=![];}else{ik=im;}}}if(!(ik!=null)){throw new Error('Soft\x20evidence\x20cannot\x20contain\x20all\x20zeros.');}if(ii){this['setState'](id,null,ig);return;}if(ij&&ie[ik]===0x1){this['setState'](id,ik,ig);return;}var ip=ih['Bed_x_'];if(ip['list']==null){if(id['node']['temporalType']===core_1['TemporalType']['Temporal']){ih['Bea_x_']['svt_x_'](ie,ig);}else{ih['Bdh_x_']=TypeScriptUtils['createArray'](ie['length'],0x0);TypeScriptUtils['arrayCopy5'](ie,0x0,ih['Bdh_x_'],0x0,ie['length']);}this['_Cf_x_']['addLast'](ip);}else{if(id['node']['temporalType']===core_1['TemporalType']['Temporal']){ih['Bea_x_']['svt_x_'](ie,ig);}else{ih['Bdg_x_']=null;if(ih['Bdh_x_']==null||ih['Bdh_x_']['length']<ie['length']){ih['Bdh_x_']=TypeScriptUtils['createArray'](ie['length'],0x0);}TypeScriptUtils['arrayCopy5'](ie,0x0,ih['Bdh_x_'],0x0,ie['length']);}}if(id['node']['temporalType']===core_1['TemporalType']['Temporal']){ih['Beb_x_']=EvidenceType['Temporal'];}else{ih['Beb_x_']=EvidenceType['Soft'];}}else{this['clear'](id,ig);}};fy['prototype']['_uu_x_']=function(iq,ir,is,it,iu){};fy['prototype']['_uv_x_']=function(iv,iw,ix,iy,iz){};fy['prototype']['_vq_x_']=function(iA,iB,iC,iD,iE){};fy['prototype']['_vr_x_']=function(iF,iG,iH,iI,iJ,iK){if(!iK)return;if(iF['valueType']!=core_1['VariableValueType']['Discrete'])throw new Error('State\x20count\x20change\x20on\x20continuous\x20variable\x20not\x20allowed');var iL=this['getEvidenceType'](iF);if(iL===EvidenceType['None'])return;if(iJ===core_1['CollectionAction']['Clear']||iJ===core_1['CollectionAction']['Replace']){this['clear'](iF);return;}if(iL===EvidenceType['Hard']){this['_vu_x_'](iF,iG,iJ,null);}else if(iL===EvidenceType['Soft']){this['_vv_x_'](iF,iG,iJ,null);}else if(iL===EvidenceType['Temporal']){var iM=this['getMaxTime'](iF);if(iM!=null){for(var iN=0x0;iN<=iM;iN++){var iO=this['getEvidenceType'](iF,iN);if(iO===EvidenceType['Hard']){this['_vu_x_'](iF,iG,iJ,iN);}else if(iO===EvidenceType['Soft']){this['_vv_x_'](iF,iG,iJ,iN);}}}}};fy['prototype']['_vs_x_']=function(iP,iQ,iR,iS,iT){if(!iT){return;}this['_Dc_x_']=this['_Da_x_']['variables']['size'];switch(iS){case core_1['CollectionAction']['Insert']:{if(this['_Cg_x_']['length']<this['_Dc_x_']){var iU=this['_Cg_x_']['length']===0x0?0x4:this['_Cg_x_']['length']*0x2;var iV=TypeScriptUtils['createArray'](iU,null);TypeScriptUtils['arrayCopy5'](this['_Cg_x_'],0x0,iV,0x0,this['_Cg_x_']['length']);this['_Cg_x_']=iV;}for(var iW=this['_Dc_x_']-0x1;iW>iP;iW--){this['_Cg_x_'][iW]=this['_Cg_x_'][iW-0x1];this['_Cg_x_'][iW]['Bed_x_']['value']=iW;}var iX=new Zzx_x_(iQ);this['_Cg_x_'][iP]=iX;if(iX['Bed_x_']['value']!=iP){throw new Error('Index\x20mismatch');}}break;case core_1['CollectionAction']['Remove']:{this['_rqq_x_'](iP,!![]);for(var iY=iP+0x1;iY<=this['_Dc_x_'];iY++){this['_Cg_x_'][iY-0x1]=this['_Cg_x_'][iY];this['_Cg_x_'][iY-0x1]['Bed_x_']['value']=iY-0x1;}this['_Cg_x_'][this['_Dc_x_']]=null;}break;case core_1['CollectionAction']['Replace']:this['_rqq_x_'](iP,!![]);this['_Cg_x_'][iP]=new Zzx_x_(iQ);break;case core_1['CollectionAction']['Clear']:this['clear']();break;}};fy['prototype']['_vu_x_']=function(iZ,j0,j1,j2){if(iZ['valueType']===core_1['VariableValueType']['Continuous'])return;var j3=this['getState'](iZ,j2);if(!(j3!=null))return;switch(j1){case core_1['CollectionAction']['Insert']:if(j0<=j3){this['setState'](iZ,j3+0x1);}break;case core_1['CollectionAction']['Remove']:if(j0===j3){this['clear'](iZ,j2);}else if(j0<j3){this['setState'](iZ,j3-0x1,j2);}break;default:break;}};fy['prototype']['_vv_x_']=function(j4,j5,j6,j7){if(j4['valueType']===core_1['VariableValueType']['Continuous']){return;}var j8=this['_Cg_x_'][j4['index']];if(j6===core_1['CollectionAction']['Insert']){var j9=TypeScriptUtils['createArray'](j4['states']['size']-0x1,0x0);if(j4['node']['temporalType']===core_1['TemporalType']['Temporal']){TypeScriptUtils['arrayCopy3'](j8['Bea_x_']['p_x_'][j7],j9,j4['states']['size']-0x1);}else{TypeScriptUtils['arrayCopy3'](j8['Bdh_x_'],j9,j4['states']['size']-0x1);}var ja=TypeScriptUtils['createArray'](j9['length']+0x1,0x0);var jb=0x0;var jc=![];for(var jd=0x0;jd<ja['length'];jd++){if(jd!=j5){var je=j9[jb++];ja[jd]=je;if(je!=0x0){jc=!![];}}}if(jc){this['setStates'](j4,ja,j7);}else{this['clear'](j4,j7);}}else if(j6===core_1['CollectionAction']['Remove']){var jf=TypeScriptUtils['createArray'](j4['states']['size']+0x1,0x0);if(j4['node']['temporalType']===core_1['TemporalType']['Temporal']){TypeScriptUtils['arrayCopy3'](j8['Bea_x_']['p_x_'][j7],jf,j4['states']['size']+0x1);}else{TypeScriptUtils['arrayCopy3'](j8['Bdh_x_'],jf,j4['states']['size']+0x1);}var jg=TypeScriptUtils['createArray'](jf['length']-0x1,0x0);var jh=0x0;var ji=![];for(var jj=0x0;jj<jf['length'];jj++){if(jj!=j5){var jk=jf[jj];jg[jh++]=jk;if(jk!=0x0){ji=!![];}}}if(ji){this['setStates'](j4,jg,j7);}else{this['clear'](j4,j7);}}else{}};fy['prototype']['_rqq_x_']=function(jl,jm){var jn=this['_Cg_x_'][jl];if(jn['Bed_x_']['list']!=null){this['_Cf_x_']['remove'](jn['Bed_x_']);jn['Bdg_x_']=null;jn['Bdh_x_']=null;if(jn['Bea_x_']!=null){jn['Bea_x_']['svr_x_']();}jn['Beb_x_']=EvidenceType['None'];if(jm){}}else{}};fy['prototype']['_rqr_x_']=function(jo){if(this['size']===0x0){return;}this['_Dd_x_']['k_x_']=0x1;this['_Cf_x_']['clear']();for(var jp=0x0;jp<this['_Dc_x_'];jp++){var jq=this['_Cg_x_'][jp];jq['Bdg_x_']=null;jq['Bdh_x_']=null;if(jq['Bea_x_']!=null){jq['Bea_x_']['svr_x_']();}jq['Beb_x_']=EvidenceType['None'];}if(jo){}};fy['prototype']['_rqs_x_']=function(jr){this['_Dd_x_']['l_x_']=jr['logWeight'];var js=jr['_Cf_x_']['first'];while(js!=null){var jt=js['value']['valueOf']();var ju=this['_Cg_x_'][jt];var jv=jr['_Cg_x_'][jt];ju['Beb_x_']=jv['Beb_x_'];ju['Bdg_x_']=jv['Bdg_x_'];var jw=jv['Bdh_x_'];if(jw!=null){var jx=TypeScriptUtils['createArray'](jw['length'],0x0);TypeScriptUtils['arrayCopy5'](jw,0x0,jx,0x0,jw['length']);ju['Bdh_x_']=jx;}var jy=jv['Bea_x_'];ju['Bea_x_']=jy['suv_x_']();this['_Cf_x_']['addLast'](ju['Bed_x_']);js=js['next'];}};fy['prototype']['_rqt_x_']=function(jz,jA,jB){var jC=jz['getEvidenceType'](jA);if(jC===EvidenceType['Hard']){this['set'](jA,jz['get'](jA));}else if(jC===EvidenceType['Soft']){var jD=TypeScriptUtils['createArray'](jA['states']['size'],0x0);jz['getStates'](jA,jD);this['setStates'](jA,jD);}else if(jC===EvidenceType['Temporal']){var jE=jz['getMaxTime'](jA);var jF=jE==null?0x0:jE+0x1;var jG=TypeScriptUtils['createArray'](jF,null);jz['get'](jA,jG,0x0,0x0,jG['length']);this['set'](jA,jG,0x0,0x0,jG['length']);}else{throw new Error('Evidence\x20type\x20not\x20recognized.');}if(jB){}};fy['prototype']['_rqu_x_']=function(jH,jI,jJ,jK){if(jJ==null){this['_rqt_x_'](jH,jI,jK);return;}var jL=jH['getEvidenceType'](jI,jJ);if(jL===EvidenceType['Hard']){this['set'](jI,jH['get'](jI,jJ),jJ);}else if(jL===EvidenceType['Soft']){var jM=TypeScriptUtils['createArray'](jI['states']['size'],0x0);jH['getStates'](jI,jM,jJ);this['setStates'](jI,jM,jJ);}else if(jL===EvidenceType['Temporal']){throw new Error('Evidence\x20type\x20is\x20temporal\x20but\x20a\x20time\x20was\x20specified');}else{throw new Error('Evidence\x20type\x20not\x20recognized.');}if(jK){}};fy['prototype']['_rqv_x_']=function(jN){if(jN==null){throw new ReferenceError('network');}this['_Dc_x_']=jN['variables']['size'];this['_Da_x_']=jN;this['_Ch_x_']=new Zw_x_(jN,this);this['_Cg_x_']=TypeScriptUtils['createArray'](this['_Dc_x_'],null);for(var jO=0x0;jO<this['_Dc_x_'];jO++){this['_Cg_x_'][jO]=new Zzx_x_(jN['variables']['get'](jO));}};fy['pro