Introduction to Prescriptive AI by Akshay Kulkarni & Adarsha Shivananda & Avinash Manure

Introduction to Prescriptive AI by Akshay Kulkarni & Adarsha Shivananda & Avinash Manure

Author:Akshay Kulkarni & Adarsha Shivananda & Avinash Manure
Language: eng
Format: epub
ISBN: 9781484295687
Publisher: Apress


Step 3: Adding constraints[In]: opt_model += (lpSum(x.values()) <= 45, "Manpower")

[In]: opt_model += (6 * x[1] + 4 * x[2] + 2 * x[3] <= 100, "Wood Pulp")

[In]: opt_model += (2 * x[2] + 4 * x[3] + 6 * x[4] <= 75, "Fiber")

Step 4: Setting the objective function[In]: opt_model += (10 * x[1] + 11 * x[2] + 8 * x[3] + 12.5 * x[4], "Objective Function")

Step 5: Utilizing the default solver method for solving the given optimization problem[In]: status = opt_model.solve()

Step 6: Getting the results[In]: print(f"status: {opt_model.status}, {LpStatus[opt_model.status]}")

[In]: print(f"objective: {opt_model.objective.value()}")

[In]: for var in x.values():

print(f"{var.name}: {var.value()}")

[In]: for name, constraint in opt_model.constraints.items():

print(f"{name}: {constraint.value()}")



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.