1
0
mirror of https://github.com/gsi-upm/soil synced 2024-12-22 08:18:13 +00:00

version 0.20.5

This commit is contained in:
J. Fernando Sánchez 2022-05-18 16:13:53 +02:00
parent 5559d37e57
commit dfb6d13649
4 changed files with 9 additions and 5 deletions

View File

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

View File

@ -1 +1 @@
0.20.4
0.20.5

View 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):

View File

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