excel solver

Attribution Non-Commercial (BY-NC)

46 views

excel solver

Attribution Non-Commercial (BY-NC)

- Annual_Appraisal_2010-2011_Evaluation_For_Prashant_Prakash
- AeroDyn
- Basic Stored Procedure
- PythonReference_en.pdf
- Excel DATEDIF Function
- C03 - Type Design V2-1
- PPT_BW4.pdf
- C Subjective Question
- PL7 Reference Manual 1
- ABAP_4 Programming.pdf
- Https Doc 08 a4 Apps Viewer.googleusercontent
- Apps Form Dev Elopement Guide
- Ku Servo
- Simqke2.Ps
- Plaxis
- intelfor_prglangref
- 5. 100 Theory Qbasic Modular Programming File Handling and C Language Ques(1)
- Biz Days
- em_C_code_for_IOCs
- Spreadsheetstories Sample

You are on page 1of 4

Microsoft Excels Solver add-in provides a powerful tool for solving complex problems that involve multiple variables subject to multiple constraints. The Solver add-in is contained in a file named SOLVER.XLA, which by default is stored in the \EXCEL\LIBRARY\SOLVER directory (assuming that \EXCEL is the directory in which you have installed Excel). You can use Solver manually from a worksheet by selecting the Add-Ins command from the Tools menu of the worksheet menubar and then selecting Solver Add-In. After loading the Solver add-in, Excel will add a Solver command to the Tools menu, allowing you to access Solver functionality. You can also access Solver through a VBA routine, as will be discussed later in this appendix.

Before you begin programming with Solver, its important to understand exactly how Solver works. In general, the task of solving a problem that includes multiple variables can be broken down into the following steps: 1. Identify the desired value for a single target cell. (objective function) 2. Identify the cells that can be changed to reach the desired target. (decision variables) 3. Specify constraints that will be adhered to in solving the problem. 4. Define parameters of the model or the way in which the problem will be solved. (options in Solver, such as Tolerance, Assume Linear Model, etc.) 5. Solve the problem. 6. Report the results. 7. Save the values of the variable cells as a scenario. Lets look at an example to see how Solver can help you solve LP problems. Wellington Cycle Works makes three models of racing bicycles: Titan1, Titan2, Titan3. Wellington contracts manufacturing of these bicycles to three independent companies: A, B, and C. Each company is capable of making each of the three models of racing bikes. However, because the different companies have different equipment, their costs differ in making the three models of bikes. The table below shows what each company charges Wellington for each bicycle: Company A B C Titan1 $20 $25 $27 Titan2 $37 $22 $33 Titan3 $40 $50 $48

Lets assume that each manufacturing company can produce only 100 bicycles a month, no matter which model of bicycle is produced. Lets also assume that there is an unlimited demand for bicycles and that Wellington can sell a Titan1 bike for $40, a Titan2 for $50, and a Titan3 for $60. In order to maximize profits, how many of each type of bicycle should Wellington order from each of the three manufacturing companies? This is a rather straightforward example of a common type of LP problem that requires a bit of thought to solve. However, Solver is well suited for solving these types of problems. To solve this problem, we would set up a table on an Excel worksheet that might look like the one on the following page. After building the table, we would then identify three aspects of the problem: the target cell, the variable cells, and the constraints. The target cell would be the last cell in the lower right corner of the table, labeled "Total Profit"; we want to maximize the value in this cell. The variable cells would be the units for the Titan1, Titan2, and Titan3 bicycles in Range(B7:D9). Three constraints would be used in solving this problem: Total units for each company in column E must be less than or equal to 100. Units for each bicycle for each company in Range(B7:D9) must be greater than or equal to 0. Units for each bicycle for each company in Range(B7:D9) must be integers. 162698847.doc

2 Next we could use Solver to specify the information listed above and to solve the problem. After running Solver on the above model, we see these results:

Solver example table solved This solution is only one of many that will provide the maximum profit of $6,500. You might want to try duplicating the table above in Excel and experimenting with Solver manually before you move on to the programming topics that follow.

The Solver add-in provides 13 functions that can be called from a VBA macro for solving multi-variable problems. To access Solver functions from a VBA module, you must first establish a reference to the SOLVER.XLA add-in by selecting the References command from the Tools menu on the VBA module menubar and then selecting SOLVER.XLA (in the \EXCEL\LIBRARY\SOLVER directory or wherever the Solver add-in file is located) . All Solver functions can be viewed from the Object Browser. You can obtain help on Solver functions through the equivalent Solver commands in the XLM function reference in Excels general online Help. The Solver functions that can be called from VBA are listed here.

SolverAdd:

Adds constraints to a Solver model. Takes three arguments: cellRefReference to a cell or a range of cells that forms the left side of a constraint. relation1 (<=), 2 (=), 3 (>=), or 4. (Cells referenced by cellRef must contain integers.) formulaTextRight side of the constraint.

SolverChange:

Changes an existing constraint. Takes three arguments: cellRefReference to a cell or a range of cells that forms the left side of a constraint. relation1 (<=), 2 (=), 3 (>=), or 4. (Cells referenced by cellRef must contain integers.) formulaTextRight side of the constraint.

SolverDelete:

Deletes an existing constraint. Takes three arguments: cellRefReference to a cell or a range of cells that forms the left side of a constraint. relation1 (<=), 2 (=), 3 (>=), or 4. (Cells referenced by cellRef must contain integers.) formulaTextRight side of the constraint.

SolverFinish:

After solving a problem, tells Excel to keep the results and to create a report. Takes two arguments: keepFinal1 - keep final results; or 2 - discard results and return to original values. reportArray1 - create an Answer report; 2 - create a Sensitivity report; or 3 - create a Limit report.

SolverFinishDialog:

Equivalent to SolverFinish; however, also displays the Solver Results dialog box after solving a problem. Takes two arguments: keepFinal1 - keep final results; or 2 - discard results and return to original values. reportArray1 - create an Answer report; 2 - create a Sensitivity report; or 3 - create a Limit report.

SolverGet:

Returns information about the Solver model. Takes two arguments: typeNumTakes values from 1 through 18 to return information about the Solver model. For details, use the Object Browser to view the SolverGet help topic in the XLM Function Reference section in Excel 5s online Help. sheetNameName of the sheet containing the Solver model.

SolverLoad:

Loads parameters for an existing Solver model that have been saved to the worksheet. Takes one argument: loadAreaRange on the active sheet that contains the Solver model.

SolverOk:

Defines a Solver model. Takes four arguments: setCellTarget cell for the Solver model. maxMinVal1 - maximize target; 2 - minimize target; 3 - match target to a specific value. valueOfIf the maxMinVal argument is set to 3, you must specify the value to which the target cell is to be matched. byChangeCell or range of cells that will be changed in setting the target cell.

SolverOkDialog:

Same as SolverOk but also displays the Solver dialog box. Takes four arguments: setCellTarget cell for the Solver model. maxMinVal1 - maximize target; 2 - minimize target; 3 - match target to a specific value. valueOfIf the maxMinVal argument is set to 3, you must specify the value to which the target cell is to be matched. byChangeCell or range of cells that will be changed in setting the target cell. Application.Run "SolverOptions", 3000, 200, 0.000001, False, False, 1, 1, 1, 5, False, 0.0001, False

SolverOptions:

Allows you to specify advanced options for your Solver model. Takes 10 arguments: maxTimeMaximum time Excel will spend solving the problem. iterationsMaximum iterations Excel will use in solving the problem. precisionNumber between 0 and 1 that specifies the degree of precision to be used in solving the problem. assumeLinearIf True, Solver assumes that the underlying model is linear. stepThruIf True, Solver pauses at each trial solution. estimates1 for tangent estimates; 2 for quadratic estimates. derivatives1 for forward; 2 for central. search1 for Quasi-Newton search; 2 for Conjugate Gradient search. intToleranceNumber between 0 and 1 that specifies tolerance. scalingIf Scaling is True and two or more constraints differ by several orders of magnitude, Solver scales the constraints to similar orders of magnitude during computation.

SolverReset:

Resets Solver options (cell selections and constraints in the Solver Parameters dialog box and all settings in the Solver Options dialog box) to their default values.

SolverSave:

Saves a Solver model definition to a range of cells on the worksheet. Takes one argument: saveAreaThe range of cells to which the Solver model is to be saved.

SolverSolve:

Starts a Solver solution run. Takes two arguments: userFinishIf True, Solver returns results without displaying anything. If False, Solver returns results and displays the Solver Results dialog box. showRefThis argument is used only if True is passed for the stepThru argument of the SolverOptions function. If so, you can pass the name of a subroutine (as a string) as the showRef argumentthis routine will be called whenever Solver returns an intermediate solution.

A Sample Routine

The following routine is an example of how you might use Solver to solve the problem presented earlier (this subroutine was generated using the Macro Recorder in Excel):

Sub WellingtonBicycles() SolverOk SetCell:="$G$19", MaxMinVal:=1, ValueOf:="0", ByChange:="$B$7:$D$9" SolverAdd CellRef:="$B$7:$D$9", Relation:=3, FormulaText:="0" SolverAdd CellRef:="$B$7:$D$9", Relation:=4, FormulaText:="integer" SolverAdd CellRef:="$E$7:$E$9", Relation:=1, FormulaText:="100" SolverOk SetCell:="$G$19", MaxMinVal:=1, ValueOf:="0", ByChange:="$B$7:$D$9" SolverOptions MaxTime:=100, Iterations:=100, Precision:=0.000001, AssumeLinear _ :=True, StepThru:=False, Estimates:=1, Derivatives:=1, SearchOption:=1, _ IntTolerance:=0, Scaling:=False, Convergence:=0.001, AssumeNonNeg:=False SolverSolve End Sub

