Q1. If bicycles of types A and H are produced, then bicycles of type C can be produced with 20% shorter working hours, while selling profit of bicycles type H can be 20% higher.
Q2: If bicycles of types B and G are produced, then a minimum of one of the types C and F should be produced, however, total personnel requirements should not exceed 180 hours.
Bicycle_Production:
# Data
types = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
profits = [45, 100, 65, 80, 120, 95, 70, 30]
working_hours = [20.5, 13.5, 15.0, 16.5, 24.0, 32.0, 25.5, 19.0]
steel_mass = [14.5, 22.0, 13.0, 8.0, 16.5, 9.5, 21.0, 18.5]
rental_costs = [1000, 1200, 2000, 1400, 2500, 2100, 1800, 1100]
max_hours = 200
max_steel = 770
max_rental_cost = 3500
# Decision variables
x = LpVariable.dicts("Number_of_Bicycles", types, lowBound=0, cat='Integer')
y = LpVariable.dicts("Chosen", types, cat='Binary')
# Objective function
problem += lpSum([profits[i] * x[types[i]] for i in range(len(types))]), "Total_Profit"
# Constraints
problem += lpSum([working_hours[i] * x[types[i]] for i in range(len(types))]) <= max_hours, "Working_Hours_Constraint"
problem += lpSum([steel_mass[i] * x[types[i]] for i in range(len(types))]) <= max_steel, "Steel_Mass_Constraint"
problem += lpSum([rental_costs[i] * y[types[i]] for i in range(len(types))]) <= max_rental_cost, "Rental_Costs_Constraint"
#Linking constraints
for i in range(len(types)):
problem += x[types[i]] <= 1000 * y[types[i]], f"Linking_Constraint_{types[i]}"