<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/using-linear-programming-lp-for-optimizing-bowling-change-or-batting-lineup-in-t20-cricket/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://gigadom.wordpress.com/2017/09/29/using-linear-programming-lp-for-optimizing-bowling-change-or-batting-lineup/"> R – Giga thoughts …</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>In my recent post, <a rel="nofollow" href="https://gigadom.wordpress.com/2017/09/11/my-travels-through-the-realms-of-data-science-machine-learning-deep-learning-and-ai/" target="_blank">My travels through the realms of Data Science, Machine Learning, Deep Learning and (AI)</a>, I had recounted my journey in the domains of of Data Science, Machine Learning (ML), and more recently Deep Learning (DL) all of which are useful while analyzing data. Of late, I have come to the realization that there are many facets to data. And to glean insights from data, Data Science, ML and DL alone are not sufficient and one needs to also have a good handle on linear programming and optimization. My colleague at IBM Research also concurred with this view and told me he had arrived at this conclusion several years ago.</p>
<p>While ML &amp; DL are very useful and interesting to make inferences and predictions of outputs from input variables, optimization computes the choice of input which results in maximizing or minimizing the output. So I made a small course correction and started on a course from India’s own NPTEL <a rel="nofollow" href="http://freevideolectures.com/Course/2365/Fundamentals-of-Operations-Research" target="_blank">Introduction to Linear Programming</a> by Prof G. Srinivasan of IIT Madras (highly recommended!). The lectures are delivered with remarkable clarity by the Prof and I am just about halfway through the course (each lecture is of 50-55 min duration), when I decided that I needed to try to formulate and solve some real world Linear Programming problem.</p>
<p>As usual, I turned towards cricket for some appropriate situations, and sure enough it was there in the open. For this LP formulation I take International T20 and IPL, though International ODI will also work equally well.  You can download the associated code and data for this from Github at <a rel="nofollow" href="https://github.com/tvganesh/LP-cricket-analysis" target="_blank">LP-cricket-analysis</a></p>
<p>In T20 matches the captain has to make choice of how to rotate bowlers with the aim of restricting the batting side. Conversely, the batsmen need to take advantage of the bowling strength to maximize the runs scored.</p>
<p><strong>Note</strong>:<br>
a) A simple and obvious strategy would be<br>
– If the ith bowler’s economy rate is less than the economy rate of the jth bowler i.e.<br>
<img alt="er_{i}" title="er_{i}" src="https://s0.wp.com/latex.php?latex=er_%7Bi%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> &lt; <img alt="er_{j}" title="er_{j}" src="https://s0.wp.com/latex.php?latex=er_%7Bj%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> then have bowler ‘i’ to bowl more overs as his/her economy rate is better</p>
<p>b)A better strategy would be to consider the economy rate of each bowler against each batsman. How often we have seen bowlers who have a great bowling average get punished by some batsman, or a bowler who is generally very poor is very effective against a particular batsman. i.e. <img alt="er_{ij}" title="er_{ij}" src="https://s0.wp.com/latex.php?latex=er_%7Bij%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> &lt; <img alt="er_{ik}" title="er_{ik}" src="https://s0.wp.com/latex.php?latex=er_%7Bik%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> where the jth bowler is more effective than the kth bowler against the ith batsman. This now becomes a linear optimization problem as we can have several combinations of number of overs x economy rate for different bowlers and we will have to solve this algorithmically to determine the lowest score for bowling performance or highest score for batting order.</p>
<p>This post uses the latter approach to optimize bowling change and batting lineup.</p>
<p>Let is take a hypothetical situation<br>
Assume there are 3 bowlers – <img alt="bwlr_{1},bwlr_{2},bwlr_{3}" title="bwlr_{1},bwlr_{2},bwlr_{3}" src="https://s0.wp.com/latex.php?latex=bwlr_%7B1%7D%2Cbwlr_%7B2%7D%2Cbwlr_%7B3%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"><br>
and there are 4 batsmen – <img alt="bman_{1},bman_{2},bman_{3},bman_{4}" title="bman_{1},bman_{2},bman_{3},bman_{4}" src="https://s0.wp.com/latex.php?latex=bman_%7B1%7D%2Cbman_%7B2%7D%2Cbman_%7B3%7D%2Cbman_%7B4%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"></p>
<p>Let the economy rate <img alt="er_{ij}" title="er_{ij}" src="https://s0.wp.com/latex.php?latex=er_%7Bij%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> be the Economy Rate of the jth bowler to the ith batsman. Also if remaining overs for the bowlers are <img alt="o_{1},o_{2},o_{3}" title="o_{1},o_{2},o_{3}" src="https://s0.wp.com/latex.php?latex=o_%7B1%7D%2Co_%7B2%7D%2Co_%7B3%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"><br>
and the total number of overs left to be bowled are<br>
<img alt="o_{1}+o_{2}+o_{3} = N" title="o_{1}+o_{2}+o_{3} = N" src="https://s0.wp.com/latex.php?latex=o_%7B1%7D%2Bo_%7B2%7D%2Bo_%7B3%7D+%3D+N&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> then the question is</p>
<p>a) Given the economy rate of each bowler per batsman, how many overs should each bowler bowl, so that the total runs scored by all the batsmen are minimum?</p>
<p>b) Alternatively, if the know the individual strike rate of a batsman against the individual bowlers, how many overs should each batsman face with a bowler so that the total runs scored is maximized?</p>
<div>
<h2>1. LP Formulation for bowling order</h2>
<p>Let the economy rate <img alt="er_{ij}" title="er_{ij}" src="https://s0.wp.com/latex.php?latex=er_%7Bij%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> be the Economy Rate of the jth bowler to the ith batsman.<br>
<strong>Objective function</strong> : Minimize – <img alt="sum_{i=1}^{i=4}sum_{j=1}^{i=3}er_{ij}*o_{j}" title="sum_{i=1}^{i=4}sum_{j=1}^{i=3}er_{ij}*o_{j}" src="https://s0.wp.com/latex.php?latex=%5Csum_%7Bi%3D1%7D%5E%7Bi%3D4%7D%5Csum_%7Bj%3D1%7D%5E%7Bi%3D3%7Der_%7Bij%7D%2Ao_%7Bj%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"><br>
<strong>Constraints</strong><br>
If <img alt="k_{j}" title="k_{j}" src="https://s0.wp.com/latex.php?latex=k_%7Bj%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> is the number overs o, remaining for the jth bowler <img alt="o_{j} &lt;= k_{j}" title="o_{j} &lt;= k_{j}" src="https://s0.wp.com/latex.php?latex=o_%7Bj%7D+%3C%3D+k_%7Bj%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"><br>
and if the total number of overs remaining to be bowled is N then <img alt="sum o_{j} = N" title="sum o_{j} = N" src="https://s0.wp.com/latex.php?latex=%5Csum+o_%7Bj%7D+%3D+N&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"><br>
The overs that any bowler can bowl is <img alt="o_{j} &gt;=0" title="o_{j} &gt;=0" src="https://s0.wp.com/latex.php?latex=o_%7Bj%7D+%3E%3D0&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"></p>
</div>
<div>
<h2>2. LP Formulation for batting lineup</h2>
<p>Let the strike rate <img alt="sr_{ij}" title="sr_{ij}" src="https://s0.wp.com/latex.php?latex=sr_%7Bij%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex">  be the Strike Rate of the ith batsman to the jth bowler<br>
<strong>Objective function</strong> : Maximize – <img alt="sum_{i=1}^{i=4}sum_{j=1}^{i=3}sr_{ij}*o_{j}" title="sum_{i=1}^{i=4}sum_{j=1}^{i=3}sr_{ij}*o_{j}" src="https://s0.wp.com/latex.php?latex=%5Csum_%7Bi%3D1%7D%5E%7Bi%3D4%7D%5Csum_%7Bj%3D1%7D%5E%7Bi%3D3%7Dsr_%7Bij%7D%2Ao_%7Bj%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"><br>
<strong>Constraints</strong><br>
Where k is the number overs o, remaining for the jth bowler <img alt="o_{j} &lt;= k_{j}" title="o_{j} &lt;= k_{j}" src="https://s0.wp.com/latex.php?latex=o_%7Bj%7D+%3C%3D+k_%7Bj%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"><br>
and the total number of overs remaining to be bowled is N then –<img alt="sum o_{j} = N" title="sum o_{j} = N" src="https://s0.wp.com/latex.php?latex=%5Csum+o_%7Bj%7D+%3D+N&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"><br>
The overs that any bowler can bowl is <img alt="o_{j} &gt;=0" title="o_{j} &gt;=0" src="https://s0.wp.com/latex.php?latex=o_%7Bj%7D+%3E%3D0&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"></p>
<p><strong>lpSolveAPI</strong>– For this maximization and minimization problem I used lpSolveAPI.</p>
<p>Below I take 2 simple examples (example1 &amp; 2)  to ensure that my LP formulation and solution is correct before applying it on real T20 cricket data (Intl. T20 and IPL)</p>
</div>
<div>
<h2>3. LP formulation (Example 1)</h2>
<p>Initially I created a test example to ensure that I get the LP formulation and solution correct. Here the er1=4 and er2=3 and o1 &amp; o2 are the overs bowled by bowlers 1 &amp; 2. Also o1+o2=4 In this example as below</p>
<p>o1 o2 Obj Fun(=4o<em>1+3o</em>2)<br>
1    3      13<br>
2    2      14<br>
3    1      15</p>
<pre><code><span>library</span><span>(</span><span>lpSolveAPI</span><span>)</span></code></pre>
<pre><code><span>library</span><span>(</span><span>dplyr</span><span>)</span></code></pre>
<pre><code><span>library</span><span>(</span><span>knitr</span><span>)</span>
<span>lprec</span> <span>&lt;-</span> <span>make.lp</span><span>(</span><span>0</span>, <span>2</span><span>)</span>
<span>a</span> <span>&lt;-</span><span>lp.control</span><span>(</span><span>lprec</span>, <span>sense</span><span>=</span><span>&quot;min&quot;</span><span>)</span>
<span>set.objfn</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>4</span>, <span>3</span><span>)</span><span>)</span>  <span># Economy Rate of 4 and 3 for er1 and er2</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>, <span>1</span><span>)</span>, <span>&quot;=&quot;</span>,<span>4</span><span>)</span>  <span># o1 + o2 =4</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>, <span>0</span><span>)</span>, <span>&quot;>&quot;</span>,<span>1</span><span>)</span>  <span># o1 > 1</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>, <span>1</span><span>)</span>, <span>&quot;>&quot;</span>,<span>1</span><span>)</span>  <span># o2 > 1</span>
<span>lprec</span></code></pre>
<pre><code>## Model name: 
##             C1    C2       
## Minimize     4     3       
## R1           1     1   =  4
## R2           1     0  >=  1
## R3           0     1  >=  1
## Kind       Std   Std       
## Type      Real  Real       
## Upper      Inf   Inf       
## Lower        0     0</code></pre>
<pre><code><span>b</span> <span>&lt;-</span><span>solve</span><span>(</span><span>lprec</span><span>)</span>
<span>get.objective</span><span>(</span><span>lprec</span><span>)</span> <span># 13</span></code></pre>
<pre><code>## [1] 13</code></pre>
<pre><code><span>get.variables</span><span>(</span><span>lprec</span><span>)</span> <span># 1 3 </span></code></pre>
<pre><code>## [1] 1 3</code></pre>
<p><strong>Note 1:</strong> In the above example <strong>13 runs</strong> is the minimum that can be scored and this requires</p>
<ul>
<li>o1=1</li>
<li>o2=3</li>
</ul>
<p><strong>Note 2:</strong>The numbers in the columns represent the number of overs that need to be bowled by a bowler to the corresponding batsman.</p>
</div>
<div>
<h2>4. LP formulation (Example 2)</h2>
<p>In this formulation there are 2 bowlers and 2 batsmen o11,o12 are the oves bowled by bowler 1 to batsmen 1 &amp; 2 and o21, o22 are the overs bowled by bowler 2 to batsmen 1 &amp; 2 er11=4, er12=2,er21=2,er22=5 o11+o12+o21+o22=5</p>
<p>The solution for this manually computed is o11, o12, o21, o22 Runs<br>
where B11, B12 are the overs bowler 1 bowls to batsman 1 and B21 and B22 are overs bowler 2 bowls to batsman 2</p>
<p>o11     o12    o21    o22      Runs=(4*o11+2*o12+2*o21+5*o22)<br>
1            1             1            2           18<br>
1           2              1             1           15<br>
2           1              1            1            17<br>
1           1               2            1            15</p>
<pre><code><span>lprec</span> <span>&lt;-</span> <span>make.lp</span><span>(</span><span>0</span>, <span>4</span><span>)</span>
<span>a</span> <span>&lt;-</span><span>lp.control</span><span>(</span><span>lprec</span>, <span>sense</span><span>=</span><span>&quot;min&quot;</span><span>)</span>
<span>set.objfn</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>4</span>, <span>2</span>,<span>2</span>,<span>5</span><span>)</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>, <span>1</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>8</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>, <span>0</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>7</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>, <span>1</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;=&quot;</span>,<span>5</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>, <span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>&quot;</span>,<span>1</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>, <span>1</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>&quot;</span>,<span>1</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>, <span>0</span>,<span>1</span>,<span>0</span><span>)</span>, <span>&quot;>&quot;</span>,<span>1</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>, <span>0</span>,<span>0</span>,<span>1</span><span>)</span>, <span>&quot;>&quot;</span>,<span>1</span><span>)</span>
<span>lprec</span></code></pre>
<pre><code>## Model name: 
##             C1    C2    C3    C4       
## Minimize     4     2     2     5       
## R1           1     1     0     0  &lt;=  8
## R2           0     0     1     1  &lt;=  7
## R3           1     1     1     1   =  5
## R4           1     0     0     0  >=  1
## R5           0     1     0     0  >=  1
## R6           0     0     1     0  >=  1
## R7           0     0     0     1  >=  1
## Kind       Std   Std   Std   Std       
## Type      Real  Real  Real  Real       
## Upper      Inf   Inf   Inf   Inf       
## Lower        0     0     0     0</code></pre>
<pre><code><span>b</span><span>&lt;-</span><span>solve</span><span>(</span><span>lprec</span><span>)</span>
<span>get.objective</span><span>(</span><span>lprec</span><span>)</span> </code></pre>
<pre><code>## [1] 15</code></pre>
<pre><code><span>get.variables</span><span>(</span><span>lprec</span><span>)</span> </code></pre>
<pre><code>## [1] 1 2 1 1</code></pre>
<p>Note: In the above example <strong>15 runs</strong> is the minimum that can be scored and this requires</p>
<ul>
<li>o11=1</li>
<li>o12=2</li>
<li>o21=1</li>
<li>o22=1</li>
</ul>
<p>It is possible to keep the minimum to other values and solves also.</p>
</div>
<div>
<h2>5. LP formulation for International T20 India vs Australia (Batting lineup)</h2>
<p>To analyze batting and bowling lineups in the cricket world I needed to get the ball-by-ball details of runs scored by each batsman against each of the bowlers. Fortunately I had already created this with my R package <a rel="nofollow" href="https://cran.r-project.org/web/packages/yorkr/index.html" target="_blank">yorkr</a>. yorkr processes yaml data from <a rel="nofollow" href="https://cricsheet.org/" target="_blank">Cricsheet</a>. So I copied the data of all matches between Australia and India in International T20s. You can download my processed data for International T20 at <a rel="nofollow" href="https://github.com/tvganesh/inswinger" target="_blank">Inswinger</a></p>
<pre><code><span>load</span><span>(</span><span>&quot;Australia-India-allMatches.RData&quot;</span><span>)</span>
<span>dim</span><span>(</span><span>matches</span><span>)</span></code></pre>
<pre><code>## [1] 3541   25</code></pre>
<p>The following functions compute the ‘Strike Rate’ of a batsman as</p>
<div><span><span><span><span>S</span><span>R</span><span>=</span><span>1</span><span><span><span>/</span></span></span><span>o</span><span>v</span><span>e</span><span>r</span><span>s</span><span>∗</span><span>∑</span><span>R</span><span>u</span><span>n</span><span>s</span><span>S</span><span>c</span><span>o</span><span>r</span><span>e</span><span>d</span></span></span></span></div>
<p>Also the Economy Rate is computed as</p>
<div><span><span><span><span>E</span><span>R</span><span>=</span><span>1</span><span><span><span>/</span></span></span><span>o</span><span>v</span><span>e</span><span>r</span><span>s</span><span>∗</span><span>∑</span><span>R</span><span>u</span><span>n</span><span>s</span><span>C</span><span>o</span><span>n</span><span>c</span><span>e</span><span>d</span><span>e</span><span>d</span></span></span></span></div>
<p>Incidentally the SR=ER</p>
<pre><code><span># Compute the Strike Rate of the batsman</span>
<span>computeSR</span> <span>&lt;-</span> <span>function</span><span>(</span><span>batsman1</span>,<span>bowler1</span><span>)</span><span>{</span>
    <span>a</span> <span>&lt;-</span> <span>matches</span> <span>%>%</span> <span>filter</span><span>(</span><span>batsman</span><span>==</span><span>batsman1</span> <span>&amp;</span> <span>bowler</span><span>==</span><span>bowler1</span><span>)</span> 
    <span>a1</span> <span>&lt;-</span> <span>a</span> <span>%>%</span> <span>summarize</span><span>(</span><span>totalRuns</span><span>=</span><span>sum</span><span>(</span><span>runs</span><span>)</span>,<span>count</span><span>=</span><span>n</span><span>(</span><span>)</span><span>)</span> <span>%>%</span> <span>mutate</span><span>(</span><span>SR</span><span>=</span><span>(</span><span>totalRuns</span><span>/</span><span>count</span><span>)</span><span>*</span><span>6</span><span>)</span>
    <span>a1</span>
<span>}</span>

