LoslegenKostenlos loslegen

Decision variables of case study

Continue the case study of the Capacitated Plant Location model of a car manufacture. You are given four Pandas data frames demand, var_cost, fix_cost, and cap containing the regional demand (thous. of cars), variable production costs (thous. $US), fixed production costs (thous. $US), and production capacity (thous. of cars). All these variables have been printed to the console for your viewing.

Diese Übung ist Teil des Kurses

Supply Chain Analytics in Python

Kurs anzeigen

Anleitung zur Übung

  • Initialize the class.
  • Define the decision variables using LpVariable.dicts and python's list comprehension.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Initialize Class
model = LpProblem("Capacitated Plant Location Model", ____)

# Define Decision Variables
loc = ['USA', 'Germany', 'Japan', 'Brazil', 'India']
size = ['Low_Cap','High_Cap']
x = LpVariable.dicts("production_",
                     [(i,j) for ____ in ____ for ____ in ____],
                     lowBound=____, upBound=____, cat=_____)
y = LpVariable.dicts("plant_", 
                     [____ for ____ in ____ for ____ in ____], cat=____)
Code bearbeiten und ausführen