//====================================================================/ // / // KK-Multi Agent Simulator for Java / // / //====================================================================/ Version = 1.0; //------------------------------------------------------- // Component Tree //------------------------------------------------------- UNIVERSE { Space mundo(0,0),Square_2D(50, 50, Loop, North, 1){ AgtType agente(0, 0)[0] { Dim X(0, 0) As Double = (0.0); Dim Y(0, 0) As Double = (0.0); Dim Layer(0, 0) As Integer = (0); Dim Direction(0, 0) As Double = (0.0); } AgtType centro(0, 0)[1] { Dim X(0, 0) As Double = (0.0); Dim Y(0, 0) As Double = (0.0); Dim Layer(0, 0) As Integer = (0); Dim Direction(0, 0) As Double = (0.0); Dim largo(0, 0) As AgtSet = (); Dim corto(0, 0) As AgtSet = (); Dim medio(0, 0) As AgtSet = (); } } Dim shiya(0, 0) As Double = (0.0); } //------------------------------------------------------- // Agent Variable Initial Data //------------------------------------------------------- Initial_Value { UNIVERSE.SHIYA = 1(24.0); } //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE Univ_Init{ dim i as integer dim a as agtset for i = 0 to 5000 createagt(universe.mundo.agente) next i makeagtset(a, universe.mundo.agente) randomputagtset(a) } Univ_Step_Begin{ } Univ_Step_End{ } Univ_Finish{ } #end_rule UNIVERSE //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE.MUNDO.AGENTE Agt_Init{ } Agt_Step{ } #end_rule UNIVERSE.MUNDO.AGENTE //------------------------------------------------------- // Agent Rule //------------------------------------------------------- #begin_rule UNIVERSE.MUNDO.CENTRO Agt_Init{ movetocenter() } Agt_Step{ dim a as double //やらなくても動きますが、念のため、入れ物を一旦空にしておきます。 clearagtset(my.largo) //universeのsiyaに応じて、エージェントセット集合を作ります。 makeoneagtsetaroundown(my.largo, universe.shiya, universe.mundo.agente, false) //上記に追加して、universeのsiyaの2/3の距離で、エージェントセット集合を作ります。 makeoneagtsetaroundown(my.medio, (2*universe.shiya)/3.0, universe.mundo.agente, false) a = (universe.shiya)/3.0 print(a) //さらに、universeのsiyaの1/3の距離で、エージェントセット集合を作ります。 makeoneagtsetaroundown(my.corto, universe.shiya/3.0, universe.mundo.agente, false) //長距離のものから、中距離に含まれるものを取り除きます。 delagtset(my.largo, my.medio) //中距離のものから、短距離に含まれるものを取り除きます。 delagtset(my.medio, my.corto) //うまくいかない場合は、出力設定も確認してください。 } #end_rule UNIVERSE.MUNDO.CENTRO //------------------------------------------------------- // Simulation Definition Division //------------------------------------------------------- Single_Simulation { Step_Max = 0; Time_Max = 0; End_Condition = ""; Exec_Wait = 0; Exec_Order = Random; Random_Seed = 0; Log_File = "", Fixed, Append, 0; Replay_Log_File = "", Fixed, Append, 0; Redraw_Timing = Step; Redraw_Interval = 1; Garbage_Interval = 1; } //------------------------------------------------------- // Simulation Loop Definition Division //------------------------------------------------------- Repeat_Simulation { Value_Change = None; Repeat_Max = 1; } //------------------------------------------------------- // 2 Dimension Map Display Definition Division //------------------------------------------------------- Map_Output { Map_Space_Name = "UNIVERSE.MUNDO"; Map_Name = "a"; Font_Name = "Dialog"; Font_Char_Set = 81; Font_Size = 12.0; Font_Style = 0; Font_Color = 0, 0, 0; Font_Background_Color = 255, 255, 255; Title = ""; Axis_Label = "", ""; Draw_Range = 0, 0, 50, 50; Ruled_Line = No; Remarks = Yes; Legend_Pos = Top; Background_Color = 0, 0, 0; Background_Transparent = No; Target_Layer = 0; Coordinate_Display = No; Space_Kind = Square_2D; BG_Pict = No; BG_Type = 0; BG_Var_Name = ""; BG_File_Name = ""; Disable = No; Position_x = 253; Position_y = 2; Size_x = 740; Size_y = 669; Origin_Position = 2; Output { Map_Element_Name = "corto"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.mundo.centro"; Draw_Line = Yes; Collection_Name = "UNIVERSE.mundo.centro.corto"; Line_Type = 1; Line_Arrow = 1; Line_Width = 1; Line_Color = 0, 0, 204; Agent_Color = 0,153,102; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = ""; } Output { Map_Element_Name = "medio"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.mundo.centro"; Draw_Line = Yes; Collection_Name = "UNIVERSE.mundo.centro.medio"; Line_Type = 1; Line_Arrow = 1; Line_Width = 1; Line_Color = 255, 255, 0; Agent_Color = 51,51,51; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = ""; } Output { Map_Element_Name = "largo"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.mundo.centro"; Draw_Line = Yes; Collection_Name = "UNIVERSE.mundo.centro.largo"; Line_Type = 1; Line_Arrow = 1; Line_Width = 1; Line_Color = 0, 153, 51; Agent_Color = 51,51,51; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = ""; } Output { Map_Element_Name = "ag"; Map_Element = Agent_Variable; Output_Expression = "UNIVERSE.MUNDO.AGENTE"; Draw_Line = No; Collection_Name = ""; Line_Type = 0; Line_Arrow = 0; Line_Width = 0; Line_Color = 0, 0, 0; Agent_Color = 255,0,0; Marker_Id = 1; Icon_Type = 0; Icon_Var_Name = ""; Icon_Transparent = No; Icon_Enlarg_Reduce = No; Icon_File_Name = ""; Num_Display = No; Num_Var_Name = ""; } } //------------------------------------------------------- // Control Panel Definition Division //------------------------------------------------------- Control_Panel { Display_Area = 795, 310, 228, 142; Panel_Item { Item_Type = Slider; Item_Name = "視野"; Display_Area = 0, 0, 0, 0; Font_Name = ""; Font_Char_Set = 0; Font_Size = 0.0; Font_Style = 0; Font_Color = 0, 0, 0; Font_Background_Color = 0, 0, 0; Var_Name = UNIVERSE.shiya; Slider_Range_Max = 26; Slider_Value_Min = 0.0; Slider_Value_Step = 1.0; Slider_Value = "24"; } } //------------------------------------------------------- // Space Initial Value Definition Divsion //------------------------------------------------------- Space_Initial { } //------------------------------------------------------- // Other Miscellaneous Data Definition Division //------------------------------------------------------- Others_Data { Indent = 4; Rule_Colored = Yes; Font_Name = "Dialog"; Font_Char_Set = 0; Font_Size = 12.0; Font_Style = 0; Font_Color = 0, 0, 0; Font_Background_Color = 0, 0, 0; Window_Hide_Run = 1; Debug_Position_x = 75; Debug_Position_y = 75; Debug_Size_x = 400; Debug_Size_y = 200; Console_Position_x = 4; Console_Position_y = 408; Console_Size_x = 600; Console_Size_y = 120; }