# Multi-Objective Transport Network Design Problem
A Gymnasium environment to design public transport networks, by satisfying the Origin-Destination demand of multiple socio-economic groups (objectives).
![animation of transport network designer agent](/resources/motndp.gif "MOTNDP")
## Description
The Multi-Objective Transport Network Design Problem (MOTNDP) is a combinatorial optimization problem that involves designing the optimal transport line in a city to meet travel demand between various locations.
The MOTNDP environment is a highly modular environment that allows for the creation of different types of transport network design problems.
In this environemnt, an agent is tasked with placing stations within a city represented as a grid. Episodes start in a cell, and the agent can move between adjacent cells to place new stations.
The environment is based on the City object, which contains the city grid and group definitions for each cell, and the Constraints object, which contains the constraints on agent's movement in the grid and can be used to mask actions, creating different types of transport lines, such as straight lines, curves, or loops.
Each grid cell represents a location associated with a specific group. The reward reflects the total OD demand satisfied for each group, either in absolute or percentage terms.
## Observation Space
The observation space is flexible and can be set with the `state_representation` argument. It can be:
- 'grid_coordinates': the agent's location in grid coordinates (x, y). For 'grid_coordinates', the observation space is a MultiDiscrete space with two dimensions: [grid_x_size, grid_y_size].
- 'grid_index': the agent's location as a scalar index (0,0) -> 0, (0,1) -> 1, ..... For 'grid_index', the observation space is a Discrete space with the size of the grid.
- 'one_hot': a one-hot vector of the agent's location in the grid. For 'one_hot', the observation space is a Box space with the shape of the grid.
## Action Space
The actions is a discrete space where:
- 0: walk up
- 1: walk up-right
- 2: walk right
- 3: walk down-right
- 4: walk down
- 5: walk down-left
- 6: walk left
- 7: walk up-left
At every step, the agent can move to one of the 8 adjacent cells, as long as the movement is allowed by the action mask.
When an agent moves to a new cell, it places a station in the grid, connecting the previous cell with the new one.
## Reward Space
The reward is a vector of length `nr_groups` (number of groups in the city). The reward reflects the total OD demand satisfied for each group, either in absolute or percentage terms.
The type of reward can be set with the `od_type` argument: 'pct' (returns the percentage of satisfied OD pairs for each group) or 'abs' (returns the absolute number of satisfied OD pairs for each group).
## Starting State
The starting state is the initial location of the agent in the grid. The initial location can be set with the `starting_loc` argument. If not set, the starting location is chosen randomly.
## Episode Termination
An episode terminates when the agent has placed all stations under the budget or when there are no more actions to take.
## Arguments
- city (City): City object that contains the grid and the groups.
- constraints (Constraints): Transport constraints object with the constraints on movement in the grid.
- nr_stations (int): Episode length. Total number of stations to place (each station is an episode step).
- state_representation (str): State representation. Can be 'grid_coordinates' (returns the agent's location in grid coordinates), 'grid_index' (scalar index of grid coordinates) or 'one_hot' (one-hot vector).
- od_type (str): Type of Origin Destination metric. Can be 'pct' (returns the percentage of satisfied OD pairs for each group) or 'abs' (returns the absolute number of satisfied OD pairs for each group).
- chained_reward (bool): If True, each new station will receive an additional reward based not only on the ODs covered between the immediate previous station, but also those before.
- starting_loc (tuple): Set the default starting location of the agent in the grid. If None, the starting location is chosen randomly, or chosen in _reset().
- render_mode (str): if 'human', the environment will render a pygame window with the agent's movement and the covered cells.
Raw data
{
"_id": null,
"home_page": null,
"name": "motndp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "Reinforcement Learning, Multi-Objective, RL, AI, Tranportation Network",
"author": null,
"author_email": "Dimitris Michailidis <dimichai@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/27/d5/bb9286018547f037748bdba4c0035d28999322e2c305db886988aae1bf0e/motndp-0.1.0.tar.gz",
"platform": null,
"description": "# Multi-Objective Transport Network Design Problem\nA Gymnasium environment to design public transport networks, by satisfying the Origin-Destination demand of multiple socio-economic groups (objectives). \n\n![animation of transport network designer agent](/resources/motndp.gif \"MOTNDP\")\n\n\n## Description\nThe Multi-Objective Transport Network Design Problem (MOTNDP) is a combinatorial optimization problem that involves designing the optimal transport line in a city to meet travel demand between various locations.\n\nThe MOTNDP environment is a highly modular environment that allows for the creation of different types of transport network design problems.\nIn this environemnt, an agent is tasked with placing stations within a city represented as a grid. Episodes start in a cell, and the agent can move between adjacent cells to place new stations.\nThe environment is based on the City object, which contains the city grid and group definitions for each cell, and the Constraints object, which contains the constraints on agent's movement in the grid and can be used to mask actions, creating different types of transport lines, such as straight lines, curves, or loops.\nEach grid cell represents a location associated with a specific group. The reward reflects the total OD demand satisfied for each group, either in absolute or percentage terms.\n\n## Observation Space\nThe observation space is flexible and can be set with the `state_representation` argument. It can be:\n- 'grid_coordinates': the agent's location in grid coordinates (x, y). For 'grid_coordinates', the observation space is a MultiDiscrete space with two dimensions: [grid_x_size, grid_y_size].\n- 'grid_index': the agent's location as a scalar index (0,0) -> 0, (0,1) -> 1, ..... For 'grid_index', the observation space is a Discrete space with the size of the grid.\n- 'one_hot': a one-hot vector of the agent's location in the grid. For 'one_hot', the observation space is a Box space with the shape of the grid.\n\n## Action Space\nThe actions is a discrete space where:\n- 0: walk up\n- 1: walk up-right\n- 2: walk right\n- 3: walk down-right\n- 4: walk down\n- 5: walk down-left\n- 6: walk left\n- 7: walk up-left\n\nAt every step, the agent can move to one of the 8 adjacent cells, as long as the movement is allowed by the action mask.\nWhen an agent moves to a new cell, it places a station in the grid, connecting the previous cell with the new one.\n\n## Reward Space\nThe reward is a vector of length `nr_groups` (number of groups in the city). The reward reflects the total OD demand satisfied for each group, either in absolute or percentage terms.\nThe type of reward can be set with the `od_type` argument: 'pct' (returns the percentage of satisfied OD pairs for each group) or 'abs' (returns the absolute number of satisfied OD pairs for each group).\n\n## Starting State\nThe starting state is the initial location of the agent in the grid. The initial location can be set with the `starting_loc` argument. If not set, the starting location is chosen randomly.\n\n## Episode Termination\nAn episode terminates when the agent has placed all stations under the budget or when there are no more actions to take.\n\n## Arguments\n- city (City): City object that contains the grid and the groups.\n- constraints (Constraints): Transport constraints object with the constraints on movement in the grid.\n- nr_stations (int): Episode length. Total number of stations to place (each station is an episode step).\n- state_representation (str): State representation. Can be 'grid_coordinates' (returns the agent's location in grid coordinates), 'grid_index' (scalar index of grid coordinates) or 'one_hot' (one-hot vector).\n- od_type (str): Type of Origin Destination metric. Can be 'pct' (returns the percentage of satisfied OD pairs for each group) or 'abs' (returns the absolute number of satisfied OD pairs for each group).\n- chained_reward (bool): If True, each new station will receive an additional reward based not only on the ODs covered between the immediate previous station, but also those before.\n- starting_loc (tuple): Set the default starting location of the agent in the grid. If None, the starting location is chosen randomly, or chosen in _reset().\n- render_mode (str): if 'human', the environment will render a pygame window with the agent's movement and the covered cells.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Multi-Objective Transport Network Design Problem gymnasium environment.",
"version": "0.1.0",
"project_urls": {
"Repository": "https://github.com/dimichai/mo-tndp"
},
"split_keywords": [
"reinforcement learning",
" multi-objective",
" rl",
" ai",
" tranportation network"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c8a107385ecd0baaf37d8661694f8d6a6852a2580a911ef3365bfd8e6f65dde6",
"md5": "39216b2cebe91d3770c1bcceed72b781",
"sha256": "05a6b492b67ce7750bfa369640c4690f693b8252b9ae82d299cfcfe46389e0c5"
},
"downloads": -1,
"filename": "motndp-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "39216b2cebe91d3770c1bcceed72b781",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 15305,
"upload_time": "2024-11-25T16:51:39",
"upload_time_iso_8601": "2024-11-25T16:51:39.028050Z",
"url": "https://files.pythonhosted.org/packages/c8/a1/07385ecd0baaf37d8661694f8d6a6852a2580a911ef3365bfd8e6f65dde6/motndp-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "27d5bb9286018547f037748bdba4c0035d28999322e2c305db886988aae1bf0e",
"md5": "af9b2c7020c81876fa0c26e9282f75b9",
"sha256": "1106ad366b0a4d7657f1f8e3135935f0b42666ec79a130cd0c71c3df547fb69e"
},
"downloads": -1,
"filename": "motndp-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "af9b2c7020c81876fa0c26e9282f75b9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 14811,
"upload_time": "2024-11-25T16:51:40",
"upload_time_iso_8601": "2024-11-25T16:51:40.885090Z",
"url": "https://files.pythonhosted.org/packages/27/d5/bb9286018547f037748bdba4c0035d28999322e2c305db886988aae1bf0e/motndp-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-25 16:51:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dimichai",
"github_project": "mo-tndp",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "motndp"
}