public static void RunProportionExperiment(Excel.Application app, Excel.Workbook wbh, int nboots, double significance, double threshold, UserSimulation.Classification c, Random r, String outfile, long max_duration_in_ms, String logfile, ProgBar pb, bool ignore_parse_errors)
{
pb.setMax(5);
// record intitial state of spreadsheet
var prepdata = Prep.PrepSimulation(app, wbh, pb, ignore_parse_errors);
// init error generator
var eg = new ErrorGenerator();
// get inputs as an array of addresses to facilitate random selection
// DATA INPUTS ONLY
AST.Address[] inputs = prepdata.dag.terminalInputCells();
// sanity check: all of the inputs should also be in prepdata.original_inputs
foreach (AST.Address addr in inputs)
{
if (!prepdata.original_inputs.ContainsKey(addr))
{
throw new Exception("Missing address!");
}
}
for (int i = 0; i < 100; i++)
{
// randomly choose an input address
AST.Address rand_addr = inputs[r.Next(inputs.Length)];
// get the value
String input_value = prepdata.original_inputs[rand_addr];
// perturb it
String erroneous_input = eg.GenerateErrorString(input_value, c);
// create an error dictionary with this one perturbed value
var errors = new CellDict();
errors.Add(rand_addr, erroneous_input);
// run simulations; simulation code does insertion of errors and restore of originals
RunSimulation(app, wbh, nboots, significance, threshold, c, r, outfile, max_duration_in_ms, logfile, pb, prepdata, errors);
}
}