Spaces:
Sleeping
Sleeping
File size: 4,786 Bytes
22805ee 12f3696 22805ee | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | """Task presets for the satellite constellation simulator."""
from abc import ABC, abstractmethod
from typing import Any, Dict
try:
from .constellation import SatelliteConstellationEnv
except ImportError: # pragma: no cover - flat-module fallback
from constellation import SatelliteConstellationEnv
class Task(ABC):
"""Base task preset."""
def __init__(self, name: str, description: str):
self.name = name
self.description = description
@abstractmethod
def setup_environment(self, env: SatelliteConstellationEnv) -> None:
"""Apply task-specific configuration to the environment."""
@abstractmethod
def get_success_criteria(self) -> Dict[str, Any]:
"""Return deterministic task success criteria."""
class EasyTask(Task):
def __init__(self):
super().__init__(
"Easy: Basic Imaging",
"Capture images with 3 satellites while keeping the fleet healthy.",
)
def setup_environment(self, env: SatelliteConstellationEnv) -> None:
env.num_satellites = 3
env.max_steps = 50
env.seed = 101
env._reset_satellites()
env.weather = {"region1": 0.2, "region2": 0.5}
env.pending_tasks = [
{
"id": f"easy-img-{idx}",
"type": "image_capture",
"region": "region1",
"priority": 1,
}
for idx in range(1, 6)
]
def get_success_criteria(self) -> Dict[str, Any]:
return {
"min_images_captured": 3,
"min_tasks_completed": 3,
"min_battery_final": 50,
"max_invalid_actions": 3,
"max_steps": 50,
}
class MediumTask(Task):
def __init__(self):
super().__init__(
"Medium: Data Management",
"Capture images and downlink data with 5 satellites while balancing resources.",
)
def setup_environment(self, env: SatelliteConstellationEnv) -> None:
env.num_satellites = 5
env.max_steps = 100
env.seed = 202
env._reset_satellites()
env.weather = {"region1": 0.2, "region2": 0.5}
env.pending_tasks = (
[
{
"id": f"med-img-{idx}",
"type": "image_capture",
"region": "region1",
"priority": 1,
}
for idx in range(1, 7)
]
+ [
{
"id": f"med-down-{idx}",
"type": "data_downlink",
"station": idx % 2,
"priority": 2,
"units_remaining": 10,
}
for idx in range(1, 7)
]
)
def get_success_criteria(self) -> Dict[str, Any]:
return {
"min_images_captured": 5,
"min_data_downlinked": 50,
"min_tasks_completed": 8,
"min_battery_final": 30,
"max_invalid_actions": 8,
"max_steps": 100,
}
class HardTask(Task):
def __init__(self):
super().__init__(
"Hard: Constellation Coordination",
"Manage 8 satellites under heavier weather and task pressure.",
)
def setup_environment(self, env: SatelliteConstellationEnv) -> None:
env.num_satellites = 8
env.max_steps = 200
env.seed = 303
env._reset_satellites()
env.weather = {"region1": 0.8, "region2": 0.3, "region3": 0.6}
env.pending_tasks = (
[
{
"id": f"hard-img-r1-{idx}",
"type": "image_capture",
"region": "region1",
"priority": 1,
}
for idx in range(1, 7)
]
+ [
{
"id": f"hard-img-r2-{idx}",
"type": "image_capture",
"region": "region2",
"priority": 2,
}
for idx in range(1, 7)
]
+ [
{
"id": f"hard-down-{idx}",
"type": "data_downlink",
"station": idx % 3,
"priority": 2,
"units_remaining": 12.5,
}
for idx in range(1, 9)
]
)
def get_success_criteria(self) -> Dict[str, Any]:
return {
"min_images_captured": 10,
"min_data_downlinked": 100,
"min_tasks_completed": 14,
"min_battery_final": 20,
"max_invalid_actions": 12,
"max_steps": 200,
}
|