jill/src/main/java/io/github/agentsoz/jill/core/beliefbase/BeliefBase.java
public static void main(String[] args) throws BeliefBaseException {
    // Configure logging
    Log.createLogger("", Level.INFO, "BeliefBase.log");
    // BeliefBase bb = new H2BeliefBase("jdbc:h2:mem:agents;CACHE_SIZE=1048576");

    String bs1 = "neighbour";
    String bs2 = "hascar";

    long t0;
    long t1;

    int numAgents = 10000;
    int numNeighbours = 1000;
    BeliefBase bb = new ABeliefStore(numAgents, 4);
    Log.info("Initialising " + numAgents + " agents with " + numNeighbours + " beliefs each");
    BeliefSetField[] fields1 = {new BeliefSetField("name", String.class, true),
        new BeliefSetField("gender", String.class, false),};
    BeliefSetField[] fields2 = {new BeliefSetField("name", String.class, true),
        new BeliefSetField("car", Boolean.class, false),};

    long t2 = System.currentTimeMillis();
    for (int i = 0; i < numAgents; i++) {
      t0 = System.currentTimeMillis();
      bb.createBeliefSet(i, bs1, fields1);
      t1 = System.currentTimeMillis();
      Log.debug("Created belief set '" + bs1 + "' " + Log.formattedDuration(t0, t1));
      t0 = System.currentTimeMillis();
      for (int j = 0; j < numNeighbours; j++) {
        bb.addBelief(i, bs1, "agent" + j, ((j % 2) == 0) ? "male" : "female");
      }
      t1 = System.currentTimeMillis();
      Log.debug("Agent " + i + " added " + numNeighbours + " beliefs to belief set '" + bs1 + "' ("
          + (t1 - t0) + " ms)");
    }
    long t3 = System.currentTimeMillis();
    Log.info("Finished initialising " + numAgents + " agents with " + numNeighbours
        + " beliefs each for belief set '" + bs1 + "' " + Log.formattedDuration(t2, t3));

    t2 = System.currentTimeMillis();
    for (int i = 0; i < numAgents; i++) {
      t0 = System.currentTimeMillis();
      bb.createBeliefSet(i, bs2, fields2);
      t1 = System.currentTimeMillis();
      Log.debug("Created belief set '" + bs2 + "' " + Log.formattedDuration(t0, t1));
      t0 = System.currentTimeMillis();
      for (int j = 0; j < numNeighbours; j++) {
        bb.addBelief(i, bs2, "agent" + j, ((j % 2) == 0) ? true : false);
      }
      t1 = System.currentTimeMillis();
      Log.debug("Agent " + i + " added " + numNeighbours + " beliefs to belief set '" + bs2 + "' ("
          + (t1 - t0) + " ms)");
    }
    t3 = System.currentTimeMillis();
    Log.info("Finished initialising " + numAgents + " agents with " + numNeighbours
        + " beliefs each for belief set '" + bs2 + "' " + Log.formattedDuration(t2, t3));


    final String opstr = ".name=agent";
    int agentId = 0;
    int neighbourId = 0;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = 0;
    neighbourId = numNeighbours - 1;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = numAgents - 1;
    neighbourId = numNeighbours - 1;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = 0;
    neighbourId = 0;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = 0;
    neighbourId = numNeighbours - 1;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = numAgents - 1;
    neighbourId = numNeighbours - 1;
    doEval(bb, agentId, bs1 + opstr + neighbourId);
  }
public static void main(String[] args) throws BeliefBaseException {
    // Configure logging
    Log.createLogger("", Level.INFO, "BeliefBase.log");
    // BeliefBase bb = new H2BeliefBase("jdbc:h2:mem:agents;CACHE_SIZE=1048576");

    String bs1 = "neighbour";
    String bs2 = "hascar";

    long t0;
    long t1;

    int numAgents = 10000;
    int numNeighbours = 1000;
    BeliefBase bb = new ABeliefStore(numAgents, 4);
    Log.info("Initialising " + numAgents + " agents with " + numNeighbours + " beliefs each");
    BeliefSetField[] fields1 = {new BeliefSetField("name", String.class, true),
        new BeliefSetField("gender", String.class, false),};
    BeliefSetField[] fields2 = {new BeliefSetField("name", String.class, true),
        new BeliefSetField("car", Boolean.class, false),};

    long t2 = System.currentTimeMillis();
    for (int i = 0; i < numAgents; i++) {
      t0 = System.currentTimeMillis();
      bb.createBeliefSet(i, bs1, fields1);
      t1 = System.currentTimeMillis();
      Log.debug("Created belief set '" + bs1 + "' " + Log.formattedDuration(t0, t1));
      t0 = System.currentTimeMillis();
      for (int j = 0; j < numNeighbours; j++) {
        bb.addBelief(i, bs1, "agent" + j, ((j % 2) == 0) ? "male" : "female");
      }
      t1 = System.currentTimeMillis();
      Log.debug("Agent " + i + " added " + numNeighbours + " beliefs to belief set '" + bs1 + "' ("
          + (t1 - t0) + " ms)");
    }
    long t3 = System.currentTimeMillis();
    Log.info("Finished initialising " + numAgents + " agents with " + numNeighbours
        + " beliefs each for belief set '" + bs1 + "' " + Log.formattedDuration(t2, t3));

    t2 = System.currentTimeMillis();
    for (int i = 0; i < numAgents; i++) {
      t0 = System.currentTimeMillis();
      bb.createBeliefSet(i, bs2, fields2);
      t1 = System.currentTimeMillis();
      Log.debug("Created belief set '" + bs2 + "' " + Log.formattedDuration(t0, t1));
      t0 = System.currentTimeMillis();
      for (int j = 0; j < numNeighbours; j++) {
        bb.addBelief(i, bs2, "agent" + j, ((j % 2) == 0) ? true : false);
      }
      t1 = System.currentTimeMillis();
      Log.debug("Agent " + i + " added " + numNeighbours + " beliefs to belief set '" + bs2 + "' ("
          + (t1 - t0) + " ms)");
    }
    t3 = System.currentTimeMillis();
    Log.info("Finished initialising " + numAgents + " agents with " + numNeighbours
        + " beliefs each for belief set '" + bs2 + "' " + Log.formattedDuration(t2, t3));


    final String opstr = ".name=agent";
    int agentId = 0;
    int neighbourId = 0;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = 0;
    neighbourId = numNeighbours - 1;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = numAgents - 1;
    neighbourId = numNeighbours - 1;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = 0;
    neighbourId = 0;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = 0;
    neighbourId = numNeighbours - 1;
    doEval(bb, agentId, bs1 + opstr + neighbourId);

    agentId = numAgents - 1;
    neighbourId = numNeighbours - 1;
    doEval(bb, agentId, bs1 + opstr + neighbourId);
  }
Sample program to test belief base evaluation speeds.

@param args command line arguments
@throws BeliefBaseException on belief base update or evaluation errors