Presentation on theme: "CHEN 4460 – Process Synthesis, Simulation and Optimization"— Presentation transcript:
1 CHEN 4460 – Process Synthesis, Simulation and Optimization Dr. Mario Richard Eden Department of Chemical Engineering Auburn UniversityLecture No. 8 – Mathematical OptimizationOctober 16, 2012Contains Material Developed by Dr. Daniel R. Lewin, Technion, Israel
2 Lecture 10 – Objectives On completion of this part, you should: Understand the different types of optimization problems and their formulationBe able to formulate and solve a variety of optimization problems in LINGO
3 Optimization Basics What is Optimization? Examples The purpose of optimization is to maximize (or minimize) the value of a function (called objective function) subject to a number of restrictions (called constraints).Examples1. Maximize reactor conversionSubject to reactor modeling equationskinetic equationslimitations on T, P and x
4 Optimization Basics Examples (Continued) 2. Minimize cost of plant Subject to mass & energy balance equationsequipment modeling equationsenvironmental, technical and logical constraints
5 Optimization Basics Examples (Continued) 3. Maximize your grade in this courseSubject to extracurricular activitiesfull-time-job requirementsconstant demand by other courses and/or your advisor/boss
6 Optimization Basics Formulation of Optimization Problems min (or max) f(x1,x2,……,xN)subject to g1(x1,x2,……,xN)≤0g2(x1,x2,……,xN)≤0gm(x1,x2,……,xN)≤0h1(x1,x2,……,xN)=0h2(x1,x2,……,xN)=0hE(x1,x2,……,xN)=0FeasibilityAny vector (or point) which satisfies all the constraints of the optimization program is called a feasible vector (or a feasible point)The set of all feasible points is called feasibility region or feasibility domainAny optimal solution must lie within the feasibility region!Inequality ConstraintsEquality Constraints
7 Optimization Basics Classification of Optimization Problems Linear Programs (LP’s)A mathematical program is linear iff(x1,x2,……,xN) and gi(x1,x2,……,xN)≤0 are linear in each of their arguments:f(x1,x2,……,xN) = c1x1 + c2x2 + …. cNxNgi(x1,x2,……,xN) = ai1x1 + ai2x2 + …. aiNxNwhere ci and aij are known constants.Linear Programs (LP’s) can be solved to yield a global optimum. Solver routines can guarantee a truly optimal solution.
8 Optimization Basics Classification of Optimization Problems Non-Linear Programs (NLP’s)A mathematical program is non-linear if any of the arguments are non-linear. For example:min 3x + 6y2s.t. 5x + xy ≥ 0Integer ProgrammingOptimization programs in which ALL the variables must assume integer values. The most commonly used integer variables are the zero/one binary integer variables.Integer variables are often used as decision variables, e.g. to choose between two reactor types.Non-Linear Programs (NLP’s) can be solved to yield a local optimum. Solver routines can not always guarantee a globally optimal solution.
9 Optimization Basics Classification of Optimization Problems Mixed Integer Linear Programs (MILP’s)Linear programs in which SOME of the variables are real and other variables are integersCan be solved as individual LP’s by fixing the integer variables, thus a global optimum can be identified.Mixed Integer Non-Linear Programs (MINLP’s)Non-linear programs in which SOME of the variables are real and other variables are integersCan be solved as individual NLP’s by fixing the integer variables, but depending on the nature of the NLP’s it may not be possible to find a global optimum.
10 Optimization Basics Formulation of Optimization Problems Step 1 Step 2 Determine the quantity to be optimized and express it as a mathematical function (this is your objective function)Doing so also serves to define variables to be optimized (input variables or optimization variables)Step 2Identify all stipulated requirements, restrictions, and limitations, and express them mathematically. These requirements constitute the constraintsStep 3Express any hidden conditions. Such conditions are not stipulated explicitly in the problem, but are apparent from the physical situation, e.g. non-negativity constraints
11 Optimization Example Hydrogen Sulfide Scrubbing Two variable grades of MEA.First grade consists of 80 weight% MEA and 20% weight water. Its cost is 80 cent/kg.Second grade consists of 68 weight% MEA and 32 weight% water. Its cost is 60 cent/kg.It is desired to mix the two grades so as to obtain an MEA solution that contains no more than 25 weight% water.What is the optimal mixing ratio of the two grades which will minimize the cost of MEA solution (per kg)?
12 Variables (Basis 1 kg solution) Optimization ExampleHydrogen Sulfide Scrubbing (Cont’d)Objective function min z = 80x1 + 60x2ConstraintsWater content limitation 0.20x x2 ≤ 0.25Overall material balance x1 + x2 =1Non-negativity x1 ≥ 0x2 ≥ 0Variables (Basis 1 kg solution)x1 Amount of grade 1 (kg)x2 Amount of grade 2 (kg)z Cost of 1 kg solution (cents)
13 Optimization Example Hydrogen Sulfide Scrubbing (Cont’d) Feasibility regionThe set of points (x1, x2) satisfying all the constraints, including the non-negativity conditions.Constraint on water content x x2 ≤ 0.25
16 Optimization Example Hydrogen Sulfide Scrubbing (Cont’d) Feasibility regionAny optimal solutionmust lie within thefeasibility region!
17 Optimization Example Hydrogen Sulfide Scrubbing (Cont’d) By plotting objective function curves for arbitrary values of z (here 70 and 75) we can evaluate the results:Optimal PointIntersection betweenx1 + x2 = 1and0.20x x2 = 0.25In addition70 < zmin < 75
18 Optimization Example Hydrogen Sulfide Scrubbing (Cont’d) Solving the two equations simultaneously yields the optimum amounts of the two MEA solutions along with the minimum cost of the mixture
19 Optimization Software LINGOAvailable on computers in Ross 306To start entering a new optimization problem type:Model:Enter the objective function by typing:min = ……; or max = ……;Then enter the constraints.Each line must end by a semi-colon ;The final statement in the problem should be “end”
20 Optimization Software Resolving MEA Example in LINGOLINGO InputModel:min = 80*x1 + 60*x2;0.2*x *x2 < 0.25;x1 + x2 = 1;x1 > 0;x2 > 0;endLINGO OutputRows= Vars= No. integer vars= ( all are linear)Nonzeros= Constraint nonz= 6( are +- 1) Density=0.667Smallest and largest elements in absolute value=No. < : 1 No. =: 1 No. > : 2, Obj=MIN, GUBs <= 2Single cols= 0Optimal solution found at step:Objective value:Variable Value Reduced CostX E+00X E+00Row Slack or Surplus Dual PriceEEE+00E+00Value of objective function:Value of variable x1:Value of variable x2:
21 More Optimization Examples Lab ExperimentDetermine the kinetics of a certain reaction by mixing two species, A and B. The cost of raw materials A and B are 2 and 3 $/kg, respectively.Let x1 and x2 be the weights of A and B (kg) to be employed in the experimentThe operating cost of the experiment is given by:OC = 4(x1)2 + 5(x2)2The total cost of raw materials for the experiment should be exactly $6. Minimize the operating cost!
22 More Optimization Examples Lab Experiment (Cont’d)LINGO InputModel:min = 4*x1^2 + 5*x2^2;2*x1 + 3*x2 = 6;x1 > 0;x2 > 0;endLINGO OutputRows= Vars= No. integer vars=Nonlinear rows= 1 Nonlinear vars= 2 Nonlinear constraints= 0Nonzeros= Constraint nonz= Density=0.583Optimal solution found at step:Objective value:Variable Value Reduced CostX E+00X E+00Row Slack or Surplus Dual PriceEE-07E+00Value of objective function:Value of variable x1:Value of variable x2:
23 More Optimization Examples Coal Conversion PlantWhat are the optimal production rates of gaseous and liquid fuels that maximize the net profit of the plant?x1 ≤ 42x2 ≤ 123x1 + 2x2 ≤ 18
24 More Optimization Examples Coal Conversion Plant (Cont’d)Objective function max z = 3x1 + 5x2ConstraintsPretreatment capacity 3x1 + 2x2 ≤ 18Gasification capacity x1 ≤ 4Liquefaction capacity 2x2 ≤ 12Non-negativity x1 ≥ 0x2 ≥ 0
25 More Optimization Examples Maximum profit Z = 36 for x1 = 2 and x2 = 6 Coal Conversion Plant (Cont’d)Graphical solutionMaximum profit Z = 36 for x1 = 2 and x2 = 6
26 More Optimization Examples Coal Conversion Plant (Cont’d)LINGO InputModel:max = 3*x1 + 5*x2;3*x1 + 2*x2 <= 18;x1 <= 4;2*x2 <= 12;x1 > 0;x2 > 0;endLINGO OutputRows= Vars= No. integer vars= ( all are linear)Nonzeros= Constraint nonz= 6( are +- 1) Density=0.611Smallest and largest elements in absolute value=No. < : 3 No. =: 0 No. > : 2, Obj=MAX, GUBs <= 2Single cols= 0Optimal solution found at step:Objective value:Variable Value Reduced CostX E+00X E+00Row Slack or Surplus Dual PriceE+00EEE+00E+00Value of objective function: 36Value of variable x1: 2Value of variable x2: 6
27 More Optimization Examples Methanol DeliverySupply methanol for three Methyl acetate plants located in towns A, B, and CDaily methanol requirements for each plant:MeAc Plant location Tons/dayABCMethanol production plantsMeOH plantCapacity
28 More Optimization Examples Methanol Delivery (Cont’d)Shipping cost (100 $/ton)Schedule the methanol delivery system to minimize the transportation costMeOH PlantMeAc Plant AMeAc Plant BMeAc Plant C1253811615479
29 More Optimization Examples Methanol Delivery (Cont’d)We define the transportation loads (tons/day) going from each MeOH plant to each MeAc plant as follows:Total transportation cost (Z)MeOH PlantMeAc Plant AMeAc Plant BMeAc Plant C1X1AX1BX1C2X2AX2BX2C3X3AX3BX3C4X4AX4BX4CZ = 2X1A + X1B + 5X1C + 3X2A + 0X2B + 8X2C + 11X3A + 6X3B + 15X3C + 7X4A + X4B + 9X4C
32 Mixed Integer Programs Use of 0-1 Binary Integer VariablesCommonly used to represent binary choicesDichotomy modeling
33 Mixed Integer Programs The Assignment ProblemAssignment of n people to do m jobsEach job must be done by exactly one personEach person can at most do one jobThe cost of person j doing job i is CijThe problem is to assign the people to the jobs so as to minimize the total cost of completing all the jobs.We can assign integer variables to describe whether a certain person does a certain job or not
34 Mixed Integer Programs The Assignment Problem (Cont’d)The event of person j doing job i is designated XijThe objective function can be written as:Since exactly one person will do job i, and each person at most can do one job, we get:
35 Mixed Integer Programs Plant Layout – An Assignment ProblemFour new reactors R1, R2, R3 and R4 are to be installed in a chemical plantFour vacant spaces 1, 2, 3 and 4 are availableCost of assigning reactor i to space j (in $1000) isAssign reactors to spaces to minimize the total costReactorSpace 1Space 2Space 3Space 4R1151113R21217R31410R416
36 Mixed Integer Programs Plant Layout (Cont’d)Let Xij denote the existence (or absence) of reactor i in space j, i.e. if Xij =1 then reactor i exists in space jObjective function min Z = X X X X X X X X X X X X34+ 17X X X X44
37 Mixed Integer Programs Plant Layout (Cont’d)ConstraintsEach space must be assigned to one and only one reactorX11 + X12 + X13 + X14 = 1X21 + X22 + X23 + X24 = 1X31 + X32 + X33 + X34 = 1X41 + X42 + X43 + X44 = 1Each reactor must be assigned to one and only one spaceX11 + X21 + X31 + X41 = 1X12 + X22 + X32 + X42 = 1X13 + X23 + X33 + X43 = 1X14 + X24 + X34 + X44 = 1
38 Mixed Integer Programs Plant Layout (Cont’d)Solve using LINGOOptimal assignment policyReactor R1 in space 2Reactor R2 in space 1Reactor R3 in space 4Reactor R4 in space 3Minimum costCost = = $49,000
39 Lecture 10 – Summary On completion of this part, you should: Understand the different types of optimization problems and their formulationBe able to formulate and solve a variety of optimization problems in LINGO
40 Other Business Homework Next Lecture – October 23 SSLW: 24.1 plus problems posted on class webpageDue Tuesday October 23LINGO software is available on class webpage as zip-fileNext Lecture – October 23Heat and Power Integration (SSLW p )Review of Midterm ExamThursday October 18 during lab sessionsYou will get your tests back to look at during solution review