<span># Compute the Economy Rate of the batsman</span>
<span>computeER</span> <span>&lt;-</span> <span>function</span><span>(</span><span>batsman1</span>,<span>bowler1</span><span>)</span><span>{</span>
    <span>a</span> <span>&lt;-</span> <span>matches</span> <span>%>%</span> <span>filter</span><span>(</span><span>batsman</span><span>==</span><span>batsman1</span> <span>&amp;</span> <span>bowler</span><span>==</span><span>bowler1</span><span>)</span> 
    <span>a1</span> <span>&lt;-</span> <span>a</span> <span>%>%</span> <span>summarize</span><span>(</span><span>totalRuns</span><span>=</span><span>sum</span><span>(</span><span>runs</span><span>)</span>,<span>count</span><span>=</span><span>n</span><span>(</span><span>)</span><span>)</span> <span>%>%</span> <span>mutate</span><span>(</span><span>ER</span><span>=</span><span>(</span><span>totalRuns</span><span>/</span><span>count</span><span>)</span><span>*</span><span>6</span><span>)</span>
    <span>a1</span>
<span>}</span></code></pre>
<p>Here I compute the Strike Rate of Virat Kohli, Yuvraj Singh and MS Dhoni against Shane Watson, Brett Lee and MA Starc</p>
<pre><code> <span># Kohli</span>
<span>kohliWatson</span><span>&lt;-</span> <span>computeSR</span><span>(</span><span>&quot;V Kohli&quot;</span>,<span>&quot;SR Watson&quot;</span><span>)</span></code></pre>
<pre><code><span>kohliWatson</span></code></pre>
<pre><code>##   totalRuns count       SR
## 1        45    37 7.297297</code></pre>
<pre><code><span>kohliLee</span> <span>&lt;-</span> <span>computeSR</span><span>(</span><span>&quot;V Kohli&quot;</span>,<span>&quot;B Lee&quot;</span><span>)</span>
<span>kohliLee</span></code></pre>
<pre><code>##   totalRuns count       SR
## 1        10     7 8.571429</code></pre>
<pre><code><span>kohliStarc</span> <span>&lt;-</span> <span>computeSR</span><span>(</span><span>&quot;V Kohli&quot;</span>,<span>&quot;MA Starc&quot;</span><span>)</span>
<span>kohliStarc</span></code></pre>
<pre><code>##   totalRuns count       SR
## 1        11     9 7.333333</code></pre>
<pre><code><span># Yuvraj</span>
<span>yuvrajWatson</span><span>&lt;-</span> <span>computeSR</span><span>(</span><span>&quot;Yuvraj Singh&quot;</span>,<span>&quot;SR Watson&quot;</span><span>)</span>
<span>yuvrajWatson</span></code></pre>
<pre><code>##   totalRuns count       SR
## 1        24    22 6.545455</code></pre>
<pre><code><span>yuvrajLee</span> <span>&lt;-</span> <span>computeSR</span><span>(</span><span>&quot;Yuvraj Singh&quot;</span>,<span>&quot;B Lee&quot;</span><span>)</span>
<span>yuvrajLee</span></code></pre>
<pre><code>##   totalRuns count       SR
## 1        12     7 10.28571</code></pre>
<pre><code><span>yuvrajStarc</span> <span>&lt;-</span> <span>computeSR</span><span>(</span><span>&quot;Yuvraj Singh&quot;</span>,<span>&quot;MA Starc&quot;</span><span>)</span>
<span>yuvrajStarc</span></code></pre>
<pre><code>##   totalRuns count SR
## 1        12     8  9</code></pre>
<pre><code><span># MS Dhoni</span>
<span>dhoniWatson</span><span>&lt;-</span> <span>computeSR</span><span>(</span><span>&quot;MS Dhoni&quot;</span>,<span>&quot;SR Watson&quot;</span><span>)</span>
<span>dhoniWatson</span></code></pre>
<pre><code>##   totalRuns count       SR
## 1        33    28 7.071429</code></pre>
<pre><code><span>dhoniLee</span> <span>&lt;-</span> <span>computeSR</span><span>(</span><span>&quot;MS Dhoni&quot;</span>,<span>&quot;B Lee&quot;</span><span>)</span>
<span>dhoniLee</span></code></pre>
<pre><code>##   totalRuns count  SR
## 1        26    20 7.8</code></pre>
<pre><code><span>dhoniStarc</span> <span>&lt;-</span> <span>computeSR</span><span>(</span><span>&quot;MS Dhoni&quot;</span>,<span>&quot;MA Starc&quot;</span><span>)</span>
<span>dhoniStarc</span></code></pre>
<pre><code>##   totalRuns count   SR
## 1        11     8 8.25</code></pre>
<p>When we consider the batting lineup, the problem is one of maximization. In the LP formulation below V Kohli has a SR of 7.29, 8.57, 7.33 against Watson, Lee &amp; Starc<br>
Yuvraj has a SR of 6.5, 10.28, 9 against Watson, Lee &amp; Starc<br>
and Dhoni has a SR of 7.07, 7.8,  8.25 against Watson, Lee and Starc</p>
<p>The constraints are Watson, Lee and Starc have 3, 4 &amp; 3 overs remaining respectively. The total number of overs remaining to be bowled is 9.The other constraints could be that a bowler bowls at least 1 over etc.</p>
<p>Formulating and solving</p>
<pre><code><span># 3 batsman x 3 bowlers</span>
<span>lprec</span> <span>&lt;-</span> <span>make.lp</span><span>(</span><span>0</span>, <span>9</span><span>)</span>
<span># Maximization</span>
<span>a</span><span>&lt;-</span><span>lp.control</span><span>(</span><span>lprec</span>, <span>sense</span><span>=</span><span>&quot;max&quot;</span><span>)</span>

