Code Monkey home page Code Monkey logo

constraints's Introduction

Constraint programming

This is a short course about constraint programming.

Materials

  • a tl;dr introduction with the bare minimum to know about constraint programming;
  • slides for a 3h course, pdf version

Environment setup

Windows users should first activate WSL using the official instructions (French version). Please install the most recent Ubuntu version (unless you have another version ready.)

You will need to set up by yourself the following pieces:

  • Visual Studio Code, then install the Python extension:

    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.

  • the git (or 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.

    Try running git --version. If necessary, install git:

    Operating system Installation command
    MacOS brew install git
    Linux (Ubuntu) sudo apt install git
  • 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

Lab session

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 notebook/lab-session.ipynb.

Run the following command (in WSL for Windows users):

jupyter lab

Project

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.

Troubleshooting

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:

  • click on the link;

  • insert a new cell at the top of the notebook with

    !pip install 'facile>=1.5'

    and execute it to install the library;

  • all the %load commands for the solutions will not work: you will have to copy paste the solutions directly from each of these files.

Further reading

constraints's People

Contributors

xoolive avatar poitou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.