Implementation of heterogeneous agents with neural decision-making capabilities for the ANNEM framework. Each agent has a specific type, neural network weights, memory, and performance tracking.

Arguments

agent_id

Character string for agent ID

agent_type

Agent type (neural_momentum, contrarian_ai, etc.)

initial_wealth

Initial wealth amount (default: 1,000,000) Neural Network Forward Pass

state_vector

Numeric vector of input features

market_data

List containing prices, returns, volatility

network_signals

Numeric, signals from connected agents

sentiment

Numeric, market sentiment score

portfolio_return

Numeric, portfolio return for this period

Value

Numeric decision value in -1, 1 Make Trading Decision

Numeric decision value (negative = sell, positive = buy) Update Agent Wealth

Details

The ANNEMAgent class implements six different agent types as described in the mathematical framework:

  • neural_momentum: Trend-following with neural enhancement

  • contrarian_ai: Mean-reversion with AI signals

  • fundamentalist_ml: Technical analysis with machine learning

  • adaptive_noise: Random strategy with adaptive learning

  • social_network: Peer influence and herding behavior

  • meta_learning: MAML-inspired strategy adaptation

Fields

id

Character string identifying the agent

type

Agent type (one of six types)

wealth

Current wealth of the agent

risk_tolerance

Risk tolerance parameter 0,1

nn_weights

List containing neural network weights

memory

List containing agent's memory of past observations

connections

Numeric vector of connected agents

performance_history

Numeric vector of past performance

Methods

initialize(agent_id, agent_type, initial_wealth = 1e+06)

Initialize a new ANNEM agent with specified parameters

make_decision(market_data, network_signals = 0, sentiment = 0)

Generate trading decision based on agent type and neural network

neural_decision(state_vector)

Forward propagation through neural network with ReLU activation

update_wealth(portfolio_return)

Update agent wealth based on portfolio return and perform learning

Examples

if (FALSE) { # \dontrun{
# Create a neural momentum agent
agent <- ANNEMAgent$new("agent_001", "neural_momentum", 1000000)

# Make a decision based on market data
decision <- agent$make_decision(market_data, network_signals = 0.1, sentiment = 0.05)

# Update wealth based on portfolio return
agent$update_wealth(0.02)  # 2% return
} # }