Mercurial > pokemon-types
diff org/lpsolve.org @ 12:89462678a932
spell check
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 02 Nov 2011 10:31:25 -0700 |
parents | 4ea23241ff5b |
children | e1b7ef479bd1 |
line wrap: on
line diff
1.1 --- a/org/lpsolve.org Wed Nov 02 10:28:50 2011 -0700 1.2 +++ b/org/lpsolve.org Wed Nov 02 10:31:25 2011 -0700 1.3 @@ -1,13 +1,11 @@ 1.4 #+title: Discovering Effective Pok\eacute{}mon Types Using Linear Optimization 1.5 #+author: Robert McIntyre & Dylan Holmes 1.6 #+EMAIL: rlm@mit.edu 1.7 -#+description: Using Lpsolve to func effective pokemon types in clojure. 1.8 -#+keywords: Pokemon, clojure, linear optimization, lp_spolve, LpSolve 1.9 +#+description: Using Lpsolve to find effective pokemon types in clojure. 1.10 +#+keywords: Pokemon, clojure, linear optimization, lp_solve, LpSolve 1.11 #+SETUPFILE: ../../aurellem/org/setup.org 1.12 #+INCLUDE: ../../aurellem/org/level-0.org 1.13 1.14 - 1.15 - 1.16 * Introduction 1.17 This post continues the [[./types.org][previous one]] about pok\eacute{}mon types. 1.18 Pok\eacute{}mon is a game in which adorable creatures battle each 1.19 @@ -21,7 +19,7 @@ 1.20 games, attacks can be either twice as effective as normal (Water 1.21 vs. Fire), neutrally effective (Normal vs. Normal), half as effective 1.22 (Fire vs. Water), or not effective at all (Electric vs. Ground). We 1.23 -represent these strengths and weakessness as the numbers 2, 1, 1.24 +represent these strengths and weaknesses as the numbers 2, 1, 1.25 $\frac{1}{2}$, and 0, and call them the /susceptance/ of one type to 1.26 another. 1.27 1.28 @@ -37,7 +35,7 @@ 1.29 In the [[./types.org][previous post]], we used the best-first search algorithm to find 1.30 the most effective Pok\eacute{}mon type combinations. Afterwards, we 1.31 realized that we could transform this search problem into a /linear 1.32 -optimization problem/. This conversion offeres several advantages: 1.33 +optimization problem/. This conversion offers several advantages: 1.34 first, search algorithms are comparatively slow, whereas linear 1.35 optimization algorithms are extremely fast; second, it is difficult to 1.36 determine whether a search problem has any solution, whereas it is 1.37 @@ -104,34 +102,7 @@ 1.38 |----------+----------------------+---------------------+--------------| 1.39 | Profit | $1.30 per bushel | $2.00 per bushel | | 1.40 1.41 -*** COMMENT 1.42 -can be represented as a linear optimization 1.43 - problem. In this form, it is a problem with two variables\mdash{}the number of 1.44 - acres of wheat, \(w\), and the number of acres of barley, \(b\). The 1.45 - aim is to maximize profit, which 1.46 - 1.47 - subject to three constraints: the farmer can't spend more money 1.48 -than he has, the farmer can't use more acres than he owns, and the harvest has 1.49 -to fit in his storage space. 1.50 - 1.51 -We can express these constraints succinctly using matrix 1.52 -notation. Denoting the number of acres of barley and wheat by \(b\) and \(w\), 1.53 -we want to maximize the expression \(143 w + 60 b\) subject to 1.54 - 1.55 -\( 1.56 -\begin{cases} 1.57 -120 w + 210 b & \leq & 1500\\ 1.58 -110 w + 30 b & \leq & 4000\\ 1.59 -1 w + 1 w & \leq & 75 1.60 -\end{cases} 1.61 -\) 1.62 - 1.63 -#\(\begin{bmatrix}120&210\\110&30\\1 & 1.64 -#1\end{bmatrix}\;\begin{bmatrix}w\\b\end{bmatrix} 1.65 -#\leq \begin{bmatrix}\$15000\\4000\text{ bushels}\\75\text{ acres}\end{bmatrix}\) 1.66 - 1.67 ** Solution using LP Solve 1.68 -#(LP solve is available at http://www.example.com.) 1.69 In a new file, =farmer.lp=, we list the variables and constraints 1.70 of our problem using LP Solve syntax. 1.71