Giter Club home page Giter Club logo

idmp-constrained-shortest-path's Introduction

IDMP-Constrained-Shortest-Path

This project explores CP, SAT, and MIP technologies for solving the Constrained Shortest Path problem and compares their performance.

Generating graphs

To generate the graph, move to the graph_generation run the following commands:

cd graph_generation
python generate_demo_graphs.py

The graph will be drawn and saved in the graph_generation/graphs folder. Example graphs

To convert the graphs to the format used by the solvers, run the following command:

python read_graphs.py

The new files will be saved in the graph_generation/data folder.

To convert .dzn instances to txt file use the following:

First, put the .dzn files that you want to convert in a data folder together with the convert.py. Next create an empty sat folder and run the following command:

python convert.py data/FRCSP_Instance_1.dzn

Instructions for solving with CP

Navigate to cp/minizinc/Variants. There you will find the run_all.py file which takes a single argument determining the type of problem to solve. To solve the Full Resource CSP, use frcsp. To solve the Task-Constrained CSP, use tcsp. The resulting command will look as follows:

python run_all.py tcsp

Instructions for solving with SAT

For running NCSP:

Navigate to sat-node-task folder and run:

python sat_directed_edges-idpool.py data-txt/SP_Instance_1-sat.txt node g3

For running TCSP - ordered or unordered: (You need to add the number of task sets at the end of first line ...)

Navigate to sat-node-task folder and run:

python sat_directed_edges-idpool.py data-txt/SP_Instance_1-data.txt unordered_task g3

Running with run_all.py for NCSP and TCSP

Navigate to sat-node-task folder and perform the following steps: First create a folder output_sat, then inside it create a folder for each solver that you are planning to run - cadical153, (g3 and m22). In each solver folder, create two subfolders - node and unordered_task. Finally, to run all instances in data-txt folder as follows:

python run_all_with_sat.py sat-node-task

Running lab

Prerequisits

  • Python version >= 3.7
    • For windows systems pysat may fail to install in which case try downgrading python to version <= 3.8 (see: the Pysat Github)
  • Some compiler for MIP???

Installation

We recommend installing the requirements in a Python virtual environment. This has the advantage that there are no modifications to the system-wide configuration.

To setup the virtual environment:

python -m venv venv

Then to activate the virtual envionment run:

Windows
venv\Scripts\Scripts\Activate.ps1
Linux and Mac:
source venv/bin/activate

To install the requirements run:

python -m pip install -r requirements.txt

Running

To run all the steps for the expirments run:

python run_lab.py --all

To see all the steps available run:

python run_lab.py

To run specific steps you can execute the run_lab.py script with the index or name of the steps for example:

python run_lab.py 1 2 # Will build and run all experiments
python run_lab.py parse-again # Will parse all the experiments
python run_lab.py 5 6 7 8 9 # Will generate all the reports

idmp-constrained-shortest-path's People

Contributors

jopschaap avatar ne184 avatar jgroenheide avatar tudyoctav avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.