Example #1
0
        public static void RunSimulation(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, PrepData prepdata, CellDict errors)
        {
            // write header if needed
            if (!System.IO.File.Exists(outfile))
            {
                System.IO.File.AppendAllText(outfile, Simulation.HeaderRowForCSV());
            }

            // CheckCell weighted, all outputs, quantile
            //var s_1 = new UserSimulation.Simulation();
            //s_1.RunFromBatch(nboots,                                   // number of bootstraps
            //                    wbh.FullName,                          // Excel filename
            //                    significance,                          // statistical significance threshold for hypothesis test
            //                    app,                                   // Excel.Application
            //                    new QuantileCutoff(0.05),              // max % extreme values to flag
            //                    c,                                     // classification data
            //                    r,                                     // random number generator
            //                    UserSimulation.AnalysisType.CheckCell5,// analysis type
            //                    true,                                  // weighted analysis
            //                    true,                                  // use all outputs for analysis
            //                    prepdata.graph,                                 // AnalysisData
            //                    wbh,                                   // Excel.Workbook
            //                    errors,                                // pre-generated errors
            //                    prepdata.terminal_input_nodes,                  // input range nodes
            //                    prepdata.terminal_formula_nodes,                // output nodes
            //                    prepdata.original_inputs,                       // original input values
            //                    prepdata.correct_outputs,                       // original output values
            //                    max_duration_in_ms,                    // max duration of simulation
            //                    logfile);
            //System.IO.File.AppendAllText(outfile, s_1.FormatResultsAsCSV());
            pb.IncrementProgress();

            // CheckCell weighted, all outputs, quantile
            var s_4 = new UserSimulation.Simulation();

            s_4.RunFromBatch(nboots,                                   // number of bootstraps
                             wbh.FullName,                             // Excel filename
                             significance,                             // statistical significance of threshold
                             app,                                      // Excel.Application
                             new QuantileCutoff(0.10),                 // max % extreme values to flag
                             c,                                        // classification data
                             r,                                        // random number generator
                             UserSimulation.AnalysisType.CheckCell10,  // analysis type
                             true,                                     // weighted analysis
                             true,                                     // use all outputs for analysis
                             prepdata.dag,                             // AnalysisData
                             wbh,                                      // Excel.Workbook
                             errors,                                   // pre-generated errors
                             prepdata.terminal_input_nodes,            // input range nodes
                             prepdata.terminal_formula_nodes,          // output nodes
                             prepdata.original_inputs,                 // original input values
                             prepdata.correct_outputs,                 // original output values
                             max_duration_in_ms,                       // max duration of simulation
                             logfile);
            System.IO.File.AppendAllText(outfile, s_4.FormatResultsAsCSV());
            pb.IncrementProgress();

            // Normal, all inputs
            var s_2 = new UserSimulation.Simulation();

            s_2.RunFromBatch(nboots,                                      // irrelevant
                             wbh.FullName,                                // Excel filename
                             significance,                                // normal cutoff?
                             app,                                         // Excel.Application
                             new NormalCutoff(threshold),                 // ??
                             c,                                           // classification data
                             r,                                           // random number generator
                             UserSimulation.AnalysisType.NormalAllInputs, // analysis type
                             true,                                        // irrelevant
                             true,                                        // irrelevant
                             prepdata.dag,                                // AnalysisData
                             wbh,                                         // Excel.Workbook
                             errors,                                      // pre-generated errors
                             prepdata.terminal_input_nodes,               // input range nodes
                             prepdata.terminal_formula_nodes,             // output nodes
                             prepdata.original_inputs,                    // original input values
                             prepdata.correct_outputs,                    // original output values
                             max_duration_in_ms,                          // max duration of simulation
                             logfile);
            System.IO.File.AppendAllText(outfile, s_2.FormatResultsAsCSV());
            pb.IncrementProgress();

            // Normal, range inputs
            //var s_3 = new UserSimulation.Simulation();
            //s_3.RunFromBatch(nboots,                                   // irrelevant
            //                    wbh.FullName,                              // Excel filename
            //                    significance,                          // normal cutoff?
            //                    app,                                   // Excel.Application
            //                    new NormalCutoff(threshold),           // ??
            //                    c,                                     // classification data
            //                    r,                                     // random number generator
            //                    UserSimulation.AnalysisType.NormalPerRange,   // analysis type
            //                    true,                                  // irrelevant
            //                    true,                                  // irrelevant
            //                    prepdata.graph,                                 // AnalysisData
            //                    wbh,                                   // Excel.Workbook
            //                    errors,                                // pre-generated errors
            //                    prepdata.terminal_input_nodes,                  // input range nodes
            //                    prepdata.terminal_formula_nodes,                // output nodes
            //                    prepdata.original_inputs,                       // original input values
            //                    prepdata.correct_outputs,                       // original output values
            //                    max_duration_in_ms,                    // max duration of simulation
            //                    logfile);
            //System.IO.File.AppendAllText(outfile, s_3.FormatResultsAsCSV());
            pb.IncrementProgress();
        }
