#!/usr/bin/perl
#
# Graph coloring scenario running script
# Bryan Horling - Jun 2004
# ##################################################################

# ###
# The include file below contains a number of utility functions
# and default variable settings.  If you wish to change these
# (for example, to change the remote machines used to run the
# plugins), you should edit that file.  Other parameters, such
# as the actual plugins and the parameters they use, should
# be changed in this file below.
# ###
require "../lib/runfunctions.pl";

# How long should it run for? (0 = forever)
$END = 10000;

# Make the arg list, currently this is passed into the driver
$ARGS = join(" ", @ARGV);

# The Metagents.  Adjust NUM_AGENTS to control how many metagents are
# spawned, and the AGENTS assignment line to control which metagent
# is used.  The format is $AGENTS{"<java arguments>"} = "<run path>";
$NUM_AGENTS = 1;
for ($i = 0; $i < $NUM_AGENTS; $i++) {
	$AGENTS{"farm.graphcolor.plugins.GraphColorMetAgent $PLUGARGS -name MA$i -msgmintime 0 -msgmaxtime 0 -msgbytetime 0 -msglossrate 0 2> MA$i.log"} = "$FARM_DIR/graphcolor";
}

# The Plugins.  Add new plugins to this list as needed.  The format
# is roughly the same as the agents above.
%PLUGINS = (
	"farm.generic.plugins.drivers.TimeDriver $PLUGARGS -gui -end $END 2> fathertime.log" => "$FARM_DIR/generic",
#	"farm.generic.plugins.gui.GraphGui $PLUGARGS -track \"TotalMessagesReceived,TotalLinks,TotalConflicts\" 2> graph.log" => "$FARM_DIR/generic",
	"farm.graphcolor.plugins.drivers.GraphColorDriver $PLUGARGS $ARGS -metagents $NUM_AGENTS" => "$FARM_DIR/graphcolor",
        "farm.graphcolor.plugins.GraphColorAnalysis $PLUGARGS" => "$FARM_DIR/graphcolor",
#	"farm.generic.plugins.drivers.StopDriver $PLUGARGS 2> stop.log" => "$FARM_DIR/generic",
#        "farm.graphcolor.plugins.display.GraphDisplay $PLUGARGS 2> display.log" => "$FARM_DIR/graphcolor",
#	"farm.generic.plugins.PropertyLog $PLUGARGS -log \"TotalConflicts,satisfiable,TotalMessagesReceived,TotalLinks\" -o ../graphcolor/colors.log 2> property.log" => "$FARM_DIR/generic",
);

# Simulator.  This is used to spawn the simulator.
$NUM_PLUGINS = $NUM_AGENTS + keys(%PLUGINS);
%SIMULATORS = (
#	"farm.simulator.FarmSimulator -m $NUM_PLUGINS -s simulator.sav 2> simulator.log" => "$FARM_DIR/simulator"
	"farm.simulator.FarmSimulator -m $NUM_PLUGINS $PROPOWNERS 2> simulator.log" => "$FARM_DIR/simulator"
);

###################################################################
# You shouldn't need to change anything below this line
###################################################################

run();
