version 0.20.5

pull/8/head 0.20.5
J. Fernando Sánchez 2 years ago
parent 5559d37e57
commit dfb6d13649

@ -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

@ -1 +1 @@
0.20.4
0.20.5

@ -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)

Loading…
Cancel
Save