Conversation
…agents position to the specified parameters
…t and the given coordinate and distance function, which gives you the distance between the agent and another agent
… the agent will move. forward function, which moves the agent forward by specified amount. back function, which moves the agent backwards by specified amount. right function, turns the agent right by specified degree. left function, turns the agent left by specified degree.
|
Thank you for the PR! I have seen @aiwhoo's presentation on your behalf from last month, and has been waiting for this. |
| self.unique_id = unique_id | ||
| self.model = model | ||
| self.pos: Optional[Position] = None | ||
| self.heading = 90 |
There was a problem hiding this comment.
I think we should define a new class for the new attribute and methods, AgentWithHeading / AgentWithDirection / if you have a better name for it. Because not all models need the feature.
| """Turns the agent left by the given degree""" | ||
| self.heading = (self.heading + degree) % 360 | ||
|
|
||
| def setxy(self, x, y): |
There was a problem hiding this comment.
What about set_position(self, position)? This way, the API remains the same in the implementation with higher number of dimensions, instead of e.g. set_xyz for 3D.
There was a problem hiding this comment.
setxy needs to be removed now that we have set_pos.
Codecov Report
@@ Coverage Diff @@
## main #1278 +/- ##
==========================================
- Coverage 89.05% 87.18% -1.88%
==========================================
Files 19 19
Lines 1307 1280 -27
Branches 265 244 -21
==========================================
- Hits 1164 1116 -48
- Misses 104 131 +27
+ Partials 39 33 -6
Continue to review full report at Codecov.
|
…g background image capabilities to new visualization module SimpleContinousModule.py and added various shapes including rectangle, circle, default, triangle, star, smile, pentagon, arrow, plane, and ant.
| @@ -0,0 +1,332 @@ | |||
| var ContinuousVisualization = function(height, width, context, background_src=null) { | |||
|
I think this PR is too big, and will take a while to be merged. It is better to make a separate PR that does only the Python part. |
|
+1 for giving this a new name. From skimming the code this is primarily supposed to be for the continuous space, right? I think the name should be somewhat representative for that (don't know if it also works for grid, but I guess at least not for network) |
|
We're working on breaking this PR into 2 pull requests: one for the ABM language (e.g. fd, bk, rotate, etc) in agents.py, the other for the visualization improvements (canvas, background images, shapes). The ABM language would be for continous space, while the visualization improvements would be for all spaces. |
@aiwhoo Thanks for the update! |
|
Check out the reserved fields of hash.ai's hengine for inspiration for the names: https://hash.ai/docs/simulation/creating-simulations/anatomy-of-an-agent/state#Reserved-Fields. // Can be used for custom movement logic. Will affect the agent's visualization
// Suggested values: 0 to 1 for each axis
"direction": [x, y, z],
// Can be used for custom movement logic. Will affect the agent's visualization
// Suggested values: 0 to 1 for each axis
"velocity": [x, y, z],They most likely also have methods associated with those attributes. It's good to check their naming choice. |
|
For context, hash.ai's hEngine is a performant ABM library written in Rust, with interfaces to Javascript, Python, and other languages. |
|
Should we close this in lieu of two PRs or will this be one of the PRs? |
|
closing this as stale, but linked to it from #2967 |
Implemented additional core agent functionalities including adding a heading for rotational movements (forward, backwards, right, left, setxy). As well as, removal from scheduler and grid (die)