An LP model is expressed in terms of its technology matrix (A), RHS vector(b), and cost vector (c) in an Excel file named 'Params.xlsx'
An LP model is expressed in terms of its technology matrix (A), RHS vector(b), and cost vector (c) in an Excel file named 'Params.xlsx' with 3 sheets (attached). We would like to minimize the objective function. Write a Python code (or any other programming language) in Jupyter notebook that does the following steps: 1. Read each sheet of the Excel file and create A, b, and c. 2. Define a function called 'Min-Vector'. This function declares the model, adds all the decision variables and constraints to it, sets the objective, and writes the model into a file called 'Primal.lp'. Name your variables r in this function. 3. Solve the model. 4. Define another function called 'print_solution' which takes a model as input, and prints all the decision variables that have a positive optimal value next to their names. It also prints the optimal value of the objective function. 5. Define another function called 'Max-Vector' with all the functionalities of the 'Min-Vector' function. This 'Max Vector function should solve the dual of the original problem defined by A, b, and c. Name your variables in this function and write the model into a file called 'Dual.lp'. 6. Solve the dual model. 7. Use the 'print solution' function that you previously defined to print the solutions of the dual model. Verify that the optimal value of the objective function is equal for the primal and dual models. Use Markdown cells to put some explanation before every code cell that you use in Jupyter notebook. Submit your Jupyter notebook file along with your primal.lp and dual.lp files.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Step 1 Reading Data from Excel In this step well read the data from the Excel file and create matrices A b and c import pandas as pd Read data from Ex...See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started