Professional Documents
Culture Documents
OR Lab Reports
OR Lab Reports
Semester: 5th
REG: 18PWIND541
Section: A
All lab reports
Subject: Operations Research (LAB)
Submitted to: Sir Usman Qazi
Department of Industrial Engineering
Lab: 01
Objectives
LINGO
It is a programming Language, It is a software tool designed to efficiently build and solve linear,
nonlinear, and integer optimization models. The main purpose of LINGO is to allow a user to
quickly input a model formulation, solve it, assess the correctness or appropriateness of the
formulation based on the solution, quickly make minor modifications to the formulation, and
repeat the process. LINGO features a wide range of commands, any of which should be invoked
at any time. LINGO checks whether a particular command makes sense in a particular context
TORA
AMPL is a comprehensive and powerful algebraic modeling language for linear and nonlinear
optimization problems, in discrete or continuous variables. AMPL lets you use common notation
and familiar concepts to formulate optimization models and examine solutions, while the
computer manages communication with an appropriate solver. AMPL’s flexibility and
convenience render it ideal for rapid prototyping and model development, while its speed and
control options make it an especially efficient choice for repeated production runs. AMPL is
notable for the similarity of its arithmetic expressions to customary algebraic notation, and for
the generality and power of its set and subscripting xviii INTRODUCTION expressions. AMPL
also extends algebraic notation to express common mathematical programming structures such
as network flow constraints and piecewise linarites.
EXCEL
Microsoft Excel is a spreadsheet program that is used to record and analyze numerical data.
Think of a spreadsheet as a collection of columns and rows that form a table. Alphabetical letters
are usually assigned to columns and numbers are usually assigned to rows. The point where a
column and a row meet is called a cell. The address of a cell is given by the letter representing
the column and the number representing a row.
Conclusions
Operation Research holds paramount importance since the fact that mostly industrial related
problems are solved through linear programming which is the branch of OR. This lab report
deals with software, which helps us in solving different complex and simple problems which we
encounter in industrial field. In terms of software. Microsoft excel is a powerful spreadsheet
program used to record, manipulate, store numeric data and it can be customized to match your
preferences similarly TORA, LINGO etc. are really interesting and important.
Lab: 02
Methodology
The basic General Procedure in order to initiate TORA is to click on the application’s icon on the
desktop, after the TORA has been clicked this screen pops up which asks for the sort of problem
we want to solve in this case I will select the LP option cause our problem is related to it.
Therefore, as the software runs, this Figure 1 comes up, it asks for basic information related to
the problem such as the Decimal points etc.
Problem #1
Reddy Mikks produces both interior and exterior paints from two raw material M1, M2. The
following table provides the basic data of problem. A market survey indicates that the daily
demand for interior paint cannot exceed that for exterior paint more than 1 ton. Also, the
maximum daily demand for interior paint is 2 tons. Reddy Mikks wants to determine the
optimum product mix of interior and exterior paints that maximizes the total daily profit.
Solution
LAB NUMBER #3
Introduction LINGO is a software program used for solving simultaneous linear and nonlinear
equations and inequalities. LINGO may be called linear programming, integer programming,
quadratic programming, nonlinear programming, or nonlinear optimization. The main purpose of
LINGO is to allow a user to quickly input a model formulation, solve it, assess the correctness or
appropriateness of the formulation based on the solution, quickly make minor modifications to
the formulation, and repeat the process. LINGO features a wide range of commands, any of
which may be invoked at any time. LINGO checks whether a particular command makes sense
in a particular context
Objectives
Methodology
The basic General Procedure inorder to initate LINGO is to click on the application’s icon on the
desktop, after the LINGO has been clicked this white screen pops up if theres already some sort
of program,or problem written there just simply go to the file option at the top and select new
page option.There are two problems that we basically did on LINGO. It is fairly easy software to
work on and solve different problem.
Problem#1
Ozark farms uses at least 800 lb of special feed daily. The special feed is mixture of corn and
soybean meal with the following composition:
The dietary requirements of the special feed are at least 30% protein and at most 5% fiber. Ozark
farms wishes to determine the daily minimum-cost feed mix.
Decision variables:
x1 = Tons produced daily of exterior paint
x2 = Tons produced daily of interior paint
Variable types:
x1 ≥ 0 [Nonnegative reals]
x2 ≥ 0 [Nonnegative reals]
Objective function:
Constraints
a. 6x1 + 4x2 ≤ 24 [Raw material M1]
b. x1 + 2x2 ≤ 6 [Raw material M2]
c. x2 − x1 ≤ 1 [Market limit]
d. x2 ≤ 2 [Demand limit]
i. First open the TORA window and select Linear Programming option as illustrated in
Fig 2.1
ii. Select the “enter new problem option” to start and adjust the number of numerals and
decimals required as shown in Fig 2.2
iii. Enter problem title, constraints and number of variables in TORA as shown in Fig2.3
Figure 2.3 Entering Initial Information in TORA
iv. Enter values of the constraints, variables and inequalities in TORA as shown in
Fig2.4
v. After entering all the data, click SOLVE menu icon which would open another
screen, choose graphical mode as shown in Fig2.5. This would lead to another screen
showing a graph of first quadrant in grid mode depicted in Fig 2.6
vi. Click the entire constraints one by one which would limit the graph to the feasible
region simultaneously.
vii. After this, click the maximization equation which would show the optimum solution
in the graph. Optimal solution can be seen in the lower left corner of the screen. This
procedure is shown in Fig2.7
Figure 2.7 Graphical Solution
Reddy Mikks should produce 3 tons of interior paints and 1.5 tons of exterior paints, which gives
a maximum total profit of $21 000. This is the only optimal solution.
Lab:04
Title: Solve Urban Planning problem on LINGO and TORA
Introduction
This lab deals with solving two problems on TORA and LINGO. The first problem is related to
investment. Today’s investors are presented with multitudes of investment opportunities.
Example of one of such problems is bank loan policy. In this situation, linear programming can
be used to select the optimal mix of opportunities that will maximize return while meeting the
investment conditions set by the investor.
The second problem is related to production planning and inventory control. This problem deals
with the use of inventory in a multi period production system to fill future demand.
Objectives
Bad debts are assumed unrecoverable and hence produce no interest revenue.
Competition with other financial institutions in area requires that the bank allocate at least 40%
of the total funds to farm and commercial loans. To assist the housing industry in the region,
home loans must equal at least 50% of the personal, car, and home loans. The bank also has a
stated policy specifying that the overall ratio for bad debts on all loans may not exceed 4%.
Objective function:
Constraints:
x 1+ x 2+ x 3+ x 4+ x 5≤12
0.4 x 1+ 0.4 x 2+0.4 x 3 – 0.6 x 4 – 0.6 x 5≤0
0.5 x 1+0.5 x 2 – 0.5 x 3≤0
0.06 x 1+ 0.03 x 2 – 0.01 x 3+0.01 x 4 – 0.02 x 5≤0
1. When starting LINGO for Windows, the program opens an <untitled> window. Enter the
objective function and constraints like this:
MAX =0.026*x1 + 0.0509*x2 + 0.0864*x3 + 0.06875*x4 + 0.078*x5;
X1 + x2 + x3 + x4 + x5 <= 12
0.4*x1 + 0.4*x2 + 0.4*x3 – 0.6*x4 – 0.6*x5 <= 0
0.5*x1 + 0.5*x2 – 0.5*x3 <=0
0.06*x1 + 0.03*x2 – 0.01*x3 + 0.01*x4 – 0.02*x5 <= 0
END
:
Note that there are two functions used here i.e. MAX/MIN and END. Also semicolon (;)
terminates a command.
2. Click on the Solve/“bullseye” button, use the Solve command from the Solve menu, or press
Ctrl+U to solve the model. While solving, LINGO will show the Solver Status Window with
information about the model and the solution process. When it’s done solving, the “State”
field should read “Global Optimum”. Then, click on the “Close” button to close the Solver
Status Window. This is shown in figure 4.1.
Figure 4.1 Solution Report for Loan Policy Problem
3. Editing the model is simply a matter of finding and changing the variable, coefficient, or
direction that is to be changed. Any changes will be taken into account the next time the
model is solved. Click on the button, use the Save command from the File menu, or press
Ctrl+S to save your work.
1. Enter problem title, constraints and number of variables in TORA as shown in Figure 4.2.
2. Enter values of the constraints, variables and inequalities in TORA as shown in Figure4.3.
Figure 4.3 Entering Data
3. After entering all the data, click SOLVE menu icon which would open another screen. Since
graphical solution is not possible for this problem, click on the algebraic solution. This would
lead to another screen showing a comprehensive solution report. This is shown in figure 4.4.
Solution report obtained through TORA and LINGO shows that it took two iterations to solve
the problem. The optimal solution calls for allocating all $12 million: $7.2 million to home loans
and $4.8 million to commercial loans. The remaining categories receive none. The return on the
investment is .08034.
Conclusion:
The graphical solution method can only be applied to LP problems with two variables. For
problems that are larger than this, computers are relied upon to provide solutions. A variety of
programs have been written to solve linear programming problems. This report discussed the
output that a computer program called LINGO gives when it solves a linear program. Small
linear programs can also be solved with a spreadsheet, such as Excel. For larger linear
programming problems, a more specialized program, like LINGO is needed. This report
discussed setting up, solving, and interpreting LP problems with TORA and LINGO.
As discussed earlier, the solution to an LP problem is a set of optimal values for each of the
variables. However, the output that comes with the solution to a LP problem usually contains
much more information than just this. In addition to the optimal values of the variables, the
output will typically include reduced cost values, slack or surplus values, and dual prices.
Lab: 05
Title: Solving gasoline bending and Crude oil refining problem on
Tora and Lingo
Introduction
A number of linear programming deals with blending different input materials to produce
products that meet certain specifications while minimizing the cost or maximizing the profit. The
input materials can be ores, metal scrapes, chemicals or crude oils and the output products could
be metal ingots, paints, or gasoline of various grades. The final products must satisfy certain
quality specifications. One goal of the model is determining the optimal mix of final products
that will maximize an appropriate profit function. In some cases, the goal may be to minimize a
cost function. This lab deals with the study and practice of solving problems especially blending
problem on different optimization software’s like TORA, LINGO.
Problem statement
Shale Oil, located on the island of Aruba, has a capacity of 1,500,000 bbl of crude oil per day.
The final products from the refinery include three types of unleaded gasoline with different
octane numbers (ON): regular with ON = 87, premium with ON = 89, and super with ON = 92.
The refining process encompasses three stages: (1) a distillation tower that produces feedstock
1ON = 822 at the rate of .2 bbl per bbl of crude oil, (2) a cracker unit that produces gasoline
stock 1ON = 982 by using a portion of the feedstock produced from the distillation tower at the
rate of .5 bbl per bbl of feedstock, and (3) a blender unit that blends the gasoline stock from the
cracker unit and the feedstock from the distillation tower. The company estimates the net profit
per barrel of the three types of gasoline to be $6.70, $7.20, and $8.10, respectively. The input
capacity of the cracker unit is 200,000 bbl of feedstock a day. The demand limits for regular,
premium, and super gasoline are 50,000, 30,000, and 40,000 bbl, respectively, per day. Develop
a model for determining the optimum production schedule for the refinery.
Objective function
Maximize z=6.70 ( x 11 + x 21 ) +7.20 ( x12 + x 22) + 8.10(x 13+ x 23)
Constraints
Now we will find the solution with the help of TORA and LINGO
4. Click on the SOLVE menu and if we want to save data we can save it.
5. Then select solve problem through algebraic and from there we can select any method.
We will go for M method.
Lab: 06
This Lab report deals with solution of Single Period Production Model on Excel Solver, In this
problem in addition to the actual decision variable there are four slack variables as well. The
concept of using slack variable is important for single or Multiple Period Production system.
Objectives
Problem statement
The Clothing Company that is manufacturing Parka and rest of the good mentioned in the table
in four departments, the company has received firm orders for its products. It also stipulates a
penalty for Undelivered Items. The following table is the data, we are supposed to devise an
optimal production plan for the company.
Penalty
Formulation
In operation research, all types of problems are modeled following four steps. These are:
1. Decision variables
2. Objective function
3. Constraints
4. Solution
Steps mentioned above provides the agenda of how to solve a problem in operation research.
These steps are followed one after the other to get the solution of the problem. They are clearly
showed below. After specifying and completing these steps, the procedure section will show how
to use software Excel and get its services to approach the solution.
Decision Variables.
Objective Function:
Max Z= 30x1+40x2+20x3+10x4-(15s1+20s2+10s3+8s4)
Constraints:
1. .30x1+.30x2+.25x3+.15x4<= 1000
2. .25x1+.35x2+.30x3+.10x4<=1000
3. .45x1+.50x2+.40x3+.22x<=1000
4. .15x1+.15x2+.10x3+.05x<= 1000
5. x1 + s1 = 500
6. x2 + s2= 750
7. x3+ s3= 600
8. x4+ s4= 800
Procedure:
In Excel solver, we firstly make sure that the Excel software has the Solver option, if for
example its not there, we add the option by going through the settings.After that we do the
following steps.
Lab No. 07
Solving the transportation Problem on TORA.
Introduction
This lab deals with solving two transportation models on TORA. The transportation model is a
special case of linear programs that deals with shipping a commodity from sources (e.g.,
factories) to destinations (e.g., warehouses). The objective is to determine the shipping schedule
that minimizes the total shipping cost while satisfying supply and demand limits.
The transportation algorithm is based on the assumption that the model is balanced, meaning that
the total demand equals the total supply. If the model is unbalanced, we can always add a
dummy source or a dummy destination to restore balance.
Objectives
To understand a general transportation model
To solve SunRay transport model on TORA
To solve tool sharpening model on TORA
To understand and interpret the results generated by both the models
Problem Statement
SunRay Transport company ships truckloads of grain from three silos to four mills. The supply
in truckloads and the demand also in truckloads together with the unit transportation costs per
truckload on the different routes are summarized in table. The unit transportation costs are in
hundreds of dollars. The model seeks the minimum cost shipping schedule between the silos and
the mills.
Table10.8 SunRay transportation model
Solution In TORA
Transportation model in TORA can be solved through three methods i.e. northwest corner
method, least count method and vogal approximation method. Procedure is the same for all the
methods, however, results may vary.
Click on solve. The final iteration of the solution report is shown below.
Conclusion
The transportation algorithm follows the exact steps of the simplex method. However, instead of
using the regular simplex tableau, we take advantage of the special structure of the transportation
model to organize the computations in a more convenient form. Also, the application of
transportation model is not limited to transporting commodities between geographical sources
and destinations. It can also be applied in areas of tool sharpening service and production
inventory control.
Lab: 08
Title: Solving reddy mix problem and diet problem on AMPL
Introduction
This lab deals with the study and practice of solving problems on software AMPL. All practices
and usage of AMPL are covered in this lab.
Objective
The main objectives of this lab are:
1. To familiar with AMPL tool.
2. To understand the principles of AMPL tool.
3. To understand the general layout of AMPL.
4. To be able to write a program in AMPL.
5. To solve maximization and minimization problems using AMPL.
Problem statement
Ozark farms uses at least 800 lb. of special feed daily. The special feed is mixture of corn and
soybean meal with the following composition:
The dietary requirements of the special feed are at least 30% protein and at most 5% fiber. Ozark
farms wishes to determine the daily minimum-cost feed mix?
Model formulation
In operation research, all types of problems are modeled following four steps. These are:
5. Decision variables
6. Objective function
7. Constraints
8. Solution
Steps mentioned above provides the agenda of how to solve a problem in operation research.
These steps are followed one after the other to get the solution of the problem. They are clearly
showed below. After specifying and completing these steps, the procedure section will show how
to use software TORA and get its services to approach the solution.
Decision variables
X1 = lb of corn in the daily mix
X2 = lb of soybean meal in the daily mix
Objective function
Minimize Z = 0.3x1+0.9x2
Constraints
𝑥1 + 𝑥2 ≥ 800
0.21x1 - 0.3x2 ≤ 0
0.03x1 - 0.01x2 ≥ 0
x1, x2 ≥ 0
Procedure
In AMPL, function/program is typed in two ways. The two ways are: writing program directly in
the AMPL software and another one is typing program in notepad and then opening the AMPL,
calling the program by the name saved adding .txt at the end. Typing program directly in the
AMPL is not a best way because if any error done in the typing of program it will not show the
result, also the user has to type the program again instead of editing the current one. The
procedure for typing the program is:
In order to recall an already written problem in notepad in AMPL, use model (filename).txt.
Lab: 09
Title: Minimal spinning tree
Introduction
This lab deals with solving two network models on TORA. The network model is the most
efficient way to link a number of locations directly or indirectly, finding the shortest route
between two cities, determining the maximum flow in a pipeline network, determining the
minimum-cost flow in a network that satisfies supply and demand requirements at different
locations and scheduling the activities of a project.
The minimal spanning tree (a network optimization algorithm) deals with linking the nodes of a
network, directly or indirectly, using the shortest total length of connecting branches.
Objectives
To understand the general network problem
To solve two network problems on TORA using minimal spanning tree model
To interpret the results generated by TORA
Problem Statement
Midwest TV Cable Company is in the process of providing cable service to five new housing
development areas. Figure below depicts possible TV linkages among the five areas. The cable
miles are shown on each arc. Determine the most economical cable network.
Figure 12.11 Cable connections for midwest TV company
Solution In TORA
Enter the data as shown in the figure 12.2.
Lab No. 10
Title: Shortest Route Maximal Flow
Introduction:
The shortest path problem in additive networks is the min-cost flow problem of a unit flow from
the source on a single path in un-capacitated networks. The losses and gains change the amount
of flow such that the cost of an arc on the path is the product of the cost per unit and the amount
of flow at its entrance.
Problem Statement
Determine the maximal flow in each arc for the network in figure 12.8
Solution in TORA
Enter the data as shown in the figure 12.9.
Conclusion
The minimal spanning tree algorithm deals with linking the nodes of a network, directly or
indirectly, using the shortest total length of connecting branches. A typical application occurs in
the construction of paved roads that link several rural towns. The road between two towns may
pass through one or more other towns. The most economical design of the road system calls for
minimizing the total miles of paved roads, a result that is achieved by implementing the minimal
spanning tree algorithm.
Shortest path algorithms are applied to automatically find directions between physical locations,
such as driving directions on web mapping websites like MapQuest or Google Maps. For this
application fast specialized algorithms are available.
This problem involves a directed network with arcs carrying flow. The only relevant parameter
is the upper bound on arc flow, called arc capacity. The problem is to find the maximum flow
that can be sent through the arcs of the network from some specified node s, called the source, to
a second specified node t, called the sink. Applications of this problem include finding the
maximum flow of orders through a job shop, the maximum flow of water through a storm sewer
system, and the maximum flow of product through a product distribution system, among others.
Lab: 11
Title: Solving Sensitivity Problem on TORA (TOYCO Model)
Introduction
In linear programming, the parameters of the model can change within certain limits without
chasing the optimum solution to change. This is referred to as sensitivity analysis. With
sensitivity analysis, we can ascertain the impact of this uncertainty on the quality of the optimum
solution. In this lab, TOYCO model is solved using TORA to facilitate the understanding of
sensitivity analysis.
Objectives
To understand sensitivity analysis
To solve TOYCO model using TORA
To interpret the results generated in terms of sensitivity analysis
Problem Statement
TOYCO assembles three types of toys-trains, trucks, and cars-using three operations. The daily
limits on the available times for the three operations are 430,460, and 420 minutes, respectively,
and the revenues per unit of toy train, truck, and car are $3, $2, and $5, respectively. The
assembly times per train at the three operations are 1, 3, and 1 minutes, respectively. The
corresponding times per train and per car are (2, 0, 4) and (1, 2, 0) minutes (a zero time indicates
that the operation is not used).
Objective function:
Maximize z=3 x 1+2 x 2+5 x 3
Constraints
x 1+2 x 2+ x 3 ≤ 430(operation 1)
3 x 1+2 x 3 ≤ 460( operation2)
x 1+ 4 x 2 ≤ 420( operation3)
x1, x2, x3≥0
Conclusion
Sensitivity Analysis is a systematic study of how, well, sensitive, the solutions of the LP are to
small changes in the data. The basic idea is to be able to give answers to questions of the form:
(1) if the objective function changes in its parameter, how does the solution change? (2) If the
resources available change. How does the solution change? (3) If a new constraint is added to the
problem, how does the solution change?
This lab dealt with solving a linear problem and analyze the results in terms of sensitivity
analysis.
Lab: 13
Title: solve currency arbitrage problem on Excel Solver
Introduction
This lab deals with solving the problem of currency arbitrage using Excel Solver. This problem
involves five different currencies: (1) Dollars (2) Euros (3) British pounds (4) Yen (5) Kuwaiti
Dinar. Investment is given in dollars. In currency business profit is earned by circulating the
money in the international currency markets.
Objectives
To install solver in excel
To understand how to enter a problem in solver
To be able to interpret the results generated through excel solver
Problem statement
Solution
Numeric code
Decision variables
x 12=Dollar amount converted into euros
Constraints
Excel solver