Skip to main content

My Journey

[Originally posted here]

Like many people, this is not the first time I take Discrete Optimization.

I stumbled upon this course in 2013 and found it very interesting. I finished Knapsack without much problem and felt pretty good about myself. Then Graph Coloring beat me. My homegrown CP solver had serious bugs: I probably missed something important in the lecture. I thought to myself, "This is problem 2 and I'm already in deep s**t?!" Between a full-time job and a 9-month-old baby, I painfully realized that I could never finish it. I felt defeated, no, humiliated.

In 2014, I quickly dismissed the idea of taking this course again because I was way too busy to spare the amount of effort needed for this course.

This year, I made sure that I had the time for this course and started my journey of redemption.

Let me state my problem first:

minimize the amount of effort I spend 
subject to getting 10s for all problems that count toward the final grade 

As you can immediately see, I won't touch Set Cover although it looks really interesting. And I won't work towards improving my leader board position or program running time once I've passed 10-point line for that problem.

Naturally my weapon of choice is Local Search (LS). ("If you want guarantee, buy a toaster." has become my favorite Clint Eastwood quote.) And my programming language is C++. (Starting with Python was one of the mistakes I made in 2013.)

Now here is a laundry list of what worked for me for each assignment. You can skip it if you are not interested in technical details:

  • Knapsack
    • Dynamic Programming for smaller problems and Branch-and-Bound for larger ones;
    • Just follow the lectures as the solution has been "spoon-fed" to you.
  • Graph Coloring
    • The \sum 2 * |B| * |C| - |C|^2 objective from the lecture + Tabu Search (TS) worked like magic;
    • I got all 10s just by running it a bit longer.
  • Traveling Salesman
    • k-Opt neighbourhood as described in the lecture + Simulated Annealing (SA) for most of problems; 
    • For the infamous Problem 6, 2-Opt + Guided Fast Local Search (GFLS) for the win!
    • I tried k-Opt + TS first but couldn't get it to work;
    • For some problems I needed to tune the k (in k-Opt) and SA parameters (starting temperature, annealing speed) more carefully to pass the 10-point line;
    • I also tried a simple CP model but couldn't get it to work on even the smallest problem;
    • I also tried Large Neighbourhood Search with an MIP model which rearrange a small part of the whole tour; it worked for some mid-sized problems but not enough to tackle Problem 6;
    • TSP Problem 6 was the last problem I ever cracked; I'm going to buy myself a T-shirt to celebrate.
  • Facility Location
    • Large Neighbourhood Search (LNS) with a Mixed Integer Programming (MIP) model of adjacent facilities of a random facility and their current customers worked amazingly;
    • I tried simple neighbourhoods (reassignment, swap and open/close facility) + SA first but couldn't cross the 10-point line for the two harder problems (5 & 7, I think);
    • Inspired by Graph Coloring, I tried to enlarge the neighbourhood by allowing infeasible moves and penalizing constraint violation but couldn't get it to work;
    • I'm impressed with SA's ability to turn weak neighbourhoods into something usable.
  • Vehicle Routing
    • LNS + an MIP model of two random vehicles did the trick again; for smaller problems, simple neighbourhoods (reassignment, swap and k-Opt) + SA worked too;
    • I figured out an interesting way to break symmetry in my MIP model, which I shared in the forum;
    • As noted by many fellow students, the bars for this assignment seemed to be lower than previous ones; maybe to give us a little break? :)
Because of my choice of LS, most of my solvers are written from scratch so I don't have much experience with general purpose tools. But I do want to say a few words on tools. 

I don't quite understand the rationale of not recommending some good tools (to reduce the search space, if you will) but it did make it harder for me to try MIP and CP. From my limited experience, Gurobi is great for MIP and Google or-tools is good for CP. Both of them have a clean API and are well-documented, which means they are very easy to learn. The only problem I had was that I only had a limited license for Gurobi which limits the size of the problems to 2000 variables and 2000 constraints. However, it wasn't so bad because LNS worked really well.

In contrast, I wasted a lot of time on CBC. I'm sure an expert user can use CBC much better than I did but I just didn't have the time (or patience). It's a shame that I didn't have the chance to use or-tools, or CP in general, since most of the assignments don't seem to have very complex constraints. But next time I need to solve a problem with CP, I know where to start.

