reqreate 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reqreate-0.1.0/LICENSE +19 -0
- reqreate-0.1.0/PKG-INFO +192 -0
- reqreate-0.1.0/README.md +149 -0
- reqreate-0.1.0/REQreate/2assign_bus_stops_zones.py +147 -0
- reqreate-0.1.0/REQreate/REQreate.py +57 -0
- reqreate-0.1.0/REQreate/REQreate2.py +67 -0
- reqreate-0.1.0/REQreate/REQreate3.py +62 -0
- reqreate-0.1.0/REQreate/REQreate4.py +62 -0
- reqreate-0.1.0/REQreate/REQreate5.py +62 -0
- reqreate-0.1.0/REQreate/REQreate6.py +62 -0
- reqreate-0.1.0/REQreate/REQreate7.py +62 -0
- reqreate-0.1.0/REQreate/REQreate8.py +62 -0
- reqreate-0.1.0/REQreate/REQreate9.py +62 -0
- reqreate-0.1.0/REQreate/__init__.py +8 -0
- reqreate-0.1.0/REQreate/assing_bus_stops_zones.py +80 -0
- reqreate-0.1.0/REQreate/cli.py +79 -0
- reqreate-0.1.0/REQreate/compute_distance_matrix.py +393 -0
- reqreate-0.1.0/REQreate/dynamism.py +245 -0
- reqreate-0.1.0/REQreate/fixed_lines.py +889 -0
- reqreate-0.1.0/REQreate/geographic_dispersion.py +500 -0
- reqreate-0.1.0/REQreate/input_json.py +1213 -0
- reqreate-0.1.0/REQreate/instance_class.py +129 -0
- reqreate-0.1.0/REQreate/json_to_csv.py +1159 -0
- reqreate-0.1.0/REQreate/logger_utils.py +99 -0
- reqreate-0.1.0/REQreate/make_travel_time_matrix.py +232 -0
- reqreate-0.1.0/REQreate/network_class.py +550 -0
- reqreate-0.1.0/REQreate/output_files.py +131 -0
- reqreate-0.1.0/REQreate/overpass_config.py +194 -0
- reqreate-0.1.0/REQreate/parameters_class.py +5 -0
- reqreate-0.1.0/REQreate/passenger_requests.py +1285 -0
- reqreate-0.1.0/REQreate/population_density.py +170 -0
- reqreate-0.1.0/REQreate/properties_synthetic_instances.py +762 -0
- reqreate-0.1.0/REQreate/request_distribution_class.py +35 -0
- reqreate-0.1.0/REQreate/retrieve_POIs.py +562 -0
- reqreate-0.1.0/REQreate/retrieve_bus_stations.py +230 -0
- reqreate-0.1.0/REQreate/retrieve_hospitals.py +86 -0
- reqreate-0.1.0/REQreate/retrieve_network.py +406 -0
- reqreate-0.1.0/REQreate/retrieve_schools.py +82 -0
- reqreate-0.1.0/REQreate/retrieve_zones.py +147 -0
- reqreate-0.1.0/REQreate/similarity.py +168 -0
- reqreate-0.1.0/REQreate/spatial_distribution_class.py +57 -0
- reqreate-0.1.0/REQreate/speed_info.py +117 -0
- reqreate-0.1.0/REQreate/stops_locations.py +442 -0
- reqreate-0.1.0/REQreate/syn_instances_literature.py +244 -0
- reqreate-0.1.0/REQreate/trip_patterns_austin.py +841 -0
- reqreate-0.1.0/REQreate/trip_patterns_chicago_TNP.py +1415 -0
- reqreate-0.1.0/REQreate/trip_patterns_general.py +1076 -0
- reqreate-0.1.0/REQreate/trip_patterns_green.py +789 -0
- reqreate-0.1.0/REQreate/trip_patterns_sanfranciscobay.py +763 -0
- reqreate-0.1.0/REQreate/trip_patterns_yellow.py +795 -0
- reqreate-0.1.0/REQreate/uber_movement.py +857 -0
- reqreate-0.1.0/REQreate/urgency.py +69 -0
- reqreate-0.1.0/REQreate/webapp/__init__.py +1 -0
- reqreate-0.1.0/REQreate/webapp/app.py +990 -0
- reqreate-0.1.0/REQreate/webapp/attribute_library.py +525 -0
- reqreate-0.1.0/REQreate/webapp/map_utils.py +180 -0
- reqreate-0.1.0/pyproject.toml +62 -0
- reqreate-0.1.0/reqreate.egg-info/PKG-INFO +192 -0
- reqreate-0.1.0/reqreate.egg-info/SOURCES.txt +62 -0
- reqreate-0.1.0/reqreate.egg-info/dependency_links.txt +1 -0
- reqreate-0.1.0/reqreate.egg-info/entry_points.txt +2 -0
- reqreate-0.1.0/reqreate.egg-info/requires.txt +28 -0
- reqreate-0.1.0/reqreate.egg-info/top_level.txt +1 -0
- reqreate-0.1.0/setup.cfg +4 -0
reqreate-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2018 The Python Packaging Authority
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
reqreate-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: reqreate
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Instance generator for demand responsive transit systems
|
|
5
|
+
Author-email: Michell Queiroz <michell.queiroz@uantwerpen.be>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/michellqueiroz-ua/instance-generator
|
|
8
|
+
Keywords: transportation,dial-a-ride,openstreetmap,instance-generator,operations-research
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: osmnx<3,>=2.0
|
|
18
|
+
Requires-Dist: networkx
|
|
19
|
+
Requires-Dist: pandas
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
Requires-Dist: shapely
|
|
22
|
+
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: geopandas
|
|
24
|
+
Requires-Dist: osmapi
|
|
25
|
+
Requires-Dist: scipy
|
|
26
|
+
Requires-Dist: geopy
|
|
27
|
+
Requires-Dist: pyshp
|
|
28
|
+
Requires-Dist: seaborn
|
|
29
|
+
Requires-Dist: powerlaw
|
|
30
|
+
Requires-Dist: fitter
|
|
31
|
+
Provides-Extra: app
|
|
32
|
+
Requires-Dist: streamlit; extra == "app"
|
|
33
|
+
Requires-Dist: folium; extra == "app"
|
|
34
|
+
Requires-Dist: streamlit-folium; extra == "app"
|
|
35
|
+
Requires-Dist: plotly; extra == "app"
|
|
36
|
+
Provides-Extra: parallel
|
|
37
|
+
Requires-Dist: ray; extra == "parallel"
|
|
38
|
+
Provides-Extra: analysis
|
|
39
|
+
Requires-Dist: scikit-learn; extra == "analysis"
|
|
40
|
+
Requires-Dist: sqlalchemy; extra == "analysis"
|
|
41
|
+
Requires-Dist: sqlalchemy-utils; extra == "analysis"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# REQreate 🚌
|
|
45
|
+
|
|
46
|
+
REQreate is a tool to generate instances for on-demand transportation problems. Such problems consist of optimizing the routes of vehicles according to passengers' demand for transportation under space and time restrictions (requests). REQreate is flexible and can be configured to generate instances for a large number of problems in this problem class. For example, the Dial-a-Ride Problem (DARP) and On-demand Bus Routing Problem (ODBRP). The tool makes use of real-life networks from OpenStreetMaps to generate instances for an extensive catalogue of existing and upcoming on-demand transportation problems.
|
|
47
|
+
|
|
48
|
+
## ✨ New: Web Interface
|
|
49
|
+
|
|
50
|
+
REQreate now includes a user-friendly web interface built with Streamlit! No need to edit JSON files manually.
|
|
51
|
+
|
|
52
|
+
**Quick Start:**
|
|
53
|
+
```bash
|
|
54
|
+
pip install .[app]
|
|
55
|
+
reqreate app
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or simply double-click `run_webapp.bat` (Windows)
|
|
59
|
+
|
|
60
|
+
The web interface provides:
|
|
61
|
+
- 🎨 Visual forms for all parameters
|
|
62
|
+
- 📊 Browse and preview existing instances
|
|
63
|
+
- �️ Interactive maps with request distribution visualization
|
|
64
|
+
- 🔥 Heatmaps for demand density analysis
|
|
65
|
+
- �🔄 Real-time generation progress
|
|
66
|
+
- 📚 Built-in documentation
|
|
67
|
+
- 💾 Easy data exploration
|
|
68
|
+
|
|
69
|
+
See [WEBAPP.md](WEBAPP.md) for detailed instructions.
|
|
70
|
+
|
|
71
|
+
## 🌐 Deploy Online
|
|
72
|
+
|
|
73
|
+
Want to share REQreate with others? Deploy it to Hugging Face Spaces for free!
|
|
74
|
+
|
|
75
|
+
**Hugging Face Spaces** (Recommended):
|
|
76
|
+
- ✅ Free tier with 16GB RAM
|
|
77
|
+
- ✅ No timeout issues
|
|
78
|
+
- ✅ 50GB persistent storage
|
|
79
|
+
- ✅ Automatic HTTPS
|
|
80
|
+
|
|
81
|
+
**Quick Deploy:**
|
|
82
|
+
1. Create account at [huggingface.co](https://huggingface.co/join)
|
|
83
|
+
2. Create new Space with Streamlit SDK
|
|
84
|
+
3. Push your code to the Space repository
|
|
85
|
+
4. App automatically builds and deploys
|
|
86
|
+
|
|
87
|
+
See [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md) for detailed deployment instructions.
|
|
88
|
+
|
|
89
|
+
## How to use REQreate?
|
|
90
|
+
|
|
91
|
+
### Option 1: Web Interface (Recommended for new users)
|
|
92
|
+
Use the Streamlit web app for a guided, visual experience:
|
|
93
|
+
```bash
|
|
94
|
+
python -m streamlit run app.py
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Option 2: Command Line (Advanced users)
|
|
98
|
+
Attributes and parameters that define an instance are described in a configuration file given as input to REQreate. The used syntax is JSON.
|
|
99
|
+
Each configuration file can generate one or more instances and it should be given as parameter in the REQreate.py file.
|
|
100
|
+
Edit "REQreate.py" indicating the desired configuration file and a name for the output folder and simply run "python REQreate.py" on your terminal.
|
|
101
|
+
Check out [this folder](https://github.com/michellqueiroz-ua/instance-generator/tree/master/examples/basic_examples) for examples of configuration files.
|
|
102
|
+
|
|
103
|
+
# Questions? Do not hesitate to send an e-mail to:
|
|
104
|
+
|
|
105
|
+
michell.queiroz@uantwerpen.be
|
|
106
|
+
|
|
107
|
+
## Installation requirements
|
|
108
|
+
|
|
109
|
+
### Quick Install (Recommended)
|
|
110
|
+
|
|
111
|
+
1. **Install Python 3.11+** (required by osmnx 2.x)
|
|
112
|
+
|
|
113
|
+
2. **Install REQreate** from a checkout of this repository:
|
|
114
|
+
```bash
|
|
115
|
+
pip install .[app]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
3. **Run the tool:**
|
|
119
|
+
- Web Interface: `reqreate app` — opens the interface in your browser, running entirely on your machine
|
|
120
|
+
- Command Line: `reqreate generate my_config.json`
|
|
121
|
+
- `reqreate --help` lists every option
|
|
122
|
+
|
|
123
|
+
Running the interface locally is the recommended way to use REQreate. Besides
|
|
124
|
+
not depending on a hosted deployment, OpenStreetMap downloads then leave from
|
|
125
|
+
your own IP address rather than one shared with every other user of a hosting
|
|
126
|
+
platform, which is what gets requests refused by the public Overpass API.
|
|
127
|
+
|
|
128
|
+
**Optional extras:**
|
|
129
|
+
|
|
130
|
+
| Extra | Installs | Needed for |
|
|
131
|
+
|---|---|---|
|
|
132
|
+
| `parallel` | ray | parallel processing (the code falls back to sequential without it) |
|
|
133
|
+
| `analysis` | scikit-learn, sqlalchemy | the taxi-dataset trip-pattern and `uber_movement` modules |
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pip install .[app,parallel]
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Troubleshooting: Overpass API errors
|
|
140
|
+
|
|
141
|
+
If generation fails with a connection error mentioning `overpass-api.de`, the
|
|
142
|
+
public OpenStreetMap query servers are refusing or rate-limiting the request.
|
|
143
|
+
This is unrelated to the location you asked for. REQreate retries and fails
|
|
144
|
+
over across several mirrors automatically; if none of them work, set
|
|
145
|
+
`REQREATE_OVERPASS_URL` to an Overpass instance you can reach:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
export REQREATE_OVERPASS_URL=https://overpass.kumi.systems/api/interpreter
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Detailed Installation
|
|
152
|
+
|
|
153
|
+
1. Have python 3.8 or a newer version installed
|
|
154
|
+
|
|
155
|
+
2. Install anaconda (optional but recommended)
|
|
156
|
+
- [Tutorial 1 anaconda](https://problemsolvingwithpython.com/01-Orientation/01.00-Welcome/)
|
|
157
|
+
- [Tutorial 2 anaconda](https://docs.anaconda.com/anaconda/install/)
|
|
158
|
+
|
|
159
|
+
3. Install OSMnx (necessary to retrieve the networks)
|
|
160
|
+
- [Tutorial OSMnx](https://osmnx.readthedocs.io/en/stable/installation.html)
|
|
161
|
+
|
|
162
|
+
4. Install Streamlit (for web interface)
|
|
163
|
+
```bash
|
|
164
|
+
pip install streamlit
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
5. Activate your environment (if using conda):
|
|
168
|
+
```bash
|
|
169
|
+
conda activate ox
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Features
|
|
173
|
+
|
|
174
|
+
- 🌍 **Real-world networks** from OpenStreetMap
|
|
175
|
+
- 🚍 **Flexible configuration** for various on-demand transport problems
|
|
176
|
+
- 📊 **Multiple output formats** (CSV, JSON, GraphML, Pickle)
|
|
177
|
+
- 🎯 **Realistic request patterns** based on POI density
|
|
178
|
+
- ⏱️ **Accurate travel times** using actual road speeds
|
|
179
|
+
- 🖥️ **User-friendly web interface** for easy instance generation
|
|
180
|
+
|
|
181
|
+
## Output Files
|
|
182
|
+
|
|
183
|
+
REQreate generates comprehensive datasets including:
|
|
184
|
+
- Bus station locations
|
|
185
|
+
- Network topology (walk + drive)
|
|
186
|
+
- Passenger requests with time windows
|
|
187
|
+
- Travel time matrices
|
|
188
|
+
- Zone definitions
|
|
189
|
+
- Points of Interest (POIs)
|
|
190
|
+
- Network visualizations
|
|
191
|
+
|
|
192
|
+
|
reqreate-0.1.0/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# REQreate 🚌
|
|
2
|
+
|
|
3
|
+
REQreate is a tool to generate instances for on-demand transportation problems. Such problems consist of optimizing the routes of vehicles according to passengers' demand for transportation under space and time restrictions (requests). REQreate is flexible and can be configured to generate instances for a large number of problems in this problem class. For example, the Dial-a-Ride Problem (DARP) and On-demand Bus Routing Problem (ODBRP). The tool makes use of real-life networks from OpenStreetMaps to generate instances for an extensive catalogue of existing and upcoming on-demand transportation problems.
|
|
4
|
+
|
|
5
|
+
## ✨ New: Web Interface
|
|
6
|
+
|
|
7
|
+
REQreate now includes a user-friendly web interface built with Streamlit! No need to edit JSON files manually.
|
|
8
|
+
|
|
9
|
+
**Quick Start:**
|
|
10
|
+
```bash
|
|
11
|
+
pip install .[app]
|
|
12
|
+
reqreate app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or simply double-click `run_webapp.bat` (Windows)
|
|
16
|
+
|
|
17
|
+
The web interface provides:
|
|
18
|
+
- 🎨 Visual forms for all parameters
|
|
19
|
+
- 📊 Browse and preview existing instances
|
|
20
|
+
- �️ Interactive maps with request distribution visualization
|
|
21
|
+
- 🔥 Heatmaps for demand density analysis
|
|
22
|
+
- �🔄 Real-time generation progress
|
|
23
|
+
- 📚 Built-in documentation
|
|
24
|
+
- 💾 Easy data exploration
|
|
25
|
+
|
|
26
|
+
See [WEBAPP.md](WEBAPP.md) for detailed instructions.
|
|
27
|
+
|
|
28
|
+
## 🌐 Deploy Online
|
|
29
|
+
|
|
30
|
+
Want to share REQreate with others? Deploy it to Hugging Face Spaces for free!
|
|
31
|
+
|
|
32
|
+
**Hugging Face Spaces** (Recommended):
|
|
33
|
+
- ✅ Free tier with 16GB RAM
|
|
34
|
+
- ✅ No timeout issues
|
|
35
|
+
- ✅ 50GB persistent storage
|
|
36
|
+
- ✅ Automatic HTTPS
|
|
37
|
+
|
|
38
|
+
**Quick Deploy:**
|
|
39
|
+
1. Create account at [huggingface.co](https://huggingface.co/join)
|
|
40
|
+
2. Create new Space with Streamlit SDK
|
|
41
|
+
3. Push your code to the Space repository
|
|
42
|
+
4. App automatically builds and deploys
|
|
43
|
+
|
|
44
|
+
See [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md) for detailed deployment instructions.
|
|
45
|
+
|
|
46
|
+
## How to use REQreate?
|
|
47
|
+
|
|
48
|
+
### Option 1: Web Interface (Recommended for new users)
|
|
49
|
+
Use the Streamlit web app for a guided, visual experience:
|
|
50
|
+
```bash
|
|
51
|
+
python -m streamlit run app.py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Option 2: Command Line (Advanced users)
|
|
55
|
+
Attributes and parameters that define an instance are described in a configuration file given as input to REQreate. The used syntax is JSON.
|
|
56
|
+
Each configuration file can generate one or more instances and it should be given as parameter in the REQreate.py file.
|
|
57
|
+
Edit "REQreate.py" indicating the desired configuration file and a name for the output folder and simply run "python REQreate.py" on your terminal.
|
|
58
|
+
Check out [this folder](https://github.com/michellqueiroz-ua/instance-generator/tree/master/examples/basic_examples) for examples of configuration files.
|
|
59
|
+
|
|
60
|
+
# Questions? Do not hesitate to send an e-mail to:
|
|
61
|
+
|
|
62
|
+
michell.queiroz@uantwerpen.be
|
|
63
|
+
|
|
64
|
+
## Installation requirements
|
|
65
|
+
|
|
66
|
+
### Quick Install (Recommended)
|
|
67
|
+
|
|
68
|
+
1. **Install Python 3.11+** (required by osmnx 2.x)
|
|
69
|
+
|
|
70
|
+
2. **Install REQreate** from a checkout of this repository:
|
|
71
|
+
```bash
|
|
72
|
+
pip install .[app]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
3. **Run the tool:**
|
|
76
|
+
- Web Interface: `reqreate app` — opens the interface in your browser, running entirely on your machine
|
|
77
|
+
- Command Line: `reqreate generate my_config.json`
|
|
78
|
+
- `reqreate --help` lists every option
|
|
79
|
+
|
|
80
|
+
Running the interface locally is the recommended way to use REQreate. Besides
|
|
81
|
+
not depending on a hosted deployment, OpenStreetMap downloads then leave from
|
|
82
|
+
your own IP address rather than one shared with every other user of a hosting
|
|
83
|
+
platform, which is what gets requests refused by the public Overpass API.
|
|
84
|
+
|
|
85
|
+
**Optional extras:**
|
|
86
|
+
|
|
87
|
+
| Extra | Installs | Needed for |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `parallel` | ray | parallel processing (the code falls back to sequential without it) |
|
|
90
|
+
| `analysis` | scikit-learn, sqlalchemy | the taxi-dataset trip-pattern and `uber_movement` modules |
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install .[app,parallel]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Troubleshooting: Overpass API errors
|
|
97
|
+
|
|
98
|
+
If generation fails with a connection error mentioning `overpass-api.de`, the
|
|
99
|
+
public OpenStreetMap query servers are refusing or rate-limiting the request.
|
|
100
|
+
This is unrelated to the location you asked for. REQreate retries and fails
|
|
101
|
+
over across several mirrors automatically; if none of them work, set
|
|
102
|
+
`REQREATE_OVERPASS_URL` to an Overpass instance you can reach:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
export REQREATE_OVERPASS_URL=https://overpass.kumi.systems/api/interpreter
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Detailed Installation
|
|
109
|
+
|
|
110
|
+
1. Have python 3.8 or a newer version installed
|
|
111
|
+
|
|
112
|
+
2. Install anaconda (optional but recommended)
|
|
113
|
+
- [Tutorial 1 anaconda](https://problemsolvingwithpython.com/01-Orientation/01.00-Welcome/)
|
|
114
|
+
- [Tutorial 2 anaconda](https://docs.anaconda.com/anaconda/install/)
|
|
115
|
+
|
|
116
|
+
3. Install OSMnx (necessary to retrieve the networks)
|
|
117
|
+
- [Tutorial OSMnx](https://osmnx.readthedocs.io/en/stable/installation.html)
|
|
118
|
+
|
|
119
|
+
4. Install Streamlit (for web interface)
|
|
120
|
+
```bash
|
|
121
|
+
pip install streamlit
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
5. Activate your environment (if using conda):
|
|
125
|
+
```bash
|
|
126
|
+
conda activate ox
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Features
|
|
130
|
+
|
|
131
|
+
- 🌍 **Real-world networks** from OpenStreetMap
|
|
132
|
+
- 🚍 **Flexible configuration** for various on-demand transport problems
|
|
133
|
+
- 📊 **Multiple output formats** (CSV, JSON, GraphML, Pickle)
|
|
134
|
+
- 🎯 **Realistic request patterns** based on POI density
|
|
135
|
+
- ⏱️ **Accurate travel times** using actual road speeds
|
|
136
|
+
- 🖥️ **User-friendly web interface** for easy instance generation
|
|
137
|
+
|
|
138
|
+
## Output Files
|
|
139
|
+
|
|
140
|
+
REQreate generates comprehensive datasets including:
|
|
141
|
+
- Bus station locations
|
|
142
|
+
- Network topology (walk + drive)
|
|
143
|
+
- Passenger requests with time windows
|
|
144
|
+
- Travel time matrices
|
|
145
|
+
- Zone definitions
|
|
146
|
+
- Points of Interest (POIs)
|
|
147
|
+
- Network visualizations
|
|
148
|
+
|
|
149
|
+
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import math
|
|
2
|
+
import matplotlib.pyplot as plt
|
|
3
|
+
import os
|
|
4
|
+
import osmnx as ox
|
|
5
|
+
import pandas as pd
|
|
6
|
+
import shapely
|
|
7
|
+
from shapely.geometry import Polygon
|
|
8
|
+
from shapely.geometry import Point
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
# Runnable as a script from inside this directory (python 2assign_bus_stops_zones.py) as well as
|
|
11
|
+
# via `python -m REQreate.2assign_bus_stops_zones`; put the repository root on sys.path so the
|
|
12
|
+
# REQreate package resolves either way.
|
|
13
|
+
import os as _os, sys as _sys
|
|
14
|
+
_sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
|
|
15
|
+
|
|
16
|
+
from REQreate.instance_class import Instance
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def assign_bus_stops_to_zones():
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
if __name__ == '__main__':
|
|
23
|
+
|
|
24
|
+
place_name = "Chicago, Illinois"
|
|
25
|
+
save_dir = os.getcwd()+'/'+place_name
|
|
26
|
+
pickle_dir = os.path.join(save_dir, 'pickle')
|
|
27
|
+
network_class_file = pickle_dir+'/'+place_name+'.network.class.pkl'
|
|
28
|
+
|
|
29
|
+
network_directory = os.getcwd()+'/'+place_name
|
|
30
|
+
|
|
31
|
+
if Path(network_class_file).is_file():
|
|
32
|
+
inst = Instance(folder_to_network=place_name)
|
|
33
|
+
|
|
34
|
+
save_dir_csv = os.path.join(inst.save_dir, 'csv')
|
|
35
|
+
|
|
36
|
+
#zones = pd.read_csv(save_dir_csv+'/'+place_name+'.zones.csv')
|
|
37
|
+
#stations = pd.read_csv(save_dir_csv+'/'+place_name+'.stations.csv')
|
|
38
|
+
|
|
39
|
+
#zone1 70% requests
|
|
40
|
+
pt = inst.network.polygon.centroid
|
|
41
|
+
lon = pt.x
|
|
42
|
+
lat = pt.y
|
|
43
|
+
|
|
44
|
+
earth_radius = 6371009 # meters
|
|
45
|
+
dist_lat = 2000
|
|
46
|
+
dist_lon = 2000
|
|
47
|
+
|
|
48
|
+
lat = lat
|
|
49
|
+
lng = lon
|
|
50
|
+
|
|
51
|
+
delta_lat = (dist_lat / earth_radius) * (180 / math.pi)
|
|
52
|
+
delta_lng = (dist_lon / earth_radius) * (180 / math.pi) / math.cos(lat * math.pi / 180)
|
|
53
|
+
|
|
54
|
+
north = lat + delta_lat
|
|
55
|
+
south = lat - delta_lat
|
|
56
|
+
east = lng + delta_lng
|
|
57
|
+
west = lng - delta_lng
|
|
58
|
+
|
|
59
|
+
#north, south, east, west = ox.utils_geo.bbox_from_point(zone_center_point, distance)
|
|
60
|
+
polygon1 = Polygon([(west, south), (east, south), (east, north), (west, north)])
|
|
61
|
+
|
|
62
|
+
#zone2 30% requests
|
|
63
|
+
earth_radius = 6371009 # meters
|
|
64
|
+
dist_lat = 2000
|
|
65
|
+
dist_lon = 2000
|
|
66
|
+
|
|
67
|
+
lat = 41.767025
|
|
68
|
+
lng = -87.689840
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
delta_lat = (dist_lat / earth_radius) * (180 / math.pi)
|
|
72
|
+
delta_lng = (dist_lon / earth_radius) * (180 / math.pi) / math.cos(lat * math.pi / 180)
|
|
73
|
+
|
|
74
|
+
north = lat + delta_lat
|
|
75
|
+
south = lat - delta_lat
|
|
76
|
+
east = lng + delta_lng
|
|
77
|
+
west = lng - delta_lng
|
|
78
|
+
|
|
79
|
+
#north, south, east, west = ox.utils_geo.bbox_from_point(zone_center_point, distance)
|
|
80
|
+
polygon2 = Polygon([(west, south), (east, south), (east, north), (west, north)])
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
all_stations = []
|
|
84
|
+
#for indexz, zone in zones.iterrows():
|
|
85
|
+
stationslis = []
|
|
86
|
+
for index, row in inst.network.bus_stations.iterrows():
|
|
87
|
+
|
|
88
|
+
lon = inst.network.bus_stations.loc[index, 'lon']
|
|
89
|
+
lat = inst.network.bus_stations.loc[index, 'lat']
|
|
90
|
+
#polygon = shapely.wkt.loads(zone['polygon'])
|
|
91
|
+
print(type(polygon1))
|
|
92
|
+
pnt = Point(lon, lat)
|
|
93
|
+
if polygon1.contains(pnt):
|
|
94
|
+
stationslis.append(index)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
stationslis2 = []
|
|
99
|
+
for index, row in inst.network.bus_stations.iterrows():
|
|
100
|
+
|
|
101
|
+
lon = inst.network.bus_stations.loc[index, 'lon']
|
|
102
|
+
lat = inst.network.bus_stations.loc[index, 'lat']
|
|
103
|
+
#polygon = shapely.wkt.loads(zone['polygon'])
|
|
104
|
+
print(type(polygon2))
|
|
105
|
+
pnt = Point(lon, lat)
|
|
106
|
+
if polygon2.contains(pnt):
|
|
107
|
+
stationslis2.append(index)
|
|
108
|
+
|
|
109
|
+
data = {
|
|
110
|
+
'Name': ['zone70', 'zone30'],
|
|
111
|
+
'stations': [stationslis, stationslis2]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
df = pd.DataFrame(data)
|
|
115
|
+
|
|
116
|
+
df.to_csv('zones_uneven_demand.csv', index=False)
|
|
117
|
+
|
|
118
|
+
#all_stations.append(stationslis)
|
|
119
|
+
|
|
120
|
+
#zones['stations'] = all_stations
|
|
121
|
+
|
|
122
|
+
#zones = pd.DataFrame(zones)
|
|
123
|
+
#zones.to_csv(save_dir_csv+'/'+place_name+'.zones.csv')
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
'''
|
|
127
|
+
path_tt_file = os.path.join(save_dir_csv, place_name+'.tt.matrix.stations.csv')
|
|
128
|
+
pd_travel_time_matrix = pd.DataFrame()
|
|
129
|
+
travel_time_matrix = []
|
|
130
|
+
for indexs1, station1 in stations.iterrows():
|
|
131
|
+
print(indexs1)
|
|
132
|
+
d = {}
|
|
133
|
+
d['station_index'] = indexs1
|
|
134
|
+
for indexs2, station2 in stations.iterrows():
|
|
135
|
+
sv = str(indexs2)
|
|
136
|
+
if indexs2 != indexs1:
|
|
137
|
+
dist_uv = inst.network._return_estimated_travel_time_drive(int(station1['osmid_drive']), int(station2['osmid_drive']))
|
|
138
|
+
d[sv] = dist_uv
|
|
139
|
+
else:
|
|
140
|
+
d[sv] = 0
|
|
141
|
+
travel_time_matrix.append(d)
|
|
142
|
+
|
|
143
|
+
xt = pd.DataFrame(travel_time_matrix)
|
|
144
|
+
pd_travel_time_matrix = pd_travel_time_matrix.append(xt, ignore_index=True)
|
|
145
|
+
pd_travel_time_matrix.set_index(['station_index'], inplace=True)
|
|
146
|
+
pd_travel_time_matrix.to_csv(path_tt_file)
|
|
147
|
+
'''
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Runnable as a script from inside this directory (python REQreate.py) as well as
|
|
2
|
+
# via `python -m REQreate.REQreate`; put the repository root on sys.path so the
|
|
3
|
+
# REQreate package resolves either way.
|
|
4
|
+
import os as _os, sys as _sys
|
|
5
|
+
_sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
|
|
6
|
+
|
|
7
|
+
from REQreate.input_json import input_json
|
|
8
|
+
#from streamlit import caching
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
if __name__ == '__main__':
|
|
12
|
+
|
|
13
|
+
#caching.clear_cache()
|
|
14
|
+
|
|
15
|
+
#EDIT HERE
|
|
16
|
+
place_name = "Maastricht, Netherlands"
|
|
17
|
+
inst_directory = 'examples/maastricht/' #directory to which the configuration files are saved
|
|
18
|
+
base_save_folder_name = 'instancesMAASTRICHT' #give a unique folder name to save the instances
|
|
19
|
+
#EDIT HERE
|
|
20
|
+
|
|
21
|
+
directory = os.fsencode(inst_directory)
|
|
22
|
+
|
|
23
|
+
for instance in os.listdir(directory):
|
|
24
|
+
|
|
25
|
+
instance_filename = os.fsdecode(instance)
|
|
26
|
+
instance_filename = instance_filename.replace("._", "")
|
|
27
|
+
|
|
28
|
+
final_list = []
|
|
29
|
+
|
|
30
|
+
if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
|
|
31
|
+
|
|
32
|
+
file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
for filex in file_list:
|
|
36
|
+
filex = filex.replace('_1.json', "")
|
|
37
|
+
filex = filex.replace('_2.json', "")
|
|
38
|
+
filex = filex.replace('_3.json', "")
|
|
39
|
+
filex = filex.replace('_4.json', "")
|
|
40
|
+
filex = filex.replace('_5.json', "")
|
|
41
|
+
filex = filex+'.json'
|
|
42
|
+
|
|
43
|
+
final_list.append(filex)
|
|
44
|
+
|
|
45
|
+
if instance_filename not in final_list:
|
|
46
|
+
|
|
47
|
+
if (instance_filename.endswith(".json")):
|
|
48
|
+
print(instance_filename)
|
|
49
|
+
#print("here")
|
|
50
|
+
try:
|
|
51
|
+
input_json(inst_directory, instance_filename, base_save_folder_name)
|
|
52
|
+
except FileNotFoundError:
|
|
53
|
+
|
|
54
|
+
pass
|
|
55
|
+
else:
|
|
56
|
+
print('already FOUND')
|
|
57
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Runnable as a script from inside this directory (python REQreate2.py) as well as
|
|
2
|
+
# via `python -m REQreate.REQreate2`; put the repository root on sys.path so the
|
|
3
|
+
# REQreate package resolves either way.
|
|
4
|
+
import os as _os, sys as _sys
|
|
5
|
+
_sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
|
|
6
|
+
|
|
7
|
+
from REQreate.input_json import input_json
|
|
8
|
+
#from streamlit import caching
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
if __name__ == '__main__':
|
|
12
|
+
|
|
13
|
+
#caching.clear_cache()
|
|
14
|
+
|
|
15
|
+
#EDIT HERE
|
|
16
|
+
place_name = "Chicago, Illinois"
|
|
17
|
+
inst_directory = '../examples/pricing_instances/'
|
|
18
|
+
#inst_directory = '../examples/testes/'
|
|
19
|
+
base_save_folder_name = 'pricing_example' #give a unique folder name to save the instances
|
|
20
|
+
#EDIT HERE
|
|
21
|
+
|
|
22
|
+
directory = os.fsencode(inst_directory)
|
|
23
|
+
|
|
24
|
+
#input_json(inst_directory+'/'+'Chicago,Illinois_ODBRP_7.0_8.0_300_0.0_300.0_0.0_180_1000.json')
|
|
25
|
+
|
|
26
|
+
for instance in os.listdir(directory):
|
|
27
|
+
|
|
28
|
+
instance_filename = os.fsdecode(instance)
|
|
29
|
+
instance_filename = instance_filename.replace("._", "")
|
|
30
|
+
|
|
31
|
+
#print(os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name)))
|
|
32
|
+
|
|
33
|
+
final_list = []
|
|
34
|
+
|
|
35
|
+
if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
|
|
36
|
+
|
|
37
|
+
file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
for filex in file_list:
|
|
41
|
+
filex = filex.replace('_1.json', "")
|
|
42
|
+
filex = filex.replace('_2.json', "")
|
|
43
|
+
filex = filex.replace('_3.json', "")
|
|
44
|
+
filex = filex.replace('_4.json', "")
|
|
45
|
+
filex = filex.replace('_5.json', "")
|
|
46
|
+
filex = filex.replace('_6.json', "")
|
|
47
|
+
filex = filex.replace('_7.json', "")
|
|
48
|
+
filex = filex.replace('_8.json', "")
|
|
49
|
+
filex = filex.replace('_9.json', "")
|
|
50
|
+
filex = filex.replace('_10.json', "")
|
|
51
|
+
filex = filex+'.json'
|
|
52
|
+
|
|
53
|
+
final_list.append(filex)
|
|
54
|
+
|
|
55
|
+
if instance_filename not in final_list:
|
|
56
|
+
|
|
57
|
+
if (instance_filename.endswith(".json")):
|
|
58
|
+
print(instance_filename)
|
|
59
|
+
#print("here")
|
|
60
|
+
try:
|
|
61
|
+
input_json(inst_directory, instance_filename, base_save_folder_name)
|
|
62
|
+
except FileNotFoundError:
|
|
63
|
+
|
|
64
|
+
pass
|
|
65
|
+
else:
|
|
66
|
+
print('already FOUND')
|
|
67
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Runnable as a script from inside this directory (python REQreate3.py) as well as
|
|
2
|
+
# via `python -m REQreate.REQreate3`; put the repository root on sys.path so the
|
|
3
|
+
# REQreate package resolves either way.
|
|
4
|
+
import os as _os, sys as _sys
|
|
5
|
+
_sys.path.insert(0, _os.path.dirname(_os.path.dirname(_os.path.abspath(__file__))))
|
|
6
|
+
|
|
7
|
+
from REQreate.input_json import input_json
|
|
8
|
+
#from streamlit import caching
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
if __name__ == '__main__':
|
|
12
|
+
|
|
13
|
+
#caching.clear_cache()
|
|
14
|
+
|
|
15
|
+
#EDIT HERE
|
|
16
|
+
place_name = "Chicago, Illinois"
|
|
17
|
+
inst_directory = '../examples/high_dimension_instances/concert2/'
|
|
18
|
+
#inst_directory = '../examples/testes/'
|
|
19
|
+
base_save_folder_name = 'concert2' #give a unique folder name to save the instances
|
|
20
|
+
#EDIT HERE
|
|
21
|
+
|
|
22
|
+
directory = os.fsencode(inst_directory)
|
|
23
|
+
|
|
24
|
+
#input_json(inst_directory+'/'+'Chicago,Illinois_ODBRP_7.0_8.0_300_0.0_300.0_0.0_180_1000.json')
|
|
25
|
+
|
|
26
|
+
for instance in os.listdir(directory):
|
|
27
|
+
|
|
28
|
+
instance_filename = os.fsdecode(instance)
|
|
29
|
+
instance_filename = instance_filename.replace("._", "")
|
|
30
|
+
|
|
31
|
+
#print(os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name)))
|
|
32
|
+
|
|
33
|
+
final_list = []
|
|
34
|
+
|
|
35
|
+
if os.path.isdir(place_name+'/json_format/'+base_save_folder_name):
|
|
36
|
+
|
|
37
|
+
file_list = os.listdir(os.path.join(place_name, 'json_format', base_save_folder_name))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
for filex in file_list:
|
|
41
|
+
filex = filex.replace('_1.json', "")
|
|
42
|
+
filex = filex.replace('_2.json', "")
|
|
43
|
+
filex = filex.replace('_3.json', "")
|
|
44
|
+
filex = filex.replace('_4.json', "")
|
|
45
|
+
filex = filex.replace('_5.json', "")
|
|
46
|
+
filex = filex+'.json'
|
|
47
|
+
|
|
48
|
+
final_list.append(filex)
|
|
49
|
+
|
|
50
|
+
if instance_filename not in final_list:
|
|
51
|
+
|
|
52
|
+
if (instance_filename.endswith(".json")):
|
|
53
|
+
print(instance_filename)
|
|
54
|
+
#print("here")
|
|
55
|
+
try:
|
|
56
|
+
input_json(inst_directory, instance_filename, base_save_folder_name)
|
|
57
|
+
except FileNotFoundError:
|
|
58
|
+
|
|
59
|
+
pass
|
|
60
|
+
else:
|
|
61
|
+
print('already FOUND')
|
|
62
|
+
|