<span># Set the objective function</span>
<span>set.objfn</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>kohliWatson</span><span>$</span><span>SR</span>, <span>kohliLee</span><span>$</span><span>SR</span>,<span>kohliStarc</span><span>$</span><span>SR</span>,
                   <span>yuvrajWatson</span><span>$</span><span>SR</span>,<span>yuvrajLee</span><span>$</span><span>SR</span>,<span>yuvrajStarc</span><span>$</span><span>SR</span>,
                   <span>dhoniWatson</span><span>$</span><span>SR</span>,<span>dhoniLee</span><span>$</span><span>SR</span>,<span>dhoniStarc</span><span>$</span><span>SR</span><span>)</span><span>)</span>

<span>#Assume the bowlers have 3,4,3 overs left respectively</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>, <span>1</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>, <span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>3</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>4</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>3</span><span>)</span>
<span>#o11+o12+o13+o21+o22+o23+o31+o32+o33=8 (overs remaining)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;=&quot;</span>,9<span>)</span> 


<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span> <span>#o11 >=1</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span> <span>#o12 >=0</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span> <span>#o13 >=0</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span> <span>#o21 >=1</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span> <span>#o22 >=1</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span> <span>#o23 >=0</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span> <span>#o31 >=1</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span> <span>#o32 >=0</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span> <span>#o33 >=0</span>

