AgentJS agent-based modelling in the browser

Settings

ConfigurationManager holds a model's settings: numbers with limits, presets, and a JSON form you can save and load. It does not build a simulation from them.

That is the part to be clear about. The settings are a checked bag of values (how many agents to start with, the width of the space, whether trails are drawn). Your code reads them and builds the model. Nothing in the library turns a settings file into agents.

import { ConfigurationManager } from '@prayas_abhinav/agentjs-core';

const config = new ConfigurationManager();
config.on('config:validation-error', (message) => console.log('refused:', message));

config.setParameter('agents.initialCount', 80);             // true: it is a number from 1 to 1000
config.setParameter('agents.initialCount', 5000);           // false: out of range, and 'config:validation-error' is emitted
config.updateConfig({ environment: { width: 1000 } });      // merge a partial configuration

console.log(config.getParameter('agents.initialCount'), config.getParameter('environment.width'));
console.log(config.getAvailablePresets());                  // [ 'educational', 'performance', 'research' ]
config.loadPreset('research');

const saved = config.exportConfig('json');                  // a JSON string
const again = new ConfigurationManager();
again.importConfig(saved, 'json');                          // true when the string is valid
console.log(again.getParameter('agents.initialCount') === config.getParameter('agents.initialCount'));

What it provides

NSMnum rows have their own JSON form, read by tableFromJSON; the README describes it.