void Test() { this.osm_setting = new OSMSetting(ExperimentType.AAT_SW_Normal_Random_Exponential); int agent_size = osm_setting.agent_size; int dim = osm_setting.dim; int correct_dim = osm_setting.correct_dim; int malicious_dim = osm_setting.malicious_dim; AlgoEnum algo = osm_setting.algo; double targeth = osm_setting.targeth; double common_weight = osm_setting.common_weight; double common_curiocity = osm_setting.common_curiocity; double sensor_weight = osm_setting.sensor_weight; double dist_weight = osm_setting.dist_weight; double malicious_dist_weight = osm_setting.malicious_dist_weight; int sensor_size = osm_setting.sensor_size; //int malicious_sensor_size = (int)(0.04 * agent_size); int malicious_sensor_size = osm_setting.malicious_sensor_size; var op_form_threshold = osm_setting.op_form_threshold; int sample_size = osm_setting.sample_size; int change_round = osm_setting.change_round; bool bad_sensor_mode = osm_setting.bad_sensor_mode; int opinion_share_num = osm_setting.opinion_share_num; bool is_add_share_only_community = osm_setting.add_share_only_community; EnvDistributionEnum env_distribution = osm_setting.env_distribution; BeliefUpdateFunctionEnum belief_update = osm_setting.belief_update; var belief_updater = new BeliefUpdater(belief_update).SetSensorWeightMode(SensorWeightEnum.DependSensorRate); GraphGeneratorBase graph_generator; switch (osm_setting.select_graph) { case GraphEnum.WS: graph_generator = new WS_GraphGenerator().SetNodeSize(agent_size).SetNearestNeighbors(6).SetRewireP(0.01); break; //case GraphEnum.PowerLawCluster: //graph_generator = new PC_GraphGenerator().SetNodeSize(500).SetRandomEdges(3).SetAddTriangleP(0.1); // break; case GraphEnum.BA: graph_generator = new BA_GraphGenerator().SetNodeSize(agent_size).SetAttachEdges(2); break; case GraphEnum.Grid2D: graph_generator = new Grid2D_GraphGenerator().SetNodeSize(agent_size); break; //case GraphEnum.ER: //graph_generator = new ER_GraphGenerator().SetNodeSize(agent_size).SetEdgeCreateP(0.01); //break; case GraphEnum.LFR: graph_generator = new LFR_GraphGenerator().SetNodeSize(agent_size); break; default: graph_generator = new LFR_GraphGenerator().SetNodeSize(agent_size); break; } graph_generator.SetOsmSetting(osm_setting); 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(); //LFRの時のみ List <List <int> > communityList = new List <List <int> >(); if (osm_setting.select_graph == GraphEnum.LFR) { communityList = graph_generator.GetCommunity(); } 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 = 11;//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) .SetBadSensorMode(osm_setting.bad_sensor_mode) .SetSensorArrange(osm_setting.sensor_arrange) .SetCommnityList(communityList) .GenerateSensor(sensor_gene) .SetLayout(layout); var bad_community_index = agent_network.GetBadCommunityIndex(); int update_step_seed = 1; 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; default: break; } osm.SetRand(update_step_rand); osm.SetAgentNetwork(agent_network, opinion_share_num); var subject_mgr_dic = new Dictionary <int, SubjectManager>(); subject_mgr_dic.Add(0, new SubjectManagerGenerator() .Generate(subject_test, dist_weight, correct_dim, sensor_weight, env_distribution, 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(osm_setting.op_intro_interval); osm.SetOpinionIntroRate(osm_setting.op_intro_rate); //osm.SetSensorCommonWeight(0.70); osm.SetBeliefUpdater(belief_updater); osm.SetAddShareCommunityOnly(is_add_share_only_community); osm.SetStopRound(osm_setting.stop_rounds); this.MyOSM = osm; this.MyAnimationForm.RegistOSM(osm, osm_setting.opinion_share_num, communityList, bad_community_index); }