Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Integer Programming

Uploaded by

William Mitchell
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Integer Programming

Uploaded by

William Mitchell
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Intro to Integer Programming

IE 8030
Prof. Emily Tucker
Oct. 29, 2024
What’d we cover last time?
• Complementary slackness
– Example

• Sensitivity analysis
Today
• Integer programming
Project Deliverable 2
• Due Fri. Nov. 8th
• Draft formulation of one model
• Include sections for:
– Sets
– Parameters
– Model formulation
– Formulation description
• The formulation description should be a paragraph that briefly notes
what each constraint does. E.g., constraint set (4) limits …
Homework Plan
• Homework 5 released yesterday
– Due Nov. 8th

• There won’t be a homework released this Saturday


Integer Programming
Recall: Linear Programming
• Decision variables are continuous
Integer programs have discrete
• Constraints are linear decision variables

• Objective function is linear


Overview of IP
• So far we have been:
– Assuming fraction answers acceptable, or
– Round up/down to closest integers

• Is rounding good enough?


LP relaxation
Example: Bad Rounding = IP solved
without the
integrality
Optimal solution to constraints
LP relaxation: (0.5, 5)

Opt. value: 5.5

• How does rounding


down/up perform?
Optimal solution to the
original problem: (1,0)
Opt. value: 1
Desmos
Graphical Intuition (Different Problem)

Optimal Solution to LP

Optimal Solution to IP

Note: optimal value of LP


relaxation – always at
least as good as the IP
When to use IPs?
• Helpful if you have logical decisions
– Use binary variables
– A binary decision variable is the combination of
• 𝑥≥0
• 𝑥≤1
• 𝑥 int
– Or equivalently: 𝑥 ∈ {0,1}
Course Scheduling
Example: Course Selection
Antonio is an undergrad who is required to take 2 math courses, 3 IOE courses, and 2
EECS courses. Some of the classes can double count, and some have pre-requisites.
His goal is to satisfy the requirements with minimal effort.
Example: Course Selection
Required to take 2 math courses, 3 IOE courses, and 2 EECS courses. His goal is
to satisfy the requirements with minimal effort.
Course Math EECS EECS IOE IOE IOE IOE
214 280 283 265 310 373 366
Math Formulate this as an
IOE integer program
EECS

• Pre-reqs
– Math 214 is a prereq for IOE 310
– IOE 265 is a prereq for IOE 366
• Credit is not given for both EECS 280 and 283
• 300-level course requires 1.5x effort of 200-level one
Sets:
𝐶 200 ≔ Math 214, EECS 280, EECS 283, IOE 265
𝐶 300 ≔ IOE 310, IOE 373, IOE 366

Input parameters:
𝑒 Relative effort to take 300-level class

Variables:

𝑥𝑐 ∈ ቊ1, if select class 𝑐 ∈ 𝐶 200 ∪ 𝐶 300


0 otherwise

Objective:
min ෍ 𝑥𝑐 + ෍ 1.5𝑥𝑐
𝑐∈𝐶 200 𝑐∈𝐶 300
Example: Course Selection
Course Math 214 EECS 280 EECS IOE 265 IOE 310 IOE 373 IOE 366
283
Math
IOE
EECS

• Constraints
– Meet departmental requirements

𝑥1 + 𝑥2 + 𝑥4 + 𝑥5 ≥ 2 (Math)
𝑥4 + 𝑥5 + 𝑥6 + 𝑥7 ≥ 3 (IOE)
𝑥2 + 𝑥3 + 𝑥6 ≥ 2 (EECS)
Example: Course Selection
Course Math 214 EECS 280 EECS IOE 265 IOE 310 IOE 373 IOE 366
283
Math
IOE
EECS

• Constraints
– Pre-reqs
𝑥1 ≥ 𝑥5 (Math 214 is prereq for IOE 310)
𝑥4 ≥ 𝑥7 (IOE 265 is a prereq for IOE 366)
– Can’t take both EECS 280 and 283
𝑥2 + 𝑥3 ≤ 1

– Binary
𝑥𝑐 ∈ 0,1 ∀𝑐 ∈ 𝐶
Example: Course Selection
min σ𝑐∈𝐶 200 𝑥𝑐 + σ𝑐∈𝐶 300 1.5𝑥𝑐

𝑥1 + 𝑥2 + 𝑥4 + 𝑥5 ≥ 2
𝑥4 + 𝑥5 + 𝑥6 + 𝑥7 ≥ 3
𝑥2 + 𝑥3 + 𝑥6 ≥ 2
𝑥1 ≥ 𝑥5 Could we model this
𝑥4 ≥ 𝑥7 using an LP?
𝑥2 + 𝑥3 ≤ 1
Nope!
𝑥𝑐 ∈ 0,1 ∀𝑐 ∈ 𝐶
Knapsack Problem
Knapsack Example

https://xkcd.com/287/
Knapsack Problem
• General idea
– You have a knapsack that you’re trying to fill up with the most
valuable items
• Each item has a weight and a value

– There’s a weight limit to how much you can put in

– You aim to maximize the value


Knapsack Example
• This is a variant of
the knapsack
problem where the
customers would
like exactly $15.05
worth of appetizers.

Formulate this as an
integer program
Set:
𝐼 Appetizers

