Advertisement
a3f

[Mathematica/Tibia] Maximize Ammo Carried

a3f
Jun 27th, 2012
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.52 KB | None | 0 0
  1. (* Content-type: application/vnd.wolfram.mathematica *)
  2.  
  3. (*** Wolfram Notebook File ***)
  4. (* http://www.wolfram.com/nb *)
  5.  
  6. (* CreatedBy='Mathematica 8.0' *)
  7.  
  8. (*CacheID: 234*)
  9. (* Internal cache information:
  10. NotebookFileLineBreakTest
  11. NotebookFileLineBreakTest
  12. NotebookDataPosition[       157,          7]
  13. NotebookDataLength[      6301,        174]
  14. NotebookOptionsPosition[      5438,        141]
  15. NotebookOutlinePosition[      5983,        162]
  16. CellTagsIndexPosition[      5940,        159]
  17. WindowFrame->Normal*)
  18.  
  19. (* Beginning of Notebook Content *)
  20. Notebook[{
  21.  
  22. Cell[CellGroupData[{
  23. Cell["Initialization", "Section",
  24.  CellChangeTimes->{{3.542788535115634*^9, 3.542788538398822*^9}}],
  25.  
  26. Cell["\<\
  27. Inputing our values for ammo and potions [a & p respectively]
  28. Time in Minutes, Capacity in Oz and Cost in gp/projectile.
  29.  
  30. ~ Average hunting resources ~\
  31. \>", "Text",
  32.  CellChangeTimes->{{3.5427885420400305`*^9, 3.542788563572262*^9}, {
  33.    3.5427887682739697`*^9, 3.5427888251452227`*^9}, {3.5454834544639406`*^9,
  34.    3.5454834612811527`*^9}, {3.549764160172293*^9, 3.5497641606823225`*^9}, {
  35.    3.5497643288219395`*^9, 3.5497643498311415`*^9}, {3.5497643915675287`*^9,
  36.    3.5497644384282084`*^9}, {3.549764549420557*^9, 3.549764556390956*^9}, {
  37.    3.549764592785037*^9, 3.5497646403117557`*^9}, 3.549764693849818*^9}],
  38.  
  39. Cell[BoxData[{
  40.  FormBox[
  41.   RowBox[{
  42.    RowBox[{"TimeSpent", " ", "=", " ", "20"}], ";"}],
  43.   TraditionalForm], "\[IndentingNewLine]",
  44.  FormBox[
  45.   RowBox[{
  46.    RowBox[{"aSpent", " ", "=", " ", "300"}], ";", " ",
  47.    RowBox[{"aCost", " ", "=", " ", "007"}], ";",
  48.    RowBox[{"aMass", "=", "0.9"}], ";"}], TraditionalForm], "\n",
  49.  FormBox[
  50.   RowBox[{
  51.    RowBox[{"pSpent", " ", "=", " ", "070"}], ";",
  52.    RowBox[{"pCost", "=", " ", "050"}], ";", " ",
  53.    RowBox[{"pMass", "=", "2.7"}], ";"}], TraditionalForm], "\n",
  54.  FormBox[
  55.   RowBox[{
  56.    RowBox[{"Cap", "=", "900"}], " ", ";"}], TraditionalForm]}], "Input",
  57.  CellChangeTimes->{{3.542788566979457*^9, 3.5427886100769215`*^9}, {
  58.    3.54278873960233*^9, 3.5427887861729937`*^9}, {3.542788835720828*^9,
  59.    3.5427889300792246`*^9}, {3.5427890696642084`*^9, 3.5427890809408536`*^9},
  60.    3.5427894126718273`*^9, {3.5427901530191727`*^9, 3.5427901559083385`*^9}, {
  61.    3.545481669965033*^9, 3.545481672122156*^9}, {3.5454832241139355`*^9,
  62.    3.545483225549138*^9}, {3.5454834044502525`*^9, 3.5454834050430536`*^9}, {
  63.    3.5454834424363194`*^9, 3.545483446367526*^9}, {3.5455594613685184`*^9,
  64.    3.5455594645509243`*^9}, {3.5455595363246436`*^9,
  65.    3.5455595420654535`*^9}, {3.5455596160823793`*^9,
  66.    3.5455596284532013`*^9}, {3.5455599428625336`*^9, 3.545559944640937*^9}, {
  67.    3.5455600043346395`*^9, 3.5455600204114647`*^9}, {3.5497643665921*^9,
  68.    3.549764381118931*^9}, 3.5497644441075335`*^9, {3.5497644937093706`*^9,
  69.    3.5497645729669037`*^9}, {3.5497646147282925`*^9, 3.5497646157153487`*^9},
  70.    3.5497646487192364`*^9, {3.549764695835932*^9, 3.5497647071475782`*^9}, {
  71.    3.549765389625614*^9, 3.5497654509021187`*^9}, {3.5497654858651185`*^9,
  72.    3.5497654908854055`*^9}, {3.549768145813259*^9, 3.5497681679605255`*^9}, {
  73.    3.549768406918193*^9, 3.549768430691553*^9}}],
  74.  
  75. Cell[BoxData[""], "Input",
  76.  CellChangeTimes->{{3.5497681431001034`*^9, 3.549768143474125*^9},
  77.    3.549768173874864*^9}]
  78. }, Open  ]],
  79.  
  80. Cell[CellGroupData[{
  81.  
  82. Cell["\<\
  83. Computing the Linear Programming Problem\
  84. \>", "Section",
  85.  CellChangeTimes->{{3.542788956602742*^9, 3.5427889723136406`*^9}}],
  86.  
  87. Cell["\<\
  88. Constraints in plain text:\[LineSeparator]we seek to maxmize used small \
  89. \[OpenCurlyDoubleQuote]stone\[CloseCurlyDoubleQuote]s while manintianing that \
  90. we don\[CloseCurlyQuote]t run out of \[OpenCurlyDoubleQuote]fish\
  91. \[CloseCurlyDoubleQuote] before breaking all small \
  92. \[OpenCurlyDoubleQuote]stone\[CloseCurlyDoubleQuote]s\[LineSeparator]All that \
  93. while having a total Capacity of \[OpenCurlyDoubleQuote]Cap\
  94. \[CloseCurlyDoubleQuote].\
  95. \>", "Text",
  96.  CellChangeTimes->{{3.542788977708949*^9, 3.542789137244074*^9}}],
  97.  
  98. Cell[CellGroupData[{
  99.  
  100. Cell[BoxData[
  101.  FormBox[
  102.   RowBox[{"Maximize", "[",
  103.    RowBox[{
  104.     RowBox[{"{",
  105.      RowBox[{"PB", ",",
  106.       RowBox[{"PB", "\[LessEqual]",
  107.        RowBox[{"POT", "*",
  108.         RowBox[{"aSpent", "/", "pSpent"}]}]}], ",",
  109.       RowBox[{
  110.        RowBox[{
  111.         RowBox[{"PB", "*", "aMass"}], "+",
  112.         RowBox[{"POT", " ", "pMass"}]}], "<", "Cap"}]}], "}"}], ",",
  113.     RowBox[{"{",
  114.      RowBox[{"PB", ",", "POT"}], "}"}]}], "]"}], TraditionalForm]], "Input",
  115.  CellChangeTimes->{{3.542789143422427*^9, 3.542789281554328*^9},
  116.    3.542789421541335*^9, {3.5497655366190214`*^9, 3.549765566875752*^9}, {
  117.    3.5497679618217354`*^9, 3.5497681309814105`*^9}, {3.5497683876080885`*^9,
  118.    3.549768402290929*^9}, {3.5497684455194016`*^9, 3.549768458317133*^9}}],
  119.  
  120. Cell[BoxData[
  121.  RowBox[{"{",
  122.   RowBox[{"4117.647058823529`", ",",
  123.    RowBox[{"{",
  124.     RowBox[{
  125.      RowBox[{"PB", "\[Rule]", "588.235294117647`"}], ",",
  126.      RowBox[{"POT", "\[Rule]", "137.2549019607843`"}]}], "}"}]}],
  127.   "}"}]], "Output",
  128.  CellChangeTimes->{
  129.   3.5497681864095807`*^9, {3.5497683893251867`*^9, 3.549768451884765*^9}}]
  130. }, Open  ]],
  131.  
  132. Cell[BoxData[
  133.  RowBox[{
  134.   RowBox[{"(*", " ",
  135.    RowBox[{"Spent", " ", "per", " ", "1", " ", "hour"}], " ", "*)"}],
  136.   "\[IndentingNewLine]",
  137.   RowBox[{"(*", " ",
  138.    RowBox[{"to", " ", "come"}], " ", "*)"}], "\[IndentingNewLine]"}]], "Input",
  139.  CellChangeTimes->{{3.5497681825783615`*^9, 3.5497683067694654`*^9}}]
  140. }, Open  ]]
  141. },
  142. ScreenStyleEnvironment->"Working",
  143. WindowSize->{760, 589},
  144. WindowMargins->{{0, Automatic}, {Automatic, 0}},
  145. PrintingCopies->1,
  146. PrintingPageRange->{32000, 32000},
  147. PrintingOptions->{"Magnification"->1.,
  148. "PaperOrientation"->"Portrait",
  149. "PaperSize"->{583.1999999999999, 829.8}},
  150. FrontEndVersion->"8.0 for Microsoft Windows (64-bit) (February 23, 2011)",
  151. StyleDefinitions->"Default.nb"
  152. ]
  153. (* End of Notebook Content *)
  154.  
  155. (* Internal cache information *)
  156. (*CellTagsOutline
  157. CellTagsIndex->{}
  158. *)
  159. (*CellTagsIndex
  160. CellTagsIndex->{}
  161. *)
  162. (*NotebookFileOutline
  163. Notebook[{
  164. Cell[CellGroupData[{
  165. Cell[579, 22, 99, 1, 71, "Section"],
  166. Cell[681, 25, 627, 11, 83, "Text"],
  167. Cell[1311, 38, 1832, 34, 88, "Input"],
  168. Cell[3146, 74, 120, 2, 31, InheritFromParent]
  169. }, Open  ]],
  170. Cell[CellGroupData[{
  171. Cell[3303, 81, 135, 3, 71, "Section"],
  172. Cell[3441, 86, 529, 9, 65, "Text"],
  173. Cell[CellGroupData[{
  174. Cell[3995, 99, 758, 18, 30, "Input"],
  175. Cell[4756, 119, 337, 9, 30, "Output"]
  176. }, Open  ]],
  177. Cell[5108, 131, 314, 7, 72, InheritFromParent]
  178. }, Open  ]]
  179. }
  180. ]
  181. *)
  182.  
  183. (* End of internal cache information *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement