{"id":20210161,"url":"https://github.com/lancelet/cropduster","last_synced_at":"2025-07-16T12:32:56.399Z","repository":{"id":203001211,"uuid":"697728810","full_name":"lancelet/cropduster","owner":"lancelet","description":"Neural Networks for Near-Optimal Control, in *HASKELL*","archived":false,"fork":false,"pushed_at":"2023-11-11T00:51:24.000Z","size":110,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T21:27:25.219Z","etag":null,"topics":["crazy","haskell","neural-network","optimal-control"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/lancelet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-09-28T11:01:26.000Z","updated_at":"2023-10-22T23:58:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"30e0aa52-25d0-440b-917f-e06403c2ee60","html_url":"https://github.com/lancelet/cropduster","commit_stats":null,"previous_names":["lancelet/cropduster"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lancelet%2Fcropduster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lancelet%2Fcropduster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lancelet%2Fcropduster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lancelet%2Fcropduster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lancelet","download_url":"https://codeload.github.com/lancelet/cropduster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241646256,"owners_count":19996538,"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":["crazy","haskell","neural-network","optimal-control"],"created_at":"2024-11-14T05:46:36.583Z","updated_at":"2025-03-03T10:27:23.230Z","avatar_url":"https://github.com/lancelet.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Optimal Control with Neural Networks\n\n[![CI Build](https://github.com/lancelet/cropduster/actions/workflows/haskell.yml/badge.svg)](https://github.com/lancelet/cropduster/actions/workflows/haskell.yml)\n\nThe GitHub Pages site for this repository is at\n[https://lancelet.github.io/cropduster](https://lancelet.github.io/cropduster).\nThe GitHub Pages site currently contains videos of some of the animated\nplots generated by the Haskell code.\n\nWIP!\n\nThis is a repository containing work for a planned presentation to FP-Syd\n(the Sydney, Australia, Functional Programming Group) on near-optimal control\nusing neural networks.\n\nThe presentation will eventually cover:\n  - Basics of SGD.\n  - Backpropagation.\n  - Training supervised networks on batches of examples.\n  - Training networks for near-optimal control (ie. control of dynamical systems\n    using networks that have been trained by minimising an objective function\n    typical of an optimal control problem).\n\nCode examples will (hopefully) include:\n  - Least-squares linear fitting by SGD. Compared against the closed-form\n    solution for a least-squares fit. This introduces SGD with manual gradient\n    calculation to cover the basic approach, in order to motivate automatic\n    differentiation.\n  - Fitting the parameters of a mass-spring-damper system to an observed\n    trajectory. This demonstrates backpropagation through a fixed-step RK4\n    ODE solver.\n  - Training a network to swing-up a pole in a cart-pole pendulum system.\n  - Training a network to do a rocket landing in 2D.\n\n## Plan\n\nMajor items\n- [x] Show SGD linear fitting.\n- [x] Show SGD linear fitting in phase space.\n- [x] Implement RK4 for backprop.\n- [x] Fit parameters to a mass-spring-damper system using backprop.\n- [x] Run compiling and plotting in GitHub CI.\n- [x] Trial Haskell chart to see if it has better plotting performance.\n- [x] Trial video.js in place of plain HTML video tags.\n- [x] Generate slides using Pandoc and reveal.js.\n- [x] Clean up `Plot.hs` now I'm using Cairo for plots.\n- [x] Set up a flow to render images and then process them to videos straight\n      from Haskell to avoid crazy bash scripting.\n- [x] Figure out how to include reveal.js presentation in the Hugo output.\n- [ ] Tidy spring-damper example; add noise to data; make mass a\n      constant since only spring and damping constants are truly free\n      parameters.\n- [ ] Tidy build.\n- [ ] Create other plots using Haskell Chart.\n- [ ] Network for cart-pole pendulum balancing example.\n- [ ] Network for 2D rocket landing example.\n- [ ] Presentation for FP-Syd.\n- [ ] Try plyr.js instead of video.js.\n\n## Running\n\nTo generate linear fitting example movies:\n\n```\n$ ./linfit-examples.sh  # generates movies under the plots directory\n```\n\nTo generate mass-spring-damper example movies:\n\n```\n$ ./msd-examples.sh  # generates movies under the plots directory\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flancelet%2Fcropduster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flancelet%2Fcropduster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flancelet%2Fcropduster/lists"}