Hill Climbing in real life

Fifteen years back, I enrolled for a course on Artificial Intelligence as part of my B.Tech. programme at IIT Madras. It was well before stuff like “machine learning” and “data science” became big, and the course was mostly devoted to heuristics. Incidentally, that term, we had to pick between this course and one on Artificial Neural Networks (I guess nowadays that one is more popular given the hype about Deep Learning?), which meant that I didn’t learn about neural networks until last year or so.

A little googling tells me that Deepak Khemani, who taught us AI in 2002, has put up his lectures online, as part of the NPTEL programme. The first one is here:

In fact, the whole course is available here.

Anyways, one of the classes of problems we dealt with in the course was “search”. Basically, how does a computer “search” for the solution to a problem within a large “search space”?

One of the simplest heuristic is what has come to be known as “hill climbing” (too lazy to look through all of Khemani’s lectures and find where he’s spoken about this). I love computer science because a lot of computer scientists like to describe ideas in terms of intuitive metaphors. Hill climbing is definitely one such!

Let me explain it from the point of view of my weekend vacation in Edinburgh. One of my friends who had lived there a long time back recommended that I hike up this volcanic hill in the city called “Arthur’s Peak“.

On Saturday evening, I left my wife and daughter and wife’s parents (who I had travelled with) in our AirBnB and walked across town (some 3-4 km) to reach Holyrood Palace, from where Arthur’s Seat became visible. This is what I saw: 

Basically, what you see is the side of a hill, and if you see closely, there are people walking up the sides. So what you guess is that you need to make your way to the bottom of the hill and then just climb.

But then you make your way to the base of the hill and see several paths leading up. Which one do you take? You take the path that seems steepest, believing that’s the one that will take you to the top quickest. And so you take a step along that path. And then see which direction to go to climb up steepest. Take another step. Rinse. Repeat. Until you reach a point where you can no longer find a way up. Hopefully that’s the peak.

Most of the time, you are likely to end up on the top of a smaller rock. In any case, this is the hill climbing algorithm.

So back to my story. I reached the base of the hill and set off on the steepest marked path.

I puffed and panted, but I kept going. It was rather windy that day, and it was threatening to rain. I held my folded umbrella and camera tight, and went on. I got beautiful views of Edinburgh city, and captured some of them on camera. And after a while, I got tired, and decided to call my wife using Facetime.

In any case, it appeared that I had a long way to go, given the rocks that went upwards just to my left (I was using a modified version of hill climbing in that I used only marked paths. As I was to rediscover the following day, I have a fear of heights). And I told that to my wife. And then suddenly the climb got easier. And before I knew it I was descending. And soon enough I was at the bottom all over again!

And then I saw the peak. Basically what I had been climbing all along was not the main hill at all! It was a “side hill”, which I later learnt is called the “Salisbury Crags”. I got down to the middle of the two hills, and stared at the valley there. I realised that was a “saddle point”, and hungry and tired and not wanting to get soaked in rain, I made my way out, hailed a cab and went home.

I wasn’t done yet. Determined to climb the “real peak”, I returned the next morning. Again I walked all the way to the base of the hill, and started my climb at the saddle point. It was a tough climb – while there were rough steps in some places, in others there was none. I kept climbing a few steps at a time, taking short breaks.

One such break happened to be too long, though, and gave me enough time to look down and feel scared. For a long time now I’ve had a massive fear of heights. Panic hit. I was afraid of going too close to the edge and falling off the hill. I decided to play it safe and turn back.

I came down and walked across the valley you see in the last picture above. Energised, I had another go. From what was possibly a relatively easier direction. But I was too tired. And I had to get back to the apartment and check out that morning. So I gave up once again.

I still have unfinished business in Edinburgh!


Paris or Parrys Corner?

We arrived in Paris Gare Du Nord a couple of hours back by Izy train from Brussels (this is a new low-cost service introduced by Thalys, and that deserves its own blogpost).

I don’t know whether it’s something specific about Gare Du Nord, or if I feel this way about all Terminus railway stations, but it had this feeling of Chennai Central to it. This feeling was complete with the smell of urine just outside the station.

We walked to the left, as our online research had told us that there were some South Indian restaurants there, and we were seeking some comfort food. Saravana Bhavan first came into view. A little further was Hotel Sangeetha, and we ate there (I have better memories of Sangeetha than Saravana Bhavan from my times in Chennai. The decision today was well-founded).

After having finished our dinner at Sangeetha (food and coffee were brilliant, far better than at Saravana Bhavan in Amsterdam where we ate 3 days ago. Dinner was made better by the discovery that a couple of waiters there spoke Kannada), we decided to walk to La Chapelle metro station to catch a train to our hotel.