Parameters:
If items are equally
𝑐𝑖 Cost of appetizer 𝑖 ∈ 𝐼
enjoyed (equal benefit)
Decision variables
𝑥𝑖 Number of appetizer 𝑖 ∈ 𝐼 selected

Formulation
Optimal solution:
max 0
Subject to: 1 mixed fruit
σ𝑖∈𝐼 𝑐𝑖 𝑥𝑖 = 15.05 2 hot wings
1 sampler plate
𝑥𝑖 ≥ 0, integer ∀𝑖 ∈ 𝐼
Example: Knapsack Problem
Set:
𝐼 Appetizers
What if items have
Parameters:
𝑐𝑖 Cost of appetizer 𝑖 ∈ 𝐼 different benefits?
𝑣𝑖 Benefit of appetizer 𝑖 ∈ 𝐼

Decision variables
𝑥𝑖 Number of appetizer 𝑖 ∈ 𝐼 selected

Formulation

max σ𝑖∈𝐼 𝑣𝑖 𝑥𝑖 Optimal solution:

Subject to: Depends on 𝑣𝑖


σ𝑖∈𝐼 𝑐𝑖 𝑥𝑖 = 15.05

𝑥𝑖 ≥ 0, integer ∀𝑖 ∈ 𝐼
Logical Constraints
Logical Constraints with Binary Variables

• These are true for any problem with binary variables.

Let 𝑥1 , 𝑥2 , … , 𝑥𝑛 be binary variables

If we pick 𝑥1 we must also pick 𝑥2 𝒙𝟏 ≤ 𝒙𝟐

We can’t pick both 𝑥1 and 𝑥2 𝒙𝟏 + 𝒙𝟐 ≤ 𝟏


How about:
Let 𝑥1 , 𝑥2 , … , 𝑥𝑛 be binary variables

We must either pick both 𝑥1 and 𝒙𝟏 = 𝒙𝟐


𝑥2 or pick neither of them

We must pick at least one of 𝑥1 and 𝑥2 𝒙𝟏 + 𝒙𝟐 ≥ 𝟏

We must pick at least one of 𝑥1 and 𝒙𝟏 + 𝒙𝟐 = 𝟏


𝑥2 but not both 𝒏

෍ 𝒙𝒊 = 𝒎
We must pick exactly 𝑚 of them 𝒊=𝟏
𝒏

We can’t pick more than 𝑟 of them ෍ 𝒙𝒊 ≤ 𝒓


𝒊=𝟏
(More) Logical Constraints with Binary Variables

Let 𝑥1 , 𝑥2 , … , 𝑥𝑛 be binary variables

If-then constraints:

If x1 = 1 then x2 = 1 x1 ≤ 𝑥2

If x1 = 1 then x2 = 0 x1 ≤ 1 − 𝑥2

If x1 = 0 then x2 = 0 1 − 𝑥1 ≤ 1 − 𝑥2
Practice
• Binary variables: 𝑦1 and 𝑦2

• Write out conditions to enforce:


– Must pick both
– Must pick exactly 1
– Must pick at most 1
– If pick 𝑦1 , must also pick 𝑦2
Facility Location
Disney World
Disney World
• Disney has an EMT station that handles all
health emergencies it the park

• They would like to reevaluate where it


should be placed

– The primary consideration is the distance from


rides to the response station

– Rides are grouped in “population centers”


Disney World
• There are 5 population
centers (A-E)

• There are 3 candidate


locations for the EMT
station (1-3)

• The lines represent the


pathway system
Aim to locate exactly 1 EMT
station
Disney World
• We can calculate the “response time”
from any population center to location 𝑖

Table of response times (𝑐𝑖𝑗 )


Disney World
• Formulate an IP
– To minimize the average response time across all population
centers

– We must make sure that every population center is assigned to


the EMT
Disney World
• Sets
𝐼 Set of candidate locations, 𝐼 = {1,2,3}
𝐽 Set of population centers, 𝐽 = {𝐴, 𝐵, 𝐶, 𝐷, 𝐸}

• Decision variables
– 𝑦𝑖 if EMT station is built at location 𝑖 ∈ 𝐼
– 𝑥𝑖𝑗 if population center 𝑗 ∈ 𝐽 is assigned to station 𝑖 ∈ 𝐼
Disney World

Response time of 𝑗 =
Minimize average 1 σ𝑖∈𝐼 𝑐𝑖𝑗 𝑥𝑖𝑗
min ෍ ෍ 𝑐𝑖𝑗 𝑥𝑖𝑗
response time 𝐽
𝑗∈𝐽 𝑖∈𝐼

Assign all population


෍ 𝑥𝑖𝑗 = 1 , ∀𝑗 ∈ 𝐽
centers to EMT site
𝑖∈𝐼

Select one EMT site ෍ 𝑦𝑖 = 1


𝑖∈𝐼

Don’t assign to EMT 𝑥𝑖𝑗 ≤ 𝑦𝑖 ∀𝑖 ∈ 𝐼, 𝑗 ∈ 𝐽


site if not open
𝑥𝑖𝑗 ∈ {0,1} ∀𝑖 ∈ 𝐼, 𝑗 ∈ 𝐽
Domain constraints
𝑦𝑖 ∈ {0,1} ∀𝑖 ∈ 𝐼

You might also like