{"id":20485748,"url":"https://github.com/alpha74/highrisebuildingelevator_problem","last_synced_at":"2026-03-10T03:31:10.843Z","repository":{"id":102838332,"uuid":"296068962","full_name":"alpha74/highRiseBuildingElevator_problem","owner":"alpha74","description":"Trying to solve High rise building elevators problem of lot of people moving up and down the building.","archived":false,"fork":false,"pushed_at":"2020-09-16T17:20:41.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T16:37:19.682Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alpha74.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-16T15:11:48.000Z","updated_at":"2020-09-16T17:20:43.000Z","dependencies_parsed_at":"2023-03-13T15:14:25.303Z","dependency_job_id":null,"html_url":"https://github.com/alpha74/highRiseBuildingElevator_problem","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alpha74/highRiseBuildingElevator_problem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpha74%2FhighRiseBuildingElevator_problem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpha74%2FhighRiseBuildingElevator_problem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpha74%2FhighRiseBuildingElevator_problem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpha74%2FhighRiseBuildingElevator_problem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alpha74","download_url":"https://codeload.github.com/alpha74/highRiseBuildingElevator_problem/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpha74%2FhighRiseBuildingElevator_problem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30323121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T01:36:58.598Z","status":"online","status_checked_at":"2026-03-10T02:00:06.579Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-11-15T16:33:08.282Z","updated_at":"2026-03-10T03:31:10.821Z","avatar_url":"https://github.com/alpha74.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# High Rise Building Elevator Problem\n\n### Problem Statement\nConsider a high rise building having floors \u003e= 200. We have to design an algorithm for `elevator` system.\n\nGiven the number of lifts as N and M people are requesting the lifts rapidly.\n\nDesign an algorithm which would solve these problems:\n- Minimise the wait time for each lift.\n- In morning, a lot of people will be going to their offices. Hence, load would be high between 8-9am.\n- In evening, a lot of people would be going down so load will be high but it will be random.\n- Avoid the situation when a lift arrives and it is full.\n\n-----\n\n\n### Analysis\n\nWe try to analyze the problem taking some assumptions about the amount of people working in the building.\n\n:white_check_mark: **Taking an example:**\n- The building has 200 floors ( Let `F` be number of floors )\n- Lift capacity `C`\n- A total of 100 people work on each floor ( Let `W` be number of people working on each floor. It can be range of numbers. )\n- Total people visiting the building = 200 x 100 = 2000 (+- 200 others ) ( Denoted by `F.W` )\n\n:white_check_mark: **In this example, we notice that:**\n- The people only go the floors which they work on, i.e, a person who works on floor 10 will not go (or rarely) go above floor 10.\n- The above condition is valid for every person with respect to their `work_floor`.\n- We use this insight to design the elevator system.\n\n\n:white_check_mark: **Insights for lift system:**\n- The traffic load on lifts will be highest for `floor 1` and lowest for `floor F` : How?\n  - Number of people travelling in lifts from `floor 0` to `floor 1` will include all the people wanting to go up any floor.\n\n- The lower floors will have high movement of people as compared to topmost floors. \n- We use this insight in our lift system. \n  - Lower floors have more lifts as compared to upper floors.\n  \n  \n-----\n  \n### Solution:\n\n- `N` is the number of lifts.\n- We divide the number of lifts in decreasing order from bottom to top.\n- Each lift is deployed only for a specific floor_range (Eg: floor10-15). Hence, there exists no lift which goes from `floor 0` to `floor f`.\n- `list_lifts` holds number of lifts which are to be deployed in the decreasing order.\n- `threshold` denotes the minimum number of lifts for deployment across a floor range.\n- `div_factor` denotes the amount of distribution needed. It depends on `N` and `M`, and is hard coded here.\n- `inc_factor` denotes increase in `div_factor`.\n\n```\nlist_lifts = []\ndiv_factor = 3\ninc_factor = 2\nthreshold = 5\nN = number of lifts\ntempN = N\n\nbool stop = false\n\nwhile( !stop )\n{\n  N = N / div_factor\n  \n  if( N \u003e= threshold )\n    list_lifts.append( N )\n  else\n    list_lifts.append( tempN - N )\n    \n  div_factor += inc_factor\n}\n\nsort_desc( list_lifts )\n```\n\n### Example:\n\n- `N = 50`\n- `F = 200`\n- `C = 30`\n- `list_lifts` : `[16, 12, 10, 7, 5 ]`\n- We divide these number of lifts across the floor range 0-50. \n- The lifts groups are discontinuous:\n  - People will have to get out after reaching the topmost floor a lift can go.\n  - And board one of the lift in next group of lifts.\n  \n- Here, number of groups = `list_lifts.size() = 5`. We deploy lifts like this:\n  - `floor 0-10` : 16 lifts running in parallel. This floor range has largest number of lifts as it has most traffic movement.\n  - `floor 11-20` : 12 lifts running in parallel. This group of lifts is separate from all others.\n  - `floor 21-30` : 10 lifts running in parallel. This group of lifts is separate from all others.\n  - `floor 31-40` : 7 lifts running in parallel. This group of lifts is separate from all others.\n  - `floor 41-50` : 5 lifts running in parallel. This group of lifts is separate from all others.\n\n\n### Example Diagram\n![Example_Diagram](https://github.com/alpha74/highRiseBuildingElevator_problem/blob/master/assets/diag1.jpg)\n\n-----\n\n\n### Improvement\n- A more smooth distribution function can be used which depends on more parameters like actual number of people in each floor.\n- This will lead to more efficient distribution of number of lifts.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpha74%2Fhighrisebuildingelevator_problem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falpha74%2Fhighrisebuildingelevator_problem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpha74%2Fhighrisebuildingelevator_problem/lists"}