Academia.eduAcademia.edu

Linear Programming Examples Using Matlab

Given the attached black-and-white jpeg image in 1500 × 981 pixels, use Matlab to compress the image by truncating the singular value decomposition, the matrix representing the color gradient in the image. Compute the approximation errors for the corresponding compressions.

Linear Programming Problem-Solving Examples Joane Joseph December 12, 2015 Problem 1. Given the attached black-and-white jpeg image in 1500 × 981 pixels, use Matlab to compress the image by truncating the singular value decomposition, the matrix representing the color gradient in the image. Compute the approximation errors for the corresponding compressions. 1 Solution: 2 3 Problem 2. Given the following data points in R2 : {(0, 0), (1, 3), (2, 7), (3, −1), (4, 0), (5, 5), (6, 10)} We would like to fit a cubic polynomial p(x) = c3 x3 + c2 x2 + c1 x + c0 to our data to minimize the so-called L2 -error : min c0 ,c1 ,c2 ,c3 7 X (p(xi ) − yi )2 i=1 Find the optimal solution and the optimal value for the problem as a least squares problem. Then solve the problem using CVX. 4 Solution: Let      A=     1 1 1 1 1 1 1 0 0 0 1 1 1 2 4 8 3 9 27 4 16 64 5 25 125 6 36 216           ,b =          0 3 7 −1 0 5 10        ,c =        c0 c1   c2  c3 Then this problem is equivalent to the least squares problem min kAc − bk2 = min c∈R4 c∈R4 7 X (p(xi ) − yi )2 . i=1 Therefore, the solution to this equation can be written as c = (AT A)−1 AT b, and so plugging in for A and b, the solution is     c0 0.0000  c1   6.9405       c2  =  −3.3571  0.4167 c3  0.0000  6.9405   c=  −3.3571  0.4167  5 Problem 3. In radiation treatment, radiation is delivered to a patient, with the goal of killing or damaging the cells in a tumor, while carrying out minimal damage to other tissue. The radiation is delivered in beams, each of which has a known pattern; the level of each beam can be adjusted. (In most cases multiple beams are delivered at the same time, in one shot, with the treatment organized as a sequence of ’shots’.) We let bj denote the level of beam j, for j = 1, . . . , n. These must satisfy 0 ≤ bj ≤ B max , where B max is the maximum possible beam level. The exposure area is divided into P m voxels, labeled i = 1, . . . , m. m×n The dose di delivered to voxel i is linear in the beam levels, i.e., di = n nj=1 Aij bj . Here A ∈ R+ is a (known) matrix that characterizes the beam patterns. We now describe a simple radiation treatment planning problem. A (known) subset of the voxels, T ⊂ {1, . . . , m}, corresponds to the tumor or target region. We require that a minimum radiation dose Dtarget be administered to each tumor voxel, i.e., di ≥ Dtarget for i ∈ T . For all other voxels, we would like to have di ≤ Dother , where Dother is a desired maximum dose for non-target voxels. This is generally not feasible, so instead we settle for minimizing the penalty X (di − Dother )+ , E= i∈T / where (·)+ denotes the nonnegative part of its argument (i.e., (z)+ = max{0, z}). We can interpret E as the total nontarget excess dose. Solve the problem instance with data generated by the file TreatmentPlanningData.m. Here we have split the matrix A into Atarget, which contains the rows corresponding to the target voxels, and Aother, which contains the rows corresponding to other voxels. Plot the dose histogram for the target voxels, and also for the other voxels. 6 Solution: min f = b1 ,...,bn X (di − Dother )+ i∈T /  target  di ≥ DP subject to d = n nj=1 Aij bj  i 0 ≤ bj ≤ B max 7 (∀i ∈ T ) (∀i ∈ {1, 2, . . . , n}) 8