Skip to content

Multiple couriers planning problem, project of Combinatorial Decision Making and Optimization.

Notifications You must be signed in to change notification settings

jacopodabramo/MCPP

Repository files navigation

Multiple couriers planning problem

Project of "Combinatorial Decision Making and Optimization".

The goal of MCP is to decide for each courier the items to be distributed and plan a tour.

In this repository you can find four solution for this problem which use four different approaches:

  • Constraint Programming (CP)
  • SAT
  • Satisfiability Modulo Theory (SMT)
  • Mixed Integer Linear Programming (LP)

    Installation

    To install all the requirements run:
    pip install -r requirements.txt

    The suggested version of python is 3.10

    Execution

    All the solvers can be used by running the file main.py with the command python main.py and the following arguments:

  • -a approach, --approach approach with approach = {cp, sat, smt, lp, smtlib}. Selects the approach to use.
  • -m model, --model model with model = {0,1}. Select the model to use for the choosen approach, default = 1
  • -n N, --num_instance N Select an instance between 1 and 21; the code will execute the solver choosen from instance 1 to the given instance, default = 0 means solve all.
  • -i path, --input_dir path Specify the path from where take the input files, default = "./input"
  • -o path, --output_dir path Specify the path in which the results will be generated, default = " ./output"
  • -t T, --timeout T Set the timeout in T seconds, default = 300s.

    Execution SMTLIB

    For the executing an SMT model using different solvers is needed a Linux Enviroment and the installation of the solvers that you want to use.
    If you want to install z3-solver:

    sudo apt-get install -y z3

    If you want to install cvc4-solver:

    sudo apt-get install -y cvc4

    Execution on Docker

    First of all is needed to install docker: https://www.docker.com/products/docker-desktop/
    Important:
    On docker there are the execution of model with the best performance for each approach.

    To run with docker, is needed to build the docker image:
    docker build. -t name_image
    name_image is the name of image that you create

    After that it is possible to run the container
    docker run -v name_folder:/project/output name_image
    name_folder is the name of the folder where the results will be saved

    If the image is available, you need to load it on docker:
    docker load -i name_image.tar
    After that you can run the container using the previous command.

    Notes:
    To make the execution of docker linear, each approach use the instance which do not cause problem of memory exceeding, because if during the execution on docker there are problem of memory, docker kills the process and stops the execution.
    Obviusly for the instance which are not taken in account during the execution of the model, the solution is UNKNOWN.
    If you run the project in local(using for i.e Windows System), the problem of memory exceeding is handle without killed the process, the solution will be written but it still UNKNOWN.

    Best Models

    In the following there are the best models for each approach:

  • CP: Circuit Model, it can be run with the option: -a cp -m 1
  • SAT: Single Matrix, it can be run with the option: -a sat -m 1
  • SMT: Asg Array Theory, it can be run with the option: -a smt -m 0
  • MIP: Single Matrix Mip, it can be run with the option: -a lp -m 1
  • SMTLIB: it runs always the best SMT model, this approach is used only to compare different solvers on SMT

    Authors

  • About

    Multiple couriers planning problem, project of Combinatorial Decision Making and Optimization.

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Contributors 3

    •  
    •  
    •