Justin Pearson

Two new papers

Two new papers with my PhD student Frej Knutar Lewander.

One is a very long journal article where we analyse implementations of invariant graphs in local search. Invariant graphs are incremental data structures that keep track of the current cost during local search as the solver explores neighbourhoods of moves.

The other was presented at CP 2025 and is a simple technique for selecting freeze variables for large neighbourhood search. Even though the idea is simple, it is very effective and as far as we know hasn’t been tried before. We had the idea by looking at invariant graphs of constraint problems in local search.

Links to CP Solvers

Links to various repositories including some less well known constraint solvers. This is mainly so that I can find them again. I don’t make any claims that the list is complete.

  • Huub New LCG Solver.
  • Pumkin a proof carrying lazy clause solver written in Rust.
  • Munchkin a lazy caluse solver written in Rust for teaching purposes.
  • Tempo a constraint solver in C++ by Emmanuel Hebrard for solving disjunctive scheduling problems.
  • NuCS: A native Python solver that uses numpy for speed.
  • The Glasgow Constraint Solver a proof logging constraint solver.
  • MiniCP in C++ by Laurent Michel and his students. It is mainly used for research. It has a FlatZinc parser. It also includes Haddock a system for using MDDs for propagation.
  • Not really a constraint solver, but CPMpy is a python library for modelling constraint problems that interfaces to various constraint solvers.
  • Choco is a constraint solver written in Java.

Hugo: Linking to the static directory

I don’t know why this is so difficult. Hugo provides a static directory where you can put stuff that is directly copied to your web directory. In theory you can have links [A link]("/file.pdf") and if you the file static/file.pdf in your Hugo project base directory then all is well.

If your homepage has its root at some other location than the root, say example.com/Hugo rather than just example.com, then this does not always work. I really don’t understand why.

Setting up Python notebooks locally for Machine Learning

This is mainly for students on my machine learning course. I use a lot of Python notebooks either for examples from lectures or for assignments. While there are many options for hosting python notebooks for free remotely, but I prefer to do things locally. If you wish to do the same then please read on. Note that I did home some problems installing skikit-image on a new Apple with M1 silicon, but after upgrading the latest version of the operating system and doing and updating my homebrew setup everything works. Note that these instructions are for using pip. If you are using an alternative package manager such as Anaconda then you are on your own. I know nothing about setting up Python on a windows machine.

Breadth First Search in Haskell

Haskell is a really great programming language. It is elegant, the type system is beautiful, and nowadays the compiler is quite good. I’ve been using functional languages off and on for more than 30 years. I studied at the University of Kent which is the home Miranda which is a precursor to Haskell. All this is a warning. I don’t use Haskell that much. The language has changed a lot since I last used it regularly, and so my code might not be optimal or idiomatic Haskell.

Naive Bayes for Spam Classification

There are a lot of tutorials and youtube videos out there on using Naive Bayes for document classification. None of these tutorials are wrong, but they often hide some subtle points that if you think too hard about you will get confused. In this posts I want to explain what is really going on in Naive Bayes for spam classification.

This post assumes that you are already familiar with Bayes’ theorem.

Creating and using Python Virtual Environments

In a lot of my courses I encourage students to use python virtual environments. Virtual environments are a great way of making sure that you have the correct version of packages installed. This is very short cheat sheet on how to set them up. I will assume that we are using Python 3. Luckily Python 3 has virtual environments set up. It is all in the documentation, but then sometimes people are too lazy to google, or do not know what to google for. Of course this assumes that you are a command line person. If you are using some IDE, then you are on your own.

Sonic Writing

Short Review of Sonic Writing by Thor Magnusson.