def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment", required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)
    parser.add_argument("--filename", help="path to file for export", required=True)


    args = parser.parse_args()

    simconfig = utils.TreeStructuredConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)

    #### main program ####

    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
Exemplo n.º 2
0
def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment", required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)
    parser.add_argument("--parallelism", help="Number of concurrent processes to run", default="4")
    parser.add_argument("--diagram", help="Draw a diagram when complete", default=False)

    args = parser.parse_args()

    simconfig = utils.AxelrodExtensibleConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
Exemplo n.º 3
0
def setup():
    global args, config, simconfig
    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", required=True, help="provide name for experiment, to be used as prefix for database collections")
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--finalized", help="Only export runs which finalized after convergence", action="store_true")
    parser.add_argument("--action", choices=["sample", "single", "bulk"])
    parser.add_argument("--ssize", help="Sample size of graphs to export", default="100")
    parser.add_argument("--id", help="Export trait graphs with this object id")
    parser.add_argument("--idfile", help="Export trait graphs for ids in file")
    parser.add_argument("--directory", help="Directory to which DOT files are written")

    args = parser.parse_args()


    if int(args.debug) == 1:
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')


    #### main program ####
    log.info("EXPORT TRAIT GRAPHS AS DOT - Experiment: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
def setup():
    global args, config, simconfig
    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", required=True, help="provide name for experiment, to be used as prefix for database collections")
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--dryrun", help="Do the calculations but do not change the database (handiest with --debug 1 to see the results", action="store_true")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)

    args = parser.parse_args()

    simconfig = utils.TreeStructuredConfiguration(args.configuration)


    if int(args.debug) == 1:
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')


    #### main program ####
    log.info("CALCULATING GRAPH SYMMETRY STATS - Experiment: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
Exemplo n.º 5
0
def setup():
    global args, config, simconfig
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--experiment",
        help=
        "provide name for experiment, to be used as prefix for database collections"
    )
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost",
                        help="database hostname, defaults to localhost",
                        default="localhost")
    parser.add_argument("--dbport",
                        help="database port, defaults to 27017",
                        default="27017")
    parser.add_argument("--configuration", help="Path to configuration file")
    parser.add_argument("--model",
                        choices=['axelrod', 'extensible', 'treestructured'],
                        required=True)
    parser.add_argument(
        "--finalized",
        help="Only export runs which finalized after convergence",
        action="store_true")
    parser.add_argument("--filename",
                        help="path to file for export",
                        required=True)

    args = parser.parse_args()

    simconfig = utils.TreeStructuredConfiguration(args.configuration)

    if args.model == 'axelrod':
        simconfig = utils.AxelrodConfiguration(args.configuration)
    elif args.model == 'extensible':
        simconfig = utils.AxelrodExtensibleConfiguration(args.configuration)
    elif args.model == 'treestructured':
        simconfig = utils.TreeStructuredConfiguration(args.configuration)
    else:
        log.error("This shouldn't happen - args.model = %s", args.model)

    if args.debug == 1:
        log.basicConfig(level=log.DEBUG,
                        format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO,
                        format='%(asctime)s %(levelname)s: %(message)s')

    #### main program ####
    log.info("EXPORT DATA TO CSV - Experiment: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
Exemplo n.º 6
0
def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment", required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)
    parser.add_argument("--popsize", help="Population size", required=True)
    parser.add_argument("--maxinittraits", help="Max initial number of traits per indiv", required=True)
    parser.add_argument("--additionrate", help="Rate at which traits are added during interactions", required=True)
    parser.add_argument("--maxtraitvalue", help="Maximum integer token for traits in the trait space", required=True)
    parser.add_argument("--periodic", help="Periodic boundary condition", choices=['1','0'], required=True)
    parser.add_argument("--diagram", help="Draw a diagram of the converged model", action="store_true")
    parser.add_argument("--drift_rate", help="Rate of drift")


    args = parser.parse_args()

    simconfig = utils.AxelrodExtensibleConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)

    if args.drift_rate:
        simconfig.drift_rate = float(args.drift_rate)

    simconfig.popsize = int(args.popsize)
    simconfig.maxtraits = int(args.maxinittraits)
    simconfig.add_rate = float(args.additionrate)
    simconfig.max_trait_value = int(args.maxtraitvalue)

    simconfig.sim_id = uuid.uuid4().urn
    if args.periodic == '1':
        simconfig.periodic = 1
    elif args.periodic == '0':
        simconfig.periodic = 0
def setup():
    global args, config, simconfig
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--experiment",
        required=True,
        help=
        "provide name for experiment, to be used as prefix for database collections"
    )
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost",
                        help="database hostname, defaults to localhost",
                        default="localhost")
    parser.add_argument("--dbport",
                        help="database port, defaults to 27017",
                        default="27017")
    parser.add_argument(
        "--dryrun",
        help=
        "Do the calculations but do not change the database (handiest with --debug 1 to see the results",
        action="store_true")
    parser.add_argument("--configuration",
                        help="Configuration file for experiment",
                        required=True)

    args = parser.parse_args()

    simconfig = utils.TreeStructuredConfiguration(args.configuration)

    if int(args.debug) == 1:
        log.basicConfig(level=log.DEBUG,
                        format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO,
                        format='%(asctime)s %(levelname)s: %(message)s')

    #### main program ####
    log.info("CALCULATING GRAPH SYMMETRY STATS - Experiment: %s",
             args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
Exemplo n.º 8
0
def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment",
                        help="provide name for experiment",
                        required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost",
                        help="database hostname, defaults to localhost",
                        default="localhost")
    parser.add_argument("--dbport",
                        help="database port, defaults to 27017",
                        default="27017")
    parser.add_argument("--configuration",
                        help="Configuration file for experiment",
                        required=True)
    parser.add_argument("--parallelism",
                        help="Number of concurrent processes to run",
                        default="4")
    parser.add_argument("--diagram",
                        help="Draw a diagram when complete",
                        default=False)

    args = parser.parse_args()

    simconfig = utils.AxelrodExtensibleConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG,
                        format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO,
                        format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