I couldn't have done it without the following:
  • My fellow students Andrew, Lukas, Nils, Adriel and others for sharing their successes and failures on the Discussion Forums;
  • Assignment Visualization tool is extremely useful for discovering problem structures that you have previously missed. As a concrete example, one of the insights I got from visualizing VRP led me to a better greedy solver that halved the cost of Problem 5, thus giving the subsequent LS solver much better starting point.
Finally, I want to thank Prof. van Hentenryck and TAs for creating such a fantastic course! It was super challenging but once you climb it, you'll get to a beautiful spot!

Now let me have a Duchesse de Bourgogne beer with some of my favorite Neuhaus chocolate. I earned it. :)

To my fellow students: Succes! Bonne chance! Viel glück!


Comments

Popular posts from this blog

天国之秋

Book review: “Autumn in the Heavenly Kingdom: China, the West, and the Epic Story of the Taiping Civil War" by Stephen R. Platt 秋天有两种:一种是丰收喜悦之秋,一种是伤感可悲之秋。太平天国之秋,毫无疑问是第二种。 《天国之秋》改变了很多我对于太平天国的认识和评价。作者一上来就对太平天国运动的性质作了一个中肯的评价,认为西方史学界长期以来称之为“太平叛乱”,以及中国史学界以太平天国为原始共产主义而称之为“太平革命”或“太平起义”,都失之偏颇。唯一恰当的称谓,当为“太平内战”。 ("The Taiping were indeed rebels, but to call the entire war the Taiping Rebellion is to cast the rebels forever in the wrong, and to blame on them for defying their legitimate rulers and destroying what one might surmise was otherwise a peaceful and stable empire." "...just as it is unfair to suggest that the Taiping were solely responsible for the devastation of the war, it is likewise an exaggeration to claim they were building some kind of peasant utopia.") 作为西方人写中国史,作者不可避免地更关心西方历史与这段中国历史的联系。全书令人信服地论证了,发生在十九世纪中国的太平内战,已经不再是一个孤立的事件,而是跟欧洲和美国历史有实质性的联系。简而言之,因为美国内战导致大英帝国在美国的贸易锐减,英国害怕同时因为中国内战而失去另一个巨大的贸易伙伴,而违背一贯的中立政策,干预了中国内战。虽然直接干预并不多,而且政策还有反复,却鬼使神差地影响了...

TOTC - Monaco

For those of you who *actually* followed my story, I apologize: I lied, to some extent, when I said my next stop was Nice. In fact I arrived at Nice at night after a very enjoyable, and amazingly fast TGV ride. But I took a day trip to Monaco the very next day. Les Casinos de Monte-Carlo Originally uploaded by yisu1979 In case you haven't know, the Principality of Monaco is a city state with a constitutional monarchy. There are two ways to get there from Nice: a €1,5(!), 40-minute bus or a €5, 15-minute train. I took the bus not because it was cheaper but because I thought the bus ride would have much better views en route given it went along the coast line. I was *so* right. The first thing you saw after arrival was the world famous black tie required casino. Did I remember to wear black tie to get in for the allegedly exquisite interior? Are you kidding me? Symbol of Monte-Carlo Originally uploaded by yisu1979 The whole state of Monaco is built on a mountai...

Jacky Cheung Rocked Atlantic City, Again: Photos

As promised, I gave you some photos from my concert-going Atlantic City trip. Jacky Cheung Concert Poster Originally uploaded by yisu1979 This was the official poster for this encore show. I got it from the organizer's website . In case you don't speak Chinese, the words above read, "By popular demand, the King of Cantonpop returns with honor." Sounds a little cheesy in English, huh? Well, there's always something lost in translation. Trump Taj Mahal Originally uploaded by yisu1979 The concert was held in the Arena in the Trump Taj Mahal Casino Resort , a decent place for this kind of concerts. Taj Mahal Casino Originally uploaded by yisu1979 If you haven't seen a casino before, here it is. (And you've seen all of them.) Chandelier Originally uploaded by yisu1979 Taj Mahal is richly decorated. It tries to pitch itself as a better or higher-end casino than others. (So they can charge you more.) T-shirts Orig...