{ "sample_id": "0001_fleet_01", "scene_id": "0001", "fleet_id": "fleet_01", "instruction": "You are a Python code generator. Output ONLY the mission code, nothing else.\n\nFORMAT RULES (violations will be rejected):\n- First output character MUST be #\n- Output must be pure ASCII: no CJK characters, no fullwidth punctuation, no emoji\n- No markdown blocks: no ``` or ```python\n- No natural language before/after code\n- Comments use ASCII only\n\nTASK: Assign UAVs to zones and generate Python mission chains.\n\nCORE RULES (all are hard constraints except rule 13, which is a soft objective):\n1. extinguishing_drone -> fire points + SearchArea after bombing. surveillance_drone -> search only, CANNOT drop_water_bomb. If the number of surveillance drones is fewer than the number of zones without fire points, idle extinguishing drones CAN cover the remainder.\n2. Monitor zones are search-only: they never carry fire points. Fire points occur only in High- and Low-risk zones.\n3. Each fire point is handled by exactly ONE extinguishing drone. Distribute fire points to different drones for parallel execution.\n4. An extinguishing drone can only bomb as many fire points as its current_payload. If payload runs out mid-task, it must resupply (return_to_base -> land -> resupply -> takeoff) before continuing.\n5. For each fire point: fly_to_point(x, y, 100.0, that UAV's max_speed) -> hover_and_wait(HOVER_TIME) -> drop_water_bomb. HOVER_TIME: High=15s, Low=10s. Use 100.0 for ALL fly_to_point altitudes.\n6. An extinguishing drone must bomb until NONE of its assigned fire points remain -- in the SAME zone or ACROSS DIFFERENT zones -- before its FINAL return. Leftover payload is acceptable only when fire points run out. In each zone: bomb its fire point(s) -> do ONE SearchArea for that zone -> proceed to next zone; when a zone's fire points span several sorties because of payload limits, do that zone's ONE SearchArea after the LAST of them. After finishing ALL assigned zones, return_to_base -> land. Multiple drones bombing the same zone each do their own SearchArea.\n7. Every zone must be searched at least once. Zones without fire points: assign a surveillance_drone when available; if surveillance drones are fewer than such zones, idle extinguishing drones may cover the remainder. A surveillance_drone may search one or more distinct zones in the same sortie: takeoff(100.0) -> one or more SearchArea(['UAV_xx'], 'zone_id') calls (using a different zone_id each time) -> return_to_base -> land. Do NOT add fly_to_point before SearchArea.\n8. Same drone MUST NOT repeat SearchArea on the same zone_id. Different drones searching the same zone is allowed (coordinated coverage).\n9. SearchArea uses single-UAV list: ['UAV_xx']; NEVER multi-UAV list like ['UAV_01','UAV_02'].\n10. Every fly_to_point velocity MUST be <= that UAV's max_speed from the UAV RESOURCES list below.\n11. One mission chain per UAV; all sorties for the same UAV grouped together.\n12. Each sortie ends: return_to_base + land. If another sortie needed: land -> resupply -> takeoff.\n13. (soft objective) Distribute work to balance completion time; never violate rules 1-12 to do so.\n\nCHAIN TEMPLATES:\n Extinguishing (single fire point): takeoff('UAV_XX', 100.0) -> fly_to_point('UAV_XX', fire_x, fire_y, 100.0, MAX_SPEED) -> hover_and_wait('UAV_XX', HOVER_TIME) -> drop_water_bomb('UAV_XX') -> SearchArea(['UAV_XX'], 'zone_id') -> return_to_base('UAV_XX') -> land('UAV_XX')\n Extinguishing (MULTI fire point, USE THIS when multiple fire points in zone): takeoff('UAV_XX', 100.0) -> fly_to_point -> hover -> drop_water_bomb -> fly_to_point -> hover -> drop_water_bomb -> ... -> SearchArea(['UAV_XX'], 'zone_id') -> return_to_base('UAV_XX') -> land('UAV_XX')\n Extinguishing (payload-split -- a zone's fire points exceed one sortie's payload): takeoff('UAV_XX', 100.0) -> fly_to_point -> hover -> drop_water_bomb -> return_to_base('UAV_XX') -> land('UAV_XX') -> resupply('UAV_XX') -> takeoff('UAV_XX', 100.0) -> ... -> fly_to_point -> hover -> drop_water_bomb -> SearchArea(['UAV_XX'], 'zone_id') -> return_to_base('UAV_XX') -> land('UAV_XX') [the ONE SearchArea comes after this zone's LAST bomb; intermediate sorties carry none, since rule 8 forbids re-searching]\n Surveillance (one or more distinct zones per sortie): takeoff('UAV_XX', 100.0) -> SearchArea(['UAV_XX'], 'zone_id') -> optionally repeat SearchArea for other distinct zones -> return_to_base('UAV_XX') -> land('UAV_XX')\n Extended: ... land('UAV_XX') -> resupply('UAV_XX') -> takeoff('UAV_XX', 100.0) -> ...\n \nOUTPUT STRUCTURE:\n# =========================\n# UAV_XX mission chain\n# =========================\n# Sortie 1\ntakeoff('UAV_XX', 100.0)\n...actions...\nreturn_to_base('UAV_XX')\nland('UAV_XX')\n\nAVAILABLE FUNCTIONS:\ndef SearchArea(uav_ids, zone_id):\n \"\"\"\n Full-coverage reconnaissance sweep of one zone by one drone.\n\n The executor resolves the zone's geo-fence coordinates from zone_id and\n generates the coverage waypoints; no manual coordinates are supplied.\n\n uav_ids : list[str] length exactly 1 (the name is plural only for the schema)\n zone_id : str e.g. 'zone_1'\n \"\"\"\n return {\n 'action': 'SearchArea',\n 'uav_ids': uav_ids,\n 'zone_id': zone_id\n }\n\n\ndef drop_water_bomb(drone_id):\n \"\"\"\n Release one water bomb at the current position; current_payload drops by 1.\n\n drone_id : str\n \"\"\"\n return {\n 'action': 'drop_water_bomb',\n 'drone_id': drone_id\n }\n\n\ndef fly_to_point(drone_id, x, y, z, velocity):\n \"\"\"\n Fly a straight line to [x, y] holding AGL altitude z, then hover and wait.\n\n drone_id : str\n x, y : float normalized map coordinates, each satisfying 0.0 <= value <= 1.0\n z : float [m] AGL altitude maintained for the whole flight\n velocity : float [m/s] flight speed\n \"\"\"\n return {\n 'action': 'fly_to_point',\n 'drone_id': drone_id,\n 'target': [x, y, z],\n 'velocity': velocity\n }\n\n\ndef hover_and_wait(drone_id, duration):\n \"\"\"\n Hold a stationary hover at the current position for duration seconds.\n\n drone_id : str\n duration : float [s]\n \"\"\"\n return {\n 'action': 'hover_and_wait',\n 'drone_id': drone_id,\n 'duration': duration\n }\n\n\ndef land(drone_id):\n \"\"\"\n Descend vertically at the current coordinates. State becomes IDLE or CHARGING.\n\n drone_id : str\n \"\"\"\n return {\n 'action': 'land',\n 'drone_id': drone_id\n }\n\n\ndef resupply(drone_id):\n \"\"\"\n Full resupply at base. For extinguishing drones current_payload is refilled to\n max_fire_extinguisher; for surveillance drones (max_fire_extinguisher == 0)\n only the battery is restored to 100%. State then reverts to IDLE.\n\n drone_id : str\n \"\"\"\n return {\n 'action': 'resupply',\n 'drone_id': drone_id\n }\n\n\ndef return_to_base(drone_id):\n \"\"\"\n Override the current mission and return to base along an obstacle-avoiding\n path. On arrival the state becomes CHARGING, then reverts to IDLE.\n\n drone_id : str\n \"\"\"\n return {\n 'action': 'return_to_base',\n 'drone_id': drone_id\n }\n\n\ndef takeoff(drone_id, target_altitude):\n \"\"\"\n Climb vertically to target_altitude, then hover and wait for the next command.\n\n drone_id : str e.g. 'UAV_01'\n target_altitude : float [m] height above ground level (AGL), not home-relative\n \"\"\"\n return {\n 'action': 'takeoff',\n 'drone_id': drone_id,\n 'target_altitude': target_altitude\n }\n\n\nUAV RESOURCES:\nUAV_01 = {\"id\": \"UAV_01\", \"type\": \"extinguishing_drone\", \"location\": [0.0, 0.0], \"battery\": 100.0, \"capabilities\": {\"max_fire_extinguisher\": 1, \"current_payload\": 1, \"max_speed\": 12.0, \"sensor_range\": 0.2}, \"description\": \"1\"}\nUAV_02 = {\"id\": \"UAV_02\", \"type\": \"extinguishing_drone\", \"location\": [0.0, 0.0], \"battery\": 100.0, \"capabilities\": {\"max_fire_extinguisher\": 2, \"current_payload\": 2, \"max_speed\": 10.0, \"sensor_range\": 0.2}, \"description\": \"2\"}\nUAV_03 = {\"id\": \"UAV_03\", \"type\": \"surveillance_drone\", \"location\": [0.0, 0.0], \"battery\": 100.0, \"capabilities\": {\"max_fire_extinguisher\": 0, \"current_payload\": 0, \"max_speed\": 22.0, \"sensor_range\": 0.2}, \"description\": \"frontend-custom-uav\"}\n\nZONES (JSON):\n[\n {\n \"id\": \"zone_0\",\n \"risk_level\": \"Monitor\",\n \"coordinates\": [\n [\n 0.0,\n 0.0\n ],\n [\n 0.25,\n 0.0\n ],\n [\n 0.25,\n 1.0\n ],\n [\n 0.0,\n 1.0\n ]\n ],\n \"fire_points\": []\n },\n {\n \"id\": \"zone_1\",\n \"risk_level\": \"Low\",\n \"coordinates\": [\n [\n 0.25,\n 0.0\n ],\n [\n 0.6,\n 0.0\n ],\n [\n 0.6,\n 1.0\n ],\n [\n 0.25,\n 1.0\n ]\n ],\n \"fire_points\": [\n [\n 0.305,\n 0.015\n ],\n [\n 0.455,\n 0.395\n ]\n ]\n },\n {\n \"id\": \"zone_2\",\n \"risk_level\": \"High\",\n \"coordinates\": [\n [\n 0.6,\n 0.0\n ],\n [\n 1.0,\n 0.0\n ],\n [\n 1.0,\n 1.0\n ],\n [\n 0.6,\n 1.0\n ]\n ],\n \"fire_points\": [\n [\n 0.695,\n 0.135\n ],\n [\n 0.745,\n 0.395\n ],\n [\n 0.885,\n 0.375\n ],\n [\n 0.905,\n 0.725\n ]\n ]\n }\n]\n\nNow output the mission code:", "input": "", "output": "# =========================\n# UAV_01 mission chain\n# =========================\n# Sortie 1\ntakeoff('UAV_01', 100.0)\nfly_to_point('UAV_01', 0.305, 0.015, 100.0, 12.0)\nhover_and_wait('UAV_01', 10.0)\ndrop_water_bomb('UAV_01')\nreturn_to_base('UAV_01')\nland('UAV_01')\nresupply('UAV_01')\n# Sortie 2\ntakeoff('UAV_01', 100.0)\nfly_to_point('UAV_01', 0.455, 0.395, 100.0, 12.0)\nhover_and_wait('UAV_01', 10.0)\ndrop_water_bomb('UAV_01')\nSearchArea(['UAV_01'], 'zone_1')\nreturn_to_base('UAV_01')\nland('UAV_01')\n# =========================\n# UAV_02 mission chain\n# =========================\n# Sortie 1\ntakeoff('UAV_02', 100.0)\nfly_to_point('UAV_02', 0.695, 0.135, 100.0, 10.0)\nhover_and_wait('UAV_02', 15.0)\ndrop_water_bomb('UAV_02')\nfly_to_point('UAV_02', 0.745, 0.395, 100.0, 10.0)\nhover_and_wait('UAV_02', 15.0)\ndrop_water_bomb('UAV_02')\nreturn_to_base('UAV_02')\nland('UAV_02')\nresupply('UAV_02')\n# Sortie 2\ntakeoff('UAV_02', 100.0)\nfly_to_point('UAV_02', 0.885, 0.375, 100.0, 10.0)\nhover_and_wait('UAV_02', 15.0)\ndrop_water_bomb('UAV_02')\nfly_to_point('UAV_02', 0.905, 0.725, 100.0, 10.0)\nhover_and_wait('UAV_02', 15.0)\ndrop_water_bomb('UAV_02')\nSearchArea(['UAV_02'], 'zone_2')\nreturn_to_base('UAV_02')\nland('UAV_02')\n# =========================\n# UAV_03 mission chain\n# =========================\n# Sortie 1\ntakeoff('UAV_03', 100.0)\nSearchArea(['UAV_03'], 'zone_0')\nreturn_to_base('UAV_03')\nland('UAV_03')", "fleet_json": "[{\"battery\":100.0,\"capabilities\":{\"current_payload\":1,\"max_fire_extinguisher\":1,\"max_speed\":12.0,\"sensor_range\":0.2},\"description\":\"1\",\"id\":\"UAV_01\",\"location\":[0.0,0.0],\"type\":\"extinguishing_drone\"},{\"battery\":100.0,\"capabilities\":{\"current_payload\":2,\"max_fire_extinguisher\":2,\"max_speed\":10.0,\"sensor_range\":0.2},\"description\":\"2\",\"id\":\"UAV_02\",\"location\":[0.0,0.0],\"type\":\"extinguishing_drone\"},{\"battery\":100.0,\"capabilities\":{\"current_payload\":0,\"max_fire_extinguisher\":0,\"max_speed\":22.0,\"sensor_range\":0.2},\"description\":\"frontend-custom-uav\",\"id\":\"UAV_03\",\"location\":[0.0,0.0],\"type\":\"surveillance_drone\"}]", "zones_json": "[{\"boundary_description\":\"覆盖图像最左侧 25% 的垂直切片区域。\",\"coordinates\":[[0.0,0.0],[0.25,0.0],[0.25,1.0],[0.0,1.0]],\"fire_points\":[],\"id\":\"zone_0\",\"reason\":\"该区域为西部森林背景区,未检测到任何热源或烟雾,划定为安全监测区。\",\"risk_level\":\"Monitor\"},{\"boundary_description\":\"连接中部散落火点,划定为中部垂直任务走廊。\",\"coordinates\":[[0.25,0.0],[0.6,0.0],[0.6,1.0],[0.25,1.0]],\"fire_points\":[[0.305,0.015],[0.455,0.395]],\"id\":\"zone_1\",\"reason\":\"区域内包含 2 个零星散落的独立火点,火势较小且分布稀疏,判定为低风险控制区。\",\"risk_level\":\"Low\"},{\"boundary_description\":\"覆盖图像右侧 40% 区域,完整包裹东部密集火点群及烟雾扩散范围。\",\"coordinates\":[[0.6,0.0],[1.0,0.0],[1.0,1.0],[0.6,1.0]],\"fire_points\":[[0.695,0.135],[0.745,0.395],[0.885,0.375],[0.905,0.725]],\"id\":\"zone_2\",\"reason\":\"检测到 4 个密集分布的高强度火点,伴随明显浓烟,且覆盖范围广,判定为核心攻坚区。\",\"risk_level\":\"High\"}]", "num_uavs": 3, "num_extinguishing_uavs": 2, "num_surveillance_uavs": 1, "num_zones": 3, "num_fire_points": 6, "origin": "reference", "prompt_version": "core_rules", "validation_scope": "packaging_integrity_and_python_syntax", "plan_sha256": "a1c18b2cbde9fb9550b3c96b64fa3fef7cb00c302ac79c201a3e33f714485408" }