File size: 7,088 Bytes
ab849c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
182
183
184
185
186
187
188
189
190
191
"""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",
]