This pull request introduces a new Action class and integrates it into the agent system, along with several updates to the database logging and visualization modules to improve performance and error handling.
Action Class and Agent Updates:
action.py: Introduced the Action class to encapsulate agent actions and their associated weights and functions. Added default action functions (move_action, gather_action, share_action, attack_action).
agents.py: Updated SystemAgent and IndividualAgent to use the new Action class, each with specific action weights. [1][2]
base_agent.py: Integrated the Action class into the base agent, including methods for selecting and executing actions based on their weights. [1][2][3][4][5][6]
Database Logging Enhancements:
database.py: Improved the log_simulation_step method to handle errors and ensure buffers are flushed correctly. Refactored get_historical_data to fetch and process historical data more efficiently. [1][2][3][4][5]
Visualization Improvements:
visualization.py: Enhanced the _update_charts method to update all lines with full data and adjust axis limits dynamically. Improved error handling for chart updates. [1][2]
This pull request introduces a new
Action
class and integrates it into the agent system, along with several updates to the database logging and visualization modules to improve performance and error handling.Action Class and Agent Updates:
action.py
: Introduced theAction
class to encapsulate agent actions and their associated weights and functions. Added default action functions (move_action
,gather_action
,share_action
,attack_action
).agents.py
: UpdatedSystemAgent
andIndividualAgent
to use the newAction
class, each with specific action weights. [1] [2]base_agent.py
: Integrated theAction
class into the base agent, including methods for selecting and executing actions based on their weights. [1] [2] [3] [4] [5] [6]Database Logging Enhancements:
database.py
: Improved thelog_simulation_step
method to handle errors and ensure buffers are flushed correctly. Refactoredget_historical_data
to fetch and process historical data more efficiently. [1] [2] [3] [4] [5]Visualization Improvements:
visualization.py
: Enhanced the_update_charts
method to update all lines with full data and adjust axis limits dynamically. Improved error handling for chart updates. [1] [2]