aps-agent/server/engines/__init__.py

24 lines
1014 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ============================================================
# 排产引擎包(moduleId: server-engines, 可重生 ✅)
# RULE;CP = OR-Tools;HYBRID = RULE 热启动 + CP 改良;GA 仍 RULE 代跑留痕
# ============================================================
from server.engines.base import EngineParams, ISchedulingEngine
from server.engines.rule_engine import RuleEngine
from server.engines.pool_engine import PoolEngine
from server.engines.cp_engine import CpSatEngine, HybridEngine
__all__ = [
"EngineParams", "ISchedulingEngine", "RuleEngine", "PoolEngine",
"CpSatEngine", "HybridEngine", "get_engine",
]
def get_engine(engine_type: str) -> ISchedulingEngine:
"""引擎工厂:CP / HYBRID 真管线;GA 仍由 RULE 代跑并留 engineType。"""
kind = (engine_type or "RULE").upper()
if kind == "CP":
return CpSatEngine()
if kind == "HYBRID":
return HybridEngine()
return RuleEngine(requested_type=kind if kind in ("RULE", "GA") else "RULE")