算法导论第三版 第29章习题答案

article/2025/10/19 21:11:02

参考文献:

https://walkccc.me/CLRS/Chap29/29.1/
https://sites.math.rutgers.edu/~ajl213/CLRS/

29.Linear Programming

29.1 Standard and slack forms

1.If we express the linear program in (29.24)–(29.28) in the compact notation of (29.19)–(29.21), what are n, m, A, b, and c?

n=m=3

A=\begin{bmatrix} 1&1&-1\\-1&-1&1\\1&-2&2 \end{bmatrix}

b=\begin{bmatrix} 7\\-7\\4 \end{bmatrix}

 c=\begin{bmatrix} 2\\-3\\3 \end{bmatrix}

2.Give three feasible solutions to the linear program in (29.24)–(29.28). What is the objective value of each one?

  1. (x_1, x_2, x_3)=(6,1,0) with objective value 9.
  2. (x_1, x_2, x_3) = (5, 2, 0) with objective value 4.
  3. (x_1, x_2, x_3) = (4, 3, 0) with objective value −1.

3.For the slack form in (29.38)–(29.41), what are N, B, A, b, c, and v?

N=\{1,2,3\}
B=\{4,5,6\}
A=\begin{bmatrix} 1&1&-1\\-1&-1&1\\1&-2&2 \end{bmatrix}
b=\begin{bmatrix} 7\\-7\\4 \end{bmatrix}

c=\begin{bmatrix} 2\\-3\\3 \end{bmatrix}

v=0

4.Convert the following linear program into standard form:

\begin{array}{lrcrcrcrl} \text{minimize} & 2x_1 & + & 7x_2 & + & x_3 & & \\ \text{subject to} & \\ & x_1 & & & - & x_3 & = & 7 \\ & 3x_1 & + & x_2 & & & \ge & 24 \\ & & & x_2 & & & \ge & 0 \\ & & & & & x_3 & \le & 0 & . \end{array}

5.Convert the following linear program into slack form:

What are the basic and nonbasic variables?

First, we will multiply the second and third inequalities by minus one to make it so that they are all \le≤ inequalities. We will introduce the three new variables x_4,x_5,x_6​, and perform the usual procedure for rewriting in slack form

\begin{array}{rcrcrcrcr} x_4 & = & 7 & - & x_1 & - & x_2 & + & x_3 \\ x_5 & = & -8 & + & 3x_1 & - & x_2 \\ x_6 & = & & - & x_1 & + & 2x_2 & + & 2x_3 \\ x_1, x_2, x_3, x_4, x_5, x_6 & \ge & 0 \end{array}

where we are still trying to maximize 2x_1 - 6x_3​. The basic variables are x_4,x_5,x_6​ and the nonbasic variables are x_1,x_2,x_3.

6.Show that the following linear program is infeasible:

By dividing the second constraint by 2 and adding to the first, we have 0≤−3, which is impossible. Therefore there linear program is unfeasible.

7.Show that the following linear program is unbounded:

\begin{array}{lrcrcrl} \text{minimize} & x_1 & - & x_2 \\ \text{subject to} & \\ & -2x_1 & + & x_2 & \le & -1 \\ & -x_1 & - & 2x_2 & \le & -2 \\ & & x_1, x_2 & & \ge & 0 & . \end{array}

8.Suppose that we have a general linear program with n variables and m constraints, and suppose that we convert it into standard form. Give an upper bound on the number of variables and constraints in the resulting linear program.

In the worst case, we have to introduce 2 variables for every variable to ensure that we have nonnegativity constraints, so the resulting program will have 2n variables. If each constraint is an equality, we would have to double the number of constraints to create inequalities, resulting in 2m constraints. Changing minimization to maximization and greater-than signs to less-than signs don't affect the number of variables or constraints, so the upper bound is 2n on variables and 2m on constraints.

9.Give an example of a linear program for which the feasible region is not bounded, but the optimal objective value is finite.

29.2 Formulating problems as linear programs

1.Put the single-pair shortest-path linear program from (29.44)–(29.46) into standard form.

The objective is already in normal form. However, some of the constraints are equality constraints instead of ≤ constraints. This means that we need to rewrite them as a pair of inequality constraints, the overlap of whose solutions is just the case where we have equality. we also need to deal with the fact that most of the variables can be negative. To do that, we will introduce variables for the negative part and positive part, each of which need be positive, and we'll just be sure to subtract the negative part. d_sds​ need not be changed in this way since it can never be negative since we are not assuming the existence of negative weight cycles.

