alirezaaminzadeh's picture
Publish Gradio console bundle
ab849c9 verified
Raw
History Blame Contribute Delete
7.09 kB
"""Configuration constants for the Optimization Operating System."""
from __future__ import annotations
ENGINE_VERSION = "1.0.0"
PRODUCT_NAME = "Optimization Operating System"
PROBLEM_TYPES = {
"scheduling": {
"label": "Job Shop Scheduling",
"category": "scheduling",
"description": "Assign operations to machines minimizing makespan under precedence constraints.",
"default_size": "medium",
"objective": "minimize",
},
"routing": {
"label": "Vehicle Routing (VRP)",
"category": "routing",
"description": "Route a fleet from depot to customers with capacity and distance minimization.",
"default_size": "medium",
"objective": "minimize",
},
"assignment": {
"label": "Assignment Problem",
"category": "assignment",
"description": "Assign agents to tasks minimizing total assignment cost.",
"default_size": "medium",
"objective": "minimize",
},
"inventory": {
"label": "Inventory Replenishment",
"category": "inventory",
"description": "Determine order quantities minimizing holding + stockout cost over a horizon.",
"default_size": "medium",
"objective": "minimize",
},
"facility_location": {
"label": "Facility Location",
"category": "network",
"description": "Open facilities and assign customers minimizing fixed + transport cost.",
"default_size": "medium",
"objective": "minimize",
},
"packing": {
"label": "Bin Packing",
"category": "packing",
"description": "Pack items into minimum bins without exceeding capacity.",
"default_size": "medium",
"objective": "minimize",
},
}
SIZE_PRESETS = {
"small": {"scale": 0.55, "time_limit_sec": 5, "label": "Small"},
"medium": {"scale": 1.0, "time_limit_sec": 12, "label": "Medium"},
"large": {"scale": 1.6, "time_limit_sec": 25, "label": "Large"},
"dynamic": {"scale": 1.0, "time_limit_sec": 15, "label": "Dynamic"},
"stochastic": {"scale": 1.0, "time_limit_sec": 15, "label": "Stochastic"},
}
METHOD_CATEGORIES = {
"baseline": {
"label": "Baseline Heuristic",
"description": "Simple rule-based methods (FCFS, greedy, nearest, EDD).",
},
"exact": {
"label": "Exact Optimization",
"description": "MIP, CP-SAT, or convex formulations with optimality guarantees.",
},
"scalable": {
"label": "Scalable Metaheuristic",
"description": "Local search, ALNS, or genetic algorithms for larger instances.",
},
"robust": {
"label": "Robust / Dynamic",
"description": "Rolling horizon, scenario optimization, or simulation-based planning.",
},
}
METHODS = {
"scheduling": {
"baseline": {"id": "spt_baseline", "label": "Shortest Processing Time (SPT)"},
"exact": {"id": "cp_sat_scheduling", "label": "CP-SAT Job Shop"},
"scalable": {"id": "ga_scheduling", "label": "Genetic Algorithm"},
"robust": {"id": "rolling_horizon_scheduling", "label": "Rolling Horizon"},
},
"routing": {
"baseline": {"id": "nearest_depot", "label": "Nearest Warehouse Greedy"},
"exact": {"id": "cp_sat_routing", "label": "CP-SAT Routing"},
"scalable": {"id": "alns_routing", "label": "ALNS Routing"},
"robust": {"id": "scenario_routing", "label": "Scenario Robust Routing"},
},
"assignment": {
"baseline": {"id": "greedy_assignment", "label": "Greedy Assignment"},
"exact": {"id": "highs_assignment", "label": "HiGHS MIP Assignment"},
"scalable": {"id": "local_search_assignment", "label": "Local Search"},
"robust": {"id": "stochastic_assignment", "label": "Stochastic Assignment"},
},
"inventory": {
"baseline": {"id": "reorder_point", "label": "Reorder Point Heuristic"},
"exact": {"id": "cp_sat_inventory", "label": "CP-SAT Inventory MIP"},
"scalable": {"id": "decomposition_inventory", "label": "Rolling Decomposition"},
"robust": {"id": "simulation_inventory", "label": "Simulation-Based Optimization"},
},
"facility_location": {
"baseline": {"id": "nearest_facility", "label": "Nearest Facility Greedy"},
"exact": {"id": "cbc_facility", "label": "CBC Facility MIP"},
"scalable": {"id": "ga_facility", "label": "GA Facility Selection"},
"robust": {"id": "scenario_facility", "label": "Scenario Robust Location"},
},
"packing": {
"baseline": {"id": "first_fit_decreasing", "label": "First Fit Decreasing"},
"exact": {"id": "cp_sat_packing", "label": "CP-SAT Bin Packing"},
"scalable": {"id": "alns_packing", "label": "ALNS Packing"},
"robust": {"id": "dynamic_packing", "label": "Dynamic Item Arrival"},
},
}
SOLVERS = {
"highs": {
"label": "HiGHS",
"engine": "highspy",
"available": True,
"license": "MIT",
"strengths": ["LP/MIP", "fast LP root", "open source"],
},
"cbc": {
"label": "CBC (PuLP)",
"engine": "pulp",
"available": True,
"license": "EPL",
"strengths": ["MIP", "general purpose"],
},
"cp_sat": {
"label": "OR-Tools CP-SAT",
"engine": "ortools",
"available": True,
"license": "Apache-2.0",
"strengths": ["CP", "scheduling", "routing"],
},
"scip": {
"label": "SCIP",
"engine": "scip",
"available": False,
"license": "Academic/Commercial",
"strengths": ["MIP", "branch-and-cut"],
},
"gurobi": {
"label": "Gurobi",
"engine": "gurobi",
"available": False,
"license": "Commercial",
"strengths": ["MIP", "industrial speed"],
},
"heuristic": {
"label": "Heuristic Engine",
"engine": "native",
"available": True,
"license": "MIT",
"strengths": ["fast", "scalable", "anytime"],
},
}
SOLVER_CONFIGS = {
"highs": {"presolve": "on", "threads": 2, "mip_rel_gap": 0.02},
"cbc": {"presolve": "on", "cuts": "on", "heuristics": "on"},
"cp_sat": {"num_search_workers": 4, "log_search_progress": False},
"scip": {"presolving": True, "separating": True},
"gurobi": {"Presolve": 2, "MIPFocus": 1},
"heuristic": {"max_iterations": 500, "seed": 42},
}
SCENARIO_TYPES = {
"capacity_change": {"label": "Capacity Change", "factor_range": (0.6, 1.4)},
"demand_shift": {"label": "Demand Shift", "factor_range": (0.7, 1.5)},
"resource_removal": {"label": "Resource Removal", "pct_range": (0.05, 0.25)},
"cost_increase": {"label": "Cost Increase", "factor_range": (1.1, 2.0)},
"network_disruption": {"label": "Network Disruption", "pct_range": (0.1, 0.3)},
}
METRICS = [
"objective_value",
"best_bound",
"optimality_gap",
"elapsed_time_sec",
"iterations",
"constraint_violations",
"feasible",
"status",
]