#!/usr/bin/perl
#
# Bandit 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 = 1000;

# Make the arg list, currently this is passed into the
# FarmDriver To see what the FarmDriver supports, look for
# calls to getCommandLineArgument in its source code.
$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.bandit.plugins.BanditMetAgent $PLUGARGS -name MA$i -realtime false -msgmintime 0 -msgmaxtime 0 -msgbytetime 0 -msglossrate 0 2> MA$i.log"} = "$FARM_DIR/bandit";
}

# 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 -delta 1 2> fathertime.log" => "$FARM_DIR/generic",
	"farm.bandit.plugins.BanditDriver $PLUGARGS $ARGS -metagents $NUM_AGENTS 2> driver.log" => "$FARM_DIR/bandit",
	"farm.bandit.plugins.BanditAnalysis $PLUGARGS 2> analysis.log" => "$FARM_DIR/bandit",
#	"farm.generic.plugins.PropertyLog $PLUGARGS -log \"AverageReward,PercentOptimal\" -o ../bandit/values.log 2> property.log" => "$FARM_DIR/generic",
);

# Locally run plugins
%LOCALPLUGINS = (
	"farm.generic.plugins.gui.GraphGui $PLUGARGS -timegranularity 1 -track \"AverageReward,PercentOptimal\" 2> graph.log" => "$FARM_DIR/generic",
);

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

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

run();
