Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Update README and add preprint
Browse files Browse the repository at this point in the history
  • Loading branch information
leonlan committed Sep 23, 2023
1 parent c99d086 commit d505616
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 6 deletions.
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Routing and appointment scheduling

This repository contains the code implementation of our paper "A queueing-based approach for integrated routing and appointment scheduling."
This repository contains the code implementation of our paper [*A queueing-based approach for integrated routing and appointment scheduling*](preprint.pdf).

TODO
## Installation

To use this repository, make sure to have [Poetry](https://python-poetry.org/) installed with version 1.2 or higher. The following command will then create a virtual environment with all necessary dependencies:

```shell
poetry install
```

If you don't want to use Poetry, you can use install all packages listed in the `pyproject.toml` file (requires Python 3.9 or higher).


## Usage

You can use the `benchmark.py` script to solve instances. Here's an example:

``` shell
poetry run python benchmark.py instances/*.json \
--num_procs 4 \
--weight_travel 1 \
--weight_idle 2.5 \
--weight_wait 10 \
--algorithm lns \
--seed 1 \
--max_runtime 1
```

This command solves all instances, four in parallel at a time. The objective weights are 1, 2.5 and 10 for the travel, idle and waiting time contributions, respectively. The selected algorithm is LNS with seed 1 and runs for one second.

All results presented in our paper can be found in this repository. In particular, the raw results data is stored in `data/` and the notebooks that generate tables and figures can be found in `notebooks/`.
87 changes: 83 additions & 4 deletions notebooks/analyze-benchmark-results.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@
},
{
"cell_type": "code",
"execution_count": 167,
"execution_count": 201,
"id": "4bb0a920-d33a-44b6-8583-1a40dbda6467",
"metadata": {
"tags": []
Expand Down Expand Up @@ -1098,7 +1098,7 @@
" 2.0 5.85 1.04 0.06 21.48 0.00 4.15 2.81 16.65"
]
},
"execution_count": 167,
"execution_count": 201,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1119,7 +1119,7 @@
},
{
"cell_type": "code",
"execution_count": 170,
"execution_count": 202,
"id": "04c4162d-bd77-41c0-af20-824976f7fa12",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -1458,7 +1458,7 @@
" 2.0 5.85 1.04 0.06 21.48 0.00 4.15 2.81 16.65"
]
},
"execution_count": 170,
"execution_count": 202,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1474,6 +1474,85 @@
"print(res.mean().to_frame().T.to_latex(float_format=\"%.2f\", escape=True))\n",
"res"
]
},
{
"cell_type": "code",
"execution_count": 203,
"id": "57882e46-c228-4e62-8915-09de3e224480",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>serv</th>\n",
" <th>0</th>\n",
" </tr>\n",
" <tr>\n",
" <th>level_1</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>DOTSP</th>\n",
" <td>0.5</td>\n",
" <td>2.584167</td>\n",
" </tr>\n",
" <tr>\n",
" <th>LNS</th>\n",
" <td>0.5</td>\n",
" <td>0.764167</td>\n",
" </tr>\n",
" <tr>\n",
" <th>MTSP</th>\n",
" <td>0.5</td>\n",
" <td>3.383889</td>\n",
" </tr>\n",
" <tr>\n",
" <th>NNSVF</th>\n",
" <td>0.5</td>\n",
" <td>12.784722</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" serv 0\n",
"level_1 \n",
"DOTSP 0.5 2.584167\n",
"LNS 0.5 0.764167\n",
"MTSP 0.5 3.383889\n",
"NNSVF 0.5 12.784722"
]
},
"execution_count": 203,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"res.mean().reset_index().groupby(\"level_1\").mean()"
]
}
],
"metadata": {
Expand Down
32 changes: 32 additions & 0 deletions notebooks/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from ast import literal_eval as make_tuple
from pathlib import Path
from typing import Union

import pandas as pd


def read_single_instance_benchmark_output(path: Union[str, Path]) -> pd.DataFrame:
with open(path, "r") as fh:
line = fh.read()

print(line)
row = list(make_tuple(line.strip()))

# Parse the instance name to identify the instance characteristics
values = [s.strip("nidxdistributiontravelserv") for s in row[0].split("-")]
data = values + row[1:]

headers = [
"n",
"idx",
"distribution",
"travel",
"serv",
"obj",
"iters",
"time",
"alg",
"cost_profile",
]
dtypes = [int, int, int, int, int, float, float, float, str, str]
return pd.DataFrame([data], columns=headers).astype(dict(zip(headers, dtypes)))
Binary file added preprint.pdf
Binary file not shown.

0 comments on commit d505616

Please sign in to comment.