\begin{aligned} d_v^+ - d_v^- - d_u^+ + d_u^- \le w(u, v) \text{ for every edge } (u, v) \\ d_s \le 0 \end{aligned}

2.Write out explicitly the linear program corresponding to finding the shortest path from node ss to node y in Figure 24.2(a).

3.In the single-source shortest-paths problem, we want to find the shortest-path weights from a source vertex s to all vertices v∈V. Given a graph G, write a linear program for which the solution has the property that d_v​ is the shortest-path weight from s to v for each vertex v \in V.

We will follow a similar idea to the way to when we were finding the shortest path between two particular vertices.

The first type of constraint makes sure that we never say that a vertex is further away than it would be if we just took the edge corresponding to that constraint. Also, since we are trying to maximize all of the variables, we will make it so that there is no slack anywhere, and so all the d_v values will correspond to lengths of shortest paths to v. This is because the only thing holding back the variables is the information about relaxing along the edges, which is what determines shortest paths.

4.Write out explicitly the linear program corresponding to finding the maximum flow in Figure 26.1(a).

5.Rewrite the linear program for maximum flow  (29.47)–(29.50) so that it uses only O(V+E) constraints.

6.Write a linear program that, given a bipartite graph G = (V, E) solves the maximum-bipartite-matching problem.

 

7.In the minimum-cost multicommodity-flow problem, we are given directed graph  G=(V,E) in which each edge (u,v)∈E has a nonnegative capacityc(u,v)≥0 and a costa(u,v). As in the multicommodity-flow problem, we are given k different commodities, K_1, K_2, \ldots, K_k​, where we specify commodity ii by the triple K_i = (s_i, t_i, d_i). We define the flow f_i for commodity i and the aggregate flow f_{uv}​ on edge  (u,v) as in the multicommodity-flow problem. A feasible flow is one in which the aggregate flow on each edge  (u,v) is no more than the capacity of edge  (u,v). The cost of a flow is\sum_{u, v \in V} a(u, v)f_{uv}, and the goal is to find the feasible flow of minimum cost. Express this problem as a linear program.

29.3 The simplex algorithm

1.Complete the proof of Lemma 29.4 by showing that it must be the case that c = c'  and v = v' .

2.Show that the call to PIVOT in line 12 of SIMPLEX never decreases the value of v.

3.Prove that the slack form given to the PIVOT procedure and the slack form that the procedure returns are equivalent.

To show that the two slack forms are equivalent, we will show both that they have equal objective functions, and their sets of feasible solutions are equal.

First, we'll check that their sets of feasible solutions are equal. Basically all we do to the constraints when we pivot is take the non-basic variable, e, and solve the equation corresponding to the basic variable l for e. We are then taking that expression and replacing e in all the constraints with this expression we got by solving the equation corresponding to l. Since each of these algebraic operations are valid, the result of the sequence of them is also algebraically equivalent to the original.

Next, we'll see that the objective functions are equal. We decrease each c_j  byc_e \hat a_{ej}, which is to say that we replace the non-basic variable we are making basic with the expression we got it was equal to once we made it basic.

Since the slack form returned by PIVOT, has the same feasible region and an equal objective function, it is equivalent to the original slack form passed in.

4.Suppose we convert a linear program (A, b, c) in standard form to slack form. Show that the basic solution is feasible if and only if b_i \ge 0 for i = 1, 2, \ldots, m.

5.Solve the following linear program using SIMPLEX:

6.Solve the following linear program using SIMPLEX:

\begin{array}{lrcrcrl} \text{maximize} & 5x_1 & - & 3x_2 \\ \text{subject to} & \\ & x_1 & - & x_2 & \le & 1 \\ & 2x_1 & + & x_2 & \le & 2 \\ & & x_1, x_2 & & \ge & 0 & . \end{array}

very nonbasic variable now has negative coefficient in the objective function, so we take the basic solution (x_1, x_2, x_3, x_4) = (1, 0, 0, 0). The objective value this achieves is 5.

7.Solve the following linear program using SIMPLEX:

8.In the proof of Lemma 29.5, we argued that there are at most \binom{m + n}{n} ways to choose a set B of basic variables. Give an example of a linear program in which there are strictly fewer than \binom{m + n}{n} ways to choose the set B.

 

29.4 Duality

1.Formulate the dual of the linear program given in Exercise 29.3-5.

By just transposing A, swapping b and c, and switching the maximization to a minimization, we want to minimize 20y_1 + 12y_2 + 16y_3 subject to the constrain

