REPOSITORY
ontariotech/task-allocation Private
[참조 MVP] 다중 농기계 작업 배분 A-SW — 농기계 용량을 고려해 작업구역을 예상 완료시간이 최소가 되도록 배분합니다.
https://git.agrithing.ai/ontariotech/task-allocation.git e513f8a feat: adopt python SERVICE SDV reference implementation
9619a21 feat: adopt python SERVICE SDV reference implementation
9089584 ci: add language-specific static and dynamic analysis
3bf8432 docs: define component scope and interface contract
8da6f7a ci: verify contract tests and evidence package
9d1acf5 feat: add executable reference MVP
9a07d04 docs: define component scope and interface contract
2 items · main
·/ asw_component/component.py
python · 897 B · 1e634fc Download
from __future__ import annotationsdef execute(payload: dict) -> dict: machines = [{**item, "assigned_workload": 0.0, "tasks": []} for item in payload.get("machines", [])] if not machines or any(float(m["capacity"]) <= 0 for m in machines): raise ValueError("positive-capacity machines are required") for task in sorted(payload.get("tasks", []), key=lambda item: float(item["workload"]), reverse=True): machine = min(machines, key=lambda item: item["assigned_workload"] / float(item["capacity"])) machine["tasks"].append(task["id"]) machine["assigned_workload"] += float(task["workload"]) allocations = [{"machine_id": m["id"], "tasks": m["tasks"], "estimated_time": round(m["assigned_workload"] / float(m["capacity"]), 3)} for m in machines] return {"allocations": allocations, "makespan": max(item["estimated_time"] for item in allocations)}