Having been in Europe for over 3 months now, the walk from Sangeetha to La Chapelle seemed like anything but Europe. The road was dirty in parts, with water flowing next to the pavements at some places (making us lift our rolling suitcase every few metres). That was not the only thing that reminded us of Chennai, though.

Saravana Bhavan and Sangeetha were only two in the long line of Tamilesque establishments on that road (Rue du Frauborg Saint Denis). There was an Annachi, a Muniyandi Vilas and at least two outlets that served Dindigul Thalapakattu Biryani!

And it was not just the restaurants. There was a “Thangamaligai” (jewellery) store. There were barbershops. There was Ganesha Sweets. And there were shops that went by names such as “SP Traders” that looked just like shops in India do! The resemblance was uncanny.

During the course of our walk, we even passed a couple of bars, and the smell emanating from them reminded us more of the shady bars in India (not Chennai, though, since liquor sale there is tightly controlled) than any bar we’ve seen in Europe.

I understand that there’s a significant Indian-origin (and Sri Lankan Tamil origin) population in France, but the number of Tamil-esque establishments next to the Railway Station completely astounds me. That they’re clustered together is no surprise. That this cluster is right next to the city’s main railway station is. And the fact that the station is so similar to Chennai Central doesn’t help matters!

Until we got out of our Metro at Place du Clichy (to get to our hotel), it seemed more like we were in Parrys Corner than in Paris!

PS: Put recommendations on things to do here, etc. Please leave comments.

The land above the tracks

Almost exactly a year ago, we were on our way from Vienna to Budapest and ended up reading the Vienna Hauptbahnhof Railway Station some three hours early. It had been snowing that morning in Vienna (it was April 1st, and supposed to be spring), and not wanting to go anywhere in that shit weather, we simply got to the railway station. It didn’t help matters that our train (which was coming from Munich) had been delayed by a further hour.

We were not short of options for entertainment in at the railway station, though. In fact, it hardly looked like a railway station, and looked more like a mall – for there were no tracks to be seen anywhere. We spent the four hour wait shopping at the mall (it was just before Easter, so there were some good deals) and having breakfast and lunch at what could be considered to be the mall food court. And when it was time for our train to arrive, we simply took one of the escalators that went down from the mall, which deposited us at our platform.

Each platform had its own escalator going down from the mall, which had been built on top of the railway tracks. It can be considered that the entire Vienna Hbf station was built on the “first floor”, making use of the land above the railway tracks. Land that would otherwise be wasted was being put to good use by building commercial space, which apart from generating revenues for the Austrian Railways, also made life significantly better for passengers such as us who happened to reach the station insanely early.

This is a possible source of revenues that Indian Railways would do well to consider, especially in large cities. The Railways sit on large swathes of land above and around the rail tracks, especially at stations (where such tracks diverge). Currently, the quality of experience in Indian railway stations is rather poor. If a swanky mall (and maybe other commercial space) were to come up above the tracks, it could completely transform the railway experience.

There will be considerable investment required, of course, but given the quality of real estate on which most Indian railway stations sit, it is quite likely that private developers can be found who will be willing to invest in constructing these “railway station malls” in return for a share of subsequent rent realisation. There is serious possibility for a win-win here.

As the Vienna Hbf website puts it,

The BahnhofCity Wien Hauptbahnhof features 90 shops and restaurants occupying 20,000 m² of floor space. A fresh food market, textile shops, bakeries and cafés are designed to make BahnhofCity a meeting place. During the week, it will be opened until 21:00 and many shops will also open on Sundays. Excellent public transport links and 600 parking spaces complement the offer.

An idea well worth considering for the Indian Railway Ministry.


If you were to visit Granada, in the South of Spain, you might believe that the Reconquista never happened. Granada was the last Islamic kingdom in al-Andalus (the Muslim name for their Caliphate in Spain) to fall, with Boabdil, the last Moorish Sultan of Granada, uttering his last sigh in 1492.

The Moor’s Last Sigh. Source: Wikimedia Commons

While the Reconquista and subsequent Inquisition succeeded in pretty much wiping Islam and Judaism off the Spanish map, the town of Granada seems to be making a conscious attempt to reclaim its Islamic past.

The town’s most famous monument, Alhambra (was about to type “the Alhambra” but realised that would be a redundancy since “Al” is Arabic for “the”) is from Islamic times, despite a King Carlos (V) constructing his own palace right in the middle of the complex. After Christian occupation, the town withered, going from a capital city to a neglected provincial town.