\begin{aligned} y_1 + y_2 & \ge 18 \\ y_1 + y_3 & \ge 12.5 \\ y_1, y_2, y_3 & \ge 0 \end{aligned}

2.Suppose that we have a linear program that is not in standard form. We could produce the dual by first converting it to standard form, and then taking the dual. It would be more convenient, however, to be able to produce the dual directly. Explain how we can directly take the dual of an arbitrary linear program.

By working through each aspect of putting a general linear program into standard form, as outlined on page 852, we can show how to deal with transforming each into the dual individually. If the problem is a minimization instead of a maximization, replace c_j by −c_j​ in (29.84). If there is a lack of nonnegativity constraint on x_j​ we duplicate the jth column of A, which corresponds to duplicating the jth row of A^{\text T}. If there is an equality constraint for b_i​, we convert it to two inequalities by duplicating then negating the iith column of A^{\text T}, duplicating then negating the ith entry of b, and adding an extra y_i variable. We handle the greater-than-or-equal-to sign \sum_{i = 1}^n a_{ij}x_j \ge b_i  by negating iith column of A^{\text T} and negating b_i. Then we solve the dual problem of minimizing b^{\text T}y subject to A^{\text T}y and y≥0.

3.Write down the dual of the maximum-flow linear program, as given in lines (29.47)–(29.50) on page 860. Explain how to interpret this formulation as a minimum-cut problem.

4.Write down the dual of the minimum-cost-flow linear program, as given in lines(29.51)(29.52) on page 862. Explain how to interpret this problem in terms of graphs and flows.

5.Show that the dual of the dual of a linear program is the primal linear program.

6.Which result from Chapter 26 can be interpreted as weak duality for the maximum-flow problem?

Corollary 26.5 from Chapter 26 can be interpreted as weak duality.

29.5 The initial basic feasible solution

1.Give detailed pseudocode to implement lines 5 and 14 of INITIALIZE-SIMPLEX.

2.Show that when the main loop of SIMPLEX is run by INITIALIZE-SIMPLEX, it can never return "unbounded."

In order to enter line 10 of INITIALIZE-SIMPLEX and begin iterating the main loop of SIMPLEX, we must have recovered a basic solution which is feasible forL_{aux}​. Since x_0 \ge 0 and the objective function is -x_0​, the objective value associated to this solution (or any solution) must be negative. Since the goal is to aximize, we have an upper bound of 0 on the objective value. By Lemma 29.2,SIMPLEX correctly determines whether or not the input linear program is unbounded. Since L_{aux} is not unbounded, this can never be returned by SIMPLEX.

3.Suppose that we are given a linear program L in standard form, and suppose that for both L and the dual of L, the basic solutions associated with the initial slack forms are feasible. Show that the optimal objective value of L is =0.

Since it is in standard form, the objective function has no constant term, it is entirely given by \sum_{i = 1}^n c_ix_i​, which is going to be zero for any basic solution. The same thing goes for its dual. Since there is some solution which has the objective function achieve the same value both for the dual and the primal, by the corollary to the weak duality theorem, that common value must be the optimal value of the objective function.

4.Suppose that we allow strict inequalities in a linear program. Show that in this case, the fundamental theorem of linear programming does not hold.

Consider the linear program in which we wish to maximize x_1​ subject to the constraint x_1 < 1 and x_1 \ge 0. This has no optimal solution, but it is clearly bounded and has feasible solutions. Thus, the Fundamental theorem of linear programming does not hold in the case of strict inequalities.

5.Solve the following linear program using SIMPLEX:

6.Solve the following linear program using SIMPLEX:

 

7.Solve the following linear program using SIMPLEX:

8.Solve the linear program given in (29.6)–(29.10).

9.Consider the following 1-variable linear program, which we call P:

  1. One option is that r = 0,s≥0 and t≤0. Suppose that r>0, then, if we have that s is non-negative and tt is non-positive, it will be as we want.
  2. We will split into two cases based on r. If r = 0, then this is exactly when tt is non-positive and s is non-negative. The other possible case is that r is negative, and t is positive. In which case, because r is negative, we can always get rx as small as we want so s doesn't matter, however, we can never make rx positive so it can never be ≥t.
  3. Again, we split into two possible cases for r. If r=0, then it is when t is nonnegative and s is non-positive. The other possible case is that r is positive, and s is negative. Since r is positive, rx will always be non-negative, so it cannot be ≤s. But since r is positive, we have that we can always make rx as big as we want, in particular, greater than tt.
  4. If we have that r=0 and t is positive and s is negative. If r is nonzero, then we can always either make rx really big or really small depending on the sign of r, meaning that either the primal or the dual would be feasable.

