BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Introduction to Optimization in Python

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# 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}')
Kodu Düzenle ve Çalıştır