Skip to content

optimization

PuLP: rust core

I recently got a paid Cursor license and decided to make good use of it. So I decided to vibe code my way into a new Rust core for the PuLP library.

It was an interesting way of being introduced to vibe coding, and to a lesser extent to Rust, which I knew only the basics of.

I do not want to focus on the vibe coding process because I think there is just too much written about it already. I'll add my thoughts on it at the end so it is easy to ignore. I wish I could ignore half the content I get on it, to be honest.

I will write mostly about the design decisions I had to do while making the changes, which took over a week. This experience forced me to find out how other libraries (e.g., gurobi, ortools) handle things: gen AI also helped me to query design decisions of those libraries.

PuLP: past, present and future

I started using PuLP circa 2015 (already 10 years ago!). Looking at my personal and professional emails, I realize today that my first experience using this python library was following the Discrete Optimization Course from Coursera (great course by the way!, although it seems to not exist anymore). It was also at that time that I joined the PuLP user mailing list. I've realized that the best way I find the motivation to learn something technology-wise is to subscribe to a user mailing list.

At the time I was also starting my journey into python and software development. Until then, and still for many more years, I was an AIMMS user and developer. As such, I saw the world through the lens of an algebraic language: multi-dimensional parameters, indices, sets and many, many subsets. It was a very comfortable way of picturing problems, decisions, logic and data.

Pytups, functional programming & data wrangling in optimization

Every now and then, I get a sudden urge to learn another programming language. It goes away after about a week of reading and preparing a development environment in my computer. It happened last year with Kotlin and Scala. This time it happened with Rust.

Usually, I get really excited until I realized that whatever language I'm learning does not include the libraries I use and love in python. Usually it's about libraries to produce pretty charts (e.g., plotnine) or to call efficient graph algorithms (e.g., graph-tool, networkx). But, If I'm being honest, I think the one I would miss the most, especially as it relates to algorithms and mathematical models, is pytups.

The IHTC 2024 (1)

Last year I decided to participate in an Optimization contest about scheduling patients to operation rooms called Integrated Healthcare Timetabling Competition 2024. I didn't do extremely well. This was not a surprise to me: I am aware of how competitive these competitions can be.

That doesn't mean that I did not try hard, though! And since I took it as an opportunity to try engines that I'm not very comfortable using, I actually learn lots.

In this post I will try to go back to the competition and convince myself that I did not do that bad summarize what I did. Hopefully it will be useful for others in the future. I put a (1) in the name because I could not fit everything I did in a single post, I will potentially revisit this topic in the future with my other approaches (see the end of the post for the other approaches / topics).

Decision science & standards

(Here I use the terms engine and solver interchangeably).

What helps a standard become a standard is a mix of luck, popularity and actual usefulness. The optimization community hasn't agreed on many standards, languages or libraries in the past. As a result, there are many ways to code, run and deploy optimization engines. And often people re-invent the wheel.