Exemplo n.º 9
0
def setup():
    global args, config, simconfig
    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment, to be used as prefix for database collections")
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--configuration", help="Path to configuration file")
    parser.add_argument("--model", choices=['axelrod', 'extensible', 'treestructured'], required=True)
    parser.add_argument("--finalized", help="Only export runs which finalized after convergence", action="store_true")
    parser.add_argument("--filename", help="path to file for export", required=True)

    args = parser.parse_args()

    simconfig = utils.TreeStructuredConfiguration(args.configuration)

    if args.model == 'axelrod':
        simconfig = utils.AxelrodConfiguration(args.configuration)
    elif args.model == 'extensible':
        simconfig = utils.AxelrodExtensibleConfiguration(args.configuration)
    elif args.model == 'treestructured':
        simconfig = utils.TreeStructuredConfiguration(args.configuration)
    else:
        log.error("This shouldn't happen - args.model = %s", args.model)

    if args.debug == 1:
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')


    #### main program ####
    log.info("EXPORT DATA TO CSV - Experiment: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)
def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment", help="provide name for experiment", required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost", help="database hostname, defaults to localhost", default="localhost")
    parser.add_argument("--dbport", help="database port, defaults to 27017", default="27017")
    parser.add_argument("--configuration", help="Configuration file for experiment", required=True)
    parser.add_argument("--popsize", help="Population size", required=True)
    parser.add_argument("--maxinittraits", help="Max initial number of traits per indiv", required=True)
    parser.add_argument("--learningrate", help="Rate at which traits are learned during interactions", required=True)
    parser.add_argument("--lossrate", help="Rate at which traits are lost randomly by individuals (0.0 turns this off)", required=True)
    parser.add_argument("--innovrate", help="Rate at which innovations occur in population", required=True)
    parser.add_argument("--periodic", help="Periodic boundary condition", choices=['1','0'], required=True)
    parser.add_argument("--diagram", help="Draw a diagram of the converged model", action="store_true")
    parser.add_argument("--swrewiring", help="Rewiring probability for Watts-Strogatz population graph", required=False)
    parser.add_argument("--numtraittrees", help="Number of trait trees in the design space", required=True)
    parser.add_argument("--branchingfactor", help="Value or mean for tree branching factor", required=True)
    parser.add_argument("--depthfactor", help="Value or mean for tree depth factor", required=True)
    parser.add_argument("--savetraitgraphs", help="Saves a snapshot of trait tree graphs", action="store_true")
    parser.add_argument("--samplinginterval", help="Interval between samples, once sampling begins, defaults to 1M steps", default="1000000")
    parser.add_argument("--samplingstarttime", help="Time at which sampling begins, defaults to 1M steps", default="6000000")
    parser.add_argument("--simulationendtime", help="Time at which simulation and sampling end, defaults to 10000000 steps", default="10000000")

    args = parser.parse_args()

    simconfig = utils.TreeStructuredConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO, format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)

    if args.swrewiring:
        simconfig.ws_rewiring = float(args.swrewiring)

    simconfig.popsize = int(args.popsize)
    simconfig.maxtraits = int(args.maxinittraits)
    simconfig.learning_rate = float(args.learningrate)
    simconfig.num_trees = int(args.numtraittrees)
    simconfig.branching_factor = float(args.branchingfactor)
    simconfig.depth_factor = float(args.depthfactor)
    simconfig.loss_rate = float(args.lossrate)
    simconfig.innov_rate = float(args.innovrate)
    simconfig.maxtime = int(args.simulationendtime)
    simconfig.script = __file__
    simconfig.save_graphs = args.savetraitgraphs

    simconfig.sim_id = uuid.uuid4().urn
    if args.periodic == '1':
        simconfig.periodic = 1
    else:
        simconfig.periodic = 0