With its most glorious time having come during Islamic times, it is no surprise that the town seeks to look back to that part of its past. For example, the Vishwaroopam font is ubiquitous in signboards across town, with even public buses using an Arabesque font to write “Granada”. Then, Shawarma restaurants dot the city, and unlike in Barcelona (where most “Turkish” stalls are run by Pakistanis), these are mostly run by Turks.

There is even a nod to the Gypsy/Roma influence to the city in the markets, which distinctly reminded me of Jaisalmer (that the city is built next to a hill contributed to this comparison). The most common class of items in the market was leather goods, and it was also possible to buy FabIndia style kurtas and harem pants in some stalls (of course we stayed far away from them). Of course, there is a massive Granada Cathedral (built on the site of an old Mosque – this is a recurring theme in Andalusia), but it was clear which period in history this city’s pride lies in.

It was a rather unusual itinerary that we chose for this trip (a kind of parallelogram starting from Granada, successively moving to Còrdoba, Sevilla and Malaga), but it was almost as if we had planned our trip to places in decreasing order of Islamic influence (to an extent).

Còrdoba, for example, is known for its Mesquita, or Mosque-Cathedral, and the Mosque’s arches are a recurring theme through the city. It was less easy there (compared to Granada) to find Arab/Turkish food, and “Califa”, where we had dinner, was actually a a hardcore Spanish restaurant with a Matador theme.

It was Semana Santa (Holy Week) by the time we got to Sevilla and we were greeted by massive processions celebrating the week of Jesus Christ’s death (more on that in another post). During the three days we spent there, it was easy to forget that this had once been an Islamic city (long lines and after effects of excess walking in Granada and Còrdoba meant we skipped the Alcazar). As a fairly religious (the number of men in suits on Palm Sunday wasn’t funny) regional capital, it seemed as if the city had completely gotten over its Islamic past, and now presented itself to us as a completely Christian city! It is possible, though, that parts of Sevilla we didn’t visit still have a nod to the Islamic past.

Malaga retained more of its Islamic past, though. The Reconquista there again happened fairly late, just before Granada, and the most spectacular monuments are the Islamic fort and castle (Alcazaba and Gibralforo). We had two meals at Arab restaurants (one good, one bad). The city was littered with “Arab baths”. Motifs from the Còrdoba Mesquita were common across the city.

And most delightfully for us, the Islamic influence in the city included stalls selling Patatas Asadas (known as “Kumpir” in Turkish), which we had been familiar with from our trip to Turkey five years ago. That sorted my dinner on two evenings in Malaga!

Airline pricing is strange

While planning our holiday to al-Andalus during my wife’s Easter break (starting later this week), we explored different options for flights from different destinations in al-Andalus to Barcelona before we confirmed our itinerary.

As it turned out, it was cheapest (by a long way) to take a flight back from Malaga to Barcelona on Good Friday (meaning we were “wasting” three days of Priyanka’s vacation – which we were okay with), and so we’ve booked that.

Now, Vueling (Iberia’s low cost version where we’ve booked our tickets) sends me an email offering credits of €40 per passenger if we could change our flight from Friday to Saturday (one day later). In other words, it turns out now that the demand for Friday flights is so much more than that for the Saturday flight that Vueling is willing to refund more than half the fare we’ve paid so that we can make the change!

I don’t know what kind of models Vueling uses to predict demand but it seems to me now that their forecasts at the time we made our booking (3 weeks back) were a long way off – that they significantly underestimated their demand for Friday and overestimated demand for Saturday! If this is due to an unexpected bulk booking I wouldn’t blame them, else they have some explaining to do!

And “special occasions” such as long weekends, and especially festivals such as Good Friday, are a bitch when it comes to modelling, since you might need to hard code some presets for this, since normal demand patterns will be upset for the entire period surrounding that.

PS: Super excited about the upcoming holiday. We’re starting off touristy, with a day each in Granada and Cordoba. Then some days in Sevilla and some in Malaga. If you have any recommendations of things to do/see/eat in these places, please let me know! Thanks in advance.

Watching the Clasico in a bar

No, this post doesn’t have to do with the current El Clasico between Real Madrid and FC Barcelona. When I’d watched the previous Clasico on March 22nd I’d formed a blog post in my head but I never got down to writing it (combination of travel and NED and enjoying my holiday) so I thought this is a good time to put it down.

On that occasion I was in Barcelona and briefly toyed with the idea of going to watch the game at the Camp Nou. That idea was quickly shelved given that tickets were going for about €500 each. Then there was hope that the game would be telecast on local TV (like the Barcelona-Ajax game I had watched at the Camp Nou was), but that wasn’t to be. The only option was to watch it at a pub.

