Nebenbedingungen der Fallstudien-Übung
Führe die Fallstudie zum Capacitated-Plant-Location-Modell eines Autoherstellers fort. Du bekommst vier Pandas-DataFrames demand, var_cost, fix_cost und cap, die die regionale Nachfrage (Tsd. Fahrzeuge), variablen Produktionskosten (Tsd. US-\(), fixen Produktionskosten (Tsd. US-\)) und Produktionskapazitäten (Tsd. Fahrzeuge) enthalten. Außerdem wurden zwei Python-Listen loc und size erstellt, die die verschiedenen Standorte und die zwei Typen von Werkskapazitäten enthalten. Alle diese Variablen wurden zur Ansicht in die Konsole gedruckt. Der Code zum Initialisieren der Entscheidungsvariablen, zu ihrer Definition und zur Erstellung der Zielfunktion ist bereits für dich fertiggestellt.
Diese Übung ist Teil des Kurses
<Kurs>Supply Chain Analytics mit Python</Kurs>Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Initialize, Define Decision Vars., and Objective Function
model = LpProblem("Capacitated Plant Location Model", LpMinimize)
loc = ['USA', 'Germany', 'Japan', 'Brazil', 'India']
size = ['Low_Cap','High_Cap']
x = LpVariable.dicts("production_", [(i,j) for i in loc for j in loc],
lowBound=0, upBound=None, cat='Continuous')
y = LpVariable.dicts("plant_",
[(i,s) for s in size for i in loc], cat='Binary')
model += (lpSum([fix_cost.loc[i,s] * y[(i,s)] for s in size for i in loc])
+ lpSum([var_cost.loc[i,j] * x[(i,j)] for i in loc for j in loc]))
# Define the constraints
for j in loc:
model += lpSum([____ for i in ____]) ____ demand.loc[____,'Dmd']