<span>lprec</span></code></pre>
<pre><code>## Model name: 
##   a linear program with 9 decision variables and 13 constraints</code></pre>
<pre><code><span>b</span> <span>&lt;-</span><span>solve</span><span>(</span><span>lprec</span><span>)</span>
<span>get.objective</span><span>(</span><span>lprec</span><span>)</span> <span># </span></code></pre>
<pre><code>## [1] 77.16418</code></pre>
<pre><code><span>get.variables</span><span>(</span><span>lprec</span><span>)</span> <span># </span></code></pre>
<pre><code>## [1] 1 2 0 1 3 0 1 0 1</code></pre>
<p>This shows that the maximum runs that can be scored for the current strike rate is 77.16   runs in 9 overs The breakup is as follows</p>
<p>This is also shown below</p>
<pre><code><span>get.variables</span><span>(</span><span>lprec</span><span>)</span> <span># </span></code></pre>
<pre><code>## [1] 1 2 0 1 3 0 1 0 1</code></pre>
<p>This is also shown below</p>
<pre><code><span>e</span> <span>&lt;-</span> <span>as.data.frame</span><span>(</span><span>rbind</span><span>(</span><span>c</span><span>(</span><span>1</span>,<span>2</span>,<span>0</span>,<span>3</span><span>)</span>,<span>c</span><span>(</span><span>1</span>,<span>3</span>,<span>0</span>,<span>4</span><span>)</span>,<span>c</span><span>(</span><span>1</span>,<span>0</span>,<span>1</span>,<span>2</span><span>)</span><span>)</span><span>)</span>
<span>names</span><span>(</span><span>e</span><span>)</span> <span>&lt;-</span> <span>c</span><span>(</span><span>&quot;S Watson&quot;</span>,<span>&quot;B Lee&quot;</span>,<span>&quot;MA Starc&quot;</span>,<span>&quot;Overs&quot;</span><span>)</span>
<span>rownames</span><span>(</span><span>e</span><span>)</span> <span>&lt;-</span> <span>c</span><span>(</span><span>&quot;Kohli&quot;</span>,<span>&quot;Yuvraj&quot;</span>,<span>&quot;Dhoni&quot;</span><span>)</span>
<span>e</span></code></pre>
<pre><code>##        S Watson B Lee MA Starc Overs
## Kohli         1     2        0     3
## Yuvraj        1     3        0     4
## Dhoni         1     0        1     2</code></pre>
<pre><code><span>#Total overs=9</span></code></pre>
<p> </p>
<p><strong>Note:</strong> This assumes that the batsmen perform at their current Strike Rate. Howvever anything can happen in a real game, but nevertheless this is a fairly reasonable estimate of the performance</p>
<p><strong>Note 2:</strong>The numbers in the columns represent the number of overs that need to be bowled by a bowler to the corresponding batsman.</p>
<p><strong>Note 3:</strong><em>You could try other combinations of overs for the above SR. For the above constraints 77.16 is the highest score for the given number of overs</em>
</div>
<div>
<h2>6. LP formulation for International T20 India vs Australia (Bowling lineup)</h2>
<p>For this I compute how the bowling should be rotated between R Ashwin, RA Jadeja and JJ Bumrah when taking into account their performance against batsmen like Shane Watson, AJ Finch and David Warner. For the bowling performance I take the Economy rate of the bowlers. The data is the same as above</p>
<pre><code><span>computeSR</span> <span>&lt;-</span> <span>function</span><span>(</span><span>batsman1</span>,<span>bowler1</span><span>)</span><span>{</span>
    <span>a</span> <span>&lt;-</span> <span>matches</span> <span>%>%</span> <span>filter</span><span>(</span><span>batsman</span><span>==</span><span>batsman1</span> <span>&amp;</span> <span>bowler</span><span>==</span><span>bowler1</span><span>)</span> 
    <span>a1</span> <span>&lt;-</span> <span>a</span> <span>%>%</span> <span>summarize</span><span>(</span><span>totalRuns</span><span>=</span><span>sum</span><span>(</span><span>runs</span><span>)</span>,<span>count</span><span>=</span><span>n</span><span>(</span><span>)</span><span>)</span> <span>%>%</span> <span>mutate</span><span>(</span><span>SR</span><span>=</span><span>(</span><span>totalRuns</span><span>/</span><span>count</span><span>)</span><span>*</span><span>6</span><span>)</span>
    <span>a1</span>
<span>}</span>
<span># RA Jadeja</span>
<span>jadejaWatson</span><span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;SR Watson&quot;</span>,<span>&quot;RA Jadeja&quot;</span><span>)</span>
<span>jadejaWatson</span></code></pre>
<pre><code>##   totalRuns count       ER
## 1        60    29 12.41379</code></pre>
<pre><code><span>jadejaFinch</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;AJ Finch&quot;</span>,<span>&quot;RA Jadeja&quot;</span><span>)</span>
<span>jadejaFinch</span></code></pre>
<pre><code>##   totalRuns count       ER
## 1        36    33 6.545455</code></pre>
<pre><code><span>jadejaWarner</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;DA Warner&quot;</span>,<span>&quot;RA Jadeja&quot;</span><span>)</span>
<span>jadejaWarner</span></code></pre>
<pre><code>##   totalRuns count       ER
## 1        23    11 12.54545</code></pre>
<pre><code><span># Ashwin</span>
<span>ashwinWatson</span><span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;SR Watson&quot;</span>,<span>&quot;R Ashwin&quot;</span><span>)</span>
<span>ashwinWatson</span></code></pre>
<pre><code>##   totalRuns count       ER
## 1        41    26 9.461538</code></pre>
<pre><code><span>ashwinFinch</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;AJ Finch&quot;</span>,<span>&quot;R Ashwin&quot;</span><span>)</span>
<span>ashwinFinch</span></code></pre>
<pre><code>##   totalRuns count   ER
## 1        63    36 10.5</code></pre>
<pre><code><span>ashwinWarner</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;DA Warner&quot;</span>,<span>&quot;R Ashwin&quot;</span><span>)</span>
<span>ashwinWarner</span></code></pre>
<pre><code>##   totalRuns count       ER
## 1        38    28 8.142857</code></pre>
<pre><code><span># JJ Bunrah</span>
<span>bumrahWatson</span><span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;SR Watson&quot;</span>,<span>&quot;JJ Bumrah&quot;</span><span>)</span>
<span>bumrahWatson</span></code></pre>
<pre><code>##   totalRuns count  ER
## 1        22    20 6.6</code></pre>
<pre><code><span>bumrahFinch</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;AJ Finch&quot;</span>,<span>&quot;JJ Bumrah&quot;</span><span>)</span>
<span>bumrahFinch</span></code></pre>
<pre><code>##   totalRuns count       ER
## 1        25    19 7.894737</code></pre>
<pre><code><span>bumrahWarner</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;DA Warner&quot;</span>,<span>&quot;JJ Bumrah&quot;</span><span>)</span>
<span>bumrahWarner</span></code></pre>
<pre><code>##   totalRuns count ER
## 1         2     4  3</code></pre>
<p>As can be seen from above RA Jadeja has a ER of 12.4, 6.54, 12.54 against Watson, AJ Finch and Warner also Ashwin has a ER of 9.46, 10.5, 8.14 against Watson, Finch and Warner. Similarly Bumrah has an ER of 6.6,7.89, 3 against Watson, Finch and Warner<br>
The constraints are Jadeja, Ashwin and Bumrah have 4, 3 &amp; 4 overs remaining and the total overs remaining to be bowled is 10.</p>
<p>Formulating solving the bowling lineup is shown below</p>
<pre><code><span>lprec</span> <span>&lt;-</span> <span>make.lp</span><span>(</span><span>0</span>, <span>9</span><span>)</span>
<span>a</span> <span>&lt;-</span><span>lp.control</span><span>(</span><span>lprec</span>, <span>sense</span><span>=</span><span>&quot;min&quot;</span><span>)</span>

