(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 8851, 233]*) (*NotebookOutlinePosition[ 9561, 258]*) (* CellTagsIndexPosition[ 9517, 254]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Adventure Queue with different probabilities", "Subsection"], Cell[TextData[{ "With e = the number of encounters in an area (e.g., 7 in the \ Valley)\n\t ", Cell[BoxData[ \(TraditionalForm\`R = {r\_i}\)]], " = for each encounter, gives the fraction of combats that encounter \ represents, ", Cell[BoxData[ \(TraditionalForm\`i = 1 \[Ellipsis]\ e\)]], ".\n\t j = the chance of rejecting an encounter that is \ selected if it is in the queue\n \t", Cell[BoxData[ \(TraditionalForm\`U = {u\_k}\)]], " = index for each unique encounter in the queue (", Cell[BoxData[ \(TraditionalForm\`k = 1 \[Ellipsis]\ at\ most\ 5\)]], ")\nThe probability of choosing an adventure in the queue is\n\t", Cell[BoxData[ \(TraditionalForm\`\(\(p\_inq\ \((i, U, R)\)\)\(=\)\)\)]], Cell[BoxData[ \(TraditionalForm\`\(\(\ \)\(\(r\_i\ \((1 - j)\)\)\(\ \)\(+\)\(\ \)\)\)\)]], "\t\t\t(adventure chosen, not rejected) \n\t\t\t", Cell[BoxData[ \(TraditionalForm\`\(\(r\_i\ j\ p\_inq\ \((i, U, R)\)\)\(+\)\)\)]], " \t\t(adventure chosen, rejected, but chosen again),\n\t\t\t", Cell[BoxData[ \(TraditionalForm\`\[Sum]\+\(k \[Element] U, \ k \[NotEqual] i\)\ \(\(r\ \_k\)\&\[VeryThinSpace]\) j\ p\_inq\ \((i, U, R)\)\)]], "\t(some other adventure chosen, but it's rejected and ours is re-chosen).\n\ Notice that the last two terms combine: ", Cell[BoxData[ \(TraditionalForm\`r\_i\ j\ p\_inq\ \((i, U, R)\) + \[Sum]\+\(k \[Element] U, \ k \[NotEqual] i\)\ \ \(\(r\_k\)\&\[VeryThinSpace]\) j\ p\_inq\ \((i, U, R)\) = \[Sum]\+\(k \[Element] U\)\ \(\(r\_k\)\&\ \[VeryThinSpace]\) j\ p\_inq\ \((i, U, R)\)\)]], "\n\t", Cell[BoxData[ \(TraditionalForm\`p\_inq\ \((i, U, R)\) = r\_i\ \((1 - j)\)\ + \ j\ p\_inq\ \((i, U, R)\) \(\[Sum]\+\(k \[Element] U\)\ \(\(r\_k\)\&\[VeryThinSpace]\ \)\)\)]], "\nIf we define ", Cell[BoxData[ \(TraditionalForm\`r\_inq = \[Sum]\+\(k \[Element] U\)\ \(\(r\_k\)\&\ \[VeryThinSpace]\)\)]], " to be the raw probability that an adventure from this zone in the queue \ is chosen, then\n\t", Cell[BoxData[ \(TraditionalForm\`p\_inq\ \((i, U, R)\) = r\_i\ \((1 - j)\)\ + \ j\ \(r\_inq\) p\_inq\ \((i, U, R)\)\)]], "\n\nWe don't have to expand ", Cell[BoxData[ \(TraditionalForm\`p\_inq\)]], " to solve for it; just treat it as an expression:\n\t", Cell[BoxData[ \(TraditionalForm\`p\_inq\ \((i, U, R)\) = \ r\_i\ \((1 - j)\)\ + j\ \(r\_inq\) p\_inq\ \((i, U, R)\)\)]], "\n\t", Cell[BoxData[ \(TraditionalForm\`p\_inq\ \((i, U, R)\) \((1 - j\ r\_inq\ )\) = \ \(\(r\_i\)\(\ \)\((1 - j)\)\(\ \)\)\)]], "\n\t", Cell[BoxData[ \(TraditionalForm\`p\_inq\ \((i, U, R)\) = \ r\_i\ \(1 - j\)\/\(1 - j\ r\_inq\)\)]], "\t\nThe probability of choosing an adventure ", StyleBox["not", FontWeight->"Bold"], " in the queue is", " \n\t", Cell[BoxData[ \(TraditionalForm\`\(\(p\_outq\ \((i, U, R)\)\)\(=\)\)\)]], Cell[BoxData[ \(TraditionalForm\`\(\(\ \)\(\(r\_i\)\(\ \)\(+\)\(\ \)\)\)\)]], " \t\t\t\t(adventure chosen (can't be rejected))\n\t\t ", Cell[BoxData[ \(TraditionalForm\`\[Sum]\+\(k \[Element] U\)\ \(\(r\_k\)\&\ \[VeryThinSpace]\) j\ p\_outq\ \((i, U, R)\)\)]], " \t(some other adventure chosen, but it's rejected and ours is \ re-chosen).\n\t", Cell[BoxData[ \(TraditionalForm\`p\_outq\ \((i, U, R)\)\ \((1 - j\ r\_inq)\) = r\_i\)]], "\n\t", Cell[BoxData[ \(TraditionalForm\`p\_outq\ \((i, U, R)\) = \ r\_i\ 1\/\(1 - j\ r\_inq\)\)]], "\nIn both cases, the ultimate probability is the immediate probability (", Cell[BoxData[ \(TraditionalForm\`\((1 - j)\) r\_i\)]], " in-queue, ", Cell[BoxData[ \(TraditionalForm\`r\_i\)]], " out-of-queue) multiplied by a re-chosen factor ", Cell[BoxData[ \(TraditionalForm\`1\/\(1 - \[Sum]\+\(k \[Element] U\)\ \(\(r\_k\)\&\ \[VeryThinSpace]\) j\)\)]], ":\n\t", Cell[BoxData[ \(TraditionalForm\`p\_inq\ \((i, U, R)\) = \ \((1 - j)\) r\_i\ 1\/\(1 - j\ r\_inq\)\)]], "\n\t", Cell[BoxData[ \(TraditionalForm\`\(p\_outq\)(i, U, R) = \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ r\_i\ 1\/\(1 - j\ \ r\_inq\)\)]], "\nFor all adventures equally likely, ", Cell[BoxData[ \(TraditionalForm\`r\_i = 1/e\)]], ", ", Cell[BoxData[ \(TraditionalForm\`r\_inq = u\[CenterDot]1\/e\)]], ", and \t\t\n\t", Cell[BoxData[ \(TraditionalForm\`p\_inq\ \ \ = \(\(1\/e\) \(1 - j\)\/\(1 - \ \[Sum]\+\(k \[Element] U\)\ \ \(1\/e\) j\) = \(\(1\/e\) \(1 - j\)\/\(1 - \ \ \(u\/e\) j\) = \(1 - j\)\/\(e - \ u\ j\)\)\)\)]], "\n\t", Cell[BoxData[ \(TraditionalForm\`p\_outq = \(\(1\/e\) 1\/\(1 - \[Sum]\+\(k \[Element] U\)\ \ \(1\/e\) j\) = \(\(1\/e\) 1\/\(1 - \(u\/e\) j\) = 1\/\(e - u\ j\)\)\)\)]], "\nDo all the prob's add to 1?\n\t", Cell[BoxData[ \(TraditionalForm\`\[Sum]\+\(i = 1\)\%e p\ \((i, U, R)\) = \[Sum]\+\(i \[NotElement] U\)p\_outq\ \((i, U, R)\) + \[Sum]\+\(i \[Element] U\)p\_inq\ \((i, U, R)\)\)]], "\n\t\t", Cell[BoxData[ \(TraditionalForm\`\(\(=\)\(\[Sum]\+\(i \[NotElement] U\)\ r\_i\ 1\/\(1 - j\ r\_inq\) + \[Sum]\+\(i \[Element] U\)\((1 - j)\) r\_i\ 1\/\(1 - j\ r\_inq\)\)\)\)]], "\n\t\t", Cell[BoxData[ \(TraditionalForm\`\(\(=\)\(\(1\/\(1 - j\ r\_inq\)\) \((\[Sum]\+\(i \[NotElement] U\)\ r\_i\ + \[Sum]\+\(i \[Element] U\)\((1 - j)\) r\_i\ )\)\)\)\)]], "\n\t\t", Cell[BoxData[ \(TraditionalForm\`\(\(=\)\(\(1\/\(1 - j\ r\_inq\)\) \((\[Sum]\+\(i \[NotElement] U\)\ r\_i\ + \[Sum]\+\(i \[Element] U\)r\_i - \[Sum]\+\(i \ \[Element] U\)\(r\_i\) j)\)\)\)\)]], "\nBut ", Cell[BoxData[ \(TraditionalForm\`\[Sum]\+\(i \[NotElement] U\)\ r\_i\ + \[Sum]\+\(i \[Element] U\)r\_i\)]], " (sum over out-queue plus sum over in-queue) is just ", Cell[BoxData[ \(TraditionalForm\`\[Sum]\+i r\_i\)]], " (sum over all) which is just 1 (some adv is chosen):\n\t\t", Cell[BoxData[ \(TraditionalForm\`\(\(=\)\(\(1\/\(1 - j\ r\_inq\)\) \((1 - \[Sum]\+\(i \[Element] U\)\(r\_i\) j)\)\)\)\)]], "\nFinally, ", Cell[BoxData[ \(TraditionalForm\`\[Sum]\+\(i \[Element] U\)\ \(r\_\(i\_\ \[VeryThinSpace]\)\) j\)]], " and ", Cell[BoxData[ \(TraditionalForm\`\[Sum]\+\(k \[Element] U\)\ \(r\_\(k\_\ \[VeryThinSpace]\)\) j\)]], " are different indexings of the same sum:\n\t\t", Cell[BoxData[ \(TraditionalForm\`\(\(=\)\(\(1 - \[Sum]\+\(i \[Element] U\)\ \ \(r\_\(i\_\[VeryThinSpace]\)\) j\)\/\(1 - \[Sum]\+\(k \[Element] U\)\ \ \(r\_\(k\_\[VeryThinSpace]\)\) j\) = 1\)\)\)]] }], "Text"] }, Open ]] }, FrontEndVersion->"5.2 for Macintosh", ScreenRectangle->{{4, 1280}, {0, 832}}, WindowSize->{920, 683}, WindowMargins->{{4, Automatic}, {Automatic, 4}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, Magnification->1.25 ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 66, 0, 48, "Subsection"], Cell[1845, 55, 6990, 175, 982, "Text"] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)