<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anubhav Satpathy on Medium]]></title>
        <description><![CDATA[Stories by Anubhav Satpathy on Medium]]></description>
        <link>https://medium.com/@anubhavsatpathy5?source=rss-76a600b3d56a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vbgIGdRxrkDNqZuuKVv6sg.jpeg</url>
            <title>Stories by Anubhav Satpathy on Medium</title>
            <link>https://medium.com/@anubhavsatpathy5?source=rss-76a600b3d56a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:09:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anubhavsatpathy5/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ How Quick Commerce in India Can Pump Up Its Average Order Value (AOV)]]></title>
            <link>https://medium.com/@anubhavsatpathy5/how-quick-commerce-in-india-can-pump-up-its-average-order-value-aov-51407a40dc92?source=rss-76a600b3d56a------2</link>
            <guid isPermaLink="false">https://medium.com/p/51407a40dc92</guid>
            <dc:creator><![CDATA[Anubhav Satpathy]]></dc:creator>
            <pubDate>Sat, 05 Apr 2025 08:21:46 GMT</pubDate>
            <atom:updated>2025-04-05T08:21:46.332Z</atom:updated>
            <content:encoded><![CDATA[<h3>🚀 From 10-Minute Delivery to Long-Term Growth</h3><p>Quick commerce has exploded in India. Blinkit, Instamart, Zepto, BBNow — they’ve all been racing to win the “speed” game, dropping off everything from eggs to iPhones in 10 minutes or less.</p><p>But now that the land grab phase is (mostly) done, the mood is shifting. It’s no longer just about being fast. It’s about being profitable. And that means playing a different game.</p><p>Quick commerce needs to evolve — from being the place you go when you urgently need onions, to becoming the <em>go-to shopping destination</em> for planned purchases, premium goods, and everything in between. Think less “top-up,” more “Dukaan 2.0.”</p><p>And one of the most important levers to make that happen? <strong>Average Order Value (AOV).</strong></p><h3>💸 Why Should Quick Commerce Even Care About AOV?</h3><p>Let’s get into the real money mechanics:</p><p><strong>Margin per Order</strong> = Markups + Delivery Fee — Cost of Delivery</p><p>And then:</p><p><strong>Annual Customer Value</strong> = Sum of Margins per Order — Customer Acquisition Cost (CAC)</p><p>If each order brings in more rupees, profits go up — <em>without</em> needing to increase frequency or spend more on ads.</p><p>Take two examples:</p><h4>📦 Example 1: 3 Orders vs. 1 Basket</h4><p>Tanvi orders flour at 10 AM, sugar at 3 PM, and a chocolate bar at 9 PM. Each delivery costs money, and unless the platform charges a fee or gets solid margins, it’s losing money on her.</p><p>Now imagine she adds all of that to one cart. <em>Same spend, one delivery</em>. The economics just got way better.</p><h4>🧾 Example 2: Groceries vs. Gadgets</h4><p>Customer A orders groceries. Customer B buys a smartwatch and some supplements. Both spend ₹10K this year — but Customer B made 5 orders while Customer A made 20.</p><p>Fewer deliveries + fatter margins = better unit economics.</p><p>So yeah, AOV matters. A lot.</p><h3>🧠 The Three Behavior Buckets to Boost AOV</h3><p>If a Q-comm platform wants to level up, all its AOV experiments should fall into one of these:</p><ol><li>🧺 <strong>Consolidate Orders</strong> — Get users to place fewer, larger baskets.</li><li>🍫 <strong>Encourage Impulse Buys</strong> — Push low-friction add-ons at checkout.</li><li>📱 <strong>Promote High-AOV Categories</strong> — Build trust in premium product lines.</li></ol><p>Let’s break these down with real tactics and proof that they work.</p><h3>🧺 How to Get Users to Consolidate Orders</h3><h4>🥇 1. High Order Value Offers</h4><p>“₹100 off on orders above ₹599” = classic e-comm play. Flipkart and Amazon use tiered pricing to boost basket size — and it works. A Barilliance report shows this can lift AOV by 14%.</p><h4>📦 2. Combo Deals &amp; Family Packs</h4><p>Think “Buy 3 get 1 free” or combo SKUs. Swiggy Instamart reported that combo packs contributed 12–15% to AOV during their promotional campaigns (YourStory).</p><h4>🔁 3. Frequently Bought Together</h4><p>The Amazon-style “You might also like” is a perfect cross-sell mechanic. Machine-learning-powered bundling can give it a personalized twist — something Blinkit’s UX has started experimenting with.</p><h4>📅 4. Daily &amp; Monthly Subscriptions</h4><p>BigBasket Daily found that subscribers had 1.7x AOV vs casual users. Subscriptions for milk, eggs, or dahi can be made exciting with gamified rewards (like “Order 30 days straight, win IPL tickets!”).</p><h4>💊 5. Monthly Meds = Predictable Margin</h4><p>According to RedSeer, recurring medicines account for 30%+ of e-pharma revenue. Targeting seniors with monthly prescription bundles is a high-AOV, low-churn win.</p><h4>☀️ 6. First Order of the Day Is Free</h4><p>Try: “Free delivery on your first order of the day, ₹15 after that.” Uber Eats used this to drive bigger early-day orders during breakfast hours.</p><h3>🍫 How to Drive Impulse Buys</h3><h4>🛍️ 1. Checkout Shelf = Prime Real Estate</h4><p>Adding “impulse products” like gum, chocolate, energy drinks at checkout can increase AOV by 10% (Shopify data). The trick? Personalize it — show protein bars to one, Oreos to another.</p><h4>🎁 2. Gamify Impulse Buys</h4><p>“Buy 2 Red Bulls, enter to win an iPhone.” Flipkart-style lotteries boosted daily AOV by 12% during Diwali ’22 (per ET Retail).</p><p>People <em>love</em> to feel lucky.</p><h3>💳 How to Push High-AOV Categories</h3><h4>🖼️ 1. Richer Product Pages = Better Trust</h4><p>You can’t sell a ₹20,000 headset with a one-line description. PDPs need spec comparisons, warranties, reviews, and delivery guarantees.</p><p>Croma, Reliance Digital, and Amazon do this brilliantly — and convert accordingly.</p><h4>❤️ 2. Wishlists for Big Purchases</h4><p>Myntra attributes 30% of its sale period conversions to wishlist nudges. It works especially well in high-AOV categories like beauty, electronics, and fitness.</p><h4>🎉 3. Q-Commerce’s Own “Billion Day”</h4><p>Imagine a 2-day “QuickFest” where you get lightning deals delivered in 10 minutes. Flipkart and Amazon have trained India to wait for sale events — Q-comm can do the same with a twist.</p><h4>💳 4. BNPL, EMIs, Card Discounts</h4><p>Klarna reports that Buy Now, Pay Later can increase AOV by 33%. Credit card offers from ICICI, HDFC, etc. also increase cart size. Instamart has started dipping into this territory — and it’s ripe for scale.</p><h4>🧘 5. Design for Window Shopping</h4><p>Most Q-comm homepages are too utilitarian. But what if they <em>also</em> showed trending beauty finds, bestselling gadgets, or aspirational home decor?Amazon knows that 80% of sessions won’t convert immediately — but they still show you the good stuff.</p><h3>🚀 Wrapping It Up</h3><p>Quick commerce in India has cracked the convenience code. But if it wants to crack profitability, <strong>AOV is the fastest lever</strong>.</p><p>Here’s the playbook:</p><ul><li>Get users to consolidate and plan better</li><li>Tease them with impulse buys at just the right moment</li><li>Become the trusted storefront for big-ticket purchases</li></ul><p>The beauty? Most of these shifts (like most growth hacks that truly work) don’t require massive tech. Just better UX, smarter merchandising, and a little behavioral psychology</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51407a40dc92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming 006 : the Simplex Table]]></title>
            <link>https://medium.com/@anubhavsatpathy5/programming-006-the-simplex-table-2f493c7819d7?source=rss-76a600b3d56a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f493c7819d7</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[operations-research]]></category>
            <category><![CDATA[decision-making]]></category>
            <dc:creator><![CDATA[Anubhav Satpathy]]></dc:creator>
            <pubDate>Sun, 14 Oct 2018 10:26:04 GMT</pubDate>
            <atom:updated>2018-10-14T10:26:04.979Z</atom:updated>
            <content:encoded><![CDATA[<h3>Programming 006 : the Simplex Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YhrkBq3DR32Mgg6p1gkG3g.jpeg" /></figure><p>In the <a href="https://medium.com/@anubhavsatpathy5/linear-programming-005-the-simplex-algorithm-d1aeadbef12d">last article</a>, we were able to discover the simplex algorithm and hopefully were also able to see why such an algorithm must reach the optimum (if it exists) and why is it better and more efficient than the graphical and algebraic methods that were discussed earlier. I know that we have not been able to cover some use — cases like handling ‘greater than’ or ‘equality’ constraints, however, I would like you to believe for now that these can be solved with very minor tweaks to the simplex algorithm. Hence, we now turn our attention to breaking down this algorithm into small repeatable steps so as to make it computable. Before this let us reiterate the steps of the algorithm as exemplified in the previous article.</p><h3>The Simplex Algorithm:</h3><ol><li>Convert the constraints into standard form equations by adding slack variables</li><li>Let’s say the system of equations representing the constraints now has m equations in n variables when n &gt;= m</li><li>Now select (n — m) variables as your non basic variables (NBV) and call the rest of m variables as basic variables (BV)</li><li>Make sure that this selection yields a feasible solution — we call this the initial feasible solution — for this purpose it is common practice to select the slack variables as your basic variables for the first iteration</li><li>Represent the basic variables as functions of your non basic variables</li><li>Represent the objective Z as a function of the non — basic variables</li><li>Solve for Z</li><li>See from 6 if any non basic variable is directly proportional to the objective Z.</li><li>If yes, that variable needs to tfhe a basic variable — call this the entering variable</li><li>Check the limiting value that each currently basic variable sets on the amount by which the entering variable can be increased</li><li>Select the variable which poses the least limiting value — call this the leaving variable</li><li>Replace the leaving variable with the entering variable in the set of basic variables to yield new BV and NBV</li><li>Repeat 5–12 till the answer to 8 is No</li></ol><p>This should seem pretty straight forward if you have gone through the example in the previous article. However, what seems obvious to us as learned human beings may not always be representable as computer code. For example take point 5 — how do you represent this task as a sequence of arithmetic operations for the computer. This is why we break this down further so that the each of the steps can now be represented as code. This is what inspires the creation of the simplex table</p><p>Before we get cracking at the solution however, there is one concept we have to familiarise ourselves with — that of Elementary row operations or EROs and the impact they have on a system of linear equations.</p><h3>Elementary Row Operations:</h3><p>Most of us who have studied linear algebra must be familiar with this, however let us undertake a quick recap. A system of linear equations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*wMD5DNLt4MdrcDmqkk0S8w.png" /></figure><p>Can be represented in using matrices and vectors as:</p><p>Ax = b</p><p>Where A is the m*n matrix :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/189/1*NNkome9Wt6GLb-K4efh0-A.png" /></figure><p>And x and b are n dimensional and m dimensional vectors respectively:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*qHyt08k0ovc6DYcDJLRfJg.png" /></figure><p>If this section is not clear, I would recommend the initial lectures of Dr. Gilbert Strang on YouTube. Basics of linear algebra are a must and will remain a must throughout this series of articles</p><p>Once we represent a system of equations as such, we can perform certain row operations on the rows of matrix A and claim that if would not affect the solution of the system of equations. Let’s take an example to illustrate this. We use the small system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/1*ppfwEDCn_JEgSHZP9abwGA.png" /></figure><p>The solution to this system is of course</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/132/1*613xVKMwz_Zzt2SFhC8kBQ.png" /></figure><p>This can be represented in matrix form as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/163/1*1XoJ4C1IGtUwpd3LPW6Zyg.png" /></figure><p><strong>ERO 1</strong> : If we multiply the kth row of A and the kth row of b by the same constant c, the solution stays the same.</p><p>Choosing k = 1 and c = 3 for our example, the matrix form changes to :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*utA4_DhyRzPiv4ERkO_-tw.png" /></figure><p>As is clear the solution to this modified system is also the same as above</p><p><strong>ERO 2</strong> : If we perform the following operation using any combination of rows on A:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*utA4_DhyRzPiv4ERkO_-tw.png" /></figure><p>Where A[k] and A[j] are the kth and jth rows of A and c is any arbitrary constant, the solution to the system does not change.</p><p>Choosing k = 1, j = 2 and c = -3, the system gets modified as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/162/1*BqiUJc5xZhvmpEOYKeV8EQ.png" /></figure><p>As can be seen again the system changes but the solution stays the same. In conclusion, we can say that performing EROs on the matrix form of a system of equations does not change the solution to the system. Now that we know this, we can safely move on to performing the simplex table operations:</p><p>In the interest of consistency, we will be solving the same linear program that we have been tackling since the last three articles. We have reiterated the problem below in the standard form</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*V3xj6NlkasnOP8UsJaKnFQ.png" /></figure><p>What is the point of elementary row operations in the simplex method you say? Well think about it. We do at least two particularly interesting things that EROs could make a ton easier to scale.</p><ol><li>We represent our basic variables s functions of our non basic variables in order to arrive at our solutions</li><li>We represent our Z function in terms of our non basics to find the value of the objective using the current BV and to see if we can move any other variable into the BV in order to further optimize the value of Z</li></ol><p>Well we will get to how EROs make these things interesting but first let’s try to realise that in its current form our LP is simply a system of linear equations and therefore the optimum of our Z function needs to be among the solutions to this system of equations. Once we have achieved this realization, as a next step we will represent our LP in the matrix form. I strongly suggest trying to do this yourself before getting to the solution below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/1*w6-TU5fX4U7o2wtu7MyXqQ.png" /></figure><p>Trust me, if you are able to wrap your head around that, the rest of this article is going to be a cakewalk. Think of the matrix A (the [4,5] matrix as representing the coefficients of the Z function followed by that of the constraints) and the vector b (the [4,1] vector in the RHS) as representing the RHS of the Z function followed by that of the constraints. Dumbing it down even more, the columns of the A matrix represent the coefficients of each our variables (<strong><em>x1, x2, s1, s2, s3</em></strong>) in that order in each of the constraints as well as the Z function.</p><p>Now that we have our matrix representation of the LP, we are ready to finally see and understand the simplex table solution of the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*4x_dI5hYHEClLzLfVKMtng.png" /></figure><p>This is pretty much what the simplex table for this LP problem looks like. Each iteration has been color coded alternately in shades of grey and blue. We will now seek to understands how this table works and mimics the simplex algorithm as we studied it in the last article. Let’s take this iteration by iteration. Below is a picture of just iteration 1:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*BM0Iy7pvF-2BR00b8ZBQvA.png" /></figure><p>The second column represents the Basic Variables for any iteration, in this case:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/77/1*WiJLwYSjQ4vRPAm44ZlkcA.png" /></figure><p>The first column represents the coefficients of the basic variable in the current objective function. In this case, all of our variables have 0 coefficients in the objective function. Note that the columns X1 to S3 represent the matrix A in our matrix representation above and the column RHS represents the vector b. You will spot a difference however. Fow reasons that will become obvious later the first element of our vector b was Z, the the the first entry in the RHS column is 0. Actually This entry should be Z — 0 instead of just 0 but well excel does not permit such expressions. Great, so our initial setup is quite clear.</p><p>Our next step in the algorithm was to represent the basic variables as functions of the non basic variables. Well at any iteration of our algorithm, there will always be the same number of basic variables as there are constraints. Hence if we choose one constraint per basic variable and make sure that the coefficient of that basic variable is 1 in the row representing that constraint and 0 in the rows representing other constraints then we would effectively have done this. Why? Well these rows essentially represent equations right? Call to mind the matrix form and it really should be obvious by this point.</p><p>To proceed to the next iteration, we first need to represent our Z function in terms of our non basic variables. In other words, we have to reduce the coefficients of our basic variables in our current Z function to 0. There is a specific set of EROs that we can perform in order to achieve this at any point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/0*cqHpV-EnoCIwM0qt" /></figure><p>We have introduced a new row called Z-C here which represents the objective function of the next iteration. To achieve the values of Z — C, we performed the following EROs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*ik0y7FesiOZ5b01LAsZsag.png" /></figure><p>These 3 EROs will always reduce the coefficients of the basic variables to 0 in the objective function as long as the basic variables have coefficients of 1 in their own rows and 0 in all other rows. This may not be clear on the first read but I do encourage you to track back and look back at the matrix and think how is it possible to do EROs to achieve this result. You might just stumble on an understanding you haven’t had before.</p><p>Any way our new objective function tells us that w must make variable X1 enter the BV. But what currently basic variable must it replace? Well in order to find that out we must find the limiting values that X1 can be increased to without violating the sign restrictions of our currently basic variables. To do this we simply <strong>divide the RHS of each constraint by its coefficient of X1 — the entering variable</strong>. Think of the row as representing an equation and it should be fairly obvious why this division gives us the result. On doing this for all constraints(see the last column of the table below), we see constraint 3 gives us the least limit. Since S3 is the basic variable in constraint 3, we replace S3 with X1 in our BV.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/0*ud-vLgF-2TOZIraH" /></figure><p>Please note that the values in the first column of the second iteration i.e. the coefficient of the basic variables in the objective function is taken from the objective function for the current iteration i.e. the Row[Z — C] instead of the original objective function.</p><p>Also note, now that we have introduced X1 as the basic variable in the row representing Constraint 3, we must make sure that its coefficient is 1 in that row and 0 in all others. In order to do this we first perform one ERO to ensure that the coefficient of the entering variable is 1 in the row that it enters in</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*K8molJ8fsuzo_krV3qV11A.png" /></figure><p>If it is not obvious, Row[Const n][Iteration k] is supposed to be read as Row representing Constraint n of Iteration k. It is in the reader’s benefit to ask why such EROs always work when the conditions mentioned above work.</p><p>Great, now that we are through with all the steps involved in a single iteration, one can actually repeat this process to get all the iterations depicted in the image below. We shall not go through this for each iteration since, in reality, you will never be using this to solve LP problems. There are existing open source and proprietary software that have implemented the simplex algorithm for us. We will learn how to use these in the near future. Comment below if you need the excel file that implements this simplex table and I shall try and add it as an attachment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/0*RTKCvzBu_yBujRBu" /></figure><p>The objective of this article was not to have the reader be a master in utilising the simplex table. It was actually to make him/her see the correspondence between the simplex algorithm presented in the last article to its implementation using the tabular representation. If one sees this correspondence after having read this article, my job here is done.</p><p>So then, we now turn our attention to the last tweaks that can be made to the simplex algorithm in order to handle “greater than” or “equality constraints. They present a problem to us which can be handled with a very minor tweak called the Big M method. This what we study in the next article following which we shall get into really interesting parts like goal programming, duality and sensitivity analysis. Things are just about starting to get interesting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f493c7819d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linear Programming 005 : The Simplex Algorithm]]></title>
            <link>https://medium.com/@anubhavsatpathy5/linear-programming-005-the-simplex-algorithm-d1aeadbef12d?source=rss-76a600b3d56a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1aeadbef12d</guid>
            <category><![CDATA[decision-making]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[operations-research]]></category>
            <dc:creator><![CDATA[Anubhav Satpathy]]></dc:creator>
            <pubDate>Wed, 10 Oct 2018 19:22:26 GMT</pubDate>
            <atom:updated>2018-10-10T19:22:26.122Z</atom:updated>
            <content:encoded><![CDATA[<h3>Linear Programming 005 : The Simplex Algorithm</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PWwkxfkpC8OxkRxSbMB1uQ.jpeg" /></figure><p>This is where things get a tad sophisticated. We have unlearnt the wrongs of high school and we have drawn inspiration from a primitive algebraic method to derive an algorithm to solve linear programs more efficiently. In this article, we discover the simplex algorithm that does so with fantastic ease. However, most textbooks introduce the simplex algorithm hand in hand with the simplex table. The simplex table is a beautiful way to pen down the execution of the simplex algorithm however, treating them as one and the same takes away from the primary essence of this algorithm. It also renders the geometric and algebraic intuition we have developed so far rather useless. It is because of these reasons that we first develop the simplex algorithm as is, keeping the three objectives mentioned in the closing of the last article and then once we are satisfied that we have effectively achieved these objectives will we introduce the simplex table. In the interest of keeping our intuitions alive, we will solve the same problem again in this article. For this purpose, we shall reiterate the problem including the slack variables like we did in the <a href="https://medium.com/@anubhavsatpathy5/linear-programming-004-an-algebraic-approach-f1e41dd7f8f9">last article</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*xyCuRiKr_xbKVVBLDeTYIQ.png" /></figure><p>To start, let us reiterate the three objectives that require the development of a new algorithm to solve linear programs.</p><ol><li><strong>Termination : </strong>We notice there is no indication that we have reached the optimum so that we can effectively terminate our algorithm. In our baby example above, we kept iterating two more times even though we had reached the optimum 2 steps ahead of the last iteration. In larger and more involved problems this problem might cause us many unnecessary computations</li><li><strong>Avoiding Invalid Solutions : </strong>Even in our baby example above 5 of the 10 solutions were invalid. If we could have found a way to avoid such selections of basic and non basic variables that would lead to invalid solution, we would have saved us half the computation. Hence such a method might improve the efficiencies by a significant amount</li><li><strong>Monotonically increasing in Z : </strong>Based on our order of selection of basic variables, our algorithm does not give any guarantees that the Z value obtained in the next iteration will always be better that the one obtained in this iteration. Such a guarantee would be highly beneficial since we would not oscillate between close to optimum and not so close solutions. We would then have a way of selecting basic variables so as to keep moving upward/downward in Z till we reach the optimum</li></ol><p>To make the above three objectives more precise, we would like our algorithm to :</p><ol><li>Start with one basic feasible solution</li><li>Solve for the Z value using this solution</li><li>Find out if the Z value can be increased by selecting our basic variables differently</li><li>Solve for Z using the new basic variables, if so found in step 3</li><li>Keep repeating steps 3 and 4 till there is no way the Z value can be increased by any other selection of basic variables — Terminate on such a condition</li></ol><p>Well the first step is rather easy. We need one basic feasible solution to start with. Which means we need to select one set of basic variables that yields a solution without violating any sign restrictions. It is fairly obvious that if we select <strong>BV(stands for set of basic variables) = {s1,s2,s3}</strong> as our basic variables, and expressing them as a function of the non basic variables, we see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/136/1*FvuJ5jNt0hoO8Tq_nKuF2Q.png" /></figure><p>What we did above was that we expressed our basic variables as functions of our non basic variables. This makes sense because in Step 2, we need to find a solution and since we know that our non-basic variables are affixed to the value of zero, we can evaluate their functions. As per the above equations, we achieve the following solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/1*DBNx8x3CTXRekWDqx0GpBA.png" /></figure><p>The Z value that we calculate at this solution is 0 as is clear from the Z equation above. The next question we have to ask ourselves is that if we can find a better way to select our basic variables so as to render a better value of Z. What we mean is can we possibly transfer at least one non basic variable to replace a basic variable in order to increase a value of Z. In order to answer the first part of the question, we try and express Z as a function of the non basic variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*TeSjxCkstw9gdQiidWqbNw.png" /></figure><p>It is obvious that increasing <strong><em>x1</em></strong> above 0 will definitely increase the value of <strong><em>Z</em></strong>. However, in doing so, we must also take care that we do not increase it so much as to violate our sign restrictions. From the three equations above representing <strong><em>s1,s2,s3</em></strong> as functions of <strong><em>x1</em></strong>, and <strong><em>x2</em></strong>, we can clearly identify this boundary for each of our three currently basic variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*dqv-KV494AUin5MUL3i7pA.png" /></figure><p>It is clearly obvious that since <strong><em>s3</em></strong> has the least limit on increasing <strong><em>x1</em></strong>, we cannot increase <strong><em>x1</em></strong> beyond 40 and that <strong><em>x1</em></strong> should replace <strong><em>s3</em></strong> in the set of basic variables.</p><p>There.. we have our second selection of basic variables and we made sure this time that</p><ol><li>This selection will yield a solution that does not violate sign restrictions</li><li>This selection will yield a solution that renders a better value for our objective Z</li></ol><p>Now, lets validate these very points. Our new basic and non basic variables are listed below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/1*sqYKzbkah4Kt-pWFq-Iadw.png" /></figure><p>Next we follow protocol and express the basic variables as functions of the non basic variables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*bfO5nNMpxfsh6J48Bu6XQA.png" /></figure><p>This time our solution is :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*WwcxMjSONR5gTLTFzYhwIw.png" /></figure><p>If we express our Z function as a function of our non basic variables, we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/151/1*-VNgtEcvrSpY4gm_Cv-VdA.png" /></figure><p>From the above equation we get that the value of <strong><em>Z</em></strong> pertaining to this solution is <strong><em>Z = 120</em></strong>. Now we ask the same two questions again. Is there any non basic variable whose value if increased from zero would increase the value of <strong><em>Z</em></strong>? Indeed. As we can see <strong><em>x2</em></strong> has a positive coefficient and hence increasing <strong><em>x2</em></strong> can lead to a better value for <strong><em>Z</em></strong>. What variable will <strong><em>x2</em></strong> replace in BV? To find that out, we draw the same table as above again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*wUeD7RQw1A_SbQvMNFsekQ.png" /></figure><p>Now, as is clear from the equations above increasing <strong><em>x2</em></strong> does not affect the value of <strong><em>x1</em></strong> at all but <strong><em>s1</em></strong> presents the least limit by which <strong><em>x2</em></strong> can be increased. Hence, we replace <strong><em>s1</em></strong> in the current BV with <strong><em>x2</em></strong>.</p><p>This is our third and hopefully final iteration of the algorithm. We follow suit again to list down the basic and non basic variables for this iteration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/121/1*aLaUv7OqOoNoAt9dwhMqmg.png" /></figure><p>Now, we represent the values of our basic variables as functions of our non basic variables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/159/1*Ow-HHXCJ_fR0JXpjeAhTIA.png" /></figure><p>Now the solution to this is clearly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*UNiU8qNrk_G6-BC1fVz6hQ.png" /></figure><p>Now expressing Z in terms of the non basic variables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*FmE_VnHj0EmUuXZHitWmFw.png" /></figure><p>The solution obtained is <strong><em>Z = 160</em></strong> which is again better than <strong><em>Z = 120</em></strong> obtained in the last iteration. But we do still have an opportunity to further the value of <strong><em>Z</em></strong> by increasing the value of <strong><em>s3</em></strong>. Hence we follow suit and draw our table again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*TGLHUqVquNWmU1T64PnZ_w.png" /></figure><p>Note that in this case, <strong><em>x2</em></strong> actually increases with <strong><em>s3</em></strong> and hence does not limit the value that <strong><em>s3</em></strong> can take. However, <strong><em>s2</em></strong> presents the least limit by which we can increase <strong><em>s3</em></strong>. Hence we replace <strong><em>s2</em></strong> using <strong><em>s3</em></strong> in the current BV.</p><p>One last time, we list our basic and non basic variables</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/125/1*jC3trFhuK6vguWHKaFzDMw.png" /></figure><p>Following protocol to list down the basic variables as functions of the non basic variables</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/133/1*4rIgIKhWHR3Z1nxhIFmcpA.png" /></figure><p>The solution for this selection is clearly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*gcpEknCqrywE6Muq2ENoxw.png" /></figure><p>To find the Z value, we list down the Z function in terms of the non basic variables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/122/1*gu34ir7GzKU4Krs6ExYR1g.png" /></figure><p>The <strong><em>Z</em></strong> value for this solution i.e. <strong><em>Z = 180</em></strong> is definitely the best so far. We also note that there are <strong>no non basic variables left which are directly proportional to Z</strong>. Hence we can safely terminate our algorithm and claim that the solution obtained above is indeed the optimum for this linear program.</p><p>Did we terminate when we reached the optimum? Yes we did!</p><p>Did we avoid selections leading to infeasible solutions? Yes we did!</p><p>Did each iteration yield a Z value better than the previous iteration? Yes we did!</p><p>Finally we have fully developed an algorithm that has met all three of our objectives. Like I had said before, the simplex algorithm is completely independent of the simplex table. However, the table becomes important for two reasons.</p><ol><li>When solving larger problems, the table gives us an easy repetitive way of iterating over the simplex solutions</li><li>It makes the algorithm easier to code since it breaks down the algorithm into smaller and dull repeatable steps.</li></ol><p>Due to these reasons we need to know how the simplex table works. There are also a few more details left to polish out this article. It turns out there is a special geometric interpretation of our simplex algorithm. Which is what we discuss below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*m5uiX4n4-o6WoC94JX4hoQ.png" /></figure><p>If we look at our graphical solution to the same problem above and pay attention to the order in which our simplex method reaches the optimum, there shall be a few interesting revelations. In the first iteration of our algorithm we started with <strong><em>NBV = {x1,x2}</em></strong> and arrived at the solution represented by point E on the graph. In the next iteration we moved <strong><em>x1</em></strong> into the BV and arrived at the solution represented by point D. In the same manner, in the third and fourth iterations of our algorithm, we arrive at solutions represented by points C and B.</p><p>It is interesting to me how we have defined an algorithm to iterate over adjacent vertices of our feasible region in an orderly manner. It;s equivalent to think of the algorithm as starting with the <strong><em>Z = 0</em></strong> line that passes through E, stopping and looking at the adjacent vertices and asking which of these would yield a better <strong><em>Z</em></strong> value and then jumping over to that vertex and repeating the process till it finds the true optimum.</p><p>Note that towards the end of our first iteration, when we expressed <strong><em>Z</em></strong> in terms of the non basic variables, both <strong><em>x1</em></strong> and <strong><em>x2</em></strong> were directly proportional to <strong><em>Z</em></strong> but we chose to move <strong><em>x1</em></strong> to the BV since that would yield the higher value for <strong><em>Z</em></strong>. In doing so, we eventually looked as points A and D while standing on point E and decided that point D is better for our objective, only this time via equations.</p><p>Next Article — to be posted</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1aeadbef12d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linear Programming 004 : An algebraic approach]]></title>
            <link>https://medium.com/@anubhavsatpathy5/linear-programming-004-an-algebraic-approach-f1e41dd7f8f9?source=rss-76a600b3d56a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1e41dd7f8f9</guid>
            <category><![CDATA[operations-research]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[decision-making]]></category>
            <dc:creator><![CDATA[Anubhav Satpathy]]></dc:creator>
            <pubDate>Wed, 10 Oct 2018 18:45:50 GMT</pubDate>
            <atom:updated>2018-10-10T19:23:39.012Z</atom:updated>
            <content:encoded><![CDATA[<h3>Linear Programming 004 : An algebraic approach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*SOb9kn2DVZ-gy_50QF9aXg.jpeg" /></figure><p>In the last section we discussed the graphical method to solve almost any two variable linear programming problem. However, unfortunately one is never as lucky to find a real world solution that involves two or less decision variables. As we saw in the article on formulation, there can indeed be quite a few decision variables in even a simple problem. Given our incapacity to plot graphs beyond two (nowadays three) dimensions, we resort to algebra to find out if we can may be find out the solution without the need to actually plot the graph.</p><p>Think of it this way — there are two ways to find the point of intersection between two lines — one is plot them and another is to actually algebraically solve the linear equations that represent these lines. We will more or less follow the same principles — the only problem being — we are not exactly sure about solving linear inequalities which are what, in most cases, will represent our constraints.</p><p>In this article, we discuss an algebraic method to solve linear programs. What we will strive to do is to keep the geometric intuition that we built in the last chapter alive and relate our algebraic method with it at every step. In this interest, we shall solve the same problem that we solved in the last article. For the sake of convenience, I have restated the problem and the graph for the same below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*hyzSbcPVhnvQtks3qt_Crg.png" /></figure><p>The final graph of the solved LP is shown on the figure below.As we found out earlier, point B is the optimum of this problem with a Z value of 180. What we did was, we found our the coordinates of the vertices of the feasible region, evaluated Z at each of these points and claimed with sufficient intuitive proof that the vertex that renders the best value for Z is indeed the optimum of the LP.</p><p>Hence, it only makes sense, to try and find the vertices of the feasible region in our algebraic method as well. This is exactly what we attempt to do next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*qTFljGxJhMdX265ORgC5uw.png" /></figure><p>Our knowledge of algebra allows us to solve equations and not inequalities to hopefully arrive at a singular point. Hence if we have any hope of finding out the vertices of the feasible region with the tools of algebra, we must convert the inequalities that currently represent our constraints into equations. It must be worthwhile to pause here and think about how one can do this instead of reading ahead to the solution.</p><p>Well, it’s fairly obvious that if</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/1*DTpbypNR0V1KzLUDF_VlIg.png" /></figure><p>Then, it is equivalent to say that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*IF4dipEehoHoyAOeSguDLw.png" /></figure><p>We can similarly modify the other constraints to write down the LP problem in the following manner</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*_F4M0erHq8h34Jvi9uDeFQ.png" /></figure><p>What we did with the constraints is fairly obvious mathematically but one needs to ask if these variables have any meaning at all in the real world. Well constraints of the form &lt;= normally represent the threshold in the quantity of a resource that can be used, be it time or labour or raw materials. Now since, s1 is the difference between this threshold and the amount in use at any point representing the decision variables,, s1 can be treated as the <strong>wastage or the slack in the usage of the resource</strong>. It shouldn’t be surprising then that the literature on the subject refers to these variables as slack variables.</p><p>If so, shouldn’t we also want to minimize this wastage? Ideally yes, but in a maximization problem, where we want to maximize our profits we really do not care much about how much of a particular resource is left unused, since in most cases these can be monetised elsewhere in other activities. Hence in this case, assuming that we don’t care about the wastage of resources, the slack variables do not affect the objective function at all. We have made this explicit by adding the zero coefficients with the slack variables in the objective function above.</p><p>Okay then, now that we have equations, we can solve them. Not so fast though. Don’t we have only three equations and 5 variables? Surely we need 5 linear equations to be able to solve appropriately for 5 variables. How then are we supposed to surpass this hurdle? This would require a tad more involving thought process, but I am sure a good majority of the readers can if they try arrive at the solution or at least close to it before reading further.</p><p>Well, since we have three equations, we can only solve for three variables. Hence we need to freeze the remaining two variables to a certain non-negative number due the sign-restrictions. Which variables to freeze and what numbers to freeze them to in rather unclear right now. We answer these questions below.</p><p>Let us start by iteratively choosing any two variables among the five to freeze to zero and solve for the remaining three variables. Why we choose zero will be clarified in a later portion of this article. For now we represent this iteration in the table below. We call the variables that we freeze to zero as <strong>Non Basic Variables</strong> and the variables for which we solve as <strong>Basic Variables</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*RzLEln8ZKuv1pMUXJwBecQ.png" /></figure><p>The table above is by far the most important structure that we have come across in our study of linear programming. The first and the second columns list the basic and the non basic variables respectively. The third column lists the solution of the basic variables in the same order as they are mentioned in the first column and the fourth column lists the Z value for the corresponding solution. Please note that the values of the non-basic variables used to compute Z are freezed to zero.</p><p>Note that some of the rows are colored in a shade of red. These rows corresponds to solutions that violate the sign restrictions. For example, in the last low, s1 takes the value -20 which violates our sign restriction s1 &gt;= 0. The rest of the rows represent solutions that do not violate any of our constraints and hence are feasible. Out of these, we select the best solution to be presented in row 8 which is colored in a shade of green. Please note that the selections for which we arrive at valid solutions above are called <strong>Basic Feasible Solutions</strong> of the LP. Our claim now would be that the optimum of an LP is contained within this set of Basic feasible solution.</p><p>Okay but how can we claim that the optimum of the problem is within these solutions i.e. the solutions obtained by fixing the non basic variables to zero? To answer this let us try and draw a relation between our algebraic solution above and the graphical solution presented before.</p><p>We did prove intuitively in the <a href="https://medium.com/@anubhavsatpathy5/linear-programming-003-graphical-solution-8defefce1c90">previous article</a> that the optimum of any LP must lie on the vertices of the feasible region. Note that the vertices in the graph are actually the solutions of equations obtained by setting the non basic variables to zero. This can be further understood by thinking of the vertices as the intersection of the lines representing the sides of the feasible region. In our case these lines are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*j1zJr2MkBeDbyO32oMNQsg.png" /></figure><p>Note that on points lying on these lines either the slack variables or the decision variables themselves are zero. Hence by setting the non basic variables to zero, what we are eventually doing is solving for these vertices. Each valid point in the solution above actually corresponds with one of the vertices of our polygon obtained in the graphical method. This correspondence is highlighted in the table below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*lWbr_Z6yDaLZGmPx50S5Xw.png" /></figure><p>If you are able to see this correspondence you have cracked the heart of linear programming. The rest of it is simply a few mathematical tools developed to make this process more efficient, robust and computable.</p><p>So in summary, we carry out the following steps to solve any linear equation using the algebraic method.</p><ol><li>We add slack variables to convert the inequalities of our constraints into equations</li><li>Let’s say by carrying out the step above, we obtain a set of m equations in n variables where m&lt;=n</li><li>If so we choose every possible set of n — m non basic variables and affix them at zero</li><li>Having done so, we now solve for the m remaining variables using the m equations obtained in step 2</li><li>If the solution so obtained does not violate any sign restrictions, we calculate and tabulate the Z value for it</li><li>If we repeat steps 3, 4 and 5 for every possible selection of the m — n non basic variables and tabulate the Z values for each valid solution, we can safely say that the solution that gives the best Z value among these is indeed the optimum of the problem</li></ol><p>Great! What this gives us, at least in theory, is the power to solve linear programming problems involving any amount of decision variables. Yet there are certain practical concerns. We devote the following paragraph to recognize these concerns and the following articles to address them effectively. One might want to think about these issues prior to reading ahead.</p><p>For my Algorithm to work on a problem involving m equations and n variables where m &lt;= n, I need to carry our nCHOOSEm iterations each of which will involve solving a n variable system of linear equations and then solving for Z using the solution. That requires a good amount of compute and could approach an exponential complexity.It would be nice if I could reduce this complexity in computation. In this regard, I notice at least three things that my algorithm could do better:</p><ol><li><strong>Termination : </strong>We notice there is no indication that we have reached the optimum so that we can effectively terminate our algorithm. In our baby example above, we kept iterating two more times even though we had reached the optimum 2 steps ahead of the last iteration. In larger and more involved problems this problem might cause us many unnecessary computations</li><li><strong>Avoiding Invalid Solutions : </strong>Even in our baby example above 5 of the 10 solutions were invalid. If we could have found a way to avoid such selections of basic and non basic variables that would lead to invalid solution, we would have saved us half the computation. Hence such a method might improve the efficiencies by a significant amount</li><li><strong>Monotonically increasing in Z : </strong>Based on our order of selection of basic variables, our algorithm does not give any guarantees that the Z value obtained in the next iteration will always be better that the one obtained in this iteration. Such a guarantee would be highly beneficial since we would not oscillate between close to optimum and not so close solutions. We would then have a way of selecting basic variables so as to keep moving upward/downward in Z till we reach the optimum</li></ol><p>It is these basic flaws in our current algorithm that must inspire our discussion on the next improvement in this field that we call the Simplex Algorithm. The intuition and the concepts are done. The problem is solved. We now move to the task of bettering our ability in solving such problems. See you then.</p><p><a href="https://medium.com/@anubhavsatpathy5/linear-programming-005-the-simplex-algorithm-d1aeadbef12d">Next Article</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1e41dd7f8f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linear Programming 003 : Graphical Solution]]></title>
            <link>https://medium.com/@anubhavsatpathy5/linear-programming-003-graphical-solution-8defefce1c90?source=rss-76a600b3d56a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8defefce1c90</guid>
            <category><![CDATA[operations]]></category>
            <category><![CDATA[decision-making]]></category>
            <category><![CDATA[operations-research]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Anubhav Satpathy]]></dc:creator>
            <pubDate>Wed, 10 Oct 2018 18:12:29 GMT</pubDate>
            <atom:updated>2018-10-10T18:46:45.511Z</atom:updated>
            <content:encoded><![CDATA[<h3>Linear Programming 003 : Graphical Solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*McnoSImYGXN3cXJZSqeo5g.png" /></figure><p>Alright then! We know what linear programming is, what kind of problems it can be used to solve and how these kind of problems can be formulated. So let the solutions begin!!</p><p>To start with, we take a two variable linear programming problem (we spare ourselves the formulation this time) and try to discover a solution for it. I shall try my best to structure these articles to fashion discovery of knowledge rather than stating in placidly. Hence, I will leave out some pause points beyond which the readers would have a couple of options — Pause and ponder about the solution given the information above or move ahead to read the solution. I would prefer the former approach since there is nothing better and more effective than discovering a method yourself.</p><p>That said, let’s get cracking on the problem at hand. The two variable problem that we will discuss in the solution below is mentioned below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*Waj8KCVvoG91zbmOLac4Lg.png" /></figure><p>Okay, so what do we have then? We have two variables <em>x1</em> and <em>x2</em> right? Let’s assume we have a piece of paper before us so what we can do before anything at all is draw the equations and inequalities on a graph. Let’s do that to start with.</p><p>We first plot the line <strong><em>2x1 + x2 = 100</em> </strong>in the figure below. A few things to note are mentioned thereafter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*5tdgvhiezr6CUA2VQ7m6zA.png" /></figure><ol><li>We all know how to plot the line representing a linear equation from high school</li><li>What we may not know or remember is that the plot of a line actually represents two inequalities along with one equation</li><li>This has been clearly represented in the image below</li><li>The horizontal axis represents the <strong><em>x1</em> </strong>coordinates and the vertical axis represents the <strong><em>x2</em> </strong>coordinates</li><li>The line represents the equation of the first constraint</li><li>The region shaded by the reddish hue represents the inequality <strong><em>2x1 + x2 &lt;= 100</em></strong></li></ol><p>How so? Well every line divides the plane on which it is plotted into two distinct regions. In the field of convex optimisation, we refer to these regions as affine half-spaces. If the line is of the form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/1*4tL_EUZmwMu7nI9NgdxTww.png" /></figure><p>Then the two half-spaces represent the following inequalities:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/1*1HRKBjEwNziOUajPcHoJtg.png" /></figure><p>In our case, the line represents the equation of the first constraint. The half-space shaded in red represents the inequality <strong><em>2x1 + x2 &lt;= 100</em> </strong>and the half-space left unshaded represents the inequality <strong><em>2x1 + x2 &gt;= 100</em></strong></p><p>In order to validate this we consider two points one in each region as mentioned in the table below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*5xsUcv0C3SSKiL9qUfBehA.png" /></figure><p>Now that we know how to represent inequalities on a graph, I would encourage the user to try and find a method to plot at least one feasible point that satisfies all the constraints of our problem in the green box. This is our first pause and ponder point. You may choose to pause here and ponder a bit to find this method or read ahead to find the solution mentioned for you.</p><p>What I have done below is plotted all the inequalities representing our constraints using one graph or set of axes representing our decision variables. The figure so framed is given below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*sC4eIMd08Iok8HAu8mHv4A.png" /></figure><p>As can be clearly seen points representing each inequality are shaded using a different color and the intersection of all these sets of points can be clearly bounded by the polygon ABCDE</p><p>Hence, we can clearly state that any point within the interior of the polygon ABCDE will end up satisfying all the constraints of our problem and hence is called a <strong>Feasible Point.</strong></p><p>The set of these feasible points is called the <strong>Feasible region</strong> of a linear program.</p><p>For the sake of clarity, I have mentioned below the steps that can be used to find out the feasible region of any linear program:</p><ol><li>Plot all the inequalities using a single set of axis representing the decision variables of the problem</li><li>Find the region that is an intersection of all regions satisfying each equation</li><li>This intersection will be the <strong>feasible region </strong>of the problem</li></ol><p>Now that we have that down, we just need one additional concept before moving on to the full fledged solution of our problem.</p><h3>Isoprofit / Isocost lines:</h3><p>We know that the objective of our problem is to maximize the value of <strong><em>Z = 3x1 + 2x2</em>. </strong>Now the equation <strong><em>3x1 + 2x2 = c1</em> </strong>represents a line. Each point on this line has the same value of <strong>Z </strong>which is <strong>c1. </strong>Each such line for which the value of the objective function stays the same is called an <strong>isoprofit</strong> or an <strong>isocost</strong> line for <strong>maximization</strong> and <strong>minimization</strong> problems respectively.</p><p>Note that if we change <strong><em>c1</em></strong> arbitrarily, the line simply shifts parallel to itself but the slope of the line stays the same. This fact is represented in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*8_abIPKLd4XtFRMDiw0F2g.png" /></figure><p>Alright then … Now you know everything that one needs to know in order to figure out the solution of our problem. Thus it is appropriate to pause and ponder a bit regarding a generic method to solve any two variable LP using a graph.</p><h3>The Solution</h3><p>Finally, after all that necessary jargon, we arrive at a point where we can finally solve this linear programming problem by the graphical method. So speak the truth, most of you must already know the solution by now if you have grasped the concept of isoprofit and isocost lines. However, in order to make things more concrete, we shall walk through the solution step by step.</p><p>We know two things by now for sure:</p><ol><li>All points satisfying the constraints of our problem are contained within a polygon (in our case — the polygon ABCDE)</li><li>The slope of our objective function never changes — It just shifts parallel to itself as per the value of Z</li></ol><p>The problem is that the interior of the polygon ABCDE has an infinite number of points so we cannot employ an exhaustive search to find out the point that renders the best or the most optimal value for our objective function.</p><p>When faced with such an infinite search space problem, it is common practice in mathematics and computer science to use a heuristic in order to reduce the this search space to a smaller, preferably finite set. Can we do so in this case?</p><p>If you look at the last figure, pick one particular Z = c1 line and shift it parallel to itself, you will find that when shifter to the left the value of Z decreases and when shifted to the right the value of Z always increases. Hence if we take the Z = 0 line passing through the origin and keep moving it to the right (thus increasing the value of Z), we would reach a point where there is only one point in common between our isoprofit line Z = c1 and our feasible region, the polygon ABCDE. If we move the line any further to the right, we will end up increasing Z but violating at least one of our constraints. It can also be intuitively understood that this point where the Z line and the polygon have exactly one point is common has to be one of the vertices of our polygon. <strong>Hence using the heuristic above, we can safely say that the optimal point of our problem must lie at one of the vertices of our feasible region — the polygon ABCDE. </strong>Therefore each of these vertices is called a <strong>basic feasible solution</strong>. We shall find out the reason behind this nomenclature in the next article.</p><p>Thus, we have reduced the search space from an infinite set to the set of vertices of the feasible region of a LP — in this case the set of points S = {A,B,C,D,E}. If we are able to evaluate the value of Z at these 5 points, we shall be able to identify the optimal solution to this problem. This is exactly what we do below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*TnonBPuhNBPorCLCYKYSew.png" /></figure><p>Great, now that we have evaluated the Z value at all points, we can assuredly say that the optimum of our linear program lies at point B. Thats it … Done … Solved.</p><p>So in summary, the step by step algorithm to solve a linear programming problem is listed below:</p><ol><li>Plot the inequalities that represent the constraints of the problem</li><li>Find out feasible region of our problem</li><li>Evaluate Z at each vertex of the feasible region</li><li>The vertex that renders the best value for the objective function is the optimum of the problem.</li></ol><p>Well, that was rather easy wasn’t it? Yes but the subject of linear programming is only just getting interesting. We are now able to solve linear programs with the graphical method but most situations one would encounter in real life would contain more than two decision variables. In such a case we, with our primitive visual sense, cannot possibly employ this method since we cannot possibly draw a graph in 6 or 7 or more dimensions. What then? Fortunately mathematicians have developed a fantastic tool using algebra that enables us to solve programs in almost as many variables as we wish. This is where and why we part from our geometry boxes and move on to the language of mathematics — algebra. We begin to discuss this method in the next article.</p><p><a href="https://medium.com/@anubhavsatpathy5/linear-programming-004-an-algebraic-approach-f1e41dd7f8f9">Next Article</a></p><h3>Auxiliary Material:</h3><p>The above method does seem to be robust for any and all linear programming problem in two variables but is it really. Let us address a few popular concerns regarding its robustness.</p><p>Are all feasible regions contained within polygons?</p><p>Certainly not. There might be a set of constraints that lead to an unbounded feasible region or another set where the feasible region in a void set. It is left to the user to ponder over these cases. I believe the information given above is enough to find your way through these cases.</p><p>Can a linear program have more than one optimum?</p><p>Well, for instance can the Z line be parallel to one of the sides of our polygon? If yes the yes</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8defefce1c90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linear Programming 002 : Application and Formulation]]></title>
            <link>https://medium.com/@anubhavsatpathy5/linear-programming-002-application-and-formulation-2073f21b4b05?source=rss-76a600b3d56a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2073f21b4b05</guid>
            <category><![CDATA[decision-making]]></category>
            <category><![CDATA[operations-research]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[operations]]></category>
            <dc:creator><![CDATA[Anubhav Satpathy]]></dc:creator>
            <pubDate>Wed, 10 Oct 2018 17:30:58 GMT</pubDate>
            <atom:updated>2018-10-17T17:32:40.361Z</atom:updated>
            <content:encoded><![CDATA[<h3>Linear Programming 002 : Application and Formulation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*X30Bs1EH19iaiehbInRsCA.jpeg" /></figure><p>Now that we know what kind of problems we seek to solve using the tool of linear programming, let us try and draw inspiration from the real world scenarios where such problems might need to be solved. There are many rather small problems that pass as real world problems in our textbooks’ introductory chapters. However, I find them far too simple to actually qualify as a real world situation. The problem we tackle here is a bit more sophisticated and it is taken from the lectures on Operations Research delivered at the Department of Management Studies, IIT Madras. Hence, the discussion of the problem might be a tad verbose but what I hope to achieve via this example is to kindle your curiosity towards these kind of problems and to have you appreciate how an individual perspective lends itself to the varied formulations of the same problem.</p><h3>Problem 1: Production Planning Problem</h3><p>A company manufactures only one product. Let’s call it product A for the sake of brevity. The company has estimated the demand for these products so far as the next four months are concerned. This demand estimate is presented in the table given below. The company has two modes of production namely Regular Time Production (hereafter referred to as RTP) and Over Time Production (hereafter referred to as OTP).</p><p>There is a threshold to the maximum amount of product A that can be produced by each of these methods of production. This is represented in the second table below. This threshold is usually referred to as the monthly production capacity. Each of these production methods come at separate costs per unit produced which is also mentioned in the second table.</p><p>If the company produces more on a particular month than the demand for that month, it has the option to carry over the excess produce to cater to the demand of the following months. The cost to this carrying over of inventory is called inventory or storage cost. In the case of product A the storage cost is Rs. 3 per unit per month.</p><p>The objective of the company is to meet the demands of the next four months while minimising the total costs of production and storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*0vJO4hEAJO9qKGqspZNqag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*VmiIdAlDX6HZdQfUaOAHnw.png" /></figure><h3>Solution Discussion 1:</h3><p>Now that we have understood the problem. Let us start trying to quantify it. We know that the company wants to meet the demand of the next four months. Therefore the company needs to manufacture a certain (non-negative) quantity of the product in each of these four months using any or both of the production methods at its disposal so as to meet this demand. It may also decide to carry forward certain quantities of the product produced in one month to cater to the demands of the following months.</p><p>The decisions that might affect the total cost of production and storage will then include the following variables:</p><ol><li>How many units does it want to product each month by using the RTP method.</li><li>How many units does it want to product each month by using the OTP method</li><li>How many units of excess units must it produce each month</li></ol><p>Next, we give names to these decision variables in the following table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*vmOcnFUaXmLvsDFDjUN1eA.png" /></figure><p>Alright then! Now that we have identified the decision variables, we can move along to formulating the constraints. What we mean by constraints is that are there any obligations that these variables must adhere to in terms of the values that they can take.</p><p>Well for one we do know that the company has to meet the demand for each of the four months. Representing the same mathematically gives us the following constraints:</p><p>For Month 1:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*hcHer_isjagZFX8p_m1KUQ.png" /></figure><p>Since we know <strong>I1 </strong>(forgive the lack of sub scripting ability on Medium)is the excess amount produced over and above the demand for Month 1. We now list the same constraints for the other months.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/175/1*VxeoP18VHZsREsx7b4GaGg.png" /></figure><p>We note that the company would not want to produce any extra inventory for the last or the fourth month and hence the missing <strong>I4</strong> in the fourth constraint.</p><p>Okay, we got that mess in order! Next, we try and formulate the total cost of production and storage in terms of our decision variables since that is exactly what we are trying to minimise. The same is mentioned below and explained thereafter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*piGdL7IHpPsNtynOcufy8w.png" /></figure><p>What we did should be self evident by this point, but since we are bent on nailing down this discussion to the grain, a step-wise explanation follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*zU0vm3uinPB08wI74QRysQ.png" /></figure><p>What we need to do via the tools of linear programming is to minimise Z subject to the constraints listed above. A typical Linear programming problem can be formulated in the following manner:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*8Krm92awq8130Uy5F1PAUA.png" /></figure><p>The bulk of the next few articles are devoted to the articulation of algorithms to solve these kind of problems but we shall try in the rest of this article to appreciate how a different perspective of the same problem can lead to a very different kind of formulation.</p><h3>Solution Discussion 2 (Different Perspective):</h3><p>Now that we have one formulation of this problem let us try and look at this problem differently and see if it leads to a different kind of formulation. The major change in our viewpoint comes by modifying the semantics of our decision variables. The following table describes the new decision variables and the text thereafter tries to explain the same</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*0ivzOb7GDemAuOZwRMijcg.png" /></figure><p>Now we look at the constraints using these decision variables</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*nSp14IGobcUP90ua8sL6gw.png" /></figure><p>This might be troubling to the eye but trust me, read the constraints out loud and try reading past the equations to the semantics described in the decision variables table. In my experience, however little it may be, it is this comfort of reading mathematics as a language that really enables a person to employ mathematical tools and knowledge to tackle real world business problems.</p><p>Now that you are comfortable with seeing past the Greek into the semantics of each of these constraints, we shall move on to formulate the cost function or the Objective function that is to be minimised. Once again I will state it below but not try to explain it in detail. That part of the job I leave to the reader as an exercise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*10fzxmcVY9e8Rm34Zj8h2A.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*V-6kwL1NrLicrnVMM3O3Yg.png" /></figure><p>Wait wouldn’t the first solution be easier to formulate? Ummm .. Yeah … Well wouldn’t it be easier to solve as well? Like a gazillion times easier .. Well why did we have to go through this torture of a solution then??</p><p>I had two intentions behind showcasing this horrendous formulation here. Firstly I wanted to show how a shift in perspective can make the task at hand a ton easier or harder to do. Secondly, I wanted to ensure that people start building a habit of reading mathematical equations and formulae. It is not possible to overestimate the importance of building a nice comfortable relationship with equations and the alphabet of mathematics.</p><p>Think about it .. most niche algorithms, be it methods of search or recommendations to robotic automation procedures will always first find expression in the language of mathematics. In order to implement them in code, one will need to read past the alphabet into the semantics. It works the other way around as well. Imagine you have to model a real world situation described to you in a natural language.. Modelling more often than not simply means translating between the language used by people and the one used by mathematicians and computers. It must be so much easier to do if one is sufficiently comfortable with both kind of languages.</p><p>I hope i have bailed myself out of that delicate situation! In the next article, we discuss the first method to solve a linear programming problem. We shall provide a nice geometric interpretation of a small problem. I promise … No Greek … only graphs! See you around</p><h3>Auxiliary Material:</h3><p>The production planning problem has long been standing in the field of management and still manages to trouble most managers around the world. But we just solved it above didn’t we? I mean we at least formulated it into a linear programming problem which I had promised can be solved. So isn’t it just a matter of implementation now to solve this problem entirely?</p><p>Well eh … We might have cheated ourselves a little bit. In order to formulate the problem as a linear programming problem, we did skim over a few details that actually make the problem much harder to solve. Let’s take a look at a few such details:</p><ol><li>What we treated with certainty as the monthly demand of product A viz. The RHS of all our constraints is actually an estimated or forecasted demand with an uncertainty associated with it. We DID NOT factor in this uncertainty in our formulation yet</li><li>Let us say that the demands were such that meeting them was rendered impossible using the production methods at our disposal. In such a case there is a cost or a risk value associated with not meeting such goals. We did not factor those in our formulation.</li><li>Well we conveniently assumed that the production method is flawless. Well guess again… A certain amount of the monthly production capacities of these machines might actually be taken up in producing faulty units that cannot be utilised to meet the monthly demand. We DID NOT factor in these risks into our problem formulation</li></ol><p>Are you wasting your time then? Certainly not. What we were able to do was bound the bigger production planning problem by placing some numeric assumption on it. And we formulated this version of the problem in our equations. We were left at the mercy of educated guesses when we encountered the problem. We have at least been able to better our odds of tackling the problem by leaps and bounds. So did we solve it ? NO … Did we make things better? QUITE A LOT</p><h3>Practice makes Perfect:</h3><p>In the interest of getting comfortable with formulating linear programming problems, I have listed down a few problem statements taken from an operations research textbook by Mr. Wayne L. Winston. Try getting from the problem statements to the likes of the formulations mentioned in the green boxes above.</p><h3>Problem 1 : Work Scheduling Problem:</h3><p>Accio is a hyper-local delivery startup operating in Bangalore that hires runners to do errands within the city for their customers. According to the daily demand of tasks received by the company, their data science team has estimated the number of runners required to meet the demand per day of the week. This estimate is highlighted in the table below. The company follows a five day working week which means any Accio runner will work continuously for 5 consecutive days in a week and rest for the next two days. Accio wants to meet the demand of every day of the week while minimising the cost of runners hired. Try formulating this situation as a linear program. Do yourself one better and list down all the assumptions that you made while making such a formulation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*8tMm5Y-cmK_QPbP6UnqEyw.png" /></figure><p><a href="https://medium.com/@anubhavsatpathy5/linear-programming-003-graphical-solution-8defefce1c90">Next Article</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2073f21b4b05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linear Programming 001 : Setting up the problem]]></title>
            <link>https://medium.com/@anubhavsatpathy5/linear-programming-001-setting-up-the-problem-36070bb45b8b?source=rss-76a600b3d56a------2</link>
            <guid isPermaLink="false">https://medium.com/p/36070bb45b8b</guid>
            <category><![CDATA[operations-research]]></category>
            <category><![CDATA[decision-making]]></category>
            <category><![CDATA[operations]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Anubhav Satpathy]]></dc:creator>
            <pubDate>Wed, 10 Oct 2018 17:19:13 GMT</pubDate>
            <atom:updated>2018-10-10T17:35:48.446Z</atom:updated>
            <content:encoded><![CDATA[<h3>Linear Programming 001 : Setting up the problem</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DQ3X86MTxUit0EMfPyowtA.jpeg" /></figure><p>Mathematically speaking, linear programming is the study of optimising (fancy way of saying minimising or maximising) a certain linear objective function, by tweaking certain variables of interest called decision variables, so as to always satisfy a set of linear constraints governing the problem. Wow, I almost wish my high school teacher knew I’d be able to do that someday!</p><p>Anyway, what they did not want you to understand when they said it like that in the textbooks back is school was this. There is a function say</p><p><strong>f(x1,x2,…,xn)</strong></p><p>of n variables. For some reasons that we will learn to appreciate in the next section, we want to find the values of x1 to xn that maximise/minimise this function. But that is not all. We cannot just assign any or all values to these variables. They come with their own baggage(constraints)! We can, to start with, express these constraints as inequalities. Say we have the following constraints</p><p><strong>g(x1,x2,…,xn) &lt;= c1</strong></p><p><strong>h(x1,x2,…,xn) &lt;= c2</strong></p><p>Where c1 and c2 are arbitrary constants</p><p>Now, if all these functions, <strong>f(x1,x2,…,xn)</strong>, <strong>g(x1,x2,…,xn)</strong> and <strong>h(x1,x2,…,xn)</strong> were to be <strong>linear in x1,x2,…,xn</strong> , then a <strong>suitable algorithm to find the values for x1,x2,…,xn so as to maximise/minimise f(x1,x2,…,xn) while also satisfying g(x1,x2,…,xn)&lt;= c1 and h(x1,x2,…,xn) &lt;= c</strong>2 is what the study of linear programming seeks to achieve.</p><p>I get it! You are totally entitled to walk away at this stage with bad memories of high school calculus! In my defence, I had to state the problem in a generic sense before I could start explaining the wide applicability of such problems. That is precisely what we discuss in the next article.</p><p><a href="https://medium.com/@anubhavsatpathy5/linear-programming-002-application-and-formulation-2073f21b4b0">Next Article</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36070bb45b8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decision Science : The Science within the art]]></title>
            <link>https://medium.com/@anubhavsatpathy5/decision-science-the-science-within-the-art-29589f39d6ad?source=rss-76a600b3d56a------2</link>
            <guid isPermaLink="false">https://medium.com/p/29589f39d6ad</guid>
            <category><![CDATA[operations-management]]></category>
            <category><![CDATA[operations-research]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Anubhav Satpathy]]></dc:creator>
            <pubDate>Wed, 10 Oct 2018 17:10:26 GMT</pubDate>
            <atom:updated>2018-10-10T17:26:50.414Z</atom:updated>
            <content:encoded><![CDATA[<h3>Decision Science : The Science within the art</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHhmwOxkhkFZJwl3sZYhpw.jpeg" /></figure><p>In business as in life we encounter situations. These situations feed on our reactions to evolve into a future sequence of situations. I am rather uncomfortable trying to pin down a definition on a concept and not argue with it but if obligated to, I would define decisions as these interactions between situations and reactions. Since it is these interactions that clearly define the future of a business, we might want to employ our knowledge of mathematics to tame the beast as we have so successfully done in the fields of engineering and the physical sciences. Hence, the study of decision science, I believe rests at the heart of the study of management.</p><p>Last I checked Management was precariously positioned at the borders between the arts and the sciences with the former having a stronger claim to the field of study. Having enough respect for both empires and their artisans, I strongly believe that these borders are slowly but surely losing their significance as more and more people are beginning to realise the complementary aspect of the relationship between the arts and the sciences. I do acknowledge that the language of mathematics is not sufficiently evolved to express and procreate the magnanimity of the arts however, at the same time, I believe that we can try and place boundaries on a problem encountered in the arts by quantifying certain aspects of it. The hope is to sufficiently handicap the problem so that we can employ numerical methods to tame this relatively docile beast. The question that we are trying to answer while employing these techniques to the art of management is not if we can entirely solve the problems in management. It certainly rhymes more with ‘Can we do sufficiently enough to aid and abet managers in their decision making’, ‘Can we make things better than they already are’. This chain of thought will be a constant across this series of articles.</p><p>I must clarify that I claim no amount of expertise in the subject except for trying my best to be a diligent student of it. This is my attempt to uncover what is often lost under the tools and tricks of mathematics that are taught to us in business schools. It is also a self centred approach to assure myself of my own understanding of the subject.</p><p>We shall start with what we studied in school as linear programming but we shall try to appreciate the essence and applicability of it rather than losing sleep over the madness of solving a large simplex table with a pen and a paper. Once we are satisfied with grasping the essence of the subject at hand, we shall also endeavour to put technology to do what it does better than us — the execution of algorithms.</p><p>Okay … enough said — lets flirt with this long lost friend called linear programming and appreciate what we did not when we first met.</p><p><a href="https://medium.com/@anubhavsatpathy5/linear-programming-001-setting-up-the-problem-36070bb45b8b">Next Article</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29589f39d6ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>