- Annual_Appraisal_2010-2011_Evaluation_For_Prashant_PrakashUploaded byPrashant Prakash
- AeroDynUploaded by김호건
- Basic Stored ProcedureUploaded byapi-3852142
- PythonReference_en.pdfUploaded byMax Chernev
- Excel DATEDIF FunctionUploaded byanthony_obiora
- C03 - Type Design V2-1Uploaded byzvonkomihajlovic4891
- PPT_BW4.pdfUploaded byMartinez Velazquez
- C Subjective QuestionUploaded byPrashant Yadav
- PL7 Reference Manual 1Uploaded byLê Duy Tấn
- ABAP_4 Programming.pdfUploaded byShiva Annaldas
- Https Doc 08 a4 Apps Viewer.googleusercontentUploaded byRoberto Asencion Alcantar
- Apps Form Dev Elopement GuideUploaded bysridhar_vishwanath
- Ku ServoUploaded byJoaquim Martins
- Simqke2.PsUploaded byAdemar Cardoso
- PlaxisUploaded byKent Hernando
- intelfor_prglangrefUploaded byaresendep
- 5. 100 Theory Qbasic Modular Programming File Handling and C Language Ques(1)Uploaded byJoseph Israel
- Biz DaysUploaded byFibrin Yang Uelek's
- em_C_code_for_IOCsUploaded byTamilarasan M
- Spreadsheetstories SampleUploaded byroi_marketing
- Inter SciUploaded bylordtalg
- Ugwu Leaf and Its PotentialsUploaded byYese Solomon
- Avi Paf Project.an Paf ModelUploaded bysatishkrishnar
- Tutorail External Application Checks 2009Uploaded bybogdanescu16
- Fortran-guide.pdfUploaded bybourneremembers
- TREF1_enUploaded byJose Luna
- 9Add on InstructionUploaded byShahid Hussain
- JF_2_3_ProjectUploaded byAndikaWiraSatria
- En FW 800StdPrg RevCUploaded byyasararafat1
- cfuncUploaded byapi-394738731

- Investment Advisor GuideUploaded bypoopoosingh
- Credit BubbleUploaded bypoopoosingh
- Liquidity ServicesUploaded bypoopoosingh
- CA MuniUploaded bypoopoosingh
- Investment Advisor RulesUploaded bypoopoosingh
- Investment PhilosophyUploaded bypoopoosingh
- PFMTUploaded bypoopoosingh
- PaulsonUploaded bypoopoosingh
- RIAUploaded bypoopoosingh
- Kalman FilterUploaded byDebi Prosad Dogra
- Lakers EliminationUploaded bypoopoosingh
- Cost of EquityUploaded bypoopoosingh
- gund_delUploaded bypoopoosingh
- ShillingUploaded bypoopoosingh
- And the Money Kept Rolling InUploaded bypoopoosingh
- TheWireUploaded bypoopoosingh
- fw9Uploaded byCandace Sheets

- ChangesUploaded byPavan
- Secaudit.cUploaded byscriber
- BPMN by ExamplesUploaded byraj_esh_0201
- Realhowto javascriptUploaded byThanh Dq
- Guia_examen_ABAP_fin[1]Uploaded byINGARAUJO
- REXXTOOLS V7 Basic ServicesUploaded byrobertbernard
- Oracle PL-SQL Training Document.pdfUploaded byRodrigo Teles
- Bug_24301381Uploaded byMohamed Zaki
- cmake list for cmangos zeroUploaded byRifhadm
- CSYS 1203 - Introduction to Programming - Summer 2014Uploaded byWilliam Smith
- ManualUploaded byShubhang Mishra
- Java Drmbs Unit 3 SuperUploaded bydev
- gosurefUploaded byVic
- A Step-By-Step Guide to Create a Simple FPM Application Using Feeder Class for FORM GUIBB_3Uploaded byDionisis Panagopoulos
- Tutorial Ns Full by MARC GREISUploaded byv chaitanya
- Software EngineeringUploaded byHemant's Desire
- MySQL Technical Reference Manual.Uploaded bySohan SN
- Workshop-04_Android-Development.pdfUploaded byvandemberg_silva
- Empower a Pi UpdatesUploaded byh_eijy2743
- How to Build a Compiler - TutorfinalUploaded bymaxNo5
- Exam QuestionsUploaded bygauravgd16
- Primefaces Users Guide 3 1Uploaded byAngshusmita Baruah Segra
- ECS401MidTerm2007.pdfUploaded byJelaxshan Jehanathan
- f5 Asm Operations GuideUploaded byDebasish Nayak
- TeratomUploaded byVishal Gupta
- SNP lab .pdfUploaded byVishnu Kumar
- ASP.net MatrialUploaded byKrishna Sai
- Modelo de Examen MCTS .NET Framework 4.0 ADO .NET & Web ApplicationsUploaded byRony Alexander Tantajulca Romero
- EclipseSDPIntegrationGuide Integrity 10 3Uploaded byJack Anon
- How Do JavaScript Closures WorkUploaded byButik Adisti