{"id":26010486,"url":"https://github.com/jdonszelmann/mapfm-client","last_synced_at":"2025-07-09T06:07:18.328Z","repository":{"id":50839528,"uuid":"359114811","full_name":"jdonszelmann/mapfm-client","owner":"jdonszelmann","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-28T15:26:11.000Z","size":75,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-29T11:05:41.335Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdonszelmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-18T10:42:56.000Z","updated_at":"2021-05-28T15:26:14.000Z","dependencies_parsed_at":"2022-08-25T16:00:17.855Z","dependency_job_id":null,"html_url":"https://github.com/jdonszelmann/mapfm-client","commit_stats":null,"previous_names":["jdonszelmann/mapfm-client","jonay2000/mapfm-client","jonay2000/mapf_client"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdonszelmann%2Fmapfm-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdonszelmann%2Fmapfm-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdonszelmann%2Fmapfm-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdonszelmann%2Fmapfm-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdonszelmann","download_url":"https://codeload.github.com/jdonszelmann/mapfm-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242117657,"owners_count":20074436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-05T22:50:48.085Z","updated_at":"2025-03-05T22:50:48.820Z","avatar_url":"https://github.com/jdonszelmann.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MAPFM Client\n\nThis is a client library for the https://mapf.nl/ MMAPF problems\n## The MAPFM problem\nMAPFM is an abbreviation of  \"Matching in multi-agent pathfinding\".\nWith MAPFM problems, you are given:\n-\tA grid/maze\n-\tA list of agent starting positions (each agent has a color)\n-\tA list of agent goal positions (each goal has a color)\n\nThe solution for that problem is a list of paths, one for each agent st.\n-\tEach path starts on the starting position of an agent\n-\tEach path ends on a goal position of the same color as the agent\n-\tNo path crosses a wall in the grid\n-\tNo 2 agents are ever on the same position at the same time\n-\tNo 2 agents  ever cross the same edge (in opposite directions) at the same time\nThis solution is optimal if there is no other solution st. the sum of the lengths of the paths of all the agents is smaller than this solution.\n## Using the client library\nInstall the library with:\n```bash\npip install mapfmclient\n```\nThen go to https://mapf.nl/benchmarks/. Here you can find a list of benchmarks. If you click on a benchmark you can see prefiously posted solutions. By clicking on a solution, You can see what the problem looks like. Find a problem that you like, and find its index on the https://mapfw.nl/benchmarks/ page (Sorry, you will have to count yourself, starting from 1. This will change later).\n\nNow go to your account page at https://mapfw.nl/auth/account. To find your API Token\n\nThis is all the info you need to start coding. The basic outline of your code should look like this:\n```python\nfrom mapfmclient import MapfwBenchmarker\nif __name__ == '__main__':\n    benchmarker = MapfwBenchmarker(\"\u003cYOUR API TOKEN\u003e\", \u003cBENCHMARK ID(s)\u003e, \"\u003cYOUR ALGORITHMS NAME\u003e\",\n                                   \"\u003cYOUR ALGORITHMS VERSION\u003e\", \u003cDEBUG_MODE\u003e, solver=\u003cSOLVER\u003e,cores=\u003cCORES\u003e)\n    benchmarker.run()\n```\nThe only things that you need to do are to fill in\n- Your own API Token\n- The number of the benchmark that you want to solve\n- The name of your algorithm\n- Its version qnd the debug mode. (This should be set to True while you are developing your algorithm. This means that your attempts will not be shown on the global leader boards. You can however still see your own solution at https://mapf.nl/latest-debug.)\n- Your solver function\n- The amount of cores that you want to use for this benchmark (Default=1. For all cores, use -1)\n\nNote that the benchmark id does not need to be complete. Any uniquely identifying prefix of the id will work.\nOn https://mapf.nl, 5 characters are usually used.\n\nYou should implement the \"solver\" function yourself.\nThis function should take in a problem and return the solution.\nA basic outline of this function can be as follows:\n```python\nfrom mapfmclient import Problem, Solution, MarkedLocation\n\n\nclass Maze:\n    def __init__(self, grid, width, height):\n        self.grid = grid\n        self.width = width\n        self.height = height\n\n\ndef solve(problem):\n    maze = Maze(problem.grid, problem.width, problem.height)\n\n    paths = []\n    for agent in agents:\n        paths.append(find_path(agent, maze))\n\n    \"\"\"\n    Now paths looks like:\n    \n    paths = list[Path]\n    Path = List[(x, y)]\n    \"\"\"\n\n    return Solution.from_paths(paths)\n```\n\nIt is also possible to run multiple benchmarks at the same time.\nInstead of giving an integer as the benchmark index, you can also give an iterable to the ```MapfwBenchmarker``` constructor.\nValid uses are:\n\nRun benchmark 3, with solver ```solve```, with algorithm TestAlgorithm and version TestVersion, in debug on 1 core:\n```python\nMapfBenchmarker(\"\u003cYOUR API TOKEN\u003e\", 1, \"TestAlgotithm\",\n                    \"TestVersion\", True, solver=solve,cores=1)\n```\n\nRun benchmark 1,2 and 3, with solver ```solve```, with algorithm TestAlgorithm and version TestVersion, in debug on 3 cores:\n```python\nMapfBenchmarker(\"\u003cYOUR API TOKEN\u003e\", [1, 2, 3], \"TestAlgotithm\",\n                    \"TestVersion\", True, solver=solve,cores=3)\n```\n\nIf you want a list of all the indexes of the benchmarks, that is possible with the ```get_all_benchmarks``` function.\nAs an argument you can add the index, or a list of indexes of benchmarks that you dont want to run\n```python\nfrom mapfmclient import get_all_benchmarks\nall_benchmarks = get_all_benchmarks()\nwithout_benchmark_3 = get_all_benchmarks(without=\"3ab4d\")\nwithout_benchmark_2_and_4 = get_all_benchmarks(without=[1, 3, 4])\n```\n\nWhen your are ready, set the debug mode to False. The next time you run your code, your attempt will be publicly listed.\n\nThis should be all that you need to know to get started!\nPlease note that this is just some example code and feel free to change it however you like.\n\nGood luck! And let us know if you have any questions.\n\n\nNote: This client is largely an adaptation of a similar project for a different problem\ncalled MAPFW (MAPF with waypoints). It can be found [here](https://github.com/noahiscool13/mapfw-client) ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdonszelmann%2Fmapfm-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdonszelmann%2Fmapfm-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdonszelmann%2Fmapfm-client/lists"}