Exemplo n.º 11
0
def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment",
                        help="provide name for experiment",
                        required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost",
                        help="database hostname, defaults to localhost",
                        default="localhost")
    parser.add_argument("--dbport",
                        help="database port, defaults to 27017",
                        default="27017")
    parser.add_argument("--configuration",
                        help="Configuration file for experiment",
                        required=True)
    parser.add_argument("--popsize", help="Population size", required=True)
    parser.add_argument("--maxinittraits",
                        help="Max initial number of traits per indiv",
                        required=True)
    parser.add_argument(
        "--learningrate",
        help="Rate at which traits are learned during interactions",
        required=True)
    parser.add_argument(
        "--lossrate",
        help=
        "Rate at which traits are lost randomly by individuals (0.0 turns this off)",
        required=True)
    parser.add_argument("--innovrate",
                        help="Rate at which innovations occur in population",
                        required=True)
    parser.add_argument("--periodic",
                        help="Periodic boundary condition",
                        choices=['1', '0'],
                        required=True)
    parser.add_argument("--diagram",
                        help="Draw a diagram of the converged model",
                        action="store_true")
    parser.add_argument(
        "--swrewiring",
        help="Rewiring probability for Watts-Strogatz population graph",
        required=False)
    parser.add_argument("--numtraittrees",
                        help="Number of trait trees in the design space",
                        required=True)
    parser.add_argument("--branchingfactor",
                        help="Value or mean for tree branching factor",
                        required=True)
    parser.add_argument("--depthfactor",
                        help="Value or mean for tree depth factor",
                        required=True)
    parser.add_argument("--savetraitgraphs",
                        help="Saves a snapshot of trait tree graphs",
                        action="store_true")
    parser.add_argument(
        "--samplinginterval",
        help=
        "Interval between samples, once sampling begins, defaults to 250K steps",
        default="250000")
    parser.add_argument(
        "--samplingstarttime",
        help="Time at which sampling begins, defaults to 1000000 steps",
        default="1000000")

    args = parser.parse_args()

    simconfig = utils.TreeStructuredConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG,
                        format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO,
                        format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)

    if args.swrewiring:
        simconfig.ws_rewiring = float(args.swrewiring)

    simconfig.popsize = int(args.popsize)
    simconfig.maxtraits = int(args.maxinittraits)
    simconfig.learning_rate = float(args.learningrate)
    simconfig.num_trees = int(args.numtraittrees)
    simconfig.branching_factor = float(args.branchingfactor)
    simconfig.depth_factor = float(args.depthfactor)
    simconfig.loss_rate = float(args.lossrate)
    simconfig.innov_rate = float(args.innovrate)
    simconfig.maxtime = simconfig.SIMULATION_CUTOFF_TIME
    simconfig.script = __file__
    simconfig.save_graphs = args.savetraitgraphs

    simconfig.sim_id = uuid.uuid4().urn
    if args.periodic == '1':
        simconfig.periodic = 1
    else:
        simconfig.periodic = 0
Exemplo n.º 12
0
def setup():
    global args, simconfig

    parser = argparse.ArgumentParser()
    parser.add_argument("--experiment",
                        help="provide name for experiment",
                        required=True)
    parser.add_argument("--debug", help="turn on debugging output")
    parser.add_argument("--dbhost",
                        help="database hostname, defaults to localhost",
                        default="localhost")
    parser.add_argument("--dbport",
                        help="database port, defaults to 27017",
                        default="27017")
    parser.add_argument("--configuration",
                        help="Configuration file for experiment",
                        required=True)
    parser.add_argument("--popsize", help="Population size", required=True)
    parser.add_argument("--maxinittraits",
                        help="Max initial number of traits per indiv",
                        required=True)
    parser.add_argument(
        "--additionrate",
        help="Rate at which traits are added during interactions",
        required=True)
    parser.add_argument(
        "--maxtraitvalue",
        help="Maximum integer token for traits in the trait space",
        required=True)
    parser.add_argument("--periodic",
                        help="Periodic boundary condition",
                        choices=['1', '0'],
                        required=True)
    parser.add_argument("--diagram",
                        help="Draw a diagram of the converged model",
                        action="store_true")
    parser.add_argument("--drift_rate", help="Rate of drift")

    args = parser.parse_args()

    simconfig = utils.AxelrodExtensibleConfiguration(args.configuration)

    if args.debug == '1':
        log.basicConfig(level=log.DEBUG,
                        format='%(asctime)s %(levelname)s: %(message)s')
    else:
        log.basicConfig(level=log.INFO,
                        format='%(asctime)s %(levelname)s: %(message)s')

    log.debug("experiment name: %s", args.experiment)
    data.set_experiment_name(args.experiment)
    data.set_database_hostname(args.dbhost)
    data.set_database_port(args.dbport)
    config = data.getMingConfiguration(data.modules)
    ming.configure(**config)

    if args.drift_rate:
        simconfig.drift_rate = float(args.drift_rate)

    simconfig.popsize = int(args.popsize)
    simconfig.maxtraits = int(args.maxinittraits)
    simconfig.add_rate = float(args.additionrate)
    simconfig.max_trait_value = int(args.maxtraitvalue)

    simconfig.sim_id = uuid.uuid4().urn
    if args.periodic == '1':
        simconfig.periodic = 1
    elif args.periodic == '0':
        simconfig.periodic = 0