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

Integer Programming Practice

This document describes an integer programming formulation for solving Sudoku puzzles. The formulation uses binary decision variables xijk to indicate whether cell (i,j) is assigned number k. The objective is to maximize the number of assigned cells. Constraints ensure each number appears once per row, column and block. Additional constraints enforce that each cell receives exactly one number and respect any pre-assigned cells in the initial puzzle. Solving the integer program determines an optimal assignment of numbers to cells to fill in the puzzle.

Uploaded by

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

Integer Programming Practice

This document describes an integer programming formulation for solving Sudoku puzzles. The formulation uses binary decision variables xijk to indicate whether cell (i,j) is assigned number k. The objective is to maximize the number of assigned cells. Constraints ensure each number appears once per row, column and block. Additional constraints enforce that each cell receives exactly one number and respect any pre-assigned cells in the initial puzzle. Solving the integer program determines an optimal assignment of numbers to cells to fill in the puzzle.

Uploaded by

Osman Hamdi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

INFO 372

Practice Integer Programming


Solutions
A young couple, Alice and Bob, want to divide their main household chores (marketing,
cooking, dishwashing, and laundering) between them so that each has two tasks but the
total time they spend on the household duties is kept to a minimum. Tasks are cannot be
split. Their efficiencies on these tasks differ, where the time each would need to perform
the task is given by the following table:
Grocery
Shopping
4.5 hours
4.9 hours

Alice
Bob

Cooking

Dishwashing

Laundry

7.8 hours
7.2 hours

3.6 hours
4.3 hours

2.9 hours
3.1 hours

Time Needed per Week per person per task


(Note each task will be assigned to a single person).
a) Formulate a BIP model for this problem.
a)

b)

MA = 1 if Alice does the marketing (grocery shopping); 0 if she doesnt


MB = 1 if Bob does the marketing (grocery shopping); 0 if he doesnt
CA = 1 if Alice does the cooking; 0 if she doesnt
CB = 1 if Bob does the cooking; 0 is he doesnt
DA = 1 if Alice does the dishwashing; 0 if she doesnt
DB = 1 if Bob does the dishwashing; 0 if he doesnt
LA = 1 if Alice does the laundry; 0 if she doesnt
LB = 1 if Bob does the laundry; 0 is he doesnt
Minimize: T = 4.5MA + 7.8CA + 3.6DA + 2.9LA + 4.9MB + 7.2CB + 4.3DB +
3.1LB
s.t.
MA + CA + DA + LA = 2
(Alice must have 2 chores)
MB + CB + DB + LB = 2
(Bob must have 2 chores)
MA + M B = 1
(Someone must go to the market)
CA + CB = 1
(Someone must cook)
(Someone must do the dishwashing)
DA + DB = 1
LA + LB = 1
(Someone must do the laundry)
MA, MB, CA, CB, DA, DB, LA, LB Binary Variables

b) Solve this model using Mpl or Excel

The following is the MPL code and associated output


title
Problem_11_1_2;
model
Min T = 4.5MA + 7.8CA + 3.6DA + 2.9LA + 4.9MB + 7.2CB +
4.3DB + 3.1LB;
subject to
MA + CA + DA + LA = 2;
MB + CB + DB + LB = 2;
MA + MB = 1;
CA + CB = 1;
DA + DB = 1;
LA + LB = 1;
binary
MA;
CA;
DA;
LA;
MB;
CB;
DB;
LB;
End
MPL Output:
SOLUTION RESULT
Optimal integer solution found
MIN T

18.4000

DECISION VARIABLES
PLAIN VARIABLES
Variable Name
Activity
Reduced
Cost
----------------------------------------------------MA
1.0000
4.5000
CA
0.0000
7.8000
DA
1.0000
3.6000
LA
0.0000
2.9000

MB
4.9000
CB
7.2000
DB
4.3000
LB
3.1000

0.0000
1.0000
0.0000
1.0000

2 The research and Development Division of Intel-Product Company has been


