This is a short course about constraint programming.
You will need to set up by yourself the following pieces:
code --install-extension ms-python.python ms-toolsai.jupyter
Windows users should install Visual Studio Code in Windows (not WSL) then activate the Remote WSL extension:
code --install-extension ms-vscode-remote.remote-wsl
an Anaconda distribution, from the following link. In case the question arises, it is very likely that the best suited version for your needs is the 64 bits one. Anaconda is more than a Python distribution: it also provides additional dependencies you may need;
Windows users should install the Anaconda distribution within their Ubuntu subsystem.
git.exe for Windows users) program, for version control. Using Git falls out of scope of this seminar, but you are strongly encouraged to become proficient with it. You may find resources on GitHub Learning Lab, e.g. the following course for first-timers.
git --version. If necessary, install
|Operating system||Installation command|
clone the resources for the course:
git clone https://github.com/xoolive/constraints
Windows users should install the dependencies within their Ubuntu subsystem.
You may move the folder at any time if you prefer to keep things sorted differently on your computer.
install the dependencies
cd constraints pip install -r requirements.txt
A self-documented notebook is available in the notebook folder. The free and open-source
facile library is a basic wrapper around the OCaml
facile solver. You may find more powerful solvers in your future life but this one should do the job to introduce and illustrate the basic concepts of constraint programming in Python.
The notebook for the basic lab session is
Run the following command (in WSL for Windows users):
Projects should be run as Python scripts from Visual Studio Code.
Open the workspace file (with the WSL connector for Windows users), then access the project folder.
Details about projects are presented on this page.
In case you are stuck with your configuration for the first lab session only, you can fall back to a slightly less comfortable option with Google Colab:
insert a new cell at the top of the notebook with
!pip install 'facile>=1.5'
and execute it to install the library;
%loadcommands for the solutions will not work: you will have to copy paste the solutions directly from each of these files.