<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vedant Misra</title>
	<atom:link href="http://vedantmisra.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vedantmisra.com</link>
	<description></description>
	<lastBuildDate>Sun, 28 Apr 2013 16:47:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Election prediction in Python à la 538</title>
		<link>http://vedantmisra.com/archives/election-prediction-in-python-a-la-538/</link>
		<comments>http://vedantmisra.com/archives/election-prediction-in-python-a-la-538/#comments</comments>
		<pubDate>Sun, 04 Nov 2012 18:05:35 +0000</pubDate>
		<dc:creator>vedant</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vedantmisra.com/?p=631</guid>
		<description><![CDATA[With the election just a few days away, Nate Silver and his blog FiveThirtyEight have been increasingly in the news. I&#8217;ve been an enthusiastic reader since the 2008 election, when Silver correctly predicted the outcome in every senate race, and...]]></description>
				<content:encoded><![CDATA[<p>With the election just a few days away, <a href="http://en.wikipedia.org/wiki/Nate_Silver">Nate Silver</a> and his blog <a href="http://fivethirtyeight.blogs.nytimes.com">FiveThirtyEight</a> have been increasingly in the news. I&#8217;ve been an enthusiastic reader since the 2008 election, when Silver correctly predicted the outcome in every senate race, and the general election result in 49 of 50 states.</p>
<p>Silver describes his prediction methodology <a href="http://fivethirtyeight.blogs.nytimes.com/methodology/">on his blog</a>. I&#8217;ve implemented a rough version of it in Python, with placeholders for things I haven&#8217;t done yet. Code and polling data are <a href="https://github.com/vedant/election-prediction">available on github</a> (vedant/election-prediction.git). Polling data are scraped from <a href="http://realclearpolitics.com/epolls/latest_polls/president/">Real Clear Politics</a>. Try modifying and augmenting it to generate your own projections.</p>
<p>This implementation predicts 303 electoral college votes for President Obama, to 235 for Governor Romney, and generated the electoral college map below. This is close to Silver&#8217;s current projection of 305 to 232.</p>
<p><a href="http://vedantmisra.com/wp-content/uploads/2012/11/map.png"><img class="aligncenter size-full wp-image-636" title="electoral-college-projection" src="http://vedantmisra.com/wp-content/uploads/2012/11/map.png" alt="Electoral college projection 2012" width="588" height="355" /></a></p>
<p>The model implemented here gives an exponentially decaying weight to older polls, but doesn&#8217;t consider poll sample size or historical pollster ratings. I expect that neither of these is especially important when using the RealClearPolitics polling data, which seems to include only major polls. The implementation also drops historically unreliable pollsters, and provides for dropping partisan polls and making adjustments to polls that have historically leaned to one side. </p>
<p>There is currently no trendline adjustment to account for the recent propensity of the electorate, and no likely voter adjustment or non-poll data, all of which are included in Nate Silver&#8217;s model. </p>
<p>The result of this implementation is probably only close to Nate Silver&#8217;s actual methodology because there is extensive polling data for the presidential election. I imagine the more sophisticated model components only play a significant role in Nate Silver&#8217;s model when polling data is more sparse and less consistent.</p>
]]></content:encoded>
			<wfw:commentRss>http://vedantmisra.com/archives/election-prediction-in-python-a-la-538/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elevator algorithms</title>
		<link>http://vedantmisra.com/archives/elevator-algorithms/</link>
		<comments>http://vedantmisra.com/archives/elevator-algorithms/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 18:34:27 +0000</pubDate>
		<dc:creator>vedant</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vedantmisra.com/?p=413</guid>
		<description><![CDATA[A recent post on HN got me thinking (and reading) about elevator scheduling algorithms.  As it turns out, this is an active area of extensive research. Manufacturers tend to use slightly different algorithms and treat them as trade secrets. But in...]]></description>
				<content:encoded><![CDATA[<p><a href="https://news.ycombinator.com/item?id=3351649">A recent post on HN</a> got me thinking (and reading) about elevator scheduling algorithms.  As it turns out, this is an active area of extensive research.</p>
<p>Manufacturers tend to use slightly different algorithms and treat them as trade secrets. But in practice, their algorithms are similar, because the theoretical optimization criteria are roughly the same:</p>
<ul>
<li>provide even service to each floor</li>
<li>minimize how long passengers wait for an elevator to arrive</li>
<li>minimize how long passengers spend to get to their destination floor</li>
<li>serve as many passengers as possible</li>
</ul>
<p>The single elevator case is not very interesting, nor is the case when the passenger can&#8217;t specify his direction of travel when making the call (one button per floor), so I&#8217;ll instead discuss only the case where there are multiple elevators, and two buttons on each floor.</p>
<p>There are many criteria to consider in elevator scheduling. For example, people have predictable behavioral patterns that must be addressed, including the uppeak and downpeak&#8212;respectively 9AM and 5PM, in many office buildings&#8212;which are when elevator efficiency matters the most. There is often a 1-2 hour two-way peak (lunchtime) to address as well. Algorithms should consider whether an elevator is full before assigning it to an elevator call. Sometimes, some blocks of floors have predictably higher interblock or intrablock traffic than other blocks. Often, calls on some floors (executive floors, for example) are given higher priority than others (basements). All of these factors increase the algorithm sophistication.</p>
<p>Still, they tend to be based on the four classic group traffic control algorithms.</p>
<ul>
<li><strong>Nearest Car (NC): </strong>Elevator calls are assigned to the elevator best placed to answer that call according to three criteria that are used to compute a figure of suitability (FS) for each elevator. (1) If an elevator is moving towards a call, and the call is in the same direction, FS = (N + 2) &#8211; d, where N is one less than the number of floors in the building, and d is the distance in floors between the elevator and the passenger call. (2) If the elevator is moving towards the call, but the call is in the opposite direction, FS = (N + 1) &#8211; d. (3) If the elevator is moving away from the point of call, FS = 1. The elevator with the highest FS for each call is sent to answer it. The search for the &#8220;nearest car&#8221; is performed continuously until each call is serviced.</li>
<p></p>
<li><strong>Fixed Sectoring Common Sector System (FSO): </strong>The building is divided into as many sectors as there are elevators. Elevators in each sector prefer calls in that sector.</li>
<p></p>
<li><strong>Fixed Sectoring Priority Timed System (FS4): </strong>The building is divided into up sectors and down sectors, and elevators only ever treat down calls in down sectors and up calls in up sectors. Each sector has a priority level, which increases the longer the passengers wait. The rate of increase can vary from sector to sector and over time.</li>
<p></p>
<li><strong>Dynamic Sectoring System (DS): </strong>Floors are grouped into dynamic sectors. Each elevator is allocated to a sector in the sector definition, and the sectors change size and location based on the position of moving and idle elevators.</li>
</ul>
<p>Modern control systems do even more than this. Some of them dynamically compute cost functions for passengers waiting on an elevator. Stochastic traffic control systems empirically compute the distribution of response times and try to make it as Gaussian as possible (wait times should be consistent; there shouldn&#8217;t be some times when elevators respond instantly and others where they take a while). Some advanced techniques use fuzzy logic schedulers (Ho and Robertson 1994), genetic algorithms (Siikonen 2001, Miravete 1999), and neural networks (Barney and Imrak 2001).</p>
<p>Most of this information is paraphrased from UK-based lift consultant Gina Barney&#8217;s book &#8220;Elevator Traffic Handbook: Theory and Practice.&#8221; A most uplifting read.</p>
<p>This post originated as <a href="http://www.quora.com/Is-there-any-public-elevator-scheduling-algorithm-standard#">an answer on Quora</a>.</p>
<p>See discussion on <a href="http://www.reddit.com/r/programming/comments/npevh/actual_elevator_algorithms/">reddit</a> and <a href="http://news.ycombinator.com/item?id=3389374">hackernews</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://vedantmisra.com/archives/elevator-algorithms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rooting Android</title>
		<link>http://vedantmisra.com/archives/rooting-android/</link>
		<comments>http://vedantmisra.com/archives/rooting-android/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 12:00:59 +0000</pubDate>
		<dc:creator>vedant</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vedantmisra.com/?p=417</guid>
		<description><![CDATA[Android was rooted quite a while ago by a hacker who posts at c-skills.blogspot.com.  Like many others, I tried out the exploit he installed to see if I could make my phone more interesting (this is something it&#8217;s now okay to...]]></description>
				<content:encoded><![CDATA[<p>Android was <a href="http://en.wikipedia.org/wiki/Rooting_(Android_OS)">rooted</a> quite a while ago by a hacker who posts at <a href="http://c-skills.blogspot.com/">c-skills.blogspot.com</a>.  Like many others, I tried out the exploit he installed to see if I could make my phone more interesting (this is something <a href="http://www.copyright.gov/1201/">it&#8217;s now okay to admit to</a>).  This got me wondering about whether the exploit for Android is generalizable&#8212;is there any way it can be applied to Linux generally?</p>
<p>Short answer: no.</p>
<p>Rage Against the Cage (RAtC) exploits the fact that the Android Debug Bridge daemon (adb) on Android devices starts as root by default, and calls setuid to drop its privileges to those of a shell account.  The ADB daemon is what runs on Android phones to enable Android software developers to communicate with the phones they&#8217;re testing their software on.  This kind of issue doesn&#8217;t exist in Linux in general, so the exploit probably can&#8217;t be generalized.  Nonetheless, here is some more detail on how RAtC works.</p>
<p>In Linux, a system-wide resource limit, RLIMIT_NPROC, defines the maximum number of simultaneous processes allowed by the system (Android, in this case). RAtC checks this limit, and spawns processes that do nothing until Android&#8217;s limit is reached. This is called a fork bomb.</p>
<p>With the number of processes maxed out, RAtC kills the running adb process on the phone. The process that starts adb when the phone is turned on tries to ensure that adb is always running, so it restarts adb.  There&#8217;s a race condition for that parent process to overcome here, because the adb process must be spawned while RLIMIT_NPROC is already nearly maxed out.</p>
<p>Adb restarts by default as root, which it needs to do so that developers can properly debug their software. It then quickly checks if it does indeed need to keep running as root, or if it can downgrade its privileges because root access isn&#8217;t necessary. The former is only true when Android is running in a sandboxed emulator on a developer&#8217;s computer or if the Android build is a debugging version, so it tries to drop its privileges using setuid.</p>
<p>But RAtC&#8217;s fork bomb has already maxed out the number of processes already running, so the call to setuid fails, and adb keeps running as root. With adb running as root, we can do whatever we want on the device.</p>
<p>This is also <a href="http://www.quora.com/What-are-the-exact-mechanisms-flaws-exploited-by-the-rage-against-the-cage-and-z4root-Android-exploits#ans883688">a post on Quora</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://vedantmisra.com/archives/rooting-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Market manipulation in the financial crisis</title>
		<link>http://vedantmisra.com/archives/market-manipulation-in-the-financial-crisis/</link>
		<comments>http://vedantmisra.com/archives/market-manipulation-in-the-financial-crisis/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 19:20:08 +0000</pubDate>
		<dc:creator>vedant</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vedantmisra.com/?p=409</guid>
		<description><![CDATA[I authored some work recently in which we identify an instance of potential market manipulation. Here&#8217;s the page on NECSI&#8217;s website. Here are reddit posts about it in economics, politics, math, finance, and occupywallstreet.  Here&#8217;s an HN post about it. It...]]></description>
				<content:encoded><![CDATA[<p>I authored some work recently in which we identify an instance of potential market manipulation.</p>
<p>Here&#8217;s the page on <a href="http://necsi.edu/research/economics/bearraid.html">NECSI&#8217;s website</a>.</p>
<p>Here are reddit posts about it in <a href="http://www.reddit.com/r/Economics/comments/nhvq6/evidence_of_market_manipulation_in_the_financial/">economics</a>, <a href="http://www.reddit.com/r/PoliticsPDFs/comments/niemn/evidence_of_market_manipulation_in_the_financial/">politics</a>, <a href="http://www.reddit.com/r/math/comments/ngnnj/evidence_of_market_manipulation_in_the_financial/">math</a>, <a href="http://www.reddit.com/r/finance/comments/nicqk/evidence_of_market_manipulation_in_the_financial/">finance</a>, and <a href="http://www.reddit.com/r/occupywallstreet/comments/ng4pn/evidence_of_market_manipulation_in_the_financial/">occupywallstreet</a>.  Here&#8217;s <a href="http://news.ycombinator.com/item?id=3380626">an HN post</a> about it.</p>
<p>It was covered by <a href="http://boingboing.net/2011/12/21/complex-systems-institute-clai.html">BoingBoing</a>, <a href="http://www.physorg.com/news/2011-12-mystery-predators-contributed-fiscal-collapse.html">PhysOrg</a>, <a href="http://www.sciencenews.org/view/generic/id/336990/title/Smells_like_a_bear_raid">ScienceNews</a>, <a href="http://www.technologyreview.com/blog/arxiv/27422/">Technology Review</a>, <a href="http://www.zerohedge.com/contributed/market-manipulation-financial-crisis">ZeroHedge</a>, <a href="http://www.nakedcapitalism.com/2011/12/links-121811.html">Naked Capitalism</a>, and others.</p>
]]></content:encoded>
			<wfw:commentRss>http://vedantmisra.com/archives/market-manipulation-in-the-financial-crisis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
