Question: from scipy.optimize import linprog # Coefficients of the objective function for each goal ( negated because linprog minimizes ) c = [ 1 , 2

from scipy.optimize import linprog
# Coefficients of the objective function for each goal (negated because linprog minimizes)
c =[1,2,3] # Priorities for the three goals
# Coefficients of the constraints
# Labor hours constraint
A_eq =[[2,2,1]] # Coefficients of T, R, U
b_eq =[10000] # Right-hand side of the constraint
# Material supply constraints
A_ub =[[-2,-3,-4], # Coefficients of T, R, U for plastic
[-1,-1,-2], # Coefficients of T, R, U for rubber
[-2,-1,0]] # Coefficients of T, R, U for metal
b_ub =[-16000,-5000,-9000] # Right-hand side of the constraints
# Budget constraint
c_budget =[7,5,4] # Cost of producing one tank, truck, and turtle respectively
A_budget =[c_budget]
b_budget =[164000]
# Labor hour utilization constraint
A_labor =[[2,2,1]] # Coefficients of T, R, U
b_labor =[250*40] # Total available labor hours
# Bounds for each variable
bounds =[(0, None),(0, None),(0, None)] # Non-negative constraints for T, R, U
# Solve the linear program
result = linprog(c, A_eq=A_eq, b_eq=b_eq, A_ub=A_ub, b_ub=b_ub, bounds=bounds, method='highs')
# Print the results
print("Optimal number of tanks to produce:", round(result.x[0]))
print("Optimal number of trucks to produce:", round(result.x[1]))
print("Optimal number of turtles to produce:", round(result.x[2]))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!