Example #2
0
        public static void RunSimulation(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, PrepData prepdata, CellDict errors)
        {
            // write header if needed
            if (!System.IO.File.Exists(outfile))
            {
                System.IO.File.AppendAllText(outfile, Simulation.HeaderRowForCSV());
            }

            // CheckCell weighted, all outputs, quantile
            //var s_1 = new UserSimulation.Simulation();
            //s_1.RunFromBatch(nboots,                                   // number of bootstraps
            //                    wbh.FullName,                          // Excel filename
            //                    significance,                          // statistical significance threshold for hypothesis test
            //                    app,                                   // Excel.Application
            //                    new QuantileCutoff(0.05),              // max % extreme values to flag
            //                    c,                                     // classification data
            //                    r,                                     // random number generator
            //                    UserSimulation.AnalysisType.CheckCell5,// analysis type
            //                    true,                                  // weighted analysis
            //                    true,                                  // use all outputs for analysis
            //                    prepdata.graph,                                 // AnalysisData
            //                    wbh,                                   // Excel.Workbook
            //                    errors,                                // pre-generated errors
            //                    prepdata.terminal_input_nodes,                  // input range nodes
            //                    prepdata.terminal_formula_nodes,                // output nodes
            //                    prepdata.original_inputs,                       // original input values
            //                    prepdata.correct_outputs,                       // original output values
            //                    max_duration_in_ms,                    // max duration of simulation
            //                    logfile);
            //System.IO.File.AppendAllText(outfile, s_1.FormatResultsAsCSV());
            pb.IncrementProgress();

            // CheckCell weighted, all outputs, quantile
            var s_4 = new UserSimulation.Simulation();
            s_4.RunFromBatch(nboots,                                   // number of bootstraps
                                wbh.FullName,                          // Excel filename
                                significance,                          // statistical significance of threshold
                                app,                                   // Excel.Application
                                new QuantileCutoff(0.10),              // max % extreme values to flag
                                c,                                     // classification data
                                r,                                     // random number generator
                                UserSimulation.AnalysisType.CheckCell10,// analysis type
                                true,                                  // weighted analysis
                                true,                                  // use all outputs for analysis
                                prepdata.dag,                                 // AnalysisData
                                wbh,                                   // Excel.Workbook
                                errors,                                // pre-generated errors
                                prepdata.terminal_input_nodes,                  // input range nodes
                                prepdata.terminal_formula_nodes,                // output nodes
                                prepdata.original_inputs,                       // original input values
                                prepdata.correct_outputs,                       // original output values
                                max_duration_in_ms,                    // max duration of simulation
                                logfile);
            System.IO.File.AppendAllText(outfile, s_4.FormatResultsAsCSV());
            pb.IncrementProgress();

            // Normal, all inputs
            var s_2 = new UserSimulation.Simulation();
            s_2.RunFromBatch(nboots,                                   // irrelevant
                                wbh.FullName,                              // Excel filename
                                significance,                          // normal cutoff?
                                app,                                   // Excel.Application
                                new NormalCutoff(threshold),           // ??
                                c,                                     // classification data
                                r,                                     // random number generator
                                UserSimulation.AnalysisType.NormalAllInputs,   // analysis type
                                true,                                  // irrelevant
                                true,                                  // irrelevant
                                prepdata.dag,                                 // AnalysisData
                                wbh,                                   // Excel.Workbook
                                errors,                                // pre-generated errors
                                prepdata.terminal_input_nodes,                  // input range nodes
                                prepdata.terminal_formula_nodes,                // output nodes
                                prepdata.original_inputs,                       // original input values
                                prepdata.correct_outputs,                       // original output values
                                max_duration_in_ms,                    // max duration of simulation
                                logfile);
            System.IO.File.AppendAllText(outfile, s_2.FormatResultsAsCSV());
            pb.IncrementProgress();

            // Normal, range inputs
            //var s_3 = new UserSimulation.Simulation();
            //s_3.RunFromBatch(nboots,                                   // irrelevant
            //                    wbh.FullName,                              // Excel filename
            //                    significance,                          // normal cutoff?
            //                    app,                                   // Excel.Application
            //                    new NormalCutoff(threshold),           // ??
            //                    c,                                     // classification data
            //                    r,                                     // random number generator
            //                    UserSimulation.AnalysisType.NormalPerRange,   // analysis type
            //                    true,                                  // irrelevant
            //                    true,                                  // irrelevant
            //                    prepdata.graph,                                 // AnalysisData
            //                    wbh,                                   // Excel.Workbook
            //                    errors,                                // pre-generated errors
            //                    prepdata.terminal_input_nodes,                  // input range nodes
            //                    prepdata.terminal_formula_nodes,                // output nodes
            //                    prepdata.original_inputs,                       // original input values
            //                    prepdata.correct_outputs,                       // original output values
            //                    max_duration_in_ms,                    // max duration of simulation
            //                    logfile);
            //System.IO.File.AppendAllText(outfile, s_3.FormatResultsAsCSV());
            pb.IncrementProgress();
        }