ComenzarEmpieza gratis

Adjusting MILP

The gown and tuxedo firm have adjusted some aspects of their business and need you to optimize for profit based on the new structure.

The profit formula was \(545g + 330t\), where \(g\) are the gowns, and \(t\) are the tuxedos. The constraints are the same: \(6g+4t<=40\), \(3g+t<=20\)

The firm wants to increase their tuxedo profit by 10%, and Mr. S can now only work 30 hours per week.

milp, LinearConstraint and Bounds have been loaded for you.

Este ejercicio forma parte del curso

Introduction to Optimization in Python

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

# Adjust the objective
result = milp([____, ____],
              integrality=[1, 1],
              bounds=Bounds([0, 0], [20, 12]), 
              constraints=LinearConstraint([[6, 4], [3, 1]], ub=[40, 20]))

print(result.message)
print(f'The optimal number of gowns produced is: {result.x[0]:.2f}')
print(f'The optimal number of tuxedos produced is: {result.x[1]:.2f}')
print(f'The firm made: ${-result.fun:.2f}')
Editar y ejecutar código