System Analysis and Management Techniques Adama Science and Technology University School of Civil Engineering and Architecture Department of civil Engineering Getachew Tegegne (Ph.D.) Assistant Professor of Civil Engineering E-mail: getachewtegegne21@gmail.com Optimization approaches for project management Classification of Optimization Techniques Optimization techniques are also known as mathematical programming techniques The mathematical programming can be classified in several ways, such as on the nature of the problem, the nature of the equations involved, a number of objective functions involved, etc. These mathematical programming can be classified as: o Linear Programming (LP) o Nonlinear Programming (NLP) o Dynamic Programming (DP), etc. Optimization approaches for project management Basics of optimization problem: 1) Objective function: it expresses the main aim of the model which is either to be minimized or maximized. 2) Unknowns or variables: they control the value of the objective function 3) Constraints: pre-defined search space that they restrict the range over which the decision variables can change & thus affect the optimum solution. Optimization problem is then to: o Find values of the variables that minimize or maximize the objective function while satisfying the constraints. Optimization approaches for project management An optimization problem can be stated as: 𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 𝑜𝑟 𝑚𝑖𝑛𝑖𝑚𝑖𝑧𝑒 𝑓 𝑋 𝑠𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜 𝑔𝑗 𝑋 ≥ 0, 𝑗 = 1, 2, … , 𝑚 ℎ𝑗 𝑋 = 0, 𝑗 = 𝑚 + 1, 𝑚 + 2, … , 𝑝 𝑋𝐿 ≤ 𝑋 ≤ 𝑋𝑈 • where o X is a vector of n-variables which are known as decision variables, o g(X) are the inequality constraints, h(X) are the equality constraints and XL and XU, respectively, are the lower and upper limits of the decision variable X Optimization: Linear vs. Nonlinear o Are the functions J(x), g(x), and h(x) linear or nonlinear functions of x? o Linear programming (LP): • When the objective function and the constraints are all linear, the problem is called a LP problem. o Non-linear programming: • When either the objective function or any of the constraints is a non-linear function of the design variables, the problem is called a nonlinear programming (NP) problem Formulation and Application of Linear Programming Optimization using linear programming – Linear programming is a technique for determining an optimum schedule of interdependent activities in view of the available resources and constraints – Programming is just another word for planning and refers to the process of determining a particular plan of action from amongst several alternatives – The word linear stands for indicating that all relationships involved in a particular problem are linear Formulation and Application of Linear Programming Optimization using linear programming – Linear programming indicates the right combination of the various decision variables which can be best employed to achieve the objective taking full account of the practical limitations with in which the problem must be solved – Linear programming problems consist of a linear objective (cost) function (consisting of a certain number of variables) which is to be minimized or maximized subject to a certain number of constraints Formulation and Application of Linear Programming Optimization using linear programming – Linear programming indicates the right combination of the various decision variables which can be best employed to achieve the objective taking full account of the practical limitations with in which the problem must be solved – Linear programming problems consist of a linear objective (cost) function (consisting of a certain number of variables) which is to be minimized or maximized subject to a certain number of constraints Formulation and Application of Linear Programming • Formulation of linear programming problems – The steps to formulate the LP problems are: • Step1: Understand the problem • Step2: Identify decision variables • Step3: State the objective function as a linear combination of the decision variables • Step4: State the constraints as linear combinations of the decision variables • Step5: Identify the upper or lower bounds on the decision variables (Additional Constraints) Formulation and Application of Linear Programming LP optimization problem meets the following conditions: o The decision variables of the problem are non-negative (i.e., positive or zero) o The objective function is a linear function of the decision variables (i.e., a function involving only the first powers of the variables with no cross products) o The operating rules governing the processes, commonly known as constraints, are expressed as a set of linear equations or linear inequalities Mathematical Representation of a Linear Programming (LP) There are many ways to represent a linear programming problem A compact way of representing a linear program is a matrix form A general LP problem can be written in conventional form as: 𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 𝑜𝑟 𝑚𝑖𝑛𝑖𝑚𝑖𝑧𝑒 : 𝑍 = 𝑓 𝑋 𝑠𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜: 𝑔𝑗 𝑋 ≥ 0, 𝑗 = 1, 2, … , 𝑚1 ℎ𝑗 𝑋 ≤ 0, 𝑗 = 1, 2, … , 𝑚2 𝑙𝑗 𝑋 = 0, 𝑗 = 1, 2, … , 𝑚3 where Z is the objective function; x is an n-dimensional decision vector; gj(x) & hj(x) are inequality constraints; lj(x) are equality constraints; and m1, m2, and m3 indicate the number of constraints. The objective function is a linear function of decision variables. Standard Form of LP An LP problem with m constraints and n variables can be represented in standard form as follows: 𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 𝑜𝑟 𝑚𝑖𝑛𝑖𝑚𝑖𝑧𝑒 : 𝑍 = 𝑐11 𝑋1 + 𝑐2 𝑋2 + ⋯ + 𝑐𝑛 𝑋𝑛 𝑠𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜: 𝑎11 𝑋1 + 𝑎12 𝑋2 + ⋯ + 𝑎1𝑛 𝑋𝑛 = 𝑏1 𝑎21 𝑋1 + 𝑎22 𝑋2 + ⋯ + 𝑎2𝑛 𝑋𝑛 = 𝑏2 𝑎𝑚1 𝑋1 + 𝑎𝑚2 𝑋2 + ⋯ + 𝑎𝑚𝑛 𝑋𝑛 = 𝑏𝑚 𝑋𝑖 ≥ 0, 𝑖 = 1, 2, … , 𝑛 𝑏𝑖 ≥ 0, 𝑖 = 1, 2, … , 𝑚 where Z is the objective function; xi are the decision variables and ci are the cost (or benefit) coefficients) Matrix Form of LP In matrix notation, the standard LP problem can be expressed in a compact form as: 𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 𝑜𝑟 𝑚𝑖𝑛𝑖𝑚𝑖𝑧𝑒 : 𝑍 = 𝐶 𝑇 𝑋 𝑠𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜: 𝐴𝑋 = 𝑏 𝑋≥0 𝑏≥0 where A is a m*n matrix, X is an n*l column vector, b is an m*l column vector, C is an n*l column vector, and Z indicates the objective function. Subscript T in the objective function indicates the transpose operation. Thus, the equation can be written as: 𝑋 = 𝑥1 , 𝑥2 , ⋯ , 𝑥𝑛 𝑇 𝐶 = 𝑐1 , 𝑐2 , ⋯ , 𝑐𝑛 𝑇 𝑏 = 𝑏1 , 𝑏2 , ⋯ , 𝑏𝑚 𝑇 𝑎11 𝐴= ⋮ 𝑎𝑚1 ⋯ 𝑎1𝑛 ⋱ ⋮ ⋯ 𝑎𝑚𝑛 Systems of linear equations A general set of n equations with n unknowns has the form • where aij are the coefficients (known), bi are the right hand sides (known), and Xj are unknowns. The set of equations can be written more compactly as The solution of this matrix equation is equally simple to write, but can be difficult to compute, Graphical solution of a LP problem The graphical method is a simple way to solve LP problems. However, it can be used to solve the LP problems involving at most two decision variables Consider the following Figure for illustration of the graphical method for two decision variables that shows the definition sketch of feasible region and constraints Example: Let objective 𝑧1 𝑥 = 5𝑥1 − 2𝑥2 and objective 𝑧2 𝑥 = −𝑥1 + 4𝑥2 Both are to be maximized. Assume that the constraints on variables 𝑥1 and 𝑥2 are: −𝑥1 + 𝑥2 ≤ 3 𝑥1 + 𝑥2 ≤ 8 𝑥1 ≤ 6 𝑥2 ≤ 4 𝑥1 , 𝑥2 ≥ 0 Graph the Pareto optimal or non-inferior solutions in decision space. Graph the Pareto optimal or non-inferior solutions in decision space There are several solutions with the combination of Z1 and Z2 as: SW z1 ( x) z2 ( x) SW z1 ( x) z2 ( x) (5x1 2 x2 ) ( x1 4 x2 ) 4 x1 2 x2 SW is called by social welfare function. The following approach can be followed to solve the problem: (𝒙𝟏 , 𝒙𝟐 ) 𝒛𝟏 𝒛𝟐 (0, 0) 0 0 (6, 0) 30 -6 (6, 2) 26 2 (4, 4) 12 12 (1, 4) -3 15 (0, 3) -6 12 From above, there is the maximum value in (6, 2) Quiz: Solve the following problem using graphical method of LP 𝑴𝒂𝒙𝒊𝒎𝒊𝒛𝒆 𝒁 = 𝟐𝒙𝟏 + 𝒙𝟐 𝑺𝒖𝒃𝒋𝒆𝒄𝒕 𝒕𝒐: 𝟐𝒙𝟏 − 𝒙𝟐 ≤ 𝟖 𝒙𝟏 + 𝒙𝟐 ≤ 𝟏𝟎 𝒙𝟐 ≤ 𝟕 𝒙𝟏 , 𝒙𝟐 ≤ 𝟎 Application of MATLAB for solving sets of linear equations Getting the software o Get MATLAB: http://software.usc.edu The file browser o Moving around through the folder hierarchy o Command line tools for navigation cd ls change directory list directory contents The workspace and variable editor Settings variables: x=3 Clearing variables: clear x clear all Getting help help function doc function >> help sin sin Sine of argument in radians. sin(X) is the sine of the elements of X. See also asin, sind. Reference page in Help browser doc sin Scripts Anything you type into the workspace can also be run from a script “.m” files are just saved lists of Matlab commands Functions Blocks of code that operate on variables in their own independent workspaces Editor Comments Syntax highlighting Code folding Variables What is a variable? Variable names and conventions Variable types double: floating point number like 3.24 integer: no decimal places 345 Vectors and matrices Vectors are like lists a = [1,2,3,4,5] Matrices are like lists of lists a = [ 1,3,5,7; 2,4,6,8 ] Creating vectors Also try: x = [1:0.1:10] >> a = [1 2 3 4 5] a = 1 2 3 4 5 >> a = [1,2,3,4,5] a = 1 2 3 4 5 >> a = [1:5] a = 1 2 4 5 3 Creating matrices >> a = [1 2 3; 4 5 6] a = 1 2 3 4 5 6 >> a = [1 2 3; 4 5 6; 7 8 9] a = 1 2 3 4 5 6 7 8 9 >> rand(3) ans = 0.8147 0.9058 0.1270 0.9134 0.6324 0.0975 0.2785 0.5469 0.9575 >> nan(4) ans = NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN >> ones(3) ans = 1 1 1 1 1 1 1 1 1 >> ones(2,3) ans = 1 1 1 1 1 1 >> zeros(3,4) ans = 0 0 0 0 0 0 0 0 0 0 0 0 Describing matrices size() will tell you the dimensions of a matrix length() will tell you the length of a vector Accessing elements >> a = [0:4] a = 0 1 2 3 >> a(end) ans = 4 >> a(2) ans = 1 >> a(end-1) ans = >> b = [1,2,3;4,5,6;7,8,9] b = 1 2 3 4 5 6 7 8 9 >> b(2,3) ans = 6 3 4 Vector math ■ Adding a constant to each element in a vector >> a = [1 2 3] a = 1 2 >> a + 1 ans = 2 3 3 4 ■ Adding two vectors >> b = [5 1 5] b = 5 1 >> a + b ans = 6 3 5 8 Vector multiplication The .* sign refers to element-wise multiplication: >> a = [1 2 3] a = 1 2 3 >> b = [2 2 4] b = 2 2 4 >> a * b Error using * Inner matrix dimensions must agree. >> a = [1 2 3] a = 1 2 >> b = [2 2 4] b = 2 2 >> a .* b ans = 2 4 >> b = b' b = 2 2 4 >> a * b ans = 18 >> a * 4 ans = 4 >> a .* 4 ans = 4 transposing a matrix: use ‘ to transpose, i.e. flip rows and columns 3 4 12 8 12 8 12 Operators Element-wise operators: .* multiplication ./ division .^ exponentiation Many other functions work element-wise, e.g.: Saving variables save() to save the workspace to disk load() to load a .mat file that contains variables from disk clear() to remove a variable from memory who, whos to list variables in memory Creating a script create new blank document Your first script % My first script x = 5; y = 6; z = x + y Save script as “myFirst.m” >> myFirst z = 11 Function declarations All functions must be declared, that is, introduced in the proper way. code folding result of the function name of the function parameters passed to the function OUT IN >> addemup(1,1) ans = 6 >> addemup2(1,1) ans = 10 Accessing elements >> odds = [1:2:100]; >> odds([26:50, 1:25]) ans = Columns 1 through 14 73 51 75 53 77 55 57 59 61 63 65 67 69 71 87 89 91 93 95 97 99 15 17 19 21 23 25 27 43 45 47 49 Columns 15 through 28 79 3 1 81 5 83 85 Columns 29 through 42 29 7 31 9 33 11 13 Columns 43 through 50 35 37 39 41 >> [26:50,1:25] ans = Columns 1 through 14 34 26 35 27 36 28 29 37 38 30 39 31 32 33 44 45 46 47 9 10 11 23 24 25 Columns 15 through 28 48 40 49 41 50 42 43 1 2 3 7 16 8 17 Columns 29 through 42 12 4 13 5 14 6 15 Columns 43 through 50 18 19 20 21 22 Commands are executed immediately when you press Return Variables that are created appear in the Workspace Simple functions and plots Form a sine function for a seasonal variable using the following MATLAB statement. t = 1:5:365; temp= 15*sin(2**pi*t/365) + 12; Plot (t, temp, ‘+’); Xlabel (‘Time, days’); Ylabel (‘Smoothed temperature, degrees c’) The series of commands above actually produce a figure with default characteristics on line widths, font size, and so forth. Application of MATLAB for solving sets of linear equations If a system of linear equations is expressed in terms of a square matrix of coefficients, A, the vector b, and the unknowns x such that Ax = b, then x can be found using either of two MATLAB commands: The backslash operator “\” solves the system of equations using Gaussian elimination, without calculating the matrix inverse, and is preferable to “inv” because it is more efficient (in terms of computer time and memory) and has better error detection properties. Note that in this case, the vector length must equal the number of rows in the matrix. The form of a set of equations is Ax = b where A is a matrix of (known) coefficients, x is the unknown vector, and b is a vector of known quantities. The system of equations 3x + 3y =9 2x - 2y = -2 is represented in matrix notation as Example: Consider the set of equations For this set of equations In MATLAB, we can set A = [13 -8 -3; -8 10 -1; -3 -1 11] and b = [20;-5;0] Solving this with the MATLAB command x=A\b produces (in much less time than it takes to do it by hand!) Quiz #1: Solve the set of linear equations using the MATLAB command x=A\b and by hand to 2 or 3 decimal places of accuracy. Compare the answers. Linear programming in project management Linear programming can be used in construction management to solve many problems such as: 1. Optimizing use of resources 2. Determining most economic product mix. 3. Transportation and routing problems. 4. Personnel assignment. 5. Determining Optimum size of bid. 6. Location of new production plants, offices and warehouses Linear programming in project management • Production allocation problem: – A firm manufactures two types of products A and B and sells them at a profit of 2 on type A and 3 on type B. Each product is processed on two machines G and H. type A requires 01 minute of processing time on G and 02 minutes on H; type B requires 01 minute on G and 01 minute on H. The machine G is available for not more than 6 hours 40 minutes while machine H is available for 10 hours during any working day. Formulate the problem as a LPP. Linear programming in project management • Production allocation problem: – Let x1 be the number of products of type A; x2 be the number of products of type B Machine Time of products (min) Available time (min) Type A (x1 units) Type B (x2 units) G 1 1 400 H 2 1 600 Profit per unit 2 3 Linear programming in project management • Production allocation problem: – Let x1 be the number of products of type A; x2 be the number of products of type B – Total Profit (objective function): o P=2*x1+3*x2 – Constraints: o 1*x1+1*x2 <= 400 o 2*x1+1*x2 <= 600 o x1 >= 0 o x2 >=0 Linear programming in project management Assignment 2: Linear programming in construction management: o A pre-mixed concrete firm has to supply concrete to three different projects A, B, and C. The projects require 200, 350, and 400 cubic meters of concrete in a particular week. The firm has three plants P1, P2, and P3 which can produce 250, 400 and 350 respectively. The cost is different from each Plant to each project since distance will vary. It is required to determine the quantity to be supplied from each plant to each project such that cost to be incurred is a minimum