jill/src/main/java/io/github/agentsoz/jill/Main.java
public static boolean init(Config config) {

    // Pause for key press from user if requested
    if (config.isDoPauseForUserInput()) {
      Program.pauseForUserInput();
    }

    // Configure logging
    Log.createLogger(Main.LOGGER_NAME, config.getLogLevel(), config.getLogFile());
    logger = LoggerFactory.getLogger(Main.LOGGER_NAME);

    int numAgents = 0;
    for (Config.AgentTypeData agentType : config.getAgents()) {
      numAgents += agentType.getCount();
    }
    final int increment = 10000;

    GlobalState.reset();
    GlobalState.agents = new AObjectCatalog("agents", numAgents, increment);


    // Create the central belief base
    GlobalState.beliefbase = new ABeliefStore(numAgents, config.getNumThreads());
    long t0;

    // Create the agents
    t0 = System.currentTimeMillis();
    for (Config.AgentTypeData agentType : config.getAgents()) {
      if (!ProgramLoader.loadAgent(agentType.getClassname(), agentType.getCount(),
          GlobalState.agents)) {
        // return unsuccessful
        return false;
      }
    }
    long t1 = System.currentTimeMillis();
    logger.info("Created " + GlobalState.agents.size() + agentsIn + Log.formattedDuration(t0, t1));

    // Initialise the thread pools
    Program.initIntentionSelectionPools(numAgents, config.getNumThreads());


    // Redirect the agent program output if specified
    if (config.getProgramOutputFile() != null) {
      try {
        writer = new PrintStream(config.getProgramOutputFile(), "UTF-8");
      } catch (FileNotFoundException | UnsupportedEncodingException e) {
        logger.error("Could not open program outout file " + config.getProgramOutputFile(), e);
      }
    } else {
      writer = System.out;
    }

    // Initialise the intention selection threads
    Program.initIntentionSelectionThreads(config);

    // return success
    return true;
  }
public static boolean init(Config config) {

    // Pause for key press from user if requested
    if (config.isDoPauseForUserInput()) {
      Program.pauseForUserInput();
    }

    // Configure logging
    Log.createLogger(Main.LOGGER_NAME, config.getLogLevel(), config.getLogFile());
    logger = LoggerFactory.getLogger(Main.LOGGER_NAME);

    int numAgents = 0;
    for (Config.AgentTypeData agentType : config.getAgents()) {
      numAgents += agentType.getCount();
    }
    final int increment = 10000;

    GlobalState.reset();
    GlobalState.agents = new AObjectCatalog("agents", numAgents, increment);


    // Create the central belief base
    GlobalState.beliefbase = new ABeliefStore(numAgents, config.getNumThreads());
    long t0;

    // Create the agents
    t0 = System.currentTimeMillis();
    for (Config.AgentTypeData agentType : config.getAgents()) {
      if (!ProgramLoader.loadAgent(agentType.getClassname(), agentType.getCount(),
          GlobalState.agents)) {
        // return unsuccessful
        return false;
      }
    }
    long t1 = System.currentTimeMillis();
    logger.info("Created " + GlobalState.agents.size() + agentsIn + Log.formattedDuration(t0, t1));

    // Initialise the thread pools
    Program.initIntentionSelectionPools(numAgents, config.getNumThreads());


    // Redirect the agent program output if specified
    if (config.getProgramOutputFile() != null) {
      try {
        writer = new PrintStream(config.getProgramOutputFile(), "UTF-8");
      } catch (FileNotFoundException | UnsupportedEncodingException e) {
        logger.error("Could not open program outout file " + config.getProgramOutputFile(), e);
      }
    } else {
      writer = System.out;
    }

    // Initialise the intention selection threads
    Program.initIntentionSelectionThreads(config);

    // return success
    return true;
  }
public static boolean init ( Config config ) { // Pause for key press from user if requested if ( config . isDoPauseForUserInput ( ) ) { Program . pauseForUserInput ( ) ; } // Configure logging Log . createLogger ( Main . LOGGER_NAME , config . getLogLevel ( ) , config . getLogFile ( ) ) ; logger = LoggerFactory . getLogger ( Main . LOGGER_NAME ) ; int numAgents = 0 ; for ( Config . AgentTypeData agentType : config . getAgents ( ) ) { numAgents += agentType . getCount ( ) ; } final int increment = 10000 ; GlobalState . reset ( ) ; GlobalState . agents = new AObjectCatalog ( "agents" , numAgents , increment ) ; // Create the central belief base GlobalState . beliefbase = new ABeliefStore ( numAgents , config . getNumThreads ( ) ) ; long t0 ; // Create the agents t0 = System . currentTimeMillis ( ) ; for ( Config . AgentTypeData agentType : config . getAgents ( ) ) { if ( ! ProgramLoader . loadAgent ( agentType . getClassname ( ) , agentType . getCount ( ) , GlobalState . agents ) ) { // return unsuccessful return false ; } } long t1 = System . currentTimeMillis ( ) ; logger . info ( "Created " + GlobalState . agents . size ( ) + agentsIn + Log . formattedDuration ( t0 , t1 ) ) ; // Initialise the thread pools Program . initIntentionSelectionPools ( numAgents , config . getNumThreads ( ) ) ; // Redirect the agent program output if specified if ( config . getProgramOutputFile ( ) != null ) { try { writer = new PrintStream ( config . getProgramOutputFile ( ) , "UTF-8" ) ; } catch ( FileNotFoundException | UnsupportedEncodingException e ) { logger . error ( "Could not open program outout file " + config . getProgramOutputFile ( ) , e ) ; } } else { writer = System . out ; } // Initialise the intention selection threads Program . initIntentionSelectionThreads ( config ) ; // return success return true ; }
Initialises the Jill engine.

@param config a valid loaded configuration
@return a boolean.
Initialises the Jill engine .