


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



CS 141 Introduction to AI Greenwald
1 Overview 1
2 Sample Linear Programs 1
3 Sample Integer Linear Programs 2
3.1 Sample Constraints..................................... 3 3.2 Modelling Practice..................................... 4
A mathematical program is an optimization problem of the form:
min x∈Rn^ f (x)
subject to Ax ≤ b
where
If f is linear, then the program is called a linear program (LP). If f is linear, and for all i, xi ∈ Z, then the program is called an integer linear program (ILP). If f is linear, and for some i, xi ∈ R, while for other i, xi ∈ Z, then the program is called a mixed integer linear program. If f is linear, and for all i, xi ∈ { 0 , 1 }, then the program is called a binary integer linear program.
The Diet Problem Consider a set of m vitamins contained in a set of n foods. The minimum daily requirement of vitamin i is bi, for all 1 ≤ i ≤ m. The cost (in dollars or calories) per unit of food j is cj , for all 1 ≤ j ≤ n. The number of units of vitamin i contained in each unit of food j is aij. How much of each food should be consumed so as to minimize cost without failing to satisfy the minimum daily requirements?
LP If xj is the number of units of food j that one consumes daily, then the objective is to minimize cT^ x. But at the same time, one must satisfy the minimum daily requirement. The term aij xj denotes the number of units of vitamin i that are consumed in xj units of food j. Summing over all foods j yields the constraint Aix ≥ bi, for all vitamins i. The linear program that solves the diet problem can be stated as follows:
min x j
∑^ n
j=
cj xj
s.t.
∑^ n
j=
aij xj ≥ bi, ∀i
xj ≥ 0 , ∀j
The Production Problem A company manufactures n products using m resources. The com- pany has in its inventory bi units of resource i, for all 1 ≤ i ≤ m, and it earns cj profits by producing one unit of product j, for all 1 ≤ j ≤ n. The number of units of resource i required to produce one unit of product j is aij. How much of each product should be manufactured so as to maximize total profits, given the stated resource constraints?
LP If xj is the number of units of product j that is produced, then the objective is to maximize cT^ x. But the company’s resources are limited. The term aij xj denotes the number of units of resource i that is necessary to manufacture xj units of product j Summing over all products j yields the constraint Aix ≤ bi, for all resources i. The linear program that solves the production problem can be stated as follows:
max x j
∑^ n
j=
cj xj
s.t.
∑^ n j=
aij xj ≤ bi, ∀i
xj ≥ 0 , ∀j
The capital budgeting problem is the binary version of the production problem: that is, xj ∈ { 0 , 1 } indicates whether or not product j is produced (or the jth investment opportunity is selected). The knapsack problem is the special case of capital budgeting where m = 1.
Knapsack Problem Given n objects s.t. object i has value vi but weighs wi. Find an optimal set of objects to pack in a knapsack of capacity k.
LP Let xi ∈ R denote the quantity of object i that is packed in the knapsack.
max x i
∑
i
vixi
Set Partitioning Constraints (^) ∑
j
xj = 1
Assume: xi ∈ { 0 , 1 }.
We can carry at most k items: (^) ∑
i
xi ≤ k
A → B If we take item i, we must also take item j:
xi ≤ xj
¬(A ∧ B) We can take at most one of item i and item j:
xi + xj ≤ 1
A ∨ B We must take at least one of item i and item j:
xi + xj ≥ 1
A “exclusive or” B We must take exactly one of item i and item j:
xi + xj = 1