<?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 Greeva Patel on Medium]]></title>
        <description><![CDATA[Stories by Greeva Patel on Medium]]></description>
        <link>https://medium.com/@greeva17?source=rss-19a1af82ebbe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q7XzO34S8nIMifMR8361sg.jpeg</url>
            <title>Stories by Greeva Patel on Medium</title>
            <link>https://medium.com/@greeva17?source=rss-19a1af82ebbe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:33:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@greeva17/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[Ant Colony Optimization]]></title>
            <link>https://medium.com/@greeva17/ant-colony-optimization-d901b8da551d?source=rss-19a1af82ebbe------2</link>
            <guid isPermaLink="false">https://medium.com/p/d901b8da551d</guid>
            <dc:creator><![CDATA[Greeva Patel]]></dc:creator>
            <pubDate>Thu, 22 Aug 2019 17:34:22 GMT</pubDate>
            <atom:updated>2019-09-04T03:47:42.898Z</atom:updated>
            <content:encoded><![CDATA[<p>Before getting started with the Algorithm, let’s get to the philosophy behind this Algorthim. There is a beautiful observation (also an example of bio-mimicry) of a tiny creature crawling in search of food. Ants are way smarter than we think, they follow a specific path leading to their food.</p><p>One thing that we need to know about is one chemical named “<em>Pheromone</em>” which is released by ants. The ants follows the same sense of Pheromone while travelling. That means the leading ant can carve the path for the following ants by the means of Pheromone. But, one of the most important characteristic of Pheromone is that it gets evaporated over time. That means if the ants stop following the path scented by Pheromone it gets evaporated and no ants will follow it further.</p><p>There is some disciplined patterns observed how ants find the food. The phases are as follows:</p><ol><li>Wander Mode</li><li>Search Mode</li></ol><p>3. Return Mode</p><p>4. Attracted Mode</p><p>5. Trace Mode</p><p>6. Carry Mode</p><p>Briefly, the ants spread out randomly and takes all the possible paths, the ants releases Pheromone while going. Then once they find the food they return to the same path so it will increase the Phermone density of that path that means more ants will tend to follow the same path.</p><p>To make it clear let’s take an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qFI7NGvr9SRFw03lVtGKBA.jpeg" /></figure><ol><li>Everything is normal, ants are following the led path to their food.</li></ol><p>2. One obstacle comes to the path, so their direct path is blocked. So, they have to choose whether to go from left or from right. Now, clearly we can think is the one with the least distance is the best path. But how ants do it is quite interesting.</p><p>3. At the point they encounter obstacle they spread out in the both directions and try both the paths. Now, obviously longer the distance the more time would it take for ant to travel. So in our example the ants from right side of the obstacle will meet first compared to the ants on left side as they have to travel shorter distance. So, when the ants from the left side would cross the obstacle the ants from right would have gone too far.</p><p>4. So, the ants from the right side will increase the Pheromone density. So, at the point of obstacle the ants would choose the path from right side as it has more Pheromone density and over time no ants will choose the left path as Pheromone would be evaporated. So, at some point all the ants will follow the right path.</p><p>So, this algorithm has specific characteristics:</p><ol><li>Finds the best path based on the “History” (Pheromone density) .</li></ol><p>2. The one who takes the optimal path will update its “Pheromone Factor”. So, at the node the preference of that path will be increased.</p><p>3. If one path is not taken over and over again, then its Pheromone Factor goes down everytime making it less Preferable.</p><p>Travelling Salesman Problem can be solved using ACO where a saleman goes to different locations and returns home choosing the optimal path. Ant colony optimization will work for the problem even if the new locations are added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1YBLBWPhbaz29Ot6PK-mUA.jpeg" /></figure><p>Now, what if one more delivery location is added?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M_zEOgG-e0YYUTm0fQlFxQ.jpeg" /></figure><h4>Uses of Ant Colony Optimization:</h4><p>1. Network Model Problem</p><p>2. Vehicle Routing</p><p>3. Quadratic Assignment Problem</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*RpbXPJwqJ21J35qV4hgUrQ.jpeg" /></figure><p>Reference<br><a href="https://www.mii.lt/zilinskas/uploads/Heuristic%20Algorithms/Lectures/Lect3/AntColony.ppt">https://www.mii.lt/zilinskas/uploads/Heuristic%20Algorithms/Lectures/Lect3/AntColony.ppt</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d901b8da551d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DYNAMIC PROGRAMMING]]></title>
            <link>https://medium.com/@greeva17/dynamic-programming-f07cd73ca115?source=rss-19a1af82ebbe------2</link>
            <guid isPermaLink="false">https://medium.com/p/f07cd73ca115</guid>
            <dc:creator><![CDATA[Greeva Patel]]></dc:creator>
            <pubDate>Thu, 22 Aug 2019 15:32:54 GMT</pubDate>
            <atom:updated>2019-09-04T01:34:08.742Z</atom:updated>
            <content:encoded><![CDATA[<p>Dynamic Programming is a method for solving a complex problems by breaking into simpler sub-problems ,solving each of those sub-problems just once and storing their solution in array,map,etc.Storing in array is known as Memoization. Re-computation is avoided.It reduces time complexity from exponential to polynomial.</p><h3>Elements of dynamic programming</h3><p><strong>Dynamic programming</strong> posses two important elements which are as given below:</p><ol><li>Overlapping sub problem: Solved using top-down approach and bottom-up approach</li><li>Optimal sub structure: From every sub-problem optimal solution is obtained.</li></ol><p>For example:-</p><blockquote>Fibonacci using recursive equation</blockquote><p>int fib(int n)</p><p>{</p><p>if(n&lt;=1)</p><p>return n;</p><p>return fib(n-2)+fib(n-1);</p><p>}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*RihNzqbxcmt0w3MUHepqaw.jpeg" /></figure><p>Time Complexity:</p><p>T(n) = T(n-1) + T(n-2) + 1 = 2^n = O(2^n)</p><p>But using dynamic approach we can store the value of already called number in the array and can reduced the no. of calls.</p><blockquote>Fibonacci using memoization</blockquote><p>int fib(int n)</p><p>{</p><p>if(n≤1)</p><p>return n;</p><p>F[0]=0;</p><p>F[1]=1;</p><p>for(int i=2;i≤n;i++)</p><p>{</p><p>F[i]=F[i-2]+F[i-1];</p><p>}</p><p>return F(n);</p><p>}</p><p>fib(n)=n+1 calls i.e in fib(4) the calls made are fib(4),fib(3),fib(2),fib(1),fib(0).</p><p>Time Complexity: O(n)</p><p>Space Complexity : O(n)</p><h3>Applications:-</h3><ol><li>0/1 knapsack problem</li><li>Making change problem</li><li>Chain matrix multiplication</li><li>Longest common subsequence (LCS)</li><li>Time sharing: It schedules the job to maximize CPU usage</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f07cd73ca115" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>