Problems

1.Linear-inequality feasibility

2.Complementary slackness

3.Integer linear programming

4.Farkas'ss lemma

5.Minimum-cost circulation


http://chatgpt.dhexx.cn/article/oIrfHYbx.shtml

相关文章

算法导论 观后感一

此文章只作为自己看算法导论的一些理解和想法&#xff0c;希望自己能坚持下去。 算法的在计算中的应用 什么是算法&#xff1f;算法的作用&#xff1f;为什么要研究算法&#xff1f;对于算法我常有的想法是必然和数学相关&#xff0c;而且必定是高等数学之上的。甚至很多目前…

《算法导论》常见算法总结

前言&#xff1a;本篇文章总结中用到很多其他博客内容&#xff0c;本来想附上原作链接&#xff0c;但很久了未找到&#xff0c;这里关于原创性均来源于原作者。 分治法 分治策略的思想&#xff1a; 顾名思义&#xff0c;分治是将一个原始问题分解成多个子问题&#xff0c;而…

算法导论复习题

文章目录 第一章 复杂度第二章 递归与分治2.1 排列问题2.2 整数划分问题2.3 分治时间复杂度2.5 汉诺塔时间复杂度2.6二分搜索时间复杂度2.7 金块问题2.9 棋盘覆盖复杂度2.10 合并排序时间复杂度2.11 快速排序2.11 线性时间选择 第三章 动态规划3.1 矩阵连乘问题3.2 最长公共子序…

算法导论 pdf_下载算法导论_高清_pdf

关注我,持续更新好资料 点击下方链接,获得资料 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 这个公众号全是好资料,干货满满 算法导论pdf下载_书籍大小55M 此内容,仅限个人阅读,不得翻印,不得上传网络,不得用于谋利。 若因传播引起任何纠纷,由下载者自行负责。…

算法导论

1.算法在计算中的作用 1.1算法 算法解决哪些问题 数据结构 技术&#xff0c;算法设计分析技术 难题&#xff0c;PE完全问题 并行性 1.2作为一种技术的算法 效率 算法与其他技术 2.算法基础 2.1插入排序 代码 public static void main(String[] args) {int[] array {5, 2, 4, 6…

书评《算法导论》

最近空闲时间在看《算法导论》。由于之前有数据结构与算法的基础&#xff0c;并且也写过几百道代码题。所以现在看这本书反而有了一些更深的感悟。 《算法导论》确实不适合初学者&#xff0c;尤其是不适合实践派。对于实践派&#xff0c;《数据结构与算法分析——C语言描述》、…

蓝牙sbc怎么解决_【科普】蓝牙音频常用的编解码格式

蓝牙耳机的参数你是否都了解,那些看起来貌似高大上的技术是如何改变蓝牙音质和传输稳定性的,下面dy君就带你了解主流的几种蓝牙音频编码格式: SBC (Sub-band coding,子带编码) 最早的格式应该是SBC,SBC是A2DP(Advanced Audio DistribuTIon Profile,蓝牙音频传输协议)…

蓝牙音频双剑客(二)--高质量音频分布协议(A2DP) 连接播放音乐断开流程(被连接)介绍

零. 概述 主要介绍下蓝牙协议栈&#xff08;bluetooth stack&#xff09;传统蓝牙音频协议之高质量音频分布协议(A2DP) 连接播放音乐断开流程(被连接)介绍 一. 声明 本专栏文章我们会以连载的方式持续更新&#xff0c;本专栏计划更新内容如下&#xff1a; 第一篇:蓝牙综合介绍…

基于AVDTP信令分析蓝牙音频启动流程

前言 公司项目edifier那边需要在原来音频SBC,AAC基础上增加LHDC5.0编码&#xff0c;在打通lhdc协议栈之前&#xff0c;学习记录一番AVDTP音频服务流程。 一、AVDTP音频流基础知识 分析音频流程首先应具备的最简单基础概念知识&#xff1a;AVDTP信令signal&#xff0c;流端点se…

蓝牙音频广播多连接模块技术方案

蓝牙我们应该都很熟悉&#xff0c;现在的蓝牙应用在生活中随时随地都可以见得到&#xff0c;尤其是蓝牙音频;常见的蓝牙一般都是点对点的&#xff0c;或者就是TWS&#xff0c;一拖二功能&#xff0c;但是有一些使用场景&#xff0c;是需要一拖多的&#xff0c;需要多个音响同步…