While there were several bouts of NED due to which I had decided I won’t see that game, when Maxime, my wife’s flatmate, went out, I couldn’t help but join him. The first task was to find a suitable pub, especially given that it was a Sunday.

There is an interesting hierarchy of local businesses in Barcelona. Most Spanish-run supermarkets, for example, are closed on that day, though the Pakistani-run places (which are interestingly plentiful in the city) are open 24×7. A large number of Spanish-run bars are closed on Sundays, too, while the Chinese bars (again plentiful) are open all day.

Given that it was the Clasico and it was not broadcast on terrestrial television, there was no surprise that bars were full. Seating-only bars were thus out of question. And some of the standing-allowed places were choc-a-bloc. Finally it was this Chinese bar near the Entença station that Maxime and I went to.

The place was full, like most other bars in Barcelona that night, but there was some standing room with a view of one of the televisions. A sign at the entrance greeted us saying that each person was expected to order at least one beer for €2 (normal price for a beer in such a bar is €1,80). Estrella thus Dammed, it was time for the game.

I don’t remember much of that game, but the atmosphere in the bar was far from the kind I’d seen elsewhere. The crowd was partisan, of course, with anyone who wanted to support Real Madrid doing so silently (remember that this is a politically charged fixture, especially given renewed calls for Catalan secession). Loud cheers accompanied the Barcelona goals. The Madrid goal was met with silence, as you might expect (and people stepping out for a smoke). People stepping in and out created another problem – it was a rather cold spring evening, and every time the door opened it let in rather cold wind and disturbed the thermal balance of the bar!

There were a couple of other noteworthy sidelines on the evening. The first was how hard the bar staff worked. Expecting it to be a big night, they had pressed in extra staff, with possibly the entire family of the people who ran the bar involved. Children who looked as young as ten or twelve hurriedly ferried dishes from the kitchen to the tables (there were a few tables, which I’m assuming were pre-booked). Service was overall top notch, with our €2 beers arriving within two minutes despite the massive crowd at the bar. Considering that some bars were shut (given it was a Sunday), it was incredible how hard this one worked to make most of a good Barcelona night.


And then there were these guys at the slot machines. Like most other cheap bars in Europe, this one too had a couple of slot machines and they were all occupied, by people who couldn’t care less about what was going on around them, and whose only worry in life was to bet against the house. It could have been yet another night at the bar for them, except that the beer cost them twenty cents extra.

PS: I got distracted by the Manchester City – Liverpool game and hence took much longer to finish this post. I started writing it as soon as El Clasico started.


I was reading Shoba Narayan’s excellent piece in MintOnSunday about the Palani temple when I was reminded of my own trip there back when I was a kid, so thought I should write about it.

The memories are extremely hazy, for I was a really small boy back then (I don’t even remember how old I was). It was a strict pilgrimage, consisting of two overnight bus journeys, and the only purpose of the trip was to visit the Palani temple.

There was some religious context to it. Apparently my parents had visited the temple some time before I was born, and had promised to return had some condition been satisfied. I don’t remember the exact condition (though the fact that I’m named Karthik has something to do with this, I know) but apparently it had been satisfied, and so off we went to fulfil the “harke”.

I remember taking a Tamil Nadu State Transport bus. I don’t think I was old enough for them to take a ticket for me, so I didn’t get my own seat. But then my father spoke to some people across the aisle and found that they were scheduled to get off at Krishnagiri, after which we crossed over to the three-seater, and I remember sleeping across my parents’ laps.

We reached Palani in the morning and checked into some random hotel. I don’t remember much of what happened there. I remember going to the temple sometime during the day. There was a cable car, if I’m not wrong, to go up. I don’t remember if we took it.

Shoba’s piece is about the Prasad at the Palani temple, but I don’t remember any of it. All I remember is going to some vibhuti (sacred ash) shop there to buy some vibhuti. And I remember the shopkeeper telling us that whatever we bought, we would only get half of it after the pooja was done. Finally my parents, after some deliberation, settling on buying one (largish) packet of vibhuti. I remember taking home half of that, and it satisfying our vibhuti needs for several years after that.

As I said right up front, this is one of my least memorable trips from my childhood. All I remember is the bus. The shady hotel. The steep flight of stairs to get to the temple (Shoba writes about that, too). The cable car. And the half packet of vibhuti. I have no clue what we ate. I think there were people there in Palani who spoke Kannada, but I’m not so sure. And I remember taking another overnight bus back (this one being empty enough that I could sleep across my parents’ laps for the full journey).