linear programming through solver tool in excel

Upload: ami402t

Post on 09-Apr-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    1/16

    Example of Using Solver in Excel

    You may want to solve a system of nonlinear equations in your homework. You can dothis in a wide variety of ways, but a simple way to find a solution is to use MicrosoftExcel's Solver tool. Be warned that Solver is NOT a very robust tool and may fail to findsolutions! In general, finding roots to nonlinear functions is a very difficult problem.Excel does a poor job compared to more powerful programs such as Matlab, but it willsuffice for simple problems.

    As a very simple example, let's suppose you want to solve a system of linear equationsusing Solver. (This is a bad idea, because there are exact methods for linear equations,

    but this is just an example.) Consider

    3 x + y + 2 = 0 x + 2 y + 5 = 0

    We can use linear algebra to find the solution, which is x = 0.2, y = -2.6. You can use theSolver tool in Excel to find the solution to the above equations.

    Example:

    There is person who has 4 investment options as under:Option1: Interest rate 15% per year Option2: Interest rate 12.5% per year Option3: Interest rate 11.8% per year Option4: Interest rate 13% per year

    He has a total sum of Rs. 2000000 (Twenty Lakhs) available for investment for this year.But these options have some limitations or rules which need to be followed:

    Options Minimum investment whichneeds to be done

    Maximum Investmentwhich can be done

    Option1 50000 500000Option2 200000 1000000Option3 500000 1000000Option4 300000 1250000

    How much amount should he invest for the year in each option to maximize his returns?

    Solution:

    This is a typical optimization problem in which there is an aim and some constraints andsome values which u need to find.One way is hit & trial : Other is use Linear Programming techniqueMathematically there is a manual Linear programming technique called simplex method

    by which this can be solved. But since we already have so many software tools where this

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    2/16

    logic is already built there is no need to do it manuallywe can use excels solver tool tosolve this.

    First understand the solution logic:

    Objective Function:Maximize Total Return R = (R1+R2+R3+R4)

    Where R1 = return from Option 1 investmentAssume he invested X1 amount in option1So return would be R1 = 0.15*X1 (15% multiplied by X1, 15% means 15/100 = 0.15)

    Similarly,R2 = return from Option 1 investmentAssume he invested X2 amount in option2return would be R2 = 0.125*X2 (12.5% multiplied by X2)

    Similarly,R3 = return from Option 3 investmentAssume we invested X3 amount in option3return would be R3 = 0.118*X3 (11.8% multiplied by X3)

    Similarly,R4 = return from Option 4 investmentAssume he invested X4 amount in option4return would be R4 = 0.13*X4 (13% multiplied by X4)

    So mathematically Objective function isMax R = 0.15*X1 + 0.125*X2 + 0.118*X3 + 0.13*X4

    Constraints:

    1. Total invested amount cannot be more than Twenty Lakhs (which he has)Mathematically this means: X1+X2+X3+X4

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    3/16

    Now we need to simply put this model in Excel Solver like the process shown below &get the results:

    Please find attached the excel sheet at the end

    After this go to Tools select solver as shown:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    4/16

    To get a screen like this:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    5/16

    Select target cell as your objective function formula cell i.e Cell number C10 and alsoand click on MAX field (since u want to maximize returns)As under:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    6/16

    Then select all the changing cells cells for which you want the values to becalculated i.e. the X1,X2,X3,X4 values cells which are : C4, C5, C6, C7 (NOTE:changing cells will never have any formula) as shown under:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    7/16

    Then go in the field: Subject To Constraints and click on the Add button for adding the constraints we defined as shown:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    8/16

    Put constraint value for cell C4. As you know that Investment 1 (X1) should be

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    9/16

    Then again press the add button to add all constraints similarly. You can change theinequality sign by clicking on the arrow key provided in that field & selectingappropriate inequality as under:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    10/16

    similarly put all constraints and after putting the last constraint, click on OK as under:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    11/16

    click ok to get the following screen:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    12/16

    Now click on options to get the following screen

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    13/16

    Check the Assume Non-Negative box and click on OK(in this problem there is noneed as told earlier). As u do this u again reach the following screen automatically:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    14/16

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    15/16

    You can see that Solver has found the values for X1,X2,X3 & X4 and accordinglyyour objective function is also maximized to value of Rs. 480500

    Click on OK and you get the following screen:

  • 8/8/2019 Linear Programming Through Solver Tool in Excel

    16/16

    Solver

    ************************************************************************