Commit dfb6d136 authored by J. Fernando Sánchez's avatar J. Fernando Sánchez
Browse files

version 0.20.5

parent 5559d37e
Pipeline #3611 passed with stages
in 7 minutes and 21 seconds
......@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.20.5]
### Changed
* Defaults are now set in the agent __init__, not in the environment. This decouples both classes a bit more, and it is more intuitive
## [0.20.4]
### Added
* Agents can now be given any kwargs, which will be used to set their state
......
0.20.4
\ No newline at end of file
0.20.5
\ No newline at end of file
......@@ -54,9 +54,14 @@ class BaseAgent(Agent):
if hasattr(self, 'level'):
self.logger.setLevel(self.level)
for (k, v) in self.defaults.items():
if not hasattr(self, k) or getattr(self, k) is None:
setattr(self, k, deepcopy(v))
for (k, v) in kwargs.items():
setattr(self, k, v)
# TODO: refactor to clean up mesa compatibility
@property
def id(self):
......
......@@ -175,10 +175,6 @@ class Environment(Model):
unique_id=agent_id
)
for (k, v) in getattr(a, 'defaults', {}).items():
if not hasattr(a, k) or getattr(a, k) is None:
setattr(a, k, deepcopy(v))
for (k, v) in state.items():
setattr(a, k, v)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment