{"id":21760835,"url":"https://github.com/shivamswarnkar/algo-analysis","last_synced_at":"2025-03-21T04:24:59.235Z","repository":{"id":90290789,"uuid":"75971784","full_name":"shivamswarnkar/Algo-Analysis","owner":"shivamswarnkar","description":"Create and design a map, consisted of a goal, a starting point and various obstacles, and then visually analyze different algorithms as they try to find the best path from source to goal. ","archived":false,"fork":false,"pushed_at":"2019-11-07T16:54:54.000Z","size":1165,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T01:16:12.627Z","etag":null,"topics":["algo-analysis","algorithm","astar-algorithm","breadth-first-search","depth-first-search","hill-climbing-search","iterative-deepening-search","simulation","visual-analysis"],"latest_commit_sha":null,"homepage":"","language":"Java","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/shivamswarnkar.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":"2016-12-08T20:15:12.000Z","updated_at":"2020-04-30T05:04:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"a5f69dec-7eff-4033-b6c5-cd2e02201fca","html_url":"https://github.com/shivamswarnkar/Algo-Analysis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivamswarnkar%2FAlgo-Analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivamswarnkar%2FAlgo-Analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivamswarnkar%2FAlgo-Analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivamswarnkar%2FAlgo-Analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shivamswarnkar","download_url":"https://codeload.github.com/shivamswarnkar/Algo-Analysis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244735427,"owners_count":20501251,"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":["algo-analysis","algorithm","astar-algorithm","breadth-first-search","depth-first-search","hill-climbing-search","iterative-deepening-search","simulation","visual-analysis"],"created_at":"2024-11-26T11:45:39.947Z","updated_at":"2025-03-21T04:24:59.215Z","avatar_url":"https://github.com/shivamswarnkar.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Algo Analysis\nCreate and design a map, consisted of a goal, a starting\npoint and various obstacles, and then visually analyze different algorithms as they try to find the\nbest path from source to goal. For our first version, we have implemented four algorithms: Breadth\nFirst Search, Depth First Search, A* and Hill Climbing.\n\n- [Introduction](#introduction)\n- [How to Use](#how-to-use)\n- [Project Info](#goals)\n- [Results](#result)\n\n\n![Hill Climbing Solving a simple map](demo_imgs/hill_climbing.png)\n\n![BFS Searching.](demo_imgs/bfs.png)\n\n![A* searching](demo_imgs/a_star.png)\n\n![DFS Searching](demo_imgs/dfs.png)\n\n\n\n## Introduction\n\nAlgo-Analysis is a system which let user create and design a map, consisted of a goal, a starting\npoint and various obstacles, and then visually analyze different algorithms as they try to find the\nbest path from source to goal. For our first version, we have implemented four algorithms: Breadth\nFirst Search, Depth First Search, A* and Hill Climbing.\n\n\n## Questions\n\nIs it easier to understand an algorithm by visual analysis? And is it possible to visually observe\nthe algorithms and come up with good conclusions? Are there any patterns of maps where each\nalgorithm performs better? Is it easier to see edge cases in visual analysis process? Which algo-\nrithms performs better when only visually analyzed, and how does it compare to mathematical\nanalysis?\n\n## Goals\n\nGoal of this project is to analyze the performance of algorithms without using complex math and\nlogics, and to explain algorithms to students and people who are not familiar with it. Other goals\nwere to test if users, without any prior knowledge of the algorithms, could identify the optimality,\nrun time complexity and edge case possibilities for algorithms.\n\n## Background\n\nAlgorithms are complex and hard to understand for many people. However, it’s been seen that\npeople understand a problem/solution better if they can visualize it, which can also be called\nVisual thinking. Through some research, we found out that Visual Thinking is one of the best ways\nto solve/explain/understand a problem. Many people prefer analyzing genetic and evolutionary\nalgorithms visually. Hence we used this visual thinking idea and implemented as Algo-Analysis\nsystem to help students and people.\n\n## Information\n\nFor this prototype, we are using only 4 algorithms. In which two algorithms A* and BFS always\ngive the optimal (assuming that heuristic function never produce larger value than actual value),\nand one algorithm DFS may not be optimal where Hill Climbing could get stuck into local minima.\nWe modified the Hill Climbing algorithm so that it knows that which nodes has already been visited.\n\n## Experiment\n\nWe created various maps and tested them with the implemented four algorithms. Maps included\nthe cases where source and goal were really close, source and goal were on different corner and\ncases where no solutions were possible. Some maps included obstacles such that the currently\nseems best path was blocked at the end which had interesting results. Following are some pictures\nof the maps and AI’s trying to solve the map.\n\n![Hill Climbing Solving a simple map](demo_imgs/hill_climbing.png)\n\n```\nFigure 1: Hill Climbing Solving a simple map.\nFigure 2: Smarter Map.\n```\nSecond part of experiment included people who were not familiar with any algorithms (or\nfamiliar with some of the algorithms). We let people make their own maps and asked them to\nvisually analyze the performance and let us know which algorithms they think is best. We asked\nthem if they can think of some edge cases where these algorithms might fail. And which algorithms\nare finding the best optimal solutions.\n\n### Result\n\nIn visual analysis, we found that BFS had to look through each nodes for almost every map. But\nit performed well, and always found the best path. DFS didn’t look through as many nodes as\nBFS, but it couldn’t find the optimal solutions in most cases. Hill climbing was easily stuck in\nmost maps, and didn’t perform as well as other algorithms.\nPeople were able to find the pattern quickly. In beginning, everyone tried a simple map but\nsoon they tried to trap the AI with complex and smart maps. They observed quickly that DFS\ndidn’t find the best path, BFS finds the best path but looks over all the nodes, Hill Climbing goes\nfor the best neighbor and sometimes get stuck (local minima), and A* was performing really well.\nNot only it found the optimal path, it also looked through the least amount of nodes. After seeing\nsome examples, people started thinking about the edge cases like what if there is no map and what\nif the a path is really close to the source but blocked at the end.\n\n### Analysis\n\nVisual analysis almost matched with the actual mathematical analysis. Result of algorithms’ per-\nformances was as expected, however people’s behavior and learning curve was impressive. We\nintentionally made Hill Climbing weak, and let people decide how to we improve it. Some sug-\ngested to keep track of the nodes visited, some suggested to take random path when stuck (sounded\nlike simulated annealing).\nWe also found some patterns in performances of algorithms. There was no best algorithms,\nbut every algorithm has its weakness and strength. For one example, If a source is close to goal\nthen BFS worked really well, but when source is away from the goal then DFS looked through\nless nodes. Visual observation indicated that A* performed best, BFS always worked but explored\nalmost entire map, DFS was fast in some cases but failed to find shortest path and Hill Climbing\ncould perform better with some randomness. (see visual section)\n\n![Figure 3: BFS Searching.](demo_imgs/bfs.png)\n\n```\nFigure 3: BFS Searching\n```\n![Figure 4: A* searching](demo_imgs/a_star.png)\n\n```\nFigure 4: A* searching\n```\n\n![Figure 5: DFS Searching](demo_imgs/dfs.png)\n\n```\nFigure 5: DFS Searching\n```\n\n### Conclusion\n\nAt the end, we concluded that our experiment and project was successful. It seems visual analysis\nmatches (a lot) with mathematical analysis. One weakness of visual analysis is in close comparisons\nor solid logical arguments and result fluctuates with the inputs. However it did help us conclude\nthat visual analysis helped people to understand algorithms better. When we explained BFS before\nthe experiment, people seemed troubled but after the experiment, people seemed to understand\nit better. So our project was a success since we answered our questions and we came up with a\nprototype which could help future students with their studies of algorithms.\n\n### How To Use\n\nThis project is written in Java with NetBeans. Run Algo-Analysis/src/algo/analysis/AlgoAnalysis.java to start the GUI, now follow following.\n\nThere are 4 stage in the program. \n\n```\n- First stage, you select the size of the grid, select which algorithm you want to test, select whether you want to\nallow diagonal movements or not. \n- Second stage is instruction window. \n- Third is where you create your map. Click on the edit mode (like set Source, set Goal, set Obstacles) and then click play.\n- In fourth stage, you can control the speed of the visual analysis but using a slider in down right\ncorner. \n```\nFollowings are the color codes.\n\n```\n- Red: Goal\n- Green: Source\n- Black: Obstacles\n- Magenta:seen but yet to visit\n- Orange: visited\n- Blue: Current Node\n- Cyan:Best Path\n- Dark Grey: No Solution\n```\n## References\n\n- Handbook of Research on Teaching Literacy through the Communicative and Visual Arts.\n    Ed. James Flood, Shirley Brice Heath, and Diane Lapp. 1997, Macmillan Library Reference\n- M. Lotif and A. L. V. Coelho, \"Visually inspecting the search behavior of Harmony Search\n    and its variants with Viz3D,\" 2011 IEEE Congress of Evolutionary Computation (CEC),\n    New Orleans, LA, 2011, pp. 616-623.\n- Llorà, Xavier, Kumara Sastry, Francesc Alías, David E. Goldberg, and Michael Welge. \"An-\n    alyzing Active Interactive Genetic Algorithms Using Visual Analytics.\" Proceedings of the\n    8th Annual Conference on Genetic and Evolutionary Computation - GECCO ’06(2006): n.\n    pag. Web.\n- Renukamurthy, Sanjay. \"Improving Spatially Distributed Multiagent Path Nding Using Co-\n    operative JPS.\" N.p., n.d. Web.\n- Nelsen, Roger B. \"Proofs Without Words.\" Google Books. N.p., n.d. Web. 13 Dec. 2016.\n- Jacobson, Sheldon H., and Enver YÃ^14 cesan. \"Analyzing the Performance of Generalized Hill\n    Climbing Algorithms.\" Journal of Heuristics 10.4 (2004): 387-405. Web.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivamswarnkar%2Falgo-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshivamswarnkar%2Falgo-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivamswarnkar%2Falgo-analysis/lists"}