Sie sind auf Seite 1von 59

Captulo 7

Pesquisa Operacional
na Tomada de Decises
Programao No Linear


Lachtermacher, G. Pesquisa Operacional na
Tomada de Deciso, 4a. Edio, Pearson, 2009
Programao No Linear
De forma geral um problema de programao no linear
tem a seguinte forma:





Nenhum algoritmo resolve todos os problemas que
podem ser includos neste formato.
) ,..., , ( = x onde 0 x
,..., 2 , 1 para ) x (
) x ( ou
2 1 n
i i
x x x
m i b g st
f Min Max
>
= s
Programao No Linear
Aplicaes
Problemas de Mix de Produtos em que o lucro obtido
por produto varia com a quantidade vendida.

Problemas de Transporte com custos variveis de
transporte em relao quantidade enviada.

Seleo de Portfolio com Risco

Considere o Problema de Programao Linear e sua
soluo grfica
1
Max Z x x = + 3 5
1 2
1
2x s 12
2
3x x + s 2 18
1
2
s r x
s 4
. .
x x > > 0 0
1 2
,
x
2
x
1
(0;6)
(2;6)
(0;0)
(4;0)
(4;3)
Soluo
Vivel
Programao No Linear
Soluo Grfica
Considere o Problema e sua soluo grfica.
Max Z x x = + 3 5
1 2
1
s.t. x
s 4
x x > > 0 0
1 2
,
9 5 216
1
2
2
2
x x
+ s
x
2
1 2
3 4
4
2
6
0
0
x
1
Soluo
Vivel
(2;6)
Programao No Linear
Soluo Grfica
A soluo tima:
a mesma do problema
linear.
continua na fronteira do
conjunto de solues
viveis.
no mais um extremo do
conjunto de solues viveis
mas poderia ainda ocorrer
em um ponto extremo.
No existe a simplificao
existente em Programao
Linear
x
2
1 2
3 4
4
2
6
0
0
x
1
Soluo
Vivel
(2;6)
Programao No Linear
Soluo Grfica
1
2x s 12
2
3x x + s 2 18
1
2
s r x
s 4
. .
x x > > 0 0
1 2
,
Max Z= x x x x 126 9 182 13
1 1
2
2 2
2
+
x
2
x
1
(0;6)
(2;6)
(0;0)
(4;0)
(4;3)
Regio
Vivel
Programao No Linear
Soluo Grfica
A funo objetivo uma equao quadrtica.
Programao No Linear
Soluo Grfica
( )
| |
( )
| |
( )
| |
( )
| |
Z= x x x x
Z x x x x
Z x x
Para x x
Para
126 9 182 13
9
126
18
13
182
26
9
126
9
126
18
13
182
13
182
26
441 637 9 7 13 7
9 7 13 7
1 1
2
2 2
2
2 2
1
2
1
2
2
2
2
2
1
2
2
2
1
2
2
2
+

|
\

|
.
|
|
\

|
.
| =
|
\

|
.
| +
|
\

|
.
|

(

|
\

|
.
| +
|
\

|
.
|

(
=
+ Z = 907 171=
Z = 857 ( )
| |
( )
| |
( )
| |
( )
| |
+
+
221=
Z = 807 =
9 7 13 7
271 9 7 13 7
1
2
2
2
1
2
2
2
x x
Para x x
Max Z = x x x x = 857 126 9 182 13
1 1
2
2 2
2
+
2
4
4
6
2
x
1
x
2
Regio
Vivel
Z = 907
Z = 807
Z=857
Programao No Linear
Soluo Grfica
tima
1
2x s 12
2
3x x + s 2 18
1
2
s r x
s 4
. .
x x > > 0 0
1 2
,
Max Z= x x x x 54 9 78 13
1 1
2
2 2
2
+
x
2
x
1
(0;6)
(2;6)
(0;0)
(4;0)
(4;3)
Regio
Vivel
Programao No Linear
Soluo Grfica
A funo objetivo uma equao quadrtica
( )
| |
( )
| |
( )
| |
( )
| |
Z= x x x x
Z x x x x
Z x x
Para x x
Para
54 9 78 13
9
54
18
13
78
26
9
54
9
54
18
13
78
13
78
26
81 117 9 3 13 3
9 3 13 3
1 1
2
2 2
2
2 2
1
2
1
2
2
2
2
2
1
2
2
2
1
2
2
2
+

|
\

|
.
|
|
\

|
.
| =
|
\

|
.
| +
|
\

|
.
|



(

(

|
\

|
.
| +
|
\

|
.
|



(

(
=
+

Z = 198 0 =
Z = 189
( )
| |
( )
| |
( )
| |
( )
| |
9 9 3 13 3
36 9 3 13 3
1
2
2
2
1
2
2
2
=
Z = 162 =
x x
Para x x
+
+
Programao No Linear
Soluo Grfica
Soluo no interior do
conjunto de solues
viveis e no mais na
fronteira do conjunto
4
2
6
2
4
x
1
x
2
Regio
Vivel
3
3
Z=162 Z=189
Z=198
2
2 2
2
1 1
13 78 9 54 x x x x Z Max + =
2
2 2
2
1 1
13 78 9 54 198 x x x x = Z Max
+ =
Programao No Linear
Soluo Grfica
Programao No Linear
A soluo tima de um problema de programao no
linear (NLP), diferentemente de um problema de LP,
pode ser qualquer valor do conjunto de solues
viveis.

Isso torna os problemas de NLP muito mais complexos,
obrigando os algoritmos de soluo a pesquisar todos os
valores possveis.

Convex Programming Problems


One class of NLPs Convex Programming Problems can
be solved by algorithms that are guaranteed to converge to
the optimal solution.
The objective is to maximize a concave function or to
minimize a convex function.
The set of constraints form a convex set.
Properties of Convex Programming Problems
A smooth function (no sharp points, no discontinuities)
One global maximum (minimum).
A line drawn between any two points on the curve of the
function will lie below (above) the curve or on the curve.
A One Variable Concave (Convex) Function
X
A Concave function
A convex function
X
An illustration of a two variable convex function
If a straight line that joins any two points in the set lies
within the set, then the set is called a convex set.
Convex set
Non-convex set
Convex Sets
In a NLP model all the constraints are of
the less than or equal to form G
i
(X) s B.
If all the functions G
i
are convex, the set
of constraints forms a convex set.
NLP and Convex Sets
Unconstrained Nonlinear Programming
One-variable unconstrained problems are
demonstrated by the Toshi Camera problem.

The inverse relationships between demand for an
item and its value (price) are utilized in this problem.

TOSHI CAMERA
Toshi camera of Japan has just developed a new
product, the Zoomcam.

It is believed that demand
for the initial product will
be linearly related to the
price.
Price Estimated
P ($) Demand (X)
100 350,000
150 300,000
200 250,000
250 200,000
300 150,000
350 100,000
Unit production cost is estimated to be $50.
What is the production quantity that maximizes
the total profit from the initial production run?

SOLUTION

Total profit = Revenue - Production cost

F(X) = PX - 50X

TOSHI CAMERA
From the Price / Demand table it can be verified that P = 450 -
.001X

The Profit function becomes
F(X) = (450 - .001X)X = 400X - .001X
2



This is a concave function.
400,000 0
TOSHI CAMERA
To obtain an optimal solution (maximum profit), two
conditions must be satisfied:
A necessary condition dF/dX = 0
A sufficient condition d
2
F/dX
2
< 0.
The necessary condition is satisfied at:
dF/dX = 400 - 2(.001)X = 0; X = 200,000.
The sufficient condition is satisfied since
d
2
F/dX
2
= -.002.
The optimal solution:
Produce 200,000 cameras.
The profit is F(200,000) = $40,000,000.
TOSHI CAMERA
If a function is known to be concave or convex at all
points, the following condition is both a necessary and
sufficient condition for optimality:

The point X* gives the maximum value for a concave
function, or the minimum value for a convex function,
F(X), if at X*
dF/dX = 0
Optimal solutions for concave/convex functions with one
variable
Determining whether or not a multivariate function is
concave or convex requires analysis of the second derivatives
of the function.
A point X* is optimal for a concave (convex) function if all
its partial derivatives are equal to zero at X*.
For example, in the three variable case:
c
c
c
c
c
c
F
X
F
X
F
X
1
1
2
2
3
3
0 0 0 = = = ; ; ;
Optimal solutions for concave/convex functions with more than
one variable
Constrained Nonlinear Programming Problems one
variable
The feasible region for a one variable problem is a
segment on a straight line
(X > a or X s b).

When the objective function is nonlinear the optimal
solution must not be at an extreme point.
TOSHI CAMERA - revisited
Toshi Camera needs to determine the optimal
production level from among the following three
alternatives:
150,000 s X s 300,000
50,000 s X s 175,000
150,000 s X s 350,000

400 0
X > 250,000
X s 350,000
X* = 250,000
400
0
400 0
Maximize F(X) = 400X - .001X
2
X > 150,000
X s 300,000
150
X > 50,000
X s 175,000
50 175
X*=200,000
X* = 175,000
The objective function does not change:
TOSHI CAMERA solution
Constrained Nonlinear Programming Problems m
variables
m n 2 1
2 n 2 1
1 n 2 1
n 2 1
B ) X ..., , X , Gm(X
.
.
.
B ) X ..., , X , G2(X
B ) X ..., , X , G1(X
ST
) X ..., , X , X ( F Maximize
s
s
s
Let us define Y
1
, Y
2
, ,Y
m

as the instantaneous improvement
in the value of F for one unit
increase in B
1
, B
2
, B
m
respectively.
This is a set of necessary conditions for optimality of most
nonlinear problems.
If the problem is convex, the K-T conditions are also sufficient
for a point X* to be optimal.
|
.
|

\
|
c
c
+ +
|
.
|

\
|
c
c
+
|
.
|

\
|
c
c
=
c
c
|
.
|

\
|
c
c
+ +
|
|
.
|

\
|
c
c
+
|
.
|

\
|
c
c
=
c
c
= = =
>
m
m
2 1
1
m
m 2
1
1
1
m m 2 2 1 1
m 2 1
X
Gm
Y ...
X
2 G
2 Y
X
1 G
Y
Xn
F
.
.
.
X
Gm
Y ...
X
2 G
Y
X
1 G
Y
X
F
. 4
0 S Y ..., , 0 S Y , 0 S Y . 3
0 Y ..., , Y , Y . 2
. feasible is * X . 1
2
S1, S2, ,Sm
are defined as
the slack variables
in each constraint.
Kuhn-Tucker optimality conditions
PBI INDUSTRIES
PBI wants to determine an optimal production
schedule for its two CD players during the month of
April.
Data
Unit production cost for the portable CD player = $50.

Unit production cost for the deluxe table player = $90.

There is additional intermix cost of $0.01(the number of
portable CDs)(the number of deluxe CDs).
Forecasts indicate that unit selling price for each CD player
is related to the number of units sold as follows:
Portable CD player unit price = 150 - .01X1
Deluxe CD player unit price = 350 - .02X2
PBI INDUSTRIES
Resource usage
Each portable CD player uses 1 unit of a particular
electrical component, and .1 labor hour.
Each deluxe CD player uses 2 units of the electrical
component, and .3 labor hour.
Resource availabilty
10,000 units of the electrical component units;
1,500 labor hours.
PBI INDUSTRIES
PBI INDUSTRIES SOLUTION
Decision variables
X1 - the number of portable CD players to produce
X2 - the number of deluxe CD players to produce
The model
Max (150-.
X X X X X
ST
X X
X
01X1)X1+(350-.02X2)X2 - 50X1- 90X2-.01X1X2 =
-.01X1

.1X1 +.3X2 1,500
- X1
2
+ +
+ s
s
s
s
. .
,
02 2 01 1 2 100 1 260 2
1 2 2 10 000
0
2 0
2
Production cannot be negative
Resource constraints
For a point X1, X2 to be optimal, the K-T conditions require that:
Y1S1 = 0; Y2S2 = 0; Y3S3 = 0; Y4S4 = 0, and
) 1 ( Y ) 0 ( Y ) 3 (. Y ) 2 ( Y 260 2 X 04 . X 01 .
or
X
G
Y
X
G
Y
X
G
Y
X
G
Y
X
F
) 0 ( Y ) 1 ( Y ) 1 (. Y ) 1 ( Y 100 X 01 . X 02 .
or
X
G
4 Y
X
G
Y
X
G
Y
X
G
Y
X
F
4 3 2 1 1
2
4
4
2
3
3
2
2
2
2
1
1
2
4 3 2 1 2 1
1
4
1
3
3
1
2
2
1
1
1
1
+ + + = +
|
.
|

\
|
c
c
+
|
.
|

\
|
c
c
+
|
.
|

\
|
c
c
+
|
.
|

\
|
c
c
=
c
c
+ + + = +
|
.
|

\
|
c
c
+
|
.
|

\
|
c
c
+
|
.
|

\
|
c
c
+
|
.
|

\
|
c
c
=
c
c
PBI INDUSTRIES SOLUTION
Finding an optimal production plan.
Assume X1>0 and X2>0.

The assumption implies S3>0 and S4>0.
Thus, Y3 = 0 and Y4 = 0.

Add the assumption that S1 = 0 and S2 = 0.
From the first two constraints we have X1 = 0 and X2 =
5000.
X1= 0
A contradiction X1>0
AS A RESULT THE SECOND ASSUMPTION CANNOT BE TRUE
PBI INDUSTRIES SOLUTION
Change the second assumption. Assume that S1 = 0
and S2 > 0.
As before, from the first assumption S3 > 0 and S4 > 0.
Thus, Y3 = 0 and Y4 = 0.
From the second assumption Y2 = 0.
Substituting the values of all the Ys in the partial derivative equations
we get the following two equations:
-.02X1 - .01X2 + 100 = Y1
-.01X1 - .04X2 + 260 = 2Y1
Also, since S1 = 0 (by the second assumption)
X1 + 2X2 = 10,000
Solving the set of three equations in three unknowns we get:
PBI INDUSTRIES SOLUTION
X1 = 1000, X2 = 4500, Y1 = 35

This solution is a feasible point (check the constraints).
X1 and X2 are positive.
1X1 + 2X2 <= 10,000 [1000 + 2(4500) = 10,000]
.1X1 + .3X2 <= 1,500 [.1(1000) + .3(4500) = 1450]
This problem represents a convex program since
It can be shown that the objective function F is concave.
All the constraints are linear, thus, form a convex set.

The K-T conditions yielded an optimal solution
PBI INDUSTRIES SOLUTION
Portable Deluxe Total Profit
April Production 1000 4500 810000
Portable Deluxe Used Available
Electrical Components 1 2 10000 10000
Labor Hours 0.1 0.3 1450 1500
PBI INDUSTRIES
PBI INDUSTRIES Excel SOLUTION
Programao No Linear
Excel
O Excel utiliza o algoritmo GRG (generalized reduced
gradient) para chegar soluo para um dado
problema.
O algoritmo no garante que a soluo encontrada
uma soluo global.
O Solver s vezes tem dificuldades de achar solues
para problemas que tenham condies iniciais para as
variveis iguais a zero. Uma boa medida comear a
otimizao com valores diferentes de zero para as
variveis de deciso.
Programao No Linear
Excel
Uma maneira prtica para tentar minorar o problema de
mximos e mnimos locais comear a otimizao de
diversos pontos iniciais, gerados aleatoriamente.
Se todas as otimizaes gerarem o mesmo resultado,
voc pode ter maior confiana, no a certeza, de ter
atingido um ponto global.
Programao No Linear
Controle de Estoque
Um dos modelos mais simples de controle de estoque
conhecido como Modelo do Lote Econmico.
Esse tipo de modelo assume as seguintes hipteses
A demanda (ou uso) do produto a ser pedido praticamente
constante durante o ano.
Cada novo pedido do produto deve chegar de uma vez no
exato instante em que este chegar a zero.

Programao No Linear
Controle de Estoque
Determinar o tamanho do pedido e a sua periodicidade
dado os seguintes custos:
Manuteno de Estoque Custo por se manter o capital no
estoque e no em outra aplicao, rendendo benefcios
financeiros para a empresa.
Custo do Pedido Associado a trabalho de efetuar o pedido
de um determinado produto.
Custo de Falta Associado a perdas que venham a decorrer
da interrupo da produo por falta do produto.

Demanda Anual =100
Lote=25,Pedido= 4
Estoque Mdio = 12,5
3 6 9 12
meses
25
12,5
25
Demanda Anual =100
Lote=50, Pedidos = 2
Estoque Mdio = 25
6 12
meses
50
Programao No Linear
Controle de Estoque
Programao No Linear
Controle de Estoque
m
C
2
Q
S
Q
D
C D Total Custo + + =
Constante
Varivel de Deciso
Q Quantidade por Pedido
Funo Objetivo =
Onde:
D = Demanda Anual do Produto
C = Custo Unitrio do Produto
S = Custo Unitrio de Fazer o Pedido
C
m
= Custo unitrio de manuteno em estoque por ano
Caso LCL Computadores
A LCL Computadores deseja diminuir o seu
estoque de mainboards. Sabendo-se que o custo
unitrio da mainboard de R$50,00, o custo
anual unitrio de manuteno de estoque de
R$20,00 e o custo unitrio do pedido de
R$10,00, encontre o lote econmico para atender
a uma demanda anual de 1000 mainboards.
Caso LCL Computadores
Caso LCL Computadores
Caso LCL Computadores
Caso LCL Computadores
Na soluo apresentada do lote econmico, a
quantidade de pedidos por ano fracionrio, j que



Isso no representa um problema
25 , 31
32
1000


= = =
Lote do Tamanho
Anual Demanda
lotes de n
Programao No Linear
Problemas de Localizao
Um problema muito usual na rea de negcios o de
localizao de Fbricas, Armazns, Centros de
distribuio e torres de transmisso telefnica.
Nesses problemas devemos Minimizar a distncia total
entre os centros consumidores e o centro de
distribuio, reduzindo assim teoricamente o custo de
transporte.
Para tal, o usual sobre um mapa colocar-se um eixo
cartesiano e determinar a posio dos centro
consumidores em relao a uma origem aleatria.
Caso LCL Telefonia Celular S.A.
Localidade X Y
Nova Iguau -5 10
Queimados 2 1
Duque de Caxias 10 5
O Gerente de Projetos da LCL Telecom, tem que localizar uma
antena de retransmisso para atender a trs localidades na
Baixada Fluminense. Por problemas tcnicos a antena no pode
estar a mais de 10 km do centro de cada cidade. Considerando as
localizaes relativas abaixo, determine o melhor
posicionamento para a torre.
Caso LCL Telefonia Celular S.A.
Nova Iguau
(-5,10)
Queimados
(2,1)
Duque de
Caxias
(10,5)
X
Y
Caso LCL Telefonia Celular S.A.

=
+
3
1
2 2
) ( ) (
i
i i
Y y X x Min
Variveis de Deciso
X Coordenada no eixo X da torre de transmisso
Y Coordenada no eixo Y da torre de transmisso
Funo Objetivo
Caso LCL Telefonia Celular S.A.
10 ) ( ) (
10 ) ( ) (
10 ) ( ) (
2
3
2
3
2
2
2
2
2
1
2
1
s +
s +
s +
Y y X x
Y y X x
Y y X x
Restries de Distncia
Caso LCL Telefonia Celular S.A.
Modelo no Excel
=SOMA(D2:D4)
Caso LCL Telefonia Celular S.A.
Parametrizao
Caso LCL Telefonia Celular S.A.
Soluo

Das könnte Ihnen auch gefallen