22
Elementary optimization Special Topics in Industrial Chemistry Seppo Karrila November 2014

Lecture3 elementary optimization

Embed Size (px)

Citation preview

Elementary optimization

Special Topics in Industrial ChemistrySeppo Karrila

November 2014

Executive summary

• What is optimization– Important terms

• Tools you can easily use– How to use within a spreadsheet

• Some examples of Linear Programs– A raw material mix with requirements on

“concentrations”, so there are dilution effects– Diet problem: satisfy minimum daily requirements

Industry view

• The purpose of research is to enable decisions

• We want to make “the best most profitable decisions”– Research must provide a prediction: what

happens when we decide this or that– Alternative decisions must be compared, based on

numbers (calculated profit)• Finding “the best” is called “optimization”

Optimization• You are in control of some decision variables• Your decisions affect an outcome that you can

calculate from a numerical model• How do you get the best outcome?– Maximize profit– Minimize cost– In general, optimize an objective function

• You get the optimum (maximum or minimum) with an optimal decision

• Rules that your variables have to satisfy are called constraints

Example: making a blend

• Raw materials have each their characteristics• Blending them affects the characteristics as if

these were concentrations mtot c = m1 c1 + m2 c2

mtot = m1 + m2

c = (m1 c1 + m2 c2)/(m1 + m2)

A coffee blend

• Aroma and strength follow similar rules as concentrations. Must have blend aroma >=78, and strength >= 16 .

• Availability: Brazilian < = 1,500 lbColombian <= 1,200 lb, Peruvian <= 2,000 lb

• Make 4,000 lb of blend at lowest cost !

Why this is really important

• In industrial production, if you save 0.1 % in raw material costs, you have earned your wages.

• You can apply this to making any raw material mixtures– Available raw materials are often already mixtures

• Purification adds costs. Why purify if you will mix again? – Your blend must satisfy some “quality” requirements– You want to minimize the cost

What is the aroma rating of the blend?

• Apply the “concentration rule”:

• What is required of this characteristic:

Manipulate this to get a simpler inequality

• This is the quality criterion for aroma• Similarly, you get the criterion for strength of the blend:

Putting the model togetherMinimize

• Quality criteria• Required

production• Availabilities

So it looks terrible?

• This type of systems are solved routinely• Any spreadsheet program you use can solve

them– The solution technique is reliable:

if there is a solution it is found, if there is none then you will be told so

• This is an example of a “linear program”

You need to know how to handle this

• So we will go through the solution with a program that you certainly can access:– Google drive spreadsheet

• Otherwise, you can do exactly the same in Excel– You may have to activate Solver add-in, if you have

not used it before

In Google Drive, install an add-on

• Search for “solver”, add it to your spreadsheet

Open solver

• Press “Insert Example” to see a similar problem

The solution to our problem

• Note: ALL calculations done with “sumproduct” !• Method: Simplex. (LP = Linear Programming.)

You can check aroma and strength of the solution

• I left these out, they are not needed to solve the problem

• Note that LP is reliable. You can try other solution methods, they may give worse “solutions.” – Important to have “Assume Non-negative”

selected in “Options”, otherwise you get wrong results also

A Reference

• K.A. Baker: Optimization Modeling with Spreadsheets– Explains several other problem types that can be

solved with Linear Programming – Covers some further cases:• Integer variables (numbers without decimals)• Some non-linear programming

Another typical LP problem: the diet problem

• Make the lowest cost food mix that satisfies nutrition requirements, namely “daily dose” of constituents– You could have lots of details, about various vitamins and minerals. Some are

bad in overdose, you can have max limits!– If you are feeding an army, a small change in cost will be a lot of money. How

about feeding 50 cows or 100 pigs?

This problem has “minimum requirements” for total content in blend

• Dilution by other components does not matter, we are not concerned with concentrations– The concentration problem in the coffee mix example is slightly more difficult than

this one. That is why we went it through in detail, so you can do those problems in the future…

• You could also have maximum limits, for example for some contaminant in a reaction mixture

• In real world research (experiments) are used to determine limits– How much contamination can you tolerate in recycled plastic, by another type of

plastic? There is no ready-to-use model, you will have to make it.

My personal view

• You must be able to “write in equations” and solve small LP problems– They come up all the time, at least if you know to look

for them• Leave big or difficult problems to specialists– Small: Excel handles up to 200 decision variables– But to solve in Excel as LP, you have to write everything

in “sumproduct” formulas– When this does not work, go see a specialist who has

experience with some actual optimization software

Work in classroom

• Write down the diet problem as equations– What are the decision variables? • Can they be negative?

– What is the objective, is it minimized or maximized?

– What are the constraints, or quality requirements? • Solve this in Excel, or in Google spreadsheet!

Key points to know and remember• To optimize something, you need

– ONE SINGLE numeric objective to minimize or maximize, often cost or income, or profit

– The values you can choose (decide) are your decision variables – Requirements on quality, limits on availability are constraints

• When all your computations aresumproduct(decision_vars, constants)– Then you have a Linear Program– These are easy to solve reliably, even in spreadsheets

• Making blends often gives linear programs– Chemical or food industries are all about making blends