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.") 作为西方人写中国史,作者不可避免地更关心西方历史与这段中国历史的联系。全书令人信服地论证了,发生在十九世纪中国的太平内战,已经不再是一个孤立的事件,而是跟欧洲和美国历史有实质性的联系。简而言之,因为美国内战导致大英帝国在美国的贸易锐减,英国害怕同时因为中国内战而失去另一个巨大的贸易伙伴,而违背一贯的中立政策,干预了中国内战。虽然直接干预并不多,而且政策还有反复,却鬼使神差地影响了...

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...

我的语言

我出生在四川南溪,一个位于宜宾边上的小县城。但是我并不会说南溪话,因为父母都在一个从重庆调来的军工厂工作。那个年代的军工厂俨然就是一个独立的小社区,从医院到学校都是厂里自己的。厂里的人在(南溪)本地人面前有一种优越感,觉得自己是(重庆)城里人,只是为了支援三线建设,才到此苦寒之地。所以南溪话是不屑于说的,一口标准的重庆话就是高人一等的标志。虽然我父母说的都不是标准的重庆话,一傅众咻,我却操一口地道的重庆腔。因此,严格来说,我的母语是重庆话,也就是西南官话的重庆方言。 直到我七岁那年,全家搬到了绵阳。 绵阳的小朋友迅速注意到了我的重庆口音,毫不犹豫地开始取笑我。给我印象极深的就是“很多”这个常用形容词,重庆话说“he1 duo1”。我从小就是个很敏感的人,所以暗下决心,一定要学会绵阳话。几个星期之后,已经没有人能听得出我以前是说重庆话的了。 Story of my life. 考上清华以后,我的普通话立刻被北方同学嘲笑了。他们说我说普通话的时候不像在聊天,像在演讲。这是因为那个时候四川的学校里,老师还是用方言授课,只有在语文课念课文的时候,才会说普通话。我是个很敏感的人,所以暗下决心,一定要学会北京话。(我有意地模仿离我最近的北京人,也就是著名的waikok。以至于多年以后有个人跟我说,“你说话怎么跟waikok一个味儿呀”,我会心地笑了。)几个月之后,已经没有人能听得出我是四川人了。(最让我得意的是,在美国跟中国同学玩的时候,不止一次有北京人想认我当老乡。) 来到美国以后,才知道自己的英文口语有多烂。但是美国的同学很有礼貌,并没有因此嘲笑过我,只是不断地需要说"pardon"/"sorry"/"say it again"来确认。然而我是个很敏感的人,所以暗下决心,一定要学会美国英语。(我拼命看美国电视练听力,以至于什么垃圾节目我都看过。知道"Jerry Springer Show"是干嘛的吗?我还上了一门ESL的口语课,在一位慈祥的美国老太的帮助下,彻底纠正了非英非美的发音。)几年以后,虽然人家还是能听出我不是native speaker,但是说"pardon"的次数明显减少,而且有不止一位美国人真心地称赞过我的英文口语。 博士毕业之后找工作,...