Upload
vuxuyen
View
214
Download
0
Embed Size (px)
Citation preview
Túlio A. M. Toffolohttp://www.toffolo.com.br
Otimização Linear e InteiraAula 20: Revisão
BCC464 / PCC174Departamento de Computação - UFOP
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Breve Revisão
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Programação Linear vs Programação Inteira
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Modelagem Técnicas de modelagem Problemas clássicos
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Branch-and-bound
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Planos de corte Desigualdades válidas Problemas de separação Lifting
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Formulações ideais
!2
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Programação Linear vs Inteira
!4
Exemplo
Maximize:6x1 + 5x2
Sujeito a:15x1 + 7x2 492x1 + 4x2 17x1, x2 2 Z+
z = 27, 11 emx1 = 1, 7 e x2 = 3, 4
Não é pontointeiro!
1
2
3
4
1 2 3 4
17 / 25 Túlio Toffolo – Otimização Linear e Inteira – Aula 12: Programação Inteira
Exemplo
Maximize:6x1 + 5x2
Sujeito a:15x1 + 7x2 492x1 + 4x2 17x1, x2 2 Z+
z = 27, 11 emx1 = 1, 7 e x2 = 3, 4
Ótimo inteiro:z = 22 emx1 = 2 e x2 = 2
1
2
3
4
1 2 3 4
17 / 25 Túlio Toffolo – Otimização Linear e Inteira – Aula 12: Programação Inteira
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Conceito
RelaxaçãoUma formulação R = {min fR(x) : x 2 XR} é considerada umarelaxação de uma formulação M = {min f (x) : x 2 X} se:
1 todas as soluções de M são também soluções de R, ouseja, X ✓ XR,
2 e toda solução x 2 X tem custo em R menor ou igual aocusto em M, ou seja, fR(x) f (x) para todo x 2 X
Exemplo: relaxação linear
15 / 25Túlio Toffolo – Otimização Linear e Inteira – Aula 12: Programação Inteira
Relaxação de um problema
!5
Utilizada por resolvedores de Programação Inteira!
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Como modelar PLs?The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
O segredo é: praticar
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Dicas: Não se limite aos exemplos apresentados em aula. Os livros indicados na ementa da disciplina possuem exemplos e exercícios resolvidos. Estude outros problemas clássicos!
!7
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Negação
!8
Dica: negação
O Complemento BinárioSejam y e x variáveis binárias (lógicas), se y é a negação de xdenominamos y como complemento binário de x .
y = x
Linearizando:
y = 1 � x
14 / 31 Túlio Toffolo – Otimização Linear e Inteira – Aula 11: Introdução a Programação Inteira
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Restrições 'Big M'
Esta técnica pode ser utilizada para adicionar um ‘if’ na sua formulação de Programação Inteira.
Perguntas:
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Qual o impacto do valor de ‘M’ ?
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Estas restrições são muito utilizadas?
!9
Xxi Myj
4 / 4 Túlio Toffolo – Otimização Linear e Inteira – Aula 01: Introdução
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo: corte e empacotamento
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Deseja-se cortar peças unidimensionais a partir de barras que temos em estoque. Objetivo: atender a demanda reduzindo o número de barras utilizadas…
!10
Onde u é o número de barras disponíveis, c é o tamanho das barras e w indica os tamanhos das peças solicitadas.
Dados de Entrada
Estoque Pedidos (n = 4)
u = 10c = 250 w = [ 187, 119, 74, 90 ]
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo: corte e empacotamentoThe football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Como modelar este problema?
!11
Formally, let u be any upper bound on the optimal solution value (for example, the valueof any approximate solution), and assume that the potential bins are numbered as 1, . . . , u.By introducing two binary decision variables
yi =
!
1 if bin i is used in the solution;0 otherwise
(i = 1, . . . , u), (1)
xij =
!
1 if item j is packed into bin i;0 otherwise,
(i = 1, . . . , u; j = 1, . . . , n), (2)
we can model the BPP as an Integer Linear Program (ILP) of the form (see Martello andToth [105])
minu
"
i=1
yi (3)
s.t.n
"
j=1
wjxij ≤ cyi (i = 1, . . . , u), (4)
u"
i=1
xij = 1 (j = 1, . . . , n), (5)
yi ∈ {0, 1} (i = 1, . . . , u), (6)
xij ∈ {0, 1} (i = 1, . . . , u; j = 1, . . . , n). (7)
Constraints (4) impose that the capacity of any used bin is not exceeded, while constraints(5) ensure that all the items are packed.
Many variants and generalization of the BPP arise in practical contexts. One of themost important applications, studied since the sixties, is the Cutting Stock Problem (CSP).Although it has been defined in different ways according to specific real world cases, its basicdefinition, using the BPP terminology, is as follows. We are given m item types, each havingan integer weight wj and an integer demand dj (j = 1, . . . , m), and an unlimited number ofidentical bins of integer capacity c. (In the CSP literature the bins are frequently called rolls,the term coming from early applications in the paper industry, and “cutting” is normallyused instead of “packing”.) The objective is to produce dj copies of each item type j (i.e.,to cut/pack them) using the minimum number of bins so that the total weight in any bindoes not exceed the capacity. Formally, let us define u and yi as above, and let
ξij = number of items of type j packed into bin i (i = 1, . . . , u; j = 1, . . . , m). (8)
2
Formally, let u be any upper bound on the optimal solution value (for example, the valueof any approximate solution), and assume that the potential bins are numbered as 1, . . . , u.By introducing two binary decision variables
yi =
!
1 if bin i is used in the solution;0 otherwise
(i = 1, . . . , u), (1)
xij =
!
1 if item j is packed into bin i;0 otherwise,
(i = 1, . . . , u; j = 1, . . . , n), (2)
we can model the BPP as an Integer Linear Program (ILP) of the form (see Martello andToth [105])
minu
"
i=1
yi (3)
s.t.n
"
j=1
wjxij ≤ cyi (i = 1, . . . , u), (4)
u"
i=1
xij = 1 (j = 1, . . . , n), (5)
yi ∈ {0, 1} (i = 1, . . . , u), (6)
xij ∈ {0, 1} (i = 1, . . . , u; j = 1, . . . , n). (7)
Constraints (4) impose that the capacity of any used bin is not exceeded, while constraints(5) ensure that all the items are packed.
Many variants and generalization of the BPP arise in practical contexts. One of themost important applications, studied since the sixties, is the Cutting Stock Problem (CSP).Although it has been defined in different ways according to specific real world cases, its basicdefinition, using the BPP terminology, is as follows. We are given m item types, each havingan integer weight wj and an integer demand dj (j = 1, . . . , m), and an unlimited number ofidentical bins of integer capacity c. (In the CSP literature the bins are frequently called rolls,the term coming from early applications in the paper industry, and “cutting” is normallyused instead of “packing”.) The objective is to produce dj copies of each item type j (i.e.,to cut/pack them) using the minimum number of bins so that the total weight in any bindoes not exceed the capacity. Formally, let us define u and yi as above, and let
ξij = number of items of type j packed into bin i (i = 1, . . . , u; j = 1, . . . , m). (8)
2
note que c atua como um ‘Big M’
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Outros exemplos: problemas clássicos
Problemas de Fluxo
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Fluxo máximo, caminho mais curto, fluxo a custo mínimo, fluxos com ganhos, multi-fluxos.
Problemas em Grafos
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Árvores geradoras mínimas, caminho mais curto, emparelhamento máximo não-ponderado e ponderado, cortes mínimo e máximo, coloração de vértices e arestas, problema de Steiner, caixeiro viajante e roteamento de veículos.
Problemas Numéricos
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Mochila, empacotamento uni- e multi-dimensional, lot sizing.
!12
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Branch-and-bound
!14
Branch-and-bound
Branch (ramificar)
Consiste em dividir um problema em problemas menores.Divide-se um problema P em m subproblemas, tais que:
P1,P2, . . . ,Pm tal que
P1 [ P2, . . . ,[Pm = P
Geralmente divide-se o problema em 2 subproblemas emcada passo.
3 / 27 Túlio Toffolo – Otimização Linear e Inteira – Aula 13: Branch-and-bound
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Branch-and-bound
!15
Branch-and-Bound
max . z = 5x1 + 4x2
s.a. x1 + x2 510x1 + 6x2 45x1, x2 � 0
1
2
3
4
5
1 2 3 4 5
x2
x1
x1 3 OU x1 � 4
4 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
Exemplo de ramificação:
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Branch-and-bound
!16
Branch-and-bound
Bound (limites)
O branch resulta em um algoritmo exato que encontra asolução ótima em um número finito de passos, mas...
É extremamente ineficiente!Para n variáveis binárias teremos 2n nós a seremexplorados.
A chave para melhorar a eficiência do algoritmo é a podade sub-árvores através do uso de limites.
5 / 27 Túlio Toffolo – Otimização Linear e Inteira – Aula 13: Branch-and-bound
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Bounds (Limites)
!17
Bound - Limites
Para um problema demaximização:
z = max f (x)
Podemos encontrar limitesque permitem avalizar aqualidade de uma soluçãocom custo f (x).
z
z
z
Limite Superior
Solução Ótima
Limite Inferior
6 / 27 Túlio Toffolo – Otimização Linear e Inteira – Aula 13: Branch-and-bound
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo: problema da mochila
!18
Branch-and-bound: Problema da Mochila
5 :X, -1/4,113=1
10,75/95 :×z=1
X. =
1 Xy =O
5 :×
, -1,113=45 5×3=1,
114=1/2
six'=' 1×4=1 10,6/10 10,5 / 9si×3= '
3=1×3=0 ×4=1
×y=O
X 5 :X} -45,114=1 §
: xa.it/3,Xz=1inviavel yosinfueeiarjo 10,2/7si×a=1
10,33/9 si×3= '
5:X, --X4=1 13=1 113=0
×2=1* poda ×2=O
por limit
inviavel7 sinfueeirjo 9,4/4 g sdueao
inteira
5 :X4=1 5 :Xa=1, .×s= 5 :×z=1
S :Xa=1
item vi wi di
1 7 4 1,752 4 3 1,333 9 5 1,804 3 2 1,50
3 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Branch-and-Bound em Programação Inteira
Notação utilizada:
P0 : problema originalL : lista de subproblemas: problemas criados a partir de P0 com
limites inteiros para variáveisP̄ : relaxação linear de um problema P, ou seja o problema P
sem as restrições de integralidadez⇤ : custo da melhor solução inteira encontrada até o momento
z̃ : limite dual (limite inferior no caso de minimização): obtido,por exemplo, pela resolução de P̄
x̃ : vetor de solução da última resolução de P̄
5 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
Branch-and-bound em programação inteira
!19
Inicialização:L P0, z⇤ 1
Seleção de sub-problema:se L = ; então fimsenão selecione um problema P 2 L e faça L L\{P}
Relaxação linear:z̃ custo ótimo de P̄
se problema P̄ é inviável ou z̃ � z⇤ entãová para seleção de sub-problema
Teste de integralidade:se solução ótima de P̄ não tem variáveis com valores fracionários então
se z̃ < z⇤ então z⇤ z̃
vá para seleção de sub-problema
Ramificação:xj uma variável inteira com valor fracionário na solução ótima de P̄
P0 problema P com uma restrição adicional: xj bx̃jcP00 problema P com uma restrição adicional: xj � dx̃jeL L [ {P0,P00}vá para seleção de sub-problema
6 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Branch-and-bound
Algumas considerações:
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Quais sub-árvores devem ser pesquisadas primeiro?
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Qual variável selecionar para ramificação (branch)
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Depende do problema e das metodologias disponíveis!
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Vide últimas aulas práticas
!20
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Idéia principal de algoritmos de plano de corte
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Em um problema de minimização….
!22
a idéia é modificar (cortar) o problema relaxado até que seu ótimo seja
também ótimo do problema inteiro
f(x)
fR(x)
(soluções do problema original)
(limites obtidos com a relaxação do problema original)
se não for possível encontrar uma solução inteira, então ao menos
buscamos um limite melhor
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Planos de corteThe football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Cortes de arredondamento
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Cortes de Gomory
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Cortes de Chvàtal-Gomory
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Cortes de cobertura (cover)
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Cortes de clique
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Cortes de ciclo ímpar
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Cortes de roda
!23
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo: corte de arredondamento
!24
Exemplo de corte
Considere a restrição:2x1 + 4x2 17 (satisfeita por x1 = 1, 7 e x2 = 3, 4).
Vamos gerar outra restrição dividindo a primeira por 2:x1 + 2x2 8, 5
Note que do lado esquerdo temos apenas coeficientes inteirose o valor das variáveis também deve ser inteiro. Portanto:
x1 + 2x2 8
A restrição acima denomina-se Desigualdade Válida ou Corte.Note que um corte não invalida nenhuma solução inteira válida.
11 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
Suponha que as variáveis x deveriam ser inteiras:
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo: corte de Gomory
!25
Como as variáveis são inteiras (lembre-se do arredondamento):
x1 � b1, 25cs1 + b0, 25cs2 b3, 75c ) x1 � 2s1 � 3 0
Se separamos a parte inteira da fracionária, teríamos:
x1 + (�2 + 0, 75)s1 + (0 + 0, 25)s2 = (3 + 0, 75)
x1 � 2s1 � 3 = 0, 75 � 0, 75s1 � 0, 25s2
0, 75 � 0, 75s1 � 0, 25s2 0
Cortes de Gomory
x1 x2 x3 x4 rhs
z : 0 0 1, 25 0, 75 5, 25
r1 : 0 1 2, 25 �0, 25 2, 25
r2 : 1 0 �1, 25 0, 25 3, 75
Como as variáveis são inteiras (lembre-se do arredondamento):
x1 � b1, 25cs1 + b0, 25cs2 b3, 75c ) x1 � 2s1 � 3 0
Se separamos a parte inteira da fracionária, teríamos:
x1 + (�2 + 0, 75)s1 + (0 + 0, 25)s2 = (3 + 0, 75)
x1 � 2s1 � 3 = 0, 75 � 0, 75s1 � 0, 25s2
0, 75 � 0, 75s1 � 0, 25s2 0
15 / 21 Túlio Toffolo – Otimização Linear e Inteira – Aula 16: Planos de Corte (2)
Considere o tableau ao lado:
Temos que:
Cortes de Gomory
x1 x2 x3 x4 rhs
z : 0 0 1, 25 0, 75 5, 25
r1 : 0 1 2, 25 �0, 25 2, 25
r2 : 1 0 �1, 25 0, 25 3, 75
Um corte pode ser gerado a partir de uma solução fracionária no tableau(exemplo acima).
Seja a segunda restrição (r2):
x1 � 1, 25s1 + 0, 25s2 = 3, 75
Podemos utilizá-la para gerar cortes de Gomory!
14 / 21 Túlio Toffolo – Otimização Linear e Inteira – Aula 16: Planos de Corte (2)
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo: corte de Chvàtal-Gomory
!26
Exemplo 2
Considere as seguintes desigualdades:
i1 : 2x1 + 5x2 + 3x3 3i2 : x1 + x4 1i3 : 3x1 � 2x2 2
Seja u = {0.25; 0.15; 0.5}Desta forma, temos: 2.15x1 + 0.25x2 + 0.75x3 + 0.15x4 1.9
↵x1 = 2↵x2 = 0↵x3 = 0↵x4 = 0↵0 = 1
Corte de Chvàtal-Gomory produzido: 2x1 1
12 / 19 Túlio Toffolo – Otimização Linear e Inteira – Aula 15: Planos de Corte
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo: corte de cobertura (cover)
!27
Cortes da Mochila
Considere que variáveis binárias xj aparecem numa restrição do tipo:X
j2N
ajxj b (aj � 0 para todo j 2 N)
Um Conjunto C ✓ N é uma Cobertura (Cover) se:X
j2C
ajxj > b
O que define o seguinte Corte de Cover :X
j2C
xj |C|� 1
16 / 24Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo: corte de cobertura (cover)
!28
Cortes de Cover
ExemploConsidere a seguinte restrição sobre as variáveis binárias xj :
11x1 + 6x2 + 6x3 + 5x4 + 5x5 + 4x6 + x7 19
Alguns cortes de cover:
x1 + x2 + x3 2x1 + x2 + x6 2x1 + x5 + x6 2
x3 + x4 + x5 + x6 3
Os cortes acima são cortes de cover minimais, no sentido quequalquer variável retirada da restrição descaracteriza a cobertura.
17 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Empacotamento de Nós
Cliques
x1 + x2 + x3 + x4 + x5 1
x1
x2 x3
x4 x5
19 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
Exemplo: corte de clique
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Considere as seguintes restrições:
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Corte de clique:
!29
x1 + x2 1
x1 + x3 1
x1 + x4 1
x1 + x5 1
x2 + x3 1
x2 + x4 1
x2 + x5 1
x3 + x4 1
x3 + x5 1
x4 + x5 1
4 / 4 Túlio Toffolo – Otimização Linear e Inteira – Aula 01: Introdução
Empacotamento de Nós
Cliques
x1 + x2 + x3 + x4 + x5 1
x1
x2 x3
x4 x5
19 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo: corte de ciclo ímpar
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Considere o seguinte modelo:
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Corte gerado:
!30
x1 + x2 1
x1 + x5 1
x2 + x3 1
x3 + x4 1
x4 + x5 1
4 / 4 Túlio Toffolo – Otimização Linear e Inteira – Aula 01: Introdução
Empacotamento de Nós
Ciclo Ímpar
x1 + x2 + x3 + x4 + x5 2
x1
x2x5
x4 x3
20 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
Empacotamento de Nós
Ciclo Ímpar
x1 + x2 + x3 + x4 + x5 2
x1
x2x5
x4 x3
20 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Problemas de separaçãoThe football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Como gerar cortes? Depende do corte! :)
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Geralmente resolvemos um problema de separação utilizando a solução corrente (fracionária) como entrada
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Exemplo: cortes de cobertura
!31
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Problemas de separação
!32
Cortes de Cover : separação
Considere a solução fracionária x⇤.
Desigualdades violadas de Cover podem ser geradasresolvendo-se o problema DP:
DP =
8>>>>><
>>>>>:
�(x⇤) = min
X
j2N
(1 � x⇤j )zj
s.a.X
j2N
ajzj > b
zj 2 {0, 1} 8j 2 N
Uma desigualdade válida violada de cover é descobertaquando encontra-se z⇤ com �(x⇤) < 1.
18 / 24 Túlio Toffolo – Otimização Linear e Inteira – Aula 14: Desigualdades Válidas
Pergunta: precisamos mesmo resolver um Programa Inteiro para encontrar cortes de cobertura (cover)?
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Problemas de separação
Como encontrar cortes de clique? Resolvendo um problema de separação:
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Representar o modelo por meio de um grafo de conflito
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Encontrar cliques maximais neste grafo que estejam sendo violados (se possível, o clique máximo — mas isso não é fácil pois o problema é NP-Difícil)
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Problemas de otimização para encontrar cortes são chamados problemas de separação
!33
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplo de lifting
!34
Considere:
5x1 + 5x2 + 5x3 + 5x4 + 3x5 + 8x6 17
Temos, por exemplo, a seguinte desigualdade de
cobertura:
x1 + x2 + x3 + x4 3
Se fizermos lifting em x5 e depois em x6, obtemos:
x1 + x2 + x3 + x4 + ↵5x5 3
↵5 = 3 �max{x1 + x2 + x3 + x4 : x5 = 1} = 1
De forma análoga, obtemos ↵6 = 1,resultando no corte:
x1 + x2 + x3 + x4 + x5 + x6 3
Se fizéssemos lifting em x6 e depois x5, obteríamos:
x1 + x2 + x3 + x4 + 2x6 3
4 / 4 Túlio Toffolo – Otimização Linear e Inteira – Aula 01: Introdução
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Formulação Ideal
!36
A Formulação Ideal
Maximize:6x1 + 5x2
Sujeito a:2x1 + 2x2 86x1 + 3x2 18x1, x2 2 R+
Formulação ideal
envoltória convexados pontos inteirosválidos
1
2
3
4
1 2 3 4
18 / 25 Túlio Toffolo – Otimização Linear e Inteira – Aula 12: Programação Inteira
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Formulação Ideal
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Pode ser utilizado para resolver problemas com até três variáveis.
The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Muito útil para entender os principais conceitos envolvidos em Programação Linear (Inteira).
!37
A Formulação Ideal
TeoremaQuando o poliedro definido pelas restrições define a envoltóriaconvexa das soluções inteiras válidas, o Programa Inteiropode ser resolvido como um Programa Linear, ou seja, asrestrições de integralidade podem ser ignoradas e a soluçãoótima fornecida para esse problema relaxado ainda assim seráuma solução inteira.
No entanto... Obter tal poliedro não é trivial. :(
19 / 25 Túlio Toffolo – Otimização Linear e Inteira – Aula 12: Programação Inteira
Mas há casos em que tal poliedro é facilmente obtido!!!
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão !38
Definição:
Seja uma matriz A contendo apenas valores �1, 0 e +1 tal que
haja no máximo dois valores não-nulos em cada coluna.
A matriz A é totalmente unimodular se existir uma partição R1 e
R2 de suas linhas tais que:
1 cada coluna com dois termos não nulos de mesmo sinal
tem uma entrada em R1 e outra em R2;
2 cada coluna com dois termos não nulos de sinal diferente
tem ambas entradas em R1 ou em R2.
É o caso de modelos cuja matriz de coeficientes A é Totalmente Unimodular!
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplos:
!39
Exemplos
Matrizes de incidência (arco-vértice) de um dígrafo e de um
grafo bipartido (aresta-vértice).
Problemas com matrizes TUM:
Problema do caminho mínimo
Problema de fluxo máximo
Problema de fluxo com custo mínimo
Problema de emparelhamento em grafos bi-partidos
16 / 25 Túlio Toffolo – Otimização Linear e Inteira – Aula 17: Lifting e Matrizes Ideais
/ 12/ 40 Túlio Toffolo — Otimização Linear e Inteira — Aula 20: Revisão
Exemplos:The football leagues grouping problem
Problem constraints:
Leagues must comprise between m� and m+ teams.At most 2 teams from the same club can be in a league.There is a limit on the level difference between teams inthe same league.There is a limit on the travel time/distance between teamsin the same league.
It’s a generalization of the clique partitioning problem withminimum clique size requirement.
7 / 25 Toffolo et al. – IP heuristics for nesting problems
Exemplo de matriz de incidência (que é TUM):
!40
R1 = {1,2,3,4}R2 = ∅