<span># Set the objective function</span>
<span>set.objfn</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>jadejaWatson</span><span>$</span><span>ER</span>, <span>jadejaFinch</span><span>$</span><span>ER</span>,<span>jadejaWarner</span><span>$</span><span>ER</span>,
                   <span>ashwinWatson</span><span>$</span><span>ER</span>,<span>ashwinFinch</span><span>$</span><span>ER</span>,<span>ashwinWarner</span><span>$</span><span>ER</span>,
                   <span>bumrahWatson</span><span>$</span><span>ER</span>,<span>bumrahFinch</span><span>$</span><span>ER</span>,<span>bumrahWarner</span><span>$</span><span>ER</span><span>)</span><span>)</span>

<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>, <span>1</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>, <span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>4</span><span>)</span> <span># Jadeja has 4 overs</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>3</span><span>)</span>   <span># Ashwin has 3 overs left</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>4</span><span>)</span>   <span># Bumrah has 4 overs left</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;=&quot;</span>,<span>10</span><span>)</span> <span># Total overs = 10</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
<span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>

<span>lprec</span></code></pre>
<pre><code>## Model name: 
##   a linear program with 9 decision variables and 13 constraints</code></pre>
<pre><code><span>b</span> <span>&lt;-</span><span>solve</span><span>(</span><span>lprec</span><span>)</span>
<span>get.objective</span><span>(</span><span>lprec</span><span>)</span> <span># </span></code></pre>
<pre><code>## [1] 73.58775</code></pre>
<pre><code><span>get.variables</span><span>(</span><span>lprec</span><span>)</span> <span># </span></code></pre>
<pre><code>## [1] 1 2 1 0 1 1 0 1 3</code></pre>
<p>The minimum runs that will be conceded by these 3 bowlers in 10 overs is 73.58 assuming the bowling is rotated as follows</p>
<pre><code><span>e</span> <span>&lt;-</span> <span>as.data.frame</span><span>(</span><span>rbind</span><span>(</span><span>c</span><span>(</span><span>1</span>,<span>0</span>,<span>0</span><span>)</span>,<span>c</span><span>(</span><span>2</span>,<span>1</span>,<span>1</span><span>)</span>,<span>c</span><span>(</span><span>1</span>,<span>1</span>,<span>3</span><span>)</span>,<span>c</span><span>(</span><span>4</span>,<span>2</span>,<span>4</span><span>)</span><span>)</span><span>)</span>
<span>names</span><span>(</span><span>e</span><span>)</span> <span>&lt;-</span> <span>c</span><span>(</span><span>&quot;RA Jadeja&quot;</span>,<span>&quot;R Ashwin&quot;</span>,<span>&quot;JJ Bumrah&quot;</span><span>)</span>
<span>rownames</span><span>(</span><span>e</span><span>)</span> <span>&lt;-</span> <span>c</span><span>(</span><span>&quot;S Watson&quot;</span>,<span>&quot;AJ Finch&quot;</span>,<span>&quot;DA Warner&quot;</span>,<span>&quot;Overs&quot;</span><span>)</span>
<span>e</span> </code></pre>
<pre><code>##           RA Jadeja R Ashwin JJ Bumrah
## S Watson          1        0         0
## AJ Finch          2        1         1
## DA Warner         1        1         3
## Overs             4        2         4</code></pre>
<pre><code><span>#Total overs=10 </span></code></pre>
</div>
<div>
<h2>7. LP formulation for IPL (Mumbai Indians – Kolkata Knight Riders – Bowling lineup)</h2>
<p>As in the case of International T20s I also have processed IPL data derived from my R package yorkr. <a rel="nofollow" href="https://cran.r-project.org/web/packages/yorkr/index.html" target="_blank">yorkr</a>. yorkr processes yaml data from <a rel="nofollow" href="https://cricsheet.org/" target="_blank">Cricsheet</a>. The processed data for all IPL matches can be downloaded from <a rel="nofollow" href="https://github.com/tvganesh/GooglyPlus" target="_blank">GooglyPlus</a></p>
<pre><code><span>load</span><span>(</span><span>&quot;Mumbai Indians-Kolkata Knight Riders-allMatches.RData&quot;</span><span>)</span>
<span>dim</span><span>(</span><span>matches</span><span>)</span></code></pre>
<pre><code>## [1] 4237   25</code></pre>
<pre><code><span># Compute the Economy Rate of the batsman</span>

