// ~->[DNET-1]->~ // File created by an unlicensed user using Netica 5.04- on Jan 16, 2012 at 11:20:30. bnet N7___Bouncing2 { numdimensions = 1; autoupdate = TRUE; comment = "\n\ \| Bouncing Ball Copyright 1997-2012 Norsys Software Corp.\n\ \| From Brent Boerlage.\n\n\ This is a \"time series\" bayes net (also known as a \"dynamic bayes net\") to model a ball \n\ which bounces back and forth in a straight line between two parallel barriers without \n\ loosing any energy at each bounce. Initially we have no knowledge of the position or \n\ velocity of the ball.\n\n\ The Position and Velocity nodes stand for the position and velocity at each instant of time, \n\ and are connected together with brown time delay links (and could also have regular black\n\ links as well if desired). You can think of a time delay link as delivering to the arrow\n\ of the link the value that the tail had some period of time ago, with that period of time\n\ being the link's delay.\n\n\ If you double-click on the Position node you can see the equation which defines the new \n\ position in terms of the old position, and the velocity. It involves the constant \"dt\", \n\ whose value may be changed (by right-clicking on the dt node) to provide a different amount \n\ of time between time slices. \n\n\ By clicking down on the selector that originally says \"Equation\", you can choose \"Ranges\" \n\ to see how the node has been discretized. Later, you can edit this list to change the \n\ discretization.\n\n\ This net has already had it's probability tables (CPTs) built from the equation at each node.\n\ If it didn't have, the first step would be to build the CPTs for the current discretization,\n\ by making sure that no nodes are selected and choosing Table -> Equation\A0to\A0Table from \n\ the main menu. You could enter 1000 when prompted for the number of samples per cell and \n\ press \"No\" when asked about including sampling uncertainty.\n\n\ Next you generate a time expanded version of the net by doing Network -> Expand\A0Time. \n\ Enter 2 in the dialog box for the expansion time and 1 for the burn-in time.\n\ This will make a new window with a new net in it. You will probably want to resize this \n\ window to make it wider; you can use Layout -> Drawing Size and make the entry blank.\n\ The new net is a regular bayes net with each Position and Velocity node \n\ representing the position and velocity at a new point in time, with nodes to the right \n\ corresponding to later times.\n\n\ Finally you can compile the bayes net for probabilistic inference with Network -> Compile. \n\ Experiment with setting the position or velocity (by clicking on the desired range) to \n\ indicate observations at certain times, and see how the beliefs for position and velocity \n\ at all other times change.\n\n\ An interesting situation is when the ball is near the boundary, but you don\92t know which way \ it \n\ is going, since after a little while it will surely be moving away from the boundary (perhaps \ due \n\ to a bounce). Or if the positions at 2 times are known, can it infer the velocity? Or if just \n\ the velocities at two adjacent times are known, and one is the negative of the other, can it \ infer \n\ the position (because it must have bounced). You can also try entering some negative findings \n\ (that the ball isn't at some particular position or velocity) by holding down the SHIFT key when \ \|\n\ you click on the range.\n\n\ Remember that the numerical results will not be exact, due to the discretization and sampling \n\ error in converting the equations to probability tables. You may also want to try a finer \n\ discretization by changing the Ranges of the original unexpanded net.\n\n\ When you build your own time delay nets, to make some links represent a time delay, select the \n\ links, then choose Modify -> Delay Links (or right-click a link and choose \"Delay\"). \n\ Alternately, you can use the node dialog box by double-clicking the child node, then choosing \n\ \"Input Delay\" from the multi-purpose selector at the bottom.\n\n\ Assigning delays to the links is usually adequate to create a model that you are later going to\n\ time-expand. However, sometimes it is useful to be able to control the duration of time each\n\ node has in the expanded net, before another node is created to stand for the same variable\n\ at the next time interval. To do that you can use the pre-expanded node's dialog box, \n\ choosing \"Persistance\" from the multi-purpose selector.\n\n\ "; author = "BoerlageB"; whenchanged = 1326741630; visual V1 { defdispform = BELIEFBARS; nodelabeling = TITLE; NodeMaxNumEntries = 50; nodefont = font {shape= "Arial"; size= 10;}; linkfont = font {shape= "Arial"; size= 9;}; windowposn = (15, 5, 288, 478); CommentShowing = TRUE; CommentWindowPosn = (14, 477, 859, 897); resolution = 72; drawingbounds = (240, 420); showpagebreaks = FALSE; usegrid = TRUE; gridspace = (6, 6); NodeSet Node {BuiltIn = 1; Color = 0x00C0C0C0;}; NodeSet Nature {BuiltIn = 1; Color = 0x00F8EED2;}; NodeSet Deterministic {BuiltIn = 1; Color = 0x00D3CAA6;}; NodeSet Finding {BuiltIn = 1; Color = 0x00C8C8C8;}; NodeSet Constant {BuiltIn = 1; Color = 0x00FFFFFF;}; NodeSet ConstantValue {BuiltIn = 1; Color = 0x00FFFFB4;}; NodeSet Utility {BuiltIn = 1; Color = 0x00FFBDBD;}; NodeSet Decision {BuiltIn = 1; Color = 0x00DEE8FF;}; NodeSet Documentation {BuiltIn = 1; Color = 0x00F0FAFA;}; NodeSet Title {BuiltIn = 1; Color = 0x00FFFFFF;}; PrinterSetting A { margins = (1270, 1270, 1270, 1270); magnify = 1; }; }; node x { kind = NATURE; discrete = FALSE; chance = CHANCE; levels = (0, 0, 2, 4, 6, 8, 10, 10); inputs = (xd, vd); parents = (x, v); probs = // 0 0 to 2 2 to 4 4 to 6 6 to 8 8 to 10 10 // xd vd (1, 0, 0, 0, 0, 0, 0, // 0 -10 to -8 1, 0, 0, 0, 0, 0, 0, // 0 -8 to -6 1, 0, 0, 0, 0, 0, 0, // 0 -6 to -4 1, 0, 0, 0, 0, 0, 0, // 0 -4 to -2 1, 0, 0, 0, 0, 0, 0, // 0 -2 to 0 0, 1, 0, 0, 0, 0, 0, // 0 0 to 2 0, 1, 0, 0, 0, 0, 0, // 0 2 to 4 0, 1, 0, 0, 0, 0, 0, // 0 4 to 6 0, 1, 0, 0, 0, 0, 0, // 0 6 to 8 0, 0, 1, 0, 0, 0, 0, // 0 8 to 10 1, 0, 0, 0, 0, 0, 0, // 0 to 2 -10 to -8 0.8782, 0.1218, 0, 0, 0, 0, 0, // 0 to 2 -8 to -6 0.6233, 0.3767, 0, 0, 0, 0, 0, // 0 to 2 -6 to -4 0.3763, 0.6237, 0, 0, 0, 0, 0, // 0 to 2 -4 to -2 0.1279, 0.8721, 0, 0, 0, 0, 0, // 0 to 2 -2 to 0 0, 0.877, 0.123, 0, 0, 0, 0, // 0 to 2 0 to 2 0, 0.6236, 0.3764, 0, 0, 0, 0, // 0 to 2 2 to 4 0, 0.3784, 0.6216, 0, 0, 0, 0, // 0 to 2 4 to 6 0, 0.1245, 0.8755, 0, 0, 0, 0, // 0 to 2 6 to 8 0, 0, 0.8746, 0.1254, 0, 0, 0, // 0 to 2 8 to 10 0.1225, 0.8775, 0, 0, 0, 0, 0, // 2 to 4 -10 to -8 0, 0.8763, 0.1237, 0, 0, 0, 0, // 2 to 4 -8 to -6 0, 0.6251, 0.3749, 0, 0, 0, 0, // 2 to 4 -6 to -4 0, 0.3754, 0.6246, 0, 0, 0, 0, // 2 to 4 -4 to -2 0, 0.1244, 0.8756, 0, 0, 0, 0, // 2 to 4 -2 to 0 0, 0, 0.8725, 0.1275, 0, 0, 0, // 2 to 4 0 to 2 0, 0, 0.6284, 0.3716, 0, 0, 0, // 2 to 4 2 to 4 0, 0, 0.3819, 0.6181, 0, 0, 0, // 2 to 4 4 to 6 0, 0, 0.1231, 0.8769, 0, 0, 0, // 2 to 4 6 to 8 0, 0, 0, 0.8759, 0.1241, 0, 0, // 2 to 4 8 to 10 0, 0.1237, 0.8763, 0, 0, 0, 0, // 4 to 6 -10 to -8 0, 0, 0.8741, 0.1259, 0, 0, 0, // 4 to 6 -8 to -6 0, 0, 0.6268, 0.3732, 0, 0, 0, // 4 to 6 -6 to -4 0, 0, 0.3712, 0.6288, 0, 0, 0, // 4 to 6 -4 to -2 0, 0, 0.1237, 0.8763, 0, 0, 0, // 4 to 6 -2 to 0 0, 0, 0, 0.8754, 0.1246, 0, 0, // 4 to 6 0 to 2 0, 0, 0, 0.6189, 0.3811, 0, 0, // 4 to 6 2 to 4 0, 0, 0, 0.3698, 0.6302, 0, 0, // 4 to 6 4 to 6 0, 0, 0, 0.1259, 0.8741, 0, 0, // 4 to 6 6 to 8 0, 0, 0, 0, 0.874, 0.126, 0, // 4 to 6 8 to 10 0, 0, 0.1258, 0.8742, 0, 0, 0, // 6 to 8 -10 to -8 0, 0, 0, 0.8728, 0.1272, 0, 0, // 6 to 8 -8 to -6 0, 0, 0, 0.6261, 0.3739, 0, 0, // 6 to 8 -6 to -4 0, 0, 0, 0.3747, 0.6253, 0, 0, // 6 to 8 -4 to -2 0, 0, 0, 0.1221, 0.8779, 0, 0, // 6 to 8 -2 to 0 0, 0, 0, 0, 0.8767, 0.1233, 0, // 6 to 8 0 to 2 0, 0, 0, 0, 0.6147, 0.3853, 0, // 6 to 8 2 to 4 0, 0, 0, 0, 0.3749, 0.6251, 0, // 6 to 8 4 to 6 0, 0, 0, 0, 0.1215, 0.8785, 0, // 6 to 8 6 to 8 0, 0, 0, 0, 0, 0.8758, 0.1242, // 6 to 8 8 to 10 0, 0, 0, 0.1272, 0.8728, 0, 0, // 8 to 10 -10 to -8 0, 0, 0, 0, 0.8761, 0.1239, 0, // 8 to 10 -8 to -6 0, 0, 0, 0, 0.6249, 0.3751, 0, // 8 to 10 -6 to -4 0, 0, 0, 0, 0.3783, 0.6217, 0, // 8 to 10 -4 to -2 0, 0, 0, 0, 0.1272, 0.8728, 0, // 8 to 10 -2 to 0 0, 0, 0, 0, 0, 0.8766, 0.1234, // 8 to 10 0 to 2 0, 0, 0, 0, 0, 0.6189, 0.3811, // 8 to 10 2 to 4 0, 0, 0, 0, 0, 0.3787, 0.6213, // 8 to 10 4 to 6 0, 0, 0, 0, 0, 0.1235, 0.8765, // 8 to 10 6 to 8 0, 0, 0, 0, 0, 0, 1, // 8 to 10 8 to 10 0, 0, 0, 0, 1, 0, 0, // 10 -10 to -8 0, 0, 0, 0, 0, 1, 0, // 10 -8 to -6 0, 0, 0, 0, 0, 1, 0, // 10 -6 to -4 0, 0, 0, 0, 0, 1, 0, // 10 -4 to -2 0, 0, 0, 0, 0, 1, 0, // 10 -2 to 0 0, 0, 0, 0, 0, 0, 1, // 10 0 to 2 0, 0, 0, 0, 0, 0, 1, // 10 2 to 4 0, 0, 0, 0, 0, 0, 1, // 10 4 to 6 0, 0, 0, 0, 0, 0, 1, // 10 6 to 8 0, 0, 0, 0, 0, 0, 1); // 10 8 to 10 ; numcases = 10000; equation = "x (xd, vd) = clip (0, 10, xd + dt * vd)"; delays = ( (dt), (dt)); title = "Position"; comment = "Position of object bouncing back and forth between two walls with no energy loss.\n\ The discretization (Range) has two endpoint states that indicate a bounce is occuring, for the \ velocity to reverse."; whenchanged = 1303487674; visual V1 { center = (120, 96); height = 3; link 1 { path = ((202, 77), (222, 72), (222, 114), (202, 110)); }; link 2 { path = ((206, 234), (222, 222), (222, 150), (202, 138)); }; }; }; node v { kind = NATURE; discrete = FALSE; chance = DETERMIN; levels = (-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10); inputs = (vd, xd); parents = (v, x); functable = // vd xd (#9, // -10 to -8 0 #0, // -10 to -8 0 to 2 #0, // -10 to -8 2 to 4 #0, // -10 to -8 4 to 6 #0, // -10 to -8 6 to 8 #0, // -10 to -8 8 to 10 #0, // -10 to -8 10 #8, // -8 to -6 0 #1, // -8 to -6 0 to 2 #1, // -8 to -6 2 to 4 #1, // -8 to -6 4 to 6 #1, // -8 to -6 6 to 8 #1, // -8 to -6 8 to 10 #1, // -8 to -6 10 #7, // -6 to -4 0 #2, // -6 to -4 0 to 2 #2, // -6 to -4 2 to 4 #2, // -6 to -4 4 to 6 #2, // -6 to -4 6 to 8 #2, // -6 to -4 8 to 10 #2, // -6 to -4 10 #6, // -4 to -2 0 #3, // -4 to -2 0 to 2 #3, // -4 to -2 2 to 4 #3, // -4 to -2 4 to 6 #3, // -4 to -2 6 to 8 #3, // -4 to -2 8 to 10 #3, // -4 to -2 10 #5, // -2 to 0 0 #4, // -2 to 0 0 to 2 #4, // -2 to 0 2 to 4 #4, // -2 to 0 4 to 6 #4, // -2 to 0 6 to 8 #4, // -2 to 0 8 to 10 #4, // -2 to 0 10 #5, // 0 to 2 0 #5, // 0 to 2 0 to 2 #5, // 0 to 2 2 to 4 #5, // 0 to 2 4 to 6 #5, // 0 to 2 6 to 8 #5, // 0 to 2 8 to 10 #4, // 0 to 2 10 #6, // 2 to 4 0 #6, // 2 to 4 0 to 2 #6, // 2 to 4 2 to 4 #6, // 2 to 4 4 to 6 #6, // 2 to 4 6 to 8 #6, // 2 to 4 8 to 10 #3, // 2 to 4 10 #7, // 4 to 6 0 #7, // 4 to 6 0 to 2 #7, // 4 to 6 2 to 4 #7, // 4 to 6 4 to 6 #7, // 4 to 6 6 to 8 #7, // 4 to 6 8 to 10 #2, // 4 to 6 10 #8, // 6 to 8 0 #8, // 6 to 8 0 to 2 #8, // 6 to 8 2 to 4 #8, // 6 to 8 4 to 6 #8, // 6 to 8 6 to 8 #8, // 6 to 8 8 to 10 #1, // 6 to 8 10 #9, // 8 to 10 0 #9, // 8 to 10 0 to 2 #9, // 8 to 10 2 to 4 #9, // 8 to 10 4 to 6 #9, // 8 to 10 6 to 8 #9, // 8 to 10 8 to 10 #0); // 8 to 10 10 ; equation = "v (xd, vd) =\n (xd == 0 && vd < 0 || xd == 10 && vd > 0) ? \n -vd : vd"; delays = ( (dt), (dt)); title = "Velocity"; comment = "The velocity of the object (which moves back and forth\n\ on a straigt line).\n\ Its equation reverses the sign of the velocity when the\n\ object hits the barrier at either end."; whenchanged = 1301957459; visual V1 { center = (120, 294); height = 2; link 1 { path = ((206, 274), (222, 270), (222, 324), (206, 319)); }; }; }; node dt { kind = CONSTANT; discrete = FALSE; parents = (); comment = "The time step (length of time between time slices)."; whenchanged = 1301957413; value = 0.25; visual V1 { center = (18, 30); height = 1; }; }; };