developing four possible new product lines. Management must now make a decision to
which of these four products actually will be produced and at what levels. Therefore a
study hs been requested to find the most profitable product mix.
A substantial cost is associated with beginning the production of any product, as given in
the first row of the following table. The objective is to find the product mix that
maximizes the total profit (total revenue minus start-up costs).
Start-up cost
Unit Revenue

Product 1
$50,000
$70

Product 2
$40,000
$60

Product 3
$70,000
$90

Product 4
$60,000
$80

Let the continuos variables x1, x2, x3, and x4 be the production levels of products
1,2,3,and 4, respectively. Management has imposed the following policy constraints on
these variables:
No more than two of the products can be produce
Either product 3 or 4 can be produced only if either product 1 or 2 is produced
Either
i. 5 x1 + 3 x2 + 6 x3 + 4 x4 <= 6,000 or
ii. 4 x1 + 6 x2 + 3 x3 + 5 x4 <= 6,000
a) Introduce auxiliary binary variables to formulate a mixed Binary Integer Problem
model for this problem
b) Use the computer to solve this model.
X1 = Production level of Product #1
X2 = Production level of Product #2
X3 = Production level of Product #3
X4 = Production level of Product #4
a)

Y1 = 1 if X1 > 0;
Y2 = 1 if X2 > 0;
Y3 = 1 if X3 > 0;

Y4 = 1 if X4 > 0;
Y5 = either/or auxiliary binary variable
Maximize: Z = 70X1 50,000Y1 + 60X2 40,000Y2 + 90X3 70,000Y3
+ 80X4 60,000Y4
s.t.
1) Y1 + Y2 + Y3 + Y4 2
( 2 products can be
produced)
(Y3 only if either Y1
2.a) Y3 Y1 + Y2
or Y2)
2.b) Y4 Y1 + Y2
(Y4 only if either Y1
or Y2)
3.a) 5X1 + 3X2 + 6X3 + 4X4 6,000 + MY5
(either 3.a or 3.b
holds)
(either 3.a or 3.b
3.b) 4X1 + 6X2 + 3X3 + 5X4 6,000 + M(1-Y5)
holds)
(Y1 = 1 when X1 > 0)
4) X1 MY1
5) X2 MY2
(Y2 = 1 when X2 > 0)
6) X3 MY3
(Y3 = 1 when X3 > 0)
7) X4 MY4
(Y4 = 1 when X4 > 0)
8) X1, X2, X3, X4 0
(Non-negativity)
(Binary)
9) Y1, Y2, Y3, Y4, Y5 Binary
b)

MPL Output
SOLUTION RESULT
Optimal integer solution found
MAX Z

80000.0000

DECISION VARIABLES
PLAIN VARIABLES
Variable Name
Activity
Reduced Cost
-----------------------------------------------------X1
0.0000
-30.0000
Y1
0.0000
-50000.0000
X2
2000.0000
0.0000
Y2
1.0000
-40000.0000
X3
0.0000
-30.0000
Y3
0.0000
-70000.0000
X4
0.0000
0.0000
Y4
0.0000
-60000.0000
Y5
0.0000
200000000.0000
------------------------------------------------------

3 Formulate Sudoku as a Binary Integer Program problem. Assume that you are given
an initial sudoku instance and that the instance may or may not be filled in completely.
Your goal is to maximize the number of cells that can be filled in.
variables: xijk {0,1} for all rows i, columns j and numbers k:
xijk = 1 if cell [i,j] has number k
xijk = 0 otherwise
Objective function:
Max i j k xijk
constraints:
each number appears once in each row:
j xijk = 1 for all rows i and numbers k
each number appears once in each column:
i xijk = 1 for all columns i and numbers k
each number appears once in each block:
[i,j]B xijk = 1 for all numbers k and blocks B
one number per cell:
k xijk = 1 for all rows i and columns j
pre-assigned cells:
xijk = 1 if cell [i,j] has pre-assigned number k
xijk = 0 for all numbers kk if cell [i,j] has pre-assigned number k

You might also like