Documentos de Académico
Documentos de Profesional
Documentos de Cultura
NotasSeminario1 PDF
NotasSeminario1 PDF
2. Técnicas de Optimización
2.1 Programación Lineal: Método Simplex
2.2 Programación No Lineal
2.2.1 Optimización sin restricciones
2.2.2 Optimización con Restricciones de Igualdad
2.2.3 Optimización con Restricciones de Desigualdad
2.3 La Programación Mixta-Entera en el Diseño de Procesos
2.4 Programación Mixta Entera Lineal: Método de “Branch and Bound”
2.5 Programación Mixta-Entera No Lineal: Método “Outer Approximation”
• Síntesis (o Diseño)
• Simulación (o Análisis)
• Optimización
Síntesis (o Diseño ) de Procesos
Materia Productos
Prima Bajo
(condiciones Especificación
iniciales)
Materia Productos
Prima Bajo
(condiciones Especificación
iniciales)
Minimizar Costo
D, Pureza
Alimentación N=?
R=?
P=?
Simulación
Diseño Optimización
Introducción: Algunos Conceptos
en la Optimización de Procesos
Previo a la Optimización: Modelación
Representación Matemática de la Fisicoquímica
del proceso:
z Balances de Masa
z Balances de Energía Sistema de
z Relaciones Termodinámicas Ecuaciones
z Ecuaciones de Diseño No Lineales
z Balances de Momentum
z Restricciones Particulares
Análisis de Grados de Libertad
Función Objetivo:
Objetivo
obtención de diseños
óptimos
Simulación u Optimización?
Simulación Optimización
x1 + x2 = 2 x1 + x2 = 2
x1 = 3 x2 x1 , x2 ≥ 0
x1 , x2 ≥ 0
F = 2 −1 = 1
F = 2−2 = 0 Soluciones posibles:
Solución única min x1 − x2 x1 x2
x1 = 1.5 0 2
Función
x2 = 0.5 objetivo 1 1
1.5 0.5
2 0
Solución óptima M M
Selección de Variables de Diseño
M = 900 N = 1000
x1 x2 x3 x4
f1 = ln( x1 ) − 2 = 0 f1 X
f 2 = x2 − 3 x4 − 5 = 0 f2 X X
f 3 = ( x2 ) − x3 + x4 − 1 = 0
3
f3 X X X
Trayectorias de Steward
x1 x2 x3 x4
f1 X
f2 X X
f3 X X X
Representación Matemática del
Problema de Optimización
• Variables Discretas y Continuas
• Restricciones (Ecuaciones, Desigualdades)
Lineales y No Lineales
min f ( x, y )
s.t. h( x, y ) = 0
g ( x, y ) ≤ 0
x ∈ R n , y ∈ {0,1}
El Modelo Matemático
min f ( x, y )
s.t. h( x, y ) = 0
g ( x, y ) ≤ 0
x ∈ R n , y ∈ {0,1}
Límites:
Minimizar Costos 0< Comp <1
Maximizar Utilidades Temperatura,
Presión, etc.
Decisiones discretas:
Balances de Materia, Energía, ¿ Equipo Existe ?
Relaciones de Equilibrio, etc.
z ¿ Restricción Lineal o No Lineal ?
2x +3 y=1
yx + 3 y = 1 x 2 + ln ( y ) = 1
Tipos de Variables
min f ( x)
s.t. h( x) = 0
g ( x) ≤ 0
x ∈ Rn
NLP
Función Convexa o No Convexa
Función Convexa
f(x) f(x)
x1 x2 x1 x2
Convexa No
Convexa
Función Convexa?
Función f ( x) = x 3 − 6 x 2 + 11x − 6 Intervalo (1,3)
f ( x1 ) = f (1) = 0 f ( x2 ) = f (3) = 0
f (αx1 + [1 − α ]x2 ) ≤ αf ( x1 ) + (1 − α ) f ( x2 )
0.375 ≤ 0
No se cumple
Región Factible y Convexa
x1 x1
x2
x2
Convexa No
Convexa
Técnicas de Optimización
Técnicas de Optimización
Acotamiento) (MILP)
Benders (MINLP)
Programación Lineal
Programación Lineal
Forma General
T
min c x Maximize 300 x1 + 200 x2
s.t. A x ≤ b sujeto a 5 x1 + 2 x2 ≤ 180
x≥0 3x1 + 3 x2 ≤ 135
x ∈Rn
x1 ≤ 25
5 2 180
300 x1
c= x= A = 3 3 b = 135
200 x2 1 0
25
Método Simplex
Si la función objetivo
disminuye en esta dirección
g1=0
g2=0
5 x1 + 2 x2 ≤ 180 5 x1 + 2 x2 + s1 = 180
3x1 + 3 x2 ≤ 135 3x1 + 3 x2 + s2 = 135
x1 ≤ 25 x1 + s3 = 25
Método Simplex
x1 x2 s1 s2 s3 b
Punto inicial
5 2 1 0 0 180 s1
x1 = 0
Matriz de x2=0
3 3 0 1 0 135 s2
Coeficientes s1 = 180
1 0 0 0 1 25 s3
s2=135
-300 -200 0 0 0 0 f
s3 = 25
Eliminación Gaussiana
s3 x2 s1 s2 s3 b
0 2 1 0 -5 55 s1
0 3 0 1 -3 60 s2
1 0 0 0 1 25 x1
s2 x2 s1 s2 s3 b
0 -3 1 -5/3 0 -45 s1
1 1 0 1/3 0 45 x1
0 -1 0 -1/3 1 -20 s3
s3 s2 s1 s2 s3 b
0 0 1 -2/3 -3 15 s1
0 1 0 1/3 -1 20 x2
1 0 0 0 1 25 x1
3x1 + 3 x2 ≤ 135
x1 ≤ 25 (0,90)
(0,45) (25,27.5)
(25,20)
x1
(0,0)
El óptimo en el punto (25,20) (25,0)
Programación No Lineal
Condiciones de Optimalidad
Optimización Sin Restricciones
min f ( x )
x ∈ Rn
∂f
∂x1 Se obtiene un sistema
∇f (x ) = M = 0 de n Ecuaciones con n
∂f Variables x
∂xn
Condiciones de Optimalidad
Optimización Sin Restricciones
min f ( x )
x ∈ Rn
∂f
∂x1
∇f (x ) = M = 0
∂f
∂xn
Condición suficiente:
suficiente La Matriz Hessiana de la
función objetivo es definida positiva
f (x + ∆ x ) = f (x ) + ∇f (x ) ∆ x + 1 ∆ x H ∆ x
T T
2
∂2 f ∂2 f
∂x12 ∂x1 ∂x2 Hessiana para el
H = 2
∂ f ∂2 f caso de 2 variables
∂x ∂ x 2
2 1 ∂x1
1 ∆ xT H ∆ x ≥ 0
2
Optimización Sin Restricciones
min ( x1 ) 2 − 6 x1 + (x2 ) − 2 x2
2
2 x1 − 6 x1 = 3
∇f ( x ) = =0
2 x2 − 2 x2 = 1
2 0 H es positiva definida
H =
0 2
Optimo Global
Condiciones de Optimalidad
Optimización Con m Restricciones de Igualdad
min f ( x )
s.t. h( x) = 0
x ∈ Rn
j
λ se denominan multiplicadores de
Lagrange y constituyen m variables
adicionales en el problema
Condición necesaria:Obtener
necesaria: un punto crítico
(estacionario) para la función de Lagrange
∂L( x, λ )
= ∇ f ( x ) + ∑ λ j ∇h j ( x ) = 0 Se obtiene un sistema
∂x j
de n+m Ecuaciones
∂L( x, λ ) con n+m Variables x
= h( x ) = 0 yλ
∂λ
2 x1 − 6 1
∇f ( x ) + ∑ λ j ∇h j ( x ) = + λ1 = 0
j 2 x2 − 2 − 1
h( x ) = x1 − x2 − 2 = 0
2 x1 − 6 + λ1 = 0
2 x2 − 2 − λ1 = 0
x1 − x2 − 2 = 0
Condiciones de Optimalidad
Optimización Con m Restricciones de Igualdad y r de
Desigualdad
min f ( x)
s.t. h( x) = 0
g ( x) ≤ 0
x ∈ Rn
Función de Lagrange Aumentada (función escalar):
m r
L ( x, λ , µ ) = f ( x ) + λ h ( x ) + µ g ( x ) = f ( x ) + ∑ λ j h j ( x ) + ∑ µ k g k ( x )
T T
j =1 k =1
∂L(x, λ , µ )
= h( x ) = 0 Se obtiene un sistema
∂λ de n+m+r Ecuaciones
µk (x )⋅ g k (x ) = 0 con n+m+r Variables
x, µ y λ
µk (x ) ≥ 0 g k (x ) ≤ 0
∂L( x, λ , µ )
= ∇f ( x ) + ∑ λ j ∇ h j ( x ) + ∑ µ k ∇g k ( x ) = 0
∂x j k
∂L(x, λ , µ ) µk (x )⋅ g k (x ) = 0
= h( x ) = 0
∂λ
µk (x ) ≥ 0 g k (x ) ≤ 0
Optimización con
Restricciones de
Desigualdad
min f ( x ) = 1 (x12 + x22 ) − 3 x1 − x2
2
s.t. g1 = − x1 + x2 ≤ 0
g 2 = x1 − 1 x2 − 2 ≤ 0
2 Note:
x1 − 3 − 1 1
∇f ( x ) + ∑ µ k ∇hk ( x) = + µ1 + µ 2 =0
k x2 − 1 1 − 1 2
x1 − µ1 + µ 2 = 3
x2 + µ1 − 1 µ 2 = 1
2
µ1 (− x1 + x2 ) = 0
( )
µ 2 x1 − 1 x2 − 2 = 0
2
Programación No Lineal
Estrategia del Conjunto Activo (Active Set Strategy)
Solución al Conjunto de Ecuaciones KKT
∇f ( x ) + ∑ λ j ∇h j ( x ) + ∑ µ k ∇ g k ( x ) = 0
j k
h( x ) = 0
µ k (x ) ⋅ g k (x ) = 0
µk (x ) ≥ 0 g k (x ) ≤ 0
Desigualdades
g k (x ) = 0 g k (x ) < 0
Activa Inactiva
Programación No Lineal
Estrategia del Conjunto Activo
∇f ( x ) + ∑ λ j ∇h j ( x ) + ∑ µ k ∇g k ( x ) = 0
j k∈J1
h( x ) = 0
g k ( x ) = 0 k ∈ J1
Programación No Lineal
Estrategia del Conjunto Activo
3) Si para toda k g k ( x) ≤ 0 y µ k ≥ 0 OK
OK. Se ha obtenido la solución
c) Regresar a 2)
Programación No Lineal
Estrategia del Conjunto Activo: Ejemplo
min f ( x ) = 1 (x12 + x22 ) − 3 x1 − x2
2
s.t. g1 = − x1 + x2 ≤ 0
g 2 = x1 − 1 x2 − 2 ≤ 0
2
g 3 = − x2 ≤ 0
Condiciones de Karush-Kuhn-Tucker (Iteración 1):
J1 = {k g k = 0} ∇f ( x ) + ∑ λ j ∇h j ( x ) + ∑ µ k ∇g k ( x ) = 0
j k∈J1
J1 = ∅ ⇒ g k > 0 µk = 0
Sistema de Ecuaciones
No Lineales
Iteración de Newton
Programa cuádratico
Programación Mixta-Entera
Representación de Procesos en
Términos de Variables Binarias
x1 z1
I
x0
A 10 kmol/hr B
x2 z2
II
1 if reactor I is selected
y1 = min C = 7.5 y1 + 6.4 x1 + 5.5 y2 + 6.0 x2
0 if reactor I is not selected
sujeto a 0.8 x1 + 0.67 x2 = 10
1 if reactor II is selected x1 − 20 y1 ≤ 0 x2 − 20 y2 ≤ 0
y2 =
0 if reactor II is not selected x1 , x2 ≥ 0 y1 , y2 = 0,1
Relaciones Lógicas
¬p j
1) NOT
1− y j 7) Teorema de Morgan
pi ∨ p j
2) OR (exclusivo) y + y = 1 ¬( A ∨ B ) ⇔ ¬A ∧ ¬B
¬( A ∧ B ) ⇔ ¬A ∨ ¬B
i j
pi ∨ p j
3) OR (inclusivo)
yi + y j ≥ 1 8) Distribución de
pi ∧ p j AND
4) AND y 1, y 1
j ≥ i ≥
( A ∧ B ) ∨ C ⇔ ( A ∨ C ) ∧ (B ∨ C )
pi → p j ¬pi ∨ p j
5) If-Then
1 − yi + y j ≥ 1 yi ≤ y j
pi ↔ p j
6) Iff-Then
yi = y j
Representando Alternativas
Big - M Convex Hull
x11 + x12 = x1
x1 − 2 x2 ≤ M (1 − y1 )
x1 − 2 x2 ≥ − M (1 − y1 ) x21 + x22 = x2
x1 − 1 ≤ M (1 − y1 ) x11 ≤ My1
y1 + y2 = 1 x12 ≤ My2
x21 ≤ My1
x1 − 5 x2 ≤ M (1 − y2 )
x22 ≤ My2
x1 − 5 x2 ≥ − M (1 − y2 )
x1 − 1 ≥ − M (1 − y2 ) x11 − 2 x21 = 0
x1 , x2 ≥ 0 x12 − 5 x22 = 0
y1 y2 x11 ≤ y1
= ∨ =
x1 2 x2 x1 5 x2 x12 ≥ y2
x1 ≤ 1 x1 ≥ 1 y1 + y2 = 1
x , x ≥ 0 x , x ≥ 0
1 2 1 2 x11 , x12 , x21 , x22 ≥ 0
Programación Mixta-
Entera Lineal
Método de “Branch
“ and Bound” (Ramificación y Acotamiento)
Procedimiento:
y3=0
y1=0
y2=1
0<y1<1
0<y2<1
0<y3<1 y1=1
Relajado
− 5 y1 − 8 y2 − 3 y3 ≤ −9 infactible
x ≥ 0, y1 , y2 , y3 ∈ {0,1}
y1=1 y2=0
[0,1,1]
y2=1 z =8
[0.2,1,0]
z = 5.8
y3=1
y1=0 [0,0.075,1]
z = 6.75 y =0
m=3 [0,1,0.333] 2
z=6
2 m +1 − 1 = 15 y3=0
infactible
infactible
Programación Mixta-
Entera No Lineal
Seleccionar un valor inicial para y
ZU
Nueva y
Algoritmo Resolver el Problema Maestro MILP
General ZL
SI
ZL<ZU ?
NO
Solución
Programación Mixta-
Entera No Lineal
Algoritmo “Outer
“ Approximation” (DICOPT+++)
Problema Maestro
Z = min α
T
min c y + f ( x) ( ) ( )( T
sujeto a α ≥ cT y + f x k + ∇f x k x − x k )
g ( x) + B y ≤ 0 ( ) ( )( )T
g x k + ∇g x k x − x k + By ≤ 0 ∀k ∈ T
Ay ≤ a Ay ≤ a
y ∈ {0,1} x ∈ R n
m
y ∈ {0,1} x ∈ R n
m
α ∈R
f(x)
k x k es la solución óptima de S y k ∀
T =
( )
k
los posibles valores de y
x
Algoritmo “Outer
“ Approximation”
Z = min α
( ) ( )( T
sujeto a α ≥ cT y + f x k + ∇f x k x − x k )
( ) ( )( )T
g x k + ∇g x k x − x k + By ≤ 0 k = 1K K
Ay ≤ a
y ∈ {0,1} x ∈ R n
m
α ∈R
1) NLP y1 = 1 y2 = 1 y3 = 1 x1 = 2 x2 = 2 zU = 11
MILP y1 = 1 y2 = 0 y3 = 0 x1 = 2 x2 = 0 z L = 1
2) NLP y1 = 1 y2 = 0 y3 = 0 x1 = 2 x2 = 0 zU = 5
MILP y1 = 0 y2 = 1 y3 = 0 x1 = 1 x2 = 0 z L = 1.5
3) NLP y1 = 0 y 2 = 1 y3 = 0 x1 = 1 x2 = 1 zU = 3.5
MILP y1 = 0 y2 = 0 y3 = 1 x1 = 2 x2 = 1 z L = 4.5
Programación Mixta-
Entera No Lineal
“Outer Approximation”: Ejemplo 2, Iteración 1
min z = −2.7 y + x 2
s.t. g1 = − ln (1 + x ) + y ≤ 0
g 2 = − ln ( x − 0.57 ) + y − 1.1 ≤ 0
0≤ x≤2 y ∈ {0,1}
1) Comenzar con y=1 y resolver NLP:
z = 0.2525 x = 1.7183 µ1 = 9.347 µ 2 = 0
( zU )
2) Linealizar el problema MINLP en x= 1.7183 para obtener el problema maestro MILP:
zOA = min α OA
z L < zU
s.t. α OA ≥ −2.7 y + 3.4366 x − 2.9525
y=0
− 0.36787 x + y ≤ 0.36788 Volver a paso 1
zOA = −1.939 con nuevo valor
− 0.87085 x + y ≤ −0.2581
( zL ) y=0
0≤ x y ∈ {0,1}
El Entorno de Modelación
GAMS y sus Resolvedores
Formas de Atacar el Problema de
Modelación
z Corriente Modular Secuencial
Corriente
de
Reciclo
Intercambiador
Separador
Flash
Alimentación
Mezclador Reactor
Algoritmos
de Solución
GAMS: Ejemplo 1
W1
y0 = 0
Q=1000 lb/hr
xF = 0.2
Etapa de Q=1000 lb/hr
Extracción x1
W1
y1
q =1.0
N α zj
∑j =1 α
j
−θ
= 1− q
j
N α j x Dj
∑α
j =1 −θ
= 1 + Rmin
j
∑x j =1
D
j =1
Algunas Aplicaciones en
Ingeniería Química
Optimización de Columnas y
Secuencias de Destilación
ABC B
D, Pureza
Alimentación
A
2)
BC
AB
C
l∈C ktop
ξ ktop =
∑x
l∈C k
l
F
x iF
k
l ∈ Ck
∑x l
F
l∈C kbot
ξ kbot =
∑x l
F
l ∈ C kbot l∈C k
Datos de Caso de Estudio
Mezcla Cuaternaria ABCD
F=1000 Kmol/hr: 15% A, 30% B, 35% C, 20% D
Costos de utilidades:
Agua de enfriamiento: CW = 1.3 (103$ hr/ 106 KJ año)
Vapor: CH = 34 (103$ hr/ 106 KJ año)
Superestructura
B/CD
F4
y4 F8
C/D
A/BCD y8
F5
y5
BC/D
F1
y1
F3
y3
A/BC
F6
y6
ABC/D y10
A/B
y7 F10
F7
AB/C
Modelo Balance Global
Factores de separación FTOT = 1000 = F1 + F2 + F3
A
ξ1A =0.15 ξ6 =0.188
BC F9 − 0.765F5 − 0.812 F6 = 0
CD F8 − 0.55 F2 − 0.647 F4 = 0
Flujos (Big-M)
h2 ?
418 ° K
c1
305 ° K
375 ° K
c2
310 ° K 298 ° K
Modelo MINLP
(SYNHEAT)
Estrategia de Optimización Simultánea
Stage 1 Stage 2
H1-C1 H1-C1
H1
H1-C2 H1-C2
H2-C1 H2-C1 C1
H2
H2-C2 H2-C2
C2
MODELO
Balance de calor total para cada corriente:
Carga de servicios de enfriamiento y
(TIN i − TOUT i )F i = ∑ ∑q ijk + qcu i , i ∈ HP calentamiento:
k ∈ ST j ∈ CP
Thousands of barrels/day
3200
d1 3100
Demand d3 d4
d2 3000
2900
2800
2700
2600
T1 T2 T3 T4 2500
Jan Mar May Jul Sep Nov Jan
H
Month
well head
well bore storage Geological Properties:
oil permeability
flow thickness
porosity
well bore etc.
reservoir
oil flow
ts t ts t
Modelos de
Programación Mixta-
Entera
∑q T ≥ d
i
ij j ∀j ∈ P
¬Yij
Yij Wij1 Wij 2
p f = pin − D ∨ p f = pin + I ∨ p f = pup ∀i ∈W , j ∈ P
ij ij ij ij ij ij ij i
in up
p
ij + I ij ≤ pi p
ij
in
+ I ij > p up
i
Dij = qij {c1 [ln(T ) + c2 ]} ∀i ∈W , j ∈ P
I ij = qis {c1 [ln(T ) + c2 ]}(1 − yij ) ∀i ∈W , j ∈ P
(
qijmax {c1 [ln(T ) + c2 ]} = pijin − pilow )
∀i ∈W , j ∈ P
qij ≤ qijmax ∀i ∈W , j ∈ P
(
qij ≤ qiup yij + qlow 1 − yij )
∀i ∈W , j ∈ P
qij ≥ qlow ∀i ∈W , j ∈ P
pijin = pijf−1 ∀i ∈W , j ∈P
Calendarización de
Procesos por Lotes
Gráficas de Gant
Producto A
8 8 8 8
Mezclador
20 20
Reactor 1
20 20
Reactor 2
4 4 4 4
Centrífuga