Spaces:
Sleeping
Sleeping
File size: 6,676 Bytes
92d87c0 | 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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Dict, List
from .models import DeliveryWindow, PendingOrder
class Task(ABC):
name: str
num_platforms: int
max_steps: int
seed: int
solar_zones: Dict[str, float]
pending_orders: List[PendingOrder]
delivery_windows: List[DeliveryWindow]
description: str
# Grading thresholds
min_production_runs: int
min_assemblies: int
min_deliveries: int
min_energy_final: float
max_invalid_actions: int
class EasyTask(Task):
name = "easy"
num_platforms = 2
max_steps = 60
seed = 101
description = "Basic production scheduling with 2 platforms and 4 delivery orders."
solar_zones = {"zone_a": 0.8, "zone_b": 0.8}
pending_orders = [
PendingOrder(order_id=1, product_type="alloy_panel", requires_assembly=False),
PendingOrder(order_id=2, product_type="circuit_board", requires_assembly=False),
PendingOrder(order_id=3, product_type="fuel_cell", requires_assembly=False),
PendingOrder(order_id=4, product_type="alloy_panel", requires_assembly=False),
]
delivery_windows = [
DeliveryWindow(order_id=1, product_type="alloy_panel", deadline=20, reward_value=8.0),
DeliveryWindow(order_id=2, product_type="circuit_board", deadline=35, reward_value=8.0),
DeliveryWindow(order_id=3, product_type="fuel_cell", deadline=50, reward_value=8.0),
DeliveryWindow(order_id=4, product_type="alloy_panel", deadline=58, reward_value=8.0),
]
min_production_runs = 3
min_assemblies = 0
min_deliveries = 2
min_energy_final = 40.0
max_invalid_actions = 3
class MediumTask(Task):
name = "medium"
num_platforms = 4
max_steps = 120
seed = 202
description = "Multi-stage assembly and delivery balancing with 4 platforms and 10 orders."
solar_zones = {
"zone_a": 0.8,
"zone_b": 0.6,
"zone_c": 0.5,
"zone_d": 0.7,
}
pending_orders = [
PendingOrder(order_id=1, product_type="alloy_panel", requires_assembly=False),
PendingOrder(order_id=2, product_type="circuit_board", requires_assembly=False),
PendingOrder(order_id=3, product_type="solar_array", requires_assembly=True),
PendingOrder(order_id=4, product_type="fuel_cell", requires_assembly=False),
PendingOrder(order_id=5, product_type="thruster_module", requires_assembly=True),
PendingOrder(order_id=6, product_type="alloy_panel", requires_assembly=False),
PendingOrder(order_id=7, product_type="circuit_board", requires_assembly=False),
PendingOrder(order_id=8, product_type="solar_array", requires_assembly=True),
PendingOrder(order_id=9, product_type="fuel_cell", requires_assembly=False),
PendingOrder(order_id=10, product_type="habitat_unit", requires_assembly=True),
]
delivery_windows = [
DeliveryWindow(order_id=1, product_type="alloy_panel", deadline=25, reward_value=8.0),
DeliveryWindow(order_id=2, product_type="circuit_board", deadline=40, reward_value=8.0),
DeliveryWindow(order_id=3, product_type="solar_array", deadline=55, reward_value=10.0),
DeliveryWindow(order_id=4, product_type="fuel_cell", deadline=60, reward_value=8.0),
DeliveryWindow(order_id=5, product_type="thruster_module", deadline=75, reward_value=10.0),
DeliveryWindow(order_id=6, product_type="alloy_panel", deadline=80, reward_value=8.0),
DeliveryWindow(order_id=7, product_type="circuit_board", deadline=90, reward_value=8.0),
DeliveryWindow(order_id=8, product_type="solar_array", deadline=100, reward_value=10.0),
DeliveryWindow(order_id=9, product_type="fuel_cell", deadline=110, reward_value=8.0),
DeliveryWindow(order_id=10, product_type="habitat_unit", deadline=118, reward_value=12.0),
]
min_production_runs = 8
min_assemblies = 4
min_deliveries = 6
min_energy_final = 25.0
max_invalid_actions = 8
class HardTask(Task):
name = "hard"
num_platforms = 6
max_steps = 240
seed = 303
description = "Power pressure, multi-platform coordination, 20 orders, strict grading."
solar_zones = {
"zone_a": 0.9,
"zone_b": 0.2,
"zone_c": 0.6,
"zone_d": 0.4,
"zone_e": 0.7,
"zone_f": 0.3,
}
pending_orders = [
PendingOrder(order_id=i, product_type=pt, requires_assembly=asm)
for i, (pt, asm) in enumerate(
[
("alloy_panel", False),
("circuit_board", False),
("solar_array", True),
("fuel_cell", False),
("thruster_module", True),
("habitat_unit", True),
("alloy_panel", False),
("circuit_board", False),
("solar_array", True),
("fuel_cell", False),
("thruster_module", True),
("alloy_panel", False),
("circuit_board", False),
("habitat_unit", True),
("fuel_cell", False),
("solar_array", True),
("alloy_panel", False),
("thruster_module", True),
("circuit_board", False),
("habitat_unit", True),
],
start=1,
)
]
delivery_windows = [
DeliveryWindow(order_id=i, product_type=pt, deadline=dl, reward_value=rv)
for i, pt, dl, rv in [
(1, "alloy_panel", 20, 8.0),
(2, "circuit_board", 35, 8.0),
(3, "solar_array", 50, 10.0),
(4, "fuel_cell", 60, 8.0),
(5, "thruster_module", 70, 10.0),
(6, "habitat_unit", 85, 12.0),
(7, "alloy_panel", 90, 8.0),
(8, "circuit_board", 100, 8.0),
(9, "solar_array", 110, 10.0),
(10, "fuel_cell", 115, 8.0),
(11, "thruster_module", 125, 10.0),
(12, "alloy_panel", 135, 8.0),
(13, "circuit_board", 145, 8.0),
(14, "habitat_unit", 155, 12.0),
(15, "fuel_cell", 160, 8.0),
(16, "solar_array", 175, 10.0),
(17, "alloy_panel", 185, 8.0),
(18, "thruster_module", 200, 10.0),
(19, "circuit_board", 215, 8.0),
(20, "habitat_unit", 235, 12.0),
]
]
min_production_runs = 16
min_assemblies = 10
min_deliveries = 14
min_energy_final = 15.0
max_invalid_actions = 12
TASK_REGISTRY: Dict[str, Task] = {
"easy": EasyTask(),
"medium": MediumTask(),
"hard": HardTask(),
}
|