agentjs-core
Version:
A comprehensive agent-based modeling framework with built-in p5.js visualization
108 lines • 2.94 kB
TypeScript
import { MLBehaviorModel, MLAgentState, AgentAction } from '../interfaces';
/**
* Generic network formation ML model for social connections
* Works for friendship networks, collaboration networks, or any social structure
*/
export declare class NetworkFormationModel implements MLBehaviorModel {
private model?;
private inputFeatures;
private outputActions;
private isLoaded;
private homophilyStrength;
private proximityWeight;
private popularityBias;
constructor();
predict(state: MLAgentState): Promise<AgentAction>;
/**
* ML-based prediction
*/
private predictWithML;
/**
* Rule-based network formation prediction
*/
private predictWithRules;
/**
* Find potential agents to connect with
*/
private findConnectionCandidates;
/**
* Get current connections of the agent
*/
private getCurrentConnections;
/**
* Get maximum number of connections this agent can maintain
*/
private getMaxConnections;
/**
* Evaluate a potential connection candidate
*/
private evaluateConnectionCandidate;
/**
* Calculate similarity between two agents
*/
private calculateSimilarity;
/**
* Count mutual connections between two agents
*/
private countMutualConnections;
/**
* Create connection action
*/
private createConnectionAction;
/**
* Create disconnection action
*/
private createDisconnectionAction;
/**
* Create maintenance action for existing connections
*/
private createMaintenanceAction;
/**
* Create no-action response
*/
private createNoActionResponse;
/**
* Determine type of connection to form
*/
private determineConnectionType;
/**
* Evaluate candidates using ML model
*/
private evaluateCandidatesWithML;
/**
* Create network action from ML evaluation
*/
private createNetworkAction;
/**
* Encode agent state and candidate for ML model
*/
private encodeNetworkState;
load(modelPath: string): Promise<void>;
getRequiredInputs(): string[];
getOutputActions(): string[];
dispose(): void;
/**
* Configure network formation parameters
*/
configure(options: {
homophilyStrength?: number;
proximityWeight?: number;
popularityBias?: number;
}): void;
/**
* Generate training data for network formation model
*/
generateTrainingData(scenarios: Array<{
agentCount: number;
networkDensity: 'sparse' | 'medium' | 'dense';
homophilyLevel: 'low' | 'medium' | 'high';
}>, stepsPerScenario?: number): Array<{
input: number[];
output: number[];
}>;
/**
* Generate mock network state for training
*/
private generateMockNetworkState;
}
//# sourceMappingURL=NetworkFormationModel.d.ts.map