CLP(fd): Introduction to Solving Problems with Resource Constraints

Trying to maximise or minimise something with regards to some constaints is a vague sounding problem with many applications! How to do this is a whole field of study in Operational Research or Management Science.

What’s neat about Prolog, is many dialects provide a CLP(fd) library: that’s Constraint Linear Programming over finite-domains. There are other solvers for such problems out there, but with Prolog you can:

  • follow the mathematical notation
  • integrate easily into (Prolog) applications
  • reason about the problem because Prolog is homoiconic
  • iterate over solutions to find second-best, third-best, and so on

Rather than reading me waffle on about it, I made a SWISH Notebook for you so you can actually try it out online right now. Have fun!