UNPKG

agentjs-core

Version:

A comprehensive agent-based modeling framework with built-in p5.js visualization

123 lines 3.65 kB
/** * NetworkFormation - Dynamic network formation system */ import { EventEmitter } from 'eventemitter3'; import type { Agent } from '../agents/Agent'; import type { Environment } from '../environment/Environment'; import type { AgentId } from '../../types/core'; import { NetworkManager } from './NetworkManager'; /** Network formation strategy configuration */ export interface FormationConfig { readonly proximityRadius: number; readonly similarityThreshold: number; readonly interactionMemory: number; readonly connectionProbability: { proximity: number; similarity: number; interaction: number; }; readonly connectionTypeRules: { supportiveThreshold: number; exploitativeThreshold: number; }; } /** Formation statistics */ export interface FormationStats { connectionsFormed: number; connectionsFailed: number; proximityTriggers: number; similarityTriggers: number; interactionTriggers: number; } /** * NetworkFormation - Manages dynamic network creation and evolution * * Features: * - Proximity-based connection formation * - Property similarity matching * - Interaction history tracking * - Dynamic connection type determination * - Connection lifecycle management * * Educational Context: Simulates how social networks * form naturally through physical proximity, shared * characteristics, and repeated interactions. */ export declare class NetworkFormation extends EventEmitter { /** Reference to network manager */ private readonly network; /** Formation configuration */ private config; /** Interaction history by agent */ private readonly interactionHistory; /** Properties to consider for similarity */ private similarityProperties; /** Formation statistics */ private stats; constructor(network: NetworkManager, config?: Partial<FormationConfig>); /** * Process network formation for all agents */ processFormation(agentsMap: Map<AgentId, Agent>, environment: Environment): void; /** * Process connections for a single agent */ private processAgentConnections; /** * Check for proximity-based connections */ private checkProximityConnections; /** * Check for similarity-based connections */ private checkSimilarityConnections; /** * Process interaction-based connections */ private processInteractionConnections; /** * Record an interaction between agents */ recordInteraction(source: AgentId, target: AgentId, outcome: 'positive' | 'negative' | 'neutral', strength?: number): void; /** * Calculate similarity between two agents */ private calculateSimilarity; /** * Determine connection type based on agent properties */ private determineConnectionType; /** * Determine connection type from interaction history */ private determineConnectionTypeFromHistory; /** * Clean old interaction history */ private cleanInteractionHistory; /** * Set properties to consider for similarity */ setSimilarityProperties(properties: string[]): void; /** * Get current statistics */ getStats(): FormationStats; /** * Reset statistics */ resetStats(): void; /** * Get configuration */ getConfig(): FormationConfig; /** * Update configuration */ updateConfig(newConfig: Partial<FormationConfig>): void; /** * Clear all interaction history */ clearHistory(): void; } //# sourceMappingURL=NetworkFormation.d.ts.map