当前市场主流蓝牙音频SOC

2020年5月9日更&#xff1a; 目前安卓已经全面支持LDAC了&#xff0c;讨论其他格式的蓝牙音频方案已经没多大意义了。 对于真无线耳机方案来说&#xff0c;也就剩高通和苹果了&#xff0c;开发者可选也就高通了。 这个市场已经归一统了~~~~~~不要看下面的内容浪费时间了。 -…

海贝思蓝牙接收器Linux,Hagibis海备思 蓝牙音频接收 耳机怎么样,评测

Hagibis海备思 蓝牙音频接收 耳机怎么样,评测&#xff1a; 1、很不错&#xff0c;与车子AUX连接电话声音很青楚&#xff0c;物有值 2、还行&#xff0c;免提打电话效果还可以&#xff0c;就是充电线和音频线一起走的那么细一根线&#xff0c;我也是醉了。声音效果一般&#xff…

蓝牙音频编码简介 - SBC、AAC、AptX、LDAC、LHDC

https://zhuanlan.zhihu.com/p/265597723 早在2000年&#xff0c;蓝牙耳机就已经出现&#xff0c;但由于技术限制&#xff0c;只能用于通话。2008年&#xff0c;随着蓝牙A2DP(Advanced Audio Distribution Profile)开始普及&#xff0c;立体声蓝牙耳机日渐流行。发展到现在&am…

蓝牙技术|伦茨科技带你了解蓝牙音频

蓝牙设备在日常生活中随处可见&#xff0c;用蓝牙耳机或音箱听音乐已经成为蓝牙最主流的应用之一。这些都用到我们的蓝牙音频技术。 蓝牙音频协议HFP&#xff0c;HSP&#xff0c;A2DP&#xff0c;AVRCP&#xff0c;OPP&#xff0c;PBAP HFP HFP(Hands-free Profile)&#xf…

蓝牙基础:蓝牙音频

前言 蓝牙耳机中存在两种 通话音频 和 音乐音频两种音频。 1 通话音频 1.1 音频链路 通话中的音频数据&#xff08;Audio&#xff09;直接通过基带上的SCO链路进行传输 音频通路(1) Audio-》Voice-》SCO/eSCO-》HCI-》Baseband(2) Audio-》Voice-》PCM-》Baseband这两种方…

ZYNQ平台Linux4.6内核蓝牙音频

第1章 RTL8723BU蓝牙模块驱动移植 1.1. 硬件方案 1.2. 蓝牙驱动移植 1.3. 蓝牙耳机规格要求 第2章 Linux音频框架 2.1. ALSA 2.2. Pulseaudio 2.3. GStreamer 2.4. Jack 2.5. FFADO 2.6. Xine 2.7. Phonon 2.8. 其他分支 第3章 蓝牙协议栈Bluez 3.1…

蓝牙的音频通路

如上图&#xff1a; 音频通路1&#xff1a;Audio->L2CAP->ACL->HCI->Baseband&#xff0c;a2dp音频走这种方式&#xff1b; 音频通路2&#xff1a;Audio->Voice->SCO/eSCO->HCI->Baseband&#xff0c;hfp、hsp蓝牙通话走这种方式&#xff1b; 音频通路…

蓝牙音频编码协议

文章目录 一、人耳需要什么样的采样率二、采样率分类三、蓝牙音频编码协议分类 一、人耳需要什么样的采样率 人耳对声音的分辨率是在20Hz~~~~20KHz的范围。 二、采样率分类 常见的蓝牙音频采样率&#xff1a; 44.1KHz48.0KHz88.2Khz96Khz 三、蓝牙音频编码协议分类 SBC 全…

蓝牙音频那些事

蓝牙音频那些事TOC 现在随着智能手机的发展&#xff0c;全面屏的发展&#xff0c;3.5mm耳机孔逐渐变成奢侈的配件&#xff0c;为此逐渐出现了蓝牙耳机&#xff0c;而且这玩意变得越来越多&#xff0c;真有点“忽如一夜春风来&#xff0c;千树万树梨花开”的味道。 蓝牙音频包…

车载蓝牙音频系统测试

1、介绍 随着汽车影音娱乐信息技术的发展&#xff0c;车载音频系统的需求趋势越来越明显。因此&#xff0c;针对汽车音频娱乐系统的新兴技术&#xff0c;对应的测试需求也在不断提升。本文将针对汽车车机的蓝牙音频系统和车机A2B总线系统&#xff0c;做出相应的应用测试介绍。…