public void Run(int start_seed, int final_seed)
        {
            string save_folder = this.LogFolder;
            var    graphs      = this.MyGraphs;
            var    algos       = this.MyAlgos;
            var    dims        = this.MyDims;

            //int op_dim_size = this.DimSize;
            double sensor_weight = this.SensorWeight;


            int max = 0;

            foreach (var size in this.NetworkSizes)
            {
                foreach (var select_graph in graphs)
                {
                    for (int seed = start_seed; seed <= final_seed; seed++)
                    {
                        foreach (var algo in algos)
                        {
                            foreach (var dim in dims)
                            {
                                foreach (var target_h in this.TargetHs)
                                {
                                    foreach (var is_dynamic in this.IsDynamics)
                                    {
                                        foreach (var env_dist_mode in this.EnvDisModes)
                                        {
                                            foreach (var env_dist_weight in this.EnvDistWeights)
                                            {
                                                foreach (var mal_env_dist_weight in this.MaliciousEnvDistWeights)
                                                {
                                                    foreach (var info_weight_rate in this.InfoWeightRates)
                                                    {
                                                        foreach (var round in this.Rounds)
                                                        {
                                                            foreach (var sensor_size_rate in this.SensorSizeRates)
                                                            {
                                                                foreach (var mal_sensor_size_rate in this.MaliciousSensorSizeRates)
                                                                {
                                                                    foreach (var common_weight in this.CommonWeights)
                                                                    {
                                                                        max++;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            var pb = new ExtendProgressBar(max);

            foreach (var size in this.NetworkSizes)
            {
                GraphGeneratorBase graph_generator = new Null_GraphGenerator();

                foreach (var select_graph in graphs)
                {
                    foreach (var op_dim_size in dims)
                    {
                        foreach (var is_diynamic in this.IsDynamics)
                        {
                            foreach (var env_dist_mode in this.EnvDisModes)
                            {
                                foreach (var env_dist_weight in this.EnvDistWeights)
                                {
                                    foreach (var mal_env_dist_weight in this.MaliciousEnvDistWeights)
                                    {
                                        foreach (var info_weight_rate in this.InfoWeightRates)
                                        {
                                            foreach (var round in this.Rounds)
                                            {
                                                foreach (var sensor_size_rate in this.SensorSizeRates)
                                                {
                                                    foreach (var mal_sensor_size_rate in this.MaliciousSensorSizeRates)
                                                    {
                                                        foreach (var common_weight in this.CommonWeights)
                                                        {
                                                            for (int seed = start_seed; seed <= final_seed; seed++)
                                                            {
                                                                switch (select_graph)
                                                                {
                                                                case GraphEnum.WS:
                                                                    graph_generator = new WS_GraphGenerator().SetNodeSize(size).SetNearestNeighbors(6).SetRewireP(0.01);
                                                                    //graph_generator = new WS_GraphGenerator().SetNodeSize(size).SetNearestNeighbors(15).SetRewireP(0.1);
                                                                    break;

                                                                case GraphEnum.BA:
                                                                    graph_generator = new BA_GraphGenerator().SetNodeSize(size).SetAttachEdges(2);
                                                                    //graph_generator = new BA_GraphGenerator().SetNodeSize(size).SetAttachEdges(10);
                                                                    break;

                                                                case GraphEnum.Hexagonal:
                                                                    graph_generator = new Hexagonal_GraphGenerator().SetNodeSize(size);
                                                                    break;

                                                                case GraphEnum.Grid2D:
                                                                    graph_generator = new Grid2D_GraphGenerator().SetNodeSize(size);
                                                                    break;

                                                                case GraphEnum.Triangular:
                                                                    graph_generator = new Triangular_GraphGenerator().SetNodeSize(size);
                                                                    break;

                                                                default:
                                                                    new Exception();
                                                                    return;
                                                                }
                                                                var graph  = new RawGraph();
                                                                var layout = new Layout();

                                                                lock (lock_object)
                                                                {
                                                                    graph  = graph_generator.Generate(seed, pb);
                                                                    layout = new Circular_LayoutGenerator(graph).Generate(pb);
                                                                }

                                                                var init_belief_gene = new InitBeliefGenerator()
                                                                                       .SetInitBeliefMode(mode: InitBeliefMode.NormalNarrow);

                                                                var subject_test = new OpinionSubject(this.SubjectName, op_dim_size);

                                                                var sample_agent_test = new SampleAgent()
                                                                                        .SetInitBeliefGene(init_belief_gene)
                                                                                        .SetThreshold(this.OpinionThreshold)
                                                                                        .SetSubject(subject_test)
                                                                                        .SetInitOpinion(Vector <double> .Build.Dense(op_dim_size, 0.0));

                                                                var sensor_gene = new SensorGenerator();
                                                                if (this.SensorSizeFixMode)
                                                                {
                                                                    //you will add malicious sensor size
                                                                    sensor_gene.SetSensorSize(this.SensorSize);
                                                                }
                                                                else
                                                                {
                                                                    int sensor_size     = (int)(sensor_size_rate * graph.Nodes.Count);
                                                                    int mal_sensor_size = (int)(mal_sensor_size_rate * graph.Nodes.Count);
                                                                    sensor_gene.SetSensorSize(sensor_size, mal_sensor_size);
                                                                }

                                                                int agent_gene_seed = seed;
                                                                var agent_gene_rand = new ExtendRandom(agent_gene_seed);


                                                                var agent_network = new AgentNetwork()
                                                                                    .SetRand(agent_gene_rand)
                                                                                    .GenerateNetworkFrame(graph)
                                                                                    .ApplySampleAgent(sample_agent_test, mode: SampleAgentSetMode.RemainSet)
                                                                                    .GenerateSensor(sensor_gene)
                                                                                    .SetLayout(layout);

                                                                int update_step_seed = seed;

                                                                foreach (var algo in algos)
                                                                {
                                                                    OSMBase osm = new OSM_Only();
                                                                    foreach (var target_h in this.TargetHs)
                                                                    {
                                                                        var sample_size       = 10;
                                                                        var awa_rate_window   = 100;
                                                                        var info_value_window = 50;
                                                                        //var info_value_window = 100;
                                                                        var op_intro_interval = 10;
                                                                        var op_intro_rate     = 0.1;
                                                                        var dinamic_interval  = 25;

                                                                        var algo_extend = algo.ToString();
                                                                        switch (algo)
                                                                        {
                                                                        case AlgoEnum.OSMonly:
                                                                            var osm_only = new OSM_Only();
                                                                            osm_only.SetCommonWeight(common_weight);
                                                                            osm = osm_only;
                                                                            break;

                                                                        case AlgoEnum.AAT:
                                                                            var osm_aat = new AAT_OSM();
                                                                            osm_aat.SetTargetH(target_h);
                                                                            osm = osm_aat;
                                                                            break;

                                                                        case AlgoEnum.AATG:
                                                                            var osm_aatg = new AATG_OSM();
                                                                            osm_aatg.SetTargetH(target_h);
                                                                            osm = osm_aatg;
                                                                            break;

                                                                        case AlgoEnum.AATfix:
                                                                            var osm_aatfix = new AATfix_OSM();
                                                                            osm_aatfix.SetTargetH(target_h);
                                                                            osm = osm_aatfix;
                                                                            break;

                                                                        case AlgoEnum.IWTori:
                                                                            var osm_iwtori = new IWTori_OSM();
                                                                            osm_iwtori.SetCommonCuriocity(this.CommonCuriocity);
                                                                            osm_iwtori.SetTargetH(target_h);
                                                                            osm = osm_iwtori;
                                                                            break;

                                                                        case AlgoEnum.AATparticle:
                                                                            var osm_aatpar = new AATparticle_OSM();
                                                                            osm_aatpar.SetSampleSize(sample_size);
                                                                            osm_aatpar.SetTargetH(target_h);
                                                                            osm = osm_aatpar;
                                                                            break;

                                                                        case AlgoEnum.AATwindow:
                                                                            var osm_window = new AATwindow_OSM();
                                                                            osm_window.SetTargetH(target_h);
                                                                            osm_window.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm = osm_window;
                                                                            break;

                                                                        case AlgoEnum.AATwindowparticle:
                                                                            var osm_window_particle = new AATwindow_particle_OSM();
                                                                            osm_window_particle.SetTargetH(target_h);
                                                                            osm_window_particle.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm_window_particle.SetSampleSize(sample_size);
                                                                            osm = osm_window_particle;
                                                                            break;

                                                                        case AlgoEnum.AATfunction:
                                                                            var osm_function = new AATfunction_OSM();
                                                                            osm_function.SetTargetH(target_h);
                                                                            osm_function.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm = osm_function;
                                                                            break;

                                                                        case AlgoEnum.AATfunctioniwt:
                                                                            var osm_function_iwt = new AATfunction_iwt_OSM();
                                                                            osm_function_iwt.SetTargetH(target_h);
                                                                            osm_function_iwt.SetCommonCuriocity(this.CommonCuriocity);
                                                                            osm_function_iwt.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm = osm_function_iwt;
                                                                            break;

                                                                        case AlgoEnum.SWT:
                                                                            var osm_aat_info = new SWT_OSM();
                                                                            osm_aat_info.SetTargetH(target_h);
                                                                            osm_aat_info.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm_aat_info.SetLinkInfoValueWindowSize(info_value_window);
                                                                            osm_aat_info.SetInfoWeightRate(info_weight_rate);
                                                                            osm = osm_aat_info;
                                                                            break;

                                                                        case AlgoEnum.SWTstep:
                                                                            var osm_aat_info_step = new SWT_step_OSM();
                                                                            osm_aat_info_step.SetTargetH(target_h);
                                                                            osm_aat_info_step.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm_aat_info_step.SetLinkInfoValueWindowSize(info_value_window);
                                                                            osm_aat_info_step.SetInfoWeightRate(info_weight_rate);
                                                                            osm_aat_info_step.SetInfoLearningRate(0.2);
                                                                            osm = osm_aat_info_step;
                                                                            break;

                                                                        case AlgoEnum.GDWTsigW:
                                                                            var osm_gdwt_sigw = new GDWT_OSM();
                                                                            osm_gdwt_sigw.SetTargetH(target_h);
                                                                            osm_gdwt_sigw.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm_gdwt_sigw.SetEstimateFunction(new Sigmoid_weight_EstFunc(0.01, 0.0, 5));
                                                                            //osm_gdwt_sigw.SetEstimateFunction(new Sigmoid_weight_EstFunc(1.0, 0.0, 3));
                                                                            osm = osm_gdwt_sigw;
                                                                            break;

                                                                        case AlgoEnum.GDWTsigH:
                                                                            var osm_gdwt_sigh = new GDWT_OSM();
                                                                            osm_gdwt_sigh.SetTargetH(target_h);
                                                                            osm_gdwt_sigh.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm_gdwt_sigh.SetEstimateFunction(new Sigmoid_awa_EstFunc(0.05, 0, 20));
                                                                            osm = osm_gdwt_sigh;
                                                                            break;

                                                                        case AlgoEnum.GDWTpowerH:
                                                                            var osm_gdwt_powh = new GDWT_OSM();
                                                                            osm_gdwt_powh.SetTargetH(target_h);
                                                                            osm_gdwt_powh.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm_gdwt_powh.SetEstimateFunction(new Power_awa_EstFunc(3.0, 0));
                                                                            osm = osm_gdwt_powh;
                                                                            break;

                                                                        case AlgoEnum.GDWTpowerW:
                                                                            var osm_gdwt_poww = new GDWT_OSM();
                                                                            osm_gdwt_poww.SetTargetH(target_h);
                                                                            osm_gdwt_poww.SetAwaRateWindowSize(awa_rate_window);
                                                                            osm_gdwt_poww.SetEstimateFunction(new Power_weight_EstFunc(3.0, 0));
                                                                            osm = osm_gdwt_poww;
                                                                            break;

                                                                        default:
                                                                            break;
                                                                        }

                                                                        var update_step_rand_tmp = new ExtendRandom(update_step_seed);
                                                                        var subject_mgr_dic      = new Dictionary <int, SubjectManager>();
                                                                        if (is_diynamic)
                                                                        {
                                                                            for (int i = 0; i < 100; i++)
                                                                            {
                                                                                subject_mgr_dic.Add(i * dinamic_interval, new SubjectManagerGenerator().Generate(subject_test, env_dist_weight, i % op_dim_size, sensor_weight, env_dist_mode));
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            subject_mgr_dic.Add(0, new SubjectManagerGenerator().Generate(subject_test, env_dist_weight, 0, sensor_weight, env_dist_mode, 1, mal_env_dist_weight));
                                                                        }
                                                                        osm.SetSubjectManagerDic(subject_mgr_dic);
                                                                        osm.SetRand(update_step_rand_tmp);
                                                                        osm.SetAgentNetwork(agent_network);
                                                                        osm.SetInitWeightsMode(mode: CalcWeightMode.FavorMyOpinion);
                                                                        osm.SetOpinionIntroInterval(op_intro_interval);
                                                                        osm.SetOpinionIntroRate(op_intro_rate);
                                                                        osm.SimpleRecordFlag = true;
                                                                        osm.SetBeliefUpdater(this.MyBeliefUpdater);

                                                                        pb.Tag = $"{select_graph.ToString()} {size.ToString()} {algo_extend.ToString()} {op_dim_size} {seed}";
                                                                        osm.UpdateRounds(round, this.Steps, pb);

                                                                        string sensor_size_mode = "";
                                                                        if (this.SensorSizeFixMode)
                                                                        {
                                                                            sensor_size_mode = "fix" + this.SensorSize.ToString();
                                                                        }
                                                                        else
                                                                        {
                                                                            sensor_size_mode = "rate" + Math.Round(sensor_size_rate, 3).ToString();
                                                                        }

                                                                        string sensor_weight_mode = $"{this.MyBeliefUpdater.SensorWeightMode}";

                                                                        var exp_setting = new ExperimentSetting();
                                                                        exp_setting.Algorithm         = algo.ToString();
                                                                        exp_setting.AwaRateWindowSize = awa_rate_window;
                                                                        exp_setting.BeliefUpdater     = this.MyBeliefUpdater.MyBeliefUpdateFunctionMode.ToString();
                                                                        exp_setting.CommonCuriocity   = this.CommonCuriocity;
                                                                        exp_setting.Dim                 = op_dim_size;
                                                                        exp_setting.EnvDistWeight       = env_dist_weight;
                                                                        exp_setting.EnvDistMode         = env_dist_mode.ToString();
                                                                        exp_setting.GraphType           = select_graph.ToString();
                                                                        exp_setting.IsDynamic           = is_diynamic;
                                                                        exp_setting.InfoWeightRate      = info_weight_rate;
                                                                        exp_setting.NetworkSize         = size;
                                                                        exp_setting.OpinionIntroInteval = op_intro_interval;
                                                                        exp_setting.OpinionIntroRate    = op_intro_rate;
                                                                        exp_setting.Round               = round;
                                                                        exp_setting.SampleSize          = sample_size;
                                                                        exp_setting.SensorRate          = sensor_weight;
                                                                        exp_setting.SensorSize          = sensor_gene.SensorSize;
                                                                        exp_setting.SensorSizeMode      = this.SensorSizeFixMode.ToString();
                                                                        exp_setting.SensorWeightMode    = sensor_weight_mode;
                                                                        exp_setting.Step                = this.Steps;
                                                                        exp_setting.TargetAwareness     = target_h;

                                                                        var json_exp_each_setting = JsonConvert.SerializeObject(exp_setting, Formatting.Indented);

                                                                        var output_pass = Properties.Settings.Default.OutputLogPath
                                                                                          + $"/{save_folder}/data/"
                                                                                          + select_graph.ToString()
                                                                                          + $"_{size.ToString()}"
                                                                                          + $"_{algo_extend.ToString()}"
                                                                                          + $"_{op_dim_size}"
                                                                                          + $"_{is_diynamic}"
                                                                                          + $"_{target_h}"
                                                                                          + $"_{env_dist_mode.ToString()}"
                                                                                          + $"_{env_dist_weight}"
                                                                                          + $"_{info_weight_rate}"
                                                                                          + $"_{round}"
                                                                                          + $"_{sensor_size_mode}"
                                                                                          + $"_{mal_sensor_size_rate}"
                                                                                          + $"_{common_weight.ToString()}"
                                                                                          //+ $"_{est_func.ToString()}"
                                                                                          + $"_";

                                                                        //Output.OutputRounds(output_pass, osm.MyRecordRounds, seed.ToString());
                                                                        Output.OutputRounds(output_pass, osm.MyRecordRounds, json_exp_each_setting, seed.ToString());
                                                                        pb.Next();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        void Test()
        {
            int      agent_size            = 200;
            int      dim                   = 3;
            int      correct_dim           = 0;
            int      malicious_dim         = 1;
            AlgoEnum algo                  = AlgoEnum.SWTkai;
            double   targeth               = 0.80;
            double   common_weight         = 0.5;
            double   common_curiocity      = 0.5;
            double   sensor_rate           = 0.8;
            double   dist_weight           = 0.5;
            double   malicious_dist_weight = 0.8;
            int      sensor_size           = (int)(0.05 * agent_size);
            //int malicious_sensor_size = (int)(0.04 * agent_size);
            int malicious_sensor_size = 0;
            var op_form_threshold     = 0.8;
            int sample_size           = 10;
            int change_round          = 0;

            var belief_updater = new BeliefUpdater().SetSensorWeightMode(SensorWeightEnum.DependSensorRate);

            GraphGeneratorBase graph_generator;

            //graph_generator = new PC_GraphGenerator().SetNodeSize(500).SetRandomEdges(3).SetAddTriangleP(0.1);
            //graph_generator = new WS_GraphGenerator().SetNodeSize(agent_size).SetNearestNeighbors(6).SetRewireP(0.01);
            //graph_generator = new BA_GraphGenerator().SetNodeSize(agent_size).SetAttachEdges(2);
            graph_generator = new Grid2D_GraphGenerator().SetNodeSize(agent_size);
            //graph_generator = new ER_GraphGenerator().SetNodeSize(agent_size).SetEdgeCreateP(0.01);

            var pb     = new ExtendProgressBar(100);
            var graph  = graph_generator.Generate(0, pb);
            var layout = new KamadaKawai_LayoutGenerator(graph).Generate(pb);
            //var layout = new Circular_LayoutGenerator(graph).Generate();

            var init_belief_gene = new InitBeliefGenerator()
                                   .SetInitBeliefMode(mode: InitBeliefMode.NormalNarrow);
            //.SetInitBeliefMode(mode: InitBeliefMode.NormalWide);

            var subject_test = new OpinionSubject("test", dim);

            var sample_agent_test = new SampleAgent()
                                    .SetInitBeliefGene(init_belief_gene)
                                    .SetThreshold(op_form_threshold)
                                    .SetSubject(subject_test)
                                    .SetInitOpinion(Vector <double> .Build.Dense(dim, 0.0));

            var sensor_gene = new SensorGenerator()
                              //                .SetSensorSize((int)5);
                              .SetSensorSize(sensor_size, malicious_sensor_size);

            int agent_gene_seed = 4;
            var agent_gene_rand = new ExtendRandom(agent_gene_seed);


            var agent_network = new AgentNetwork()
                                .SetRand(agent_gene_rand)
                                .GenerateNetworkFrame(graph)
                                //.ApplySampleAgent(sample_agent_1, mode: SampleAgentSetMode.RandomSetRate, random_set_rate: 0.5)
                                //.ApplySampleAgent(sample_agent_2, mode: SampleAgentSetMode.RemainSet)
                                .ApplySampleAgent(sample_agent_test, mode: SampleAgentSetMode.RemainSet)
                                .GenerateSensor(sensor_gene)
                                .SetLayout(layout);

            int update_step_seed = 0;
            var update_step_rand = new ExtendRandom(update_step_seed);

            OSMBase osm = new OSM_Only();

            switch (algo)
            {
            case AlgoEnum.AAT:
                var osm_aat = new AAT_OSM();
                osm_aat.SetTargetH(targeth);
                osm = osm_aat;
                break;

            case AlgoEnum.AATG:
                var osm_aatg = new AATG_OSM();
                osm_aatg.SetTargetH(targeth);
                osm = osm_aatg;
                break;

            case AlgoEnum.AATfix:
                var osm_aatfix = new AATfix_OSM();
                osm_aatfix.SetTargetH(targeth);
                osm = osm_aatfix;
                break;

            case AlgoEnum.OSMonly:
                var osm_only = new OSM_Only();
                osm_only.SetCommonWeight(common_weight);
                osm = osm_only;
                break;

            case AlgoEnum.IWTori:
                var osm_iwtori = new IWTori_OSM();
                osm_iwtori.SetCommonCuriocity(common_curiocity);
                osm_iwtori.SetTargetH(targeth);
                osm = osm_iwtori;
                break;

            case AlgoEnum.AATparticle:
                var osm_aatpar = new AATparticle_OSM();
                osm_aatpar.SetSampleSize(sample_size);
                osm_aatpar.SetTargetH(targeth);
                osm = osm_aatpar;
                break;

            case AlgoEnum.AATwindow:
                var osm_window = new AATwindow_OSM();
                osm_window.SetTargetH(targeth);
                osm_window.SetAwaRateWindowSize(20);
                osm = osm_window;
                break;

            case AlgoEnum.AATwindowparticle:
                var osm_window_particle = new AATwindow_particle_OSM();
                osm_window_particle.SetTargetH(targeth);
                osm_window_particle.SetAwaRateWindowSize(20);
                osm_window_particle.SetSampleSize(10);
                osm = osm_window_particle;
                break;

            case AlgoEnum.AATfunction:
                var osm_function = new AATfunction_OSM();
                osm_function.SetTargetH(targeth);
                osm_function.SetAwaRateWindowSize(100);
                osm = osm_function;
                break;

            case AlgoEnum.AATfunctioniwt:
                var osm_function_iwt = new AATfunction_iwt_OSM();
                osm_function_iwt.SetCommonCuriocity(common_curiocity);
                osm_function_iwt.SetTargetH(targeth);
                osm_function_iwt.SetAwaRateWindowSize(100);
                osm = osm_function_iwt;
                break;

            case AlgoEnum.SWT:
                var osm_aat_info = new SWT_OSM();
                osm_aat_info.SetTargetH(targeth);
                osm_aat_info.SetAwaRateWindowSize(50);
                osm_aat_info.SetLinkInfoValueWindowSize(50);
                osm_aat_info.SetInfoWeightRate(1.0);
                osm = osm_aat_info;
                break;

            case AlgoEnum.SWTstep:
                var osm_aat_info_step = new SWT_step_OSM();
                osm_aat_info_step.SetTargetH(targeth);
                osm_aat_info_step.SetAwaRateWindowSize(100);
                osm_aat_info_step.SetLinkInfoValueWindowSize(100);
                osm_aat_info_step.SetInfoWeightRate(1.0);
                osm_aat_info_step.SetInfoLearningRate(0.2);
                osm = osm_aat_info_step;
                break;

            case AlgoEnum.SWTkai:
                var osm_swtkai = new SWTkai_OSM();
                osm_swtkai.SetCommonWeight(0.5);
                osm_swtkai.SetLinkInfoValueWindowSize(1000);
                osm = osm_swtkai;
                break;

            case AlgoEnum.GDWTsigW:
                var osm_gdwt_sigw = new GDWT_OSM();
                osm_gdwt_sigw.SetTargetH(targeth);
                osm_gdwt_sigw.SetAwaRateWindowSize(100);
                osm_gdwt_sigw.SetEstimateFunction(new Sigmoid_weight_EstFunc(1.0, 0, 2));
                osm = osm_gdwt_sigw;
                break;

            case AlgoEnum.GDWTsigH:
                var osm_gdwt_sigh = new GDWT_OSM();
                osm_gdwt_sigh.SetTargetH(targeth);
                osm_gdwt_sigh.SetAwaRateWindowSize(100);
                osm_gdwt_sigh.SetEstimateFunction(new Sigmoid_awa_EstFunc(1.0, 0, 3));
                osm = osm_gdwt_sigh;
                break;

            case AlgoEnum.GDWTpowerH:
                var osm_gdwt_powh = new GDWT_OSM();
                osm_gdwt_powh.SetTargetH(targeth);
                osm_gdwt_powh.SetAwaRateWindowSize(100);
                osm_gdwt_powh.SetEstimateFunction(new Power_awa_EstFunc(3.0, 0));
                osm = osm_gdwt_powh;
                break;

            case AlgoEnum.GDWTpowerW:
                var osm_gdwt_poww = new GDWT_OSM();
                osm_gdwt_poww.SetTargetH(targeth);
                osm_gdwt_poww.SetAwaRateWindowSize(100);
                osm_gdwt_poww.SetEstimateFunction(new Power_weight_EstFunc(3.0, 0));
                osm = osm_gdwt_poww;
                break;

            case AlgoEnum.GDWTLinearW:
                var osm_gdwt_linearw = new GDWT_OSM();
                osm_gdwt_linearw.SetTargetH(targeth);
                osm_gdwt_linearw.SetAwaRateWindowSize(100);
                osm_gdwt_linearw.SetEstimateFunction(new Linear_weight_EstFunc(1.0, 1, 0));
                osm = osm_gdwt_linearw;
                break;

            default:
                break;
            }
            osm.SetRand(update_step_rand);
            osm.SetAgentNetwork(agent_network);
            var subject_mgr_dic = new Dictionary <int, SubjectManager>();

            subject_mgr_dic.Add(0, new SubjectManagerGenerator()
                                .Generate(subject_test, dist_weight, correct_dim, sensor_rate, EnvDistributionEnum.Exponential, malicious_dim, malicious_dist_weight));
            //for (int i = 0; i < 1; i++)
            //{
            //  subject_mgr_dic.Add(i * change_round, new SubjectManagerGenerator().Generate(subject_test, dist_weight, i % dim, sensor_rate, EnvDistributionEnum.Turara));
            //}
            osm.SetSubjectManagerDic(subject_mgr_dic);
            osm.SetInitWeightsMode(mode: CalcWeightMode.FavorMyOpinion);
            osm.SetOpinionIntroInterval(10);
            osm.SetOpinionIntroRate(0.1);
            //osm.SetSensorCommonWeight(0.70);
            osm.SetBeliefUpdater(belief_updater);

            this.MyOSM = osm;
            this.MyAnimationForm.RegistOSM(osm);
        }