<span># Gambhir</span>
<span>gambhirMalinga</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;G Gambhir&quot;</span>,<span>&quot;SL Malinga&quot;</span><span>)</span>
<span>gambhirHarbhajan</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;G Gambhir&quot;</span>,<span>&quot;Harbhajan Singh&quot;</span><span>)</span>
<span>gambhirPollard</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;G Gambhir&quot;</span>,<span>&quot;KA Pollard&quot;</span><span>)</span>

<span>#Yusuf Pathan</span>
<span>yusufMalinga</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;YK Pathan&quot;</span>,<span>&quot;SL Malinga&quot;</span><span>)</span>
<span>yusufHarbhajan</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;YK Pathan&quot;</span>,<span>&quot;Harbhajan Singh&quot;</span><span>)</span>
<span>yusufPollard</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;YK Pathan&quot;</span>,<span>&quot;KA Pollard&quot;</span><span>)</span>

<span>#JH Kallis</span>
<span>kallisMalinga</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;JH Kallis&quot;</span>,<span>&quot;SL Malinga&quot;</span><span>)</span>
<span>kallisHarbhajan</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;JH Kallis&quot;</span>,<span>&quot;Harbhajan Singh&quot;</span><span>)</span>
<span>kallisPollard</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;JH Kallis&quot;</span>,<span>&quot;KA Pollard&quot;</span><span>)</span>

