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

文革回忆

以下是我父母对他们所亲历的文革的一些回忆: 六六年六月一日停课闹革命,八月一八号M第一次天安接见红卫兵。我校被安排十月几号左右,进京。学校组织,按系,年级,班为单位免费坐火车,发干粮,进京后,统一安排食宿点,一般是单位的大房子,北京各高校,早上就发好了中午的干粮,就是火烧(饼子之类)。街边有水龙头,喝,洗手用,同時有N个临時厕所。头天通知第二两去天安门被接见,临晨就起来,步行前往,人山人海,就等M站在城楼上,有幸可远观,运气不好看不到,不断疏散队伍,少停留,防踩踏,大部份的鞋子会丢一只或全丢。然而统一返回学校。接着就斗各地走资派,即各级政府党政领导干部。我校大部份学生于八月二十六日在成都锦江大礼堂斗西南局(管云,贵,川),省委把手,以此,成立东方红八,二六战斗团,推选出政委,团长,参谋长等,各系成分团,学生自由组合成各种名称的战斗队。我们就是化学系六二级(入校時间)《丛中笑》战斗队。此時,首都红卫兵带头到全国各地串联,造当地党地干部的反,都叫走资派。一般都愿到自已家所在地去。坐火车免费。 老爹以串联名义,到北京,东北,柳州,贵州等地,凡有红卫兵接待站的地,吃住免费,以串联民义游山玩水。后和别人以返成都的火车票换成广州的,回到老家。或买短乘长,几个人又去广州玩。西北和海南外都去了。 我们則就地闹革命,写大字报,批校,系领导甚至老师,说把我们培养成了修正主义的苗子。我们只文斗(大字报)不打人(武斗)。经此一折腾,机关,学校,单位完全痪换。后觉没趣,打祘学红军长征步行串联去峨眉山,只走到五通桥就被当地造反派邀请指导革命[呲牙]闹到十二月底,又呌复课闹革命,回学校又上课了。此時,全国各地,各行,各业均革命了,不上班,有工资。因对待走资派态度不同,分成造反,保守两派。于是派性斗争开始,学生相对单纯,但单位的两派,除观点不同,还有个人恩怨。从打人升级到武斗,用石头,棍棒,互殴。后发展到去武装部枪枪,武器。四川以重庆武斗最兇,因有八大兵工厂,死人也多。此時动用军队,以军宣队进驻学校,机关,企,事业单位,复恢秩序。学校从二月开始,复课闹革命。此時,中学生无课可上,同地方工人造返派一起,打派仗。有時会到大学找自已那派的人支持,闹得不大。毕竟我们要考虑该踏入社会,挣钱了。老爹跑到132厂看热闹,被误伤,鼻梁骨打破,送川医免费治好了。武斗开始,成都工学院(又叫成都科大)对着我们打枪,到食...