<span>#RV Uthappa</span>
<span>uthappaMalinga</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;RV Uthappa&quot;</span>,<span>&quot;SL Malinga&quot;</span><span>)</span>
<span>uthappaHarbhajan</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;RV Uthappa&quot;</span>,<span>&quot;Harbhajan Singh&quot;</span><span>)</span>
<span>uthappaPollard</span> <span>&lt;-</span> <span>computeER</span><span>(</span><span>&quot;RV Uthappa&quot;</span>,<span>&quot;KA Pollard&quot;</span><span>)</span></code></pre>
<p>Formulating and solving this for the bowling lineup of Mumbai Indians against Kolkata Knight Riders</p>
<pre><code> <span>library</span><span>(</span><span>&quot;lpSolveAPI&quot;</span><span>)</span>
 <span>lprec</span> <span>&lt;-</span> <span>make.lp</span><span>(</span><span>0</span>, <span>12</span><span>)</span>
 <span>a</span><span>=</span><span>lp.control</span><span>(</span><span>lprec</span>, <span>sense</span><span>=</span><span>&quot;min&quot;</span><span>)</span>
 
 <span>set.objfn</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>gambhirMalinga</span><span>$</span><span>ER</span>, <span>yusufMalinga</span><span>$</span><span>ER</span>,<span>kallisMalinga</span><span>$</span><span>ER</span>,<span>uthappaMalinga</span><span>$</span><span>ER</span>,
                    <span>gambhirHarbhajan</span><span>$</span><span>ER</span>,<span>yusufHarbhajan</span><span>$</span><span>ER</span>,<span>kallisHarbhajan</span><span>$</span><span>ER</span>,<span>uthappaHarbhajan</span><span>$</span><span>ER</span>,
                    <span>gambhirPollard</span><span>$</span><span>ER</span>,<span>yusufPollard</span><span>$</span><span>ER</span>,<span>kallisPollard</span><span>$</span><span>ER</span>,<span>uthappaPollard</span><span>$</span><span>ER</span><span>)</span><span>)</span>
 
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>, <span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>, <span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>4</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>4</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>4</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;=&quot;</span>,<span>10</span><span>)</span>
 
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 
 <span>lprec</span></code></pre>
<pre><code>## Model name: 
##   a linear program with 12 decision variables and 16 constraints</code></pre>
<pre><code> <span>b</span><span>=</span><span>solve</span><span>(</span><span>lprec</span><span>)</span>
 <span>get.objective</span><span>(</span><span>lprec</span><span>)</span> <span># </span></code></pre>
<pre><code>## [1] 55.57887</code></pre>
<pre><code> <span>get.variables</span><span>(</span><span>lprec</span><span>)</span> <span># </span></code></pre>
<pre><code>##  [1] 3 1 0 0 0 1 0 1 3 1 0 0</code></pre>
<pre><code><span>e</span> <span>&lt;-</span> <span>as.data.frame</span><span>(</span><span>rbind</span><span>(</span><span>c</span><span>(</span><span>3</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>4</span><span>)</span>,<span>c</span><span>(</span><span>0</span>, <span>1</span>, <span>0</span>,<span>1</span>,<span>2</span><span>)</span>,<span>c</span><span>(</span><span>3</span>, <span>1</span>, <span>0</span>,<span>0</span>,<span>4</span><span>)</span><span>)</span><span>)</span>
<span>names</span><span>(</span><span>e</span><span>)</span> <span>&lt;-</span> <span>c</span><span>(</span><span>&quot;Gambhir&quot;</span>,<span>&quot;Yusuf&quot;</span>,<span>&quot;Kallis&quot;</span>,<span>&quot;Uthappa&quot;</span>,<span>&quot;Overs&quot;</span><span>)</span>
<span>rownames</span><span>(</span><span>e</span><span>)</span> <span>&lt;-</span> <span>c</span><span>(</span><span>&quot;Malinga&quot;</span>,<span>&quot;Harbhajan&quot;</span>,<span>&quot;Pollard&quot;</span><span>)</span> 
<span>e</span></code></pre>
<pre><code>##           Gambhir Yusuf Kallis Uthappa Overs
## Malinga         3     1      0       0     4
## Harbhajan       0     1      0       1     2
## Pollard         3     1      0       0     4</code></pre>
<pre><code><span>#Total overs=10 </span></code></pre>
</div>
<div>
<h2>8. LP formulation for IPL (Mumbai Indians – Kolkata Knight Riders – Batting lineup)</h2>
<p>As I mentioned it is possible to perform a maximation with the same formulation since computeSR&lt;==>computeER</p>
<p>This just flips the problem around and computes the maximum runs that can be scored for the batsman’s Strike rate (this is same as the bowler’s Economy rate)</p>
<pre><code> <span>library</span><span>(</span><span>&quot;lpSolveAPI&quot;</span><span>)</span>
 <span>lprec</span> <span>&lt;-</span> <span>make.lp</span><span>(</span><span>0</span>, <span>12</span><span>)</span>
 <span>a</span><span>=</span><span>lp.control</span><span>(</span><span>lprec</span>, <span>sense</span><span>=</span><span>&quot;max&quot;</span><span>)</span>
 
 <span>a</span> <span>&lt;-</span><span>set.objfn</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>gambhirMalinga</span><span>$</span><span>ER</span>, <span>yusufMalinga</span><span>$</span><span>ER</span>,<span>kallisMalinga</span><span>$</span><span>ER</span>,<span>uthappaMalinga</span><span>$</span><span>ER</span>,
                    <span>gambhirHarbhajan</span><span>$</span><span>ER</span>,<span>yusufHarbhajan</span><span>$</span><span>ER</span>,<span>kallisHarbhajan</span><span>$</span><span>ER</span>,<span>uthappaHarbhajan</span><span>$</span><span>ER</span>,
                    <span>gambhirPollard</span><span>$</span><span>ER</span>,<span>yusufPollard</span><span>$</span><span>ER</span>,<span>kallisPollard</span><span>$</span><span>ER</span>,<span>uthappaPollard</span><span>$</span><span>ER</span><span>)</span><span>)</span>
 
 
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>, <span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>, <span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>4</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>4</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;&lt;=&quot;</span>,<span>4</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span>,<span>1</span><span>)</span>, <span>&quot;=&quot;</span>,<span>11</span><span>)</span>
 
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>1</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span>,<span>0</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>add.constraint</span><span>(</span><span>lprec</span>, <span>c</span><span>(</span><span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>0</span>,<span>1</span><span>)</span>, <span>&quot;>=&quot;</span>,<span>0</span><span>)</span>
 <span>lprec</span></code></pre>
<pre><code>## Model name: 
##   a linear program with 12 decision variables and 16 constraints</code></pre>
<pre><code> <span>b</span><span>=</span><span>solve</span><span>(</span><span>lprec</span><span>)</span>
 <span>get.objective</span><span>(</span><span>lprec</span><span>)</span> <span># </span></code></pre>
<pre><code>## [1] 94.22649</code></pre>
<pre><code> <span>get.variables</span><span>(</span><span>lprec</span><span>)</span> <span># </span></code></pre>
<pre><code>##  [1] 0 3 0 0 0 1 0 3 0 1 3 0</code></pre>
<pre><code><span>e</span> <span>&lt;-</span> <span>as.data.frame</span><span>(</span><span>rbind</span><span>(</span><span>c</span><span>(</span><span>0</span>,<span>3</span>,<span>0</span>,<span>0</span>,<span>3</span><span>)</span>,<span>c</span><span>(</span><span>0</span>, <span>1</span>, <span>0</span>,<span>3</span>,<span>4</span><span>)</span>,<span>c</span><span>(</span><span>0</span>, <span>1</span>, <span>3</span>,<span>0</span>,<span>4</span><span>)</span><span>)</span><span>)</span>
<span>names</span><span>(</span><span>e</span><span>)</span> <span>&lt;-</span> <span>c</span><span>(</span><span>&quot;Gambhir&quot;</span>,<span>&quot;Yusuf&quot;</span>,<span>&quot;Kallis&quot;</span>,<span>&quot;Uthappa&quot;</span>,<span>&quot;Overs&quot;</span><span>)</span>
<span>rownames</span><span>(</span><span>e</span><span>)</span> <span>&lt;-</span> <span>c</span><span>(</span><span>&quot;Malinga&quot;</span>,<span>&quot;Harbhajan&quot;</span>,<span>&quot;Pollard&quot;</span><span>)</span> 
<span>e</span></code></pre>
<pre><code>##           Gambhir Yusuf Kallis Uthappa Overs
## Malinga         0     3      0       0     3
## Harbhajan       0     1      0       3     4
## Pollard         0     1      3       0     4</code></pre>
<pre><code><span>#Total overs=11 </span></code></pre>
<p><strong>Conclusion:</strong> It is possible to thus determine the optimum no of overs to give to a specific bowler based on his/her Economy Rate with a particular batsman. Similarly one can determine the maximum runs that can be scored by a batsmen based on their strike rate with bowlers. Cricket like many other games is a game of strategy, skill, talent and some amount of luck. So while the LP formulation can provide some direction,  one must be aware anything could happen in a game of cricket!</p>
<p>Thoughts, comments, suggestions welcome!</p>
<p>Also see<br>
<a rel="nofollow" href="https://gigadom.wordpress.com/2017/02/14/inswinger-yorkr-swings-into-international-t20s/" target="_blank">1. Inswinger: yorkr swings into International T20s</a><br>
<a rel="nofollow" href="https://gigadom.wordpress.com/2014/07/20/working-with-node-js-and-postgresql/" target="_blank">2. Working with Node.js and PostgreSQL</a><br>
3. <a rel="nofollow" href="https://gigadom.wordpress.com/2013/01/09/simulating-the-domino-effect-in-android-using-box2d-and-andengine/" target="_blank">Simulating the domino effect in Android using Box2D and AndEngine</a><br>
4. <a rel="nofollow" href="https://gigadom.wordpress.com/2016/04/02/introducing-cricket-package-yorkr-part-1-beaten-by-sheer-pace/" target="_blank">Introducing cricket package yorkr: Part 1- Beaten by sheer pace!</a><br>
5. <a rel="nofollow" href="https://gigadom.wordpress.com/2016/06/23/introducing-qcsimulator-a-5-qubit-quantum-computing-simulator-in-r/" target="_blank">Introducing QCSimulator: A 5-qubit quantum computing simulator in R</a><br>
6. <a rel="nofollow" href="https://gigadom.wordpress.com/2014/08/15/a-cloud-medley-with-ibm-bluemix-cloudant-db-and-node-js/" target="_blank">A Cloud medley with IBM Bluemix, Cloudant DB and Node.js</a></p>
<p>To see all posts see <a rel="nofollow" href="https://gigadom.wordpress.com/aa-2/" target="_blank">Index of Posts</a></p>
</div>
<p> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gigadom.wordpress.com/5526/" target="_blank"><img border="0" alt="" src="http://feeds.wordpress.com/1.0/comments/gigadom.wordpress.com/5526/"></a> <img border="0" alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" data-recalc-dims="1"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://gigadom.wordpress.com/2017/09/29/using-linear-programming-lp-for-optimizing-bowling-change-or-batting-lineup/"> R – Giga thoughts …</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/ZjRiGpyNFcw" height="1"></a></div>