由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Science版 - [转载] help, greedy algorithm
相关主题
问题征解Re: who knows the natural frequency of sound?
Re: 陈竺当选为美国国家科学院外籍院士Re: 难题非高手莫入
Re: Integer Optimization[转载] how do you do integer division?
电泳理论---物理学的应用(1).Re: help: the approximation of n!
Re: a dumb probability problem, please help图形覆盖与(凸分析).
Weistrass的逼近定理Re: matrix inverse
补充一下!Re: HELP! a algorithm problem!
Re: 大气压 X 地球表面积 ?= 大气质量两个一笔画老问题(一个修正)。Sorry
相关话题的讨论汇总
话题: greedy话题: segments话题: optimal话题: algorithm话题: pick
进入Science版参与讨论
1 (共1页)
c*****t
发帖数: 1879
1
【 以下文字转载自 Programming 讨论区 】
【 原文由 coconut 所发表 】
Activity selection problem. For those people who don't remember,
it asks one to pick max # of non-overlapping segments. The optimal
strategy is to sort the segments according to where it ends and
pick accordingly. However, this is not what I am asking.
I am asking for a counter example that that Minimum Overlap greedy
(sort segments according to minimum overlap). I knew that it is
not optimal (I did it before), but apparently I forgot the solut
k**y
发帖数: 320
2
not quite sure i understand. maybe the following example helps:
{[0,10], [11,20], [10,11]} greedy picks [10,11] but the opt
solution is [0,11]+[11,20].
it is not hard to prove greedy gives > 0.5 approximation.

【在 c*****t 的大作中提到】
: 【 以下文字转载自 Programming 讨论区 】
: 【 原文由 coconut 所发表 】
: Activity selection problem. For those people who don't remember,
: it asks one to pick max # of non-overlapping segments. The optimal
: strategy is to sort the segments according to where it ends and
: pick accordingly. However, this is not what I am asking.
: I am asking for a counter example that that Minimum Overlap greedy
: (sort segments according to minimum overlap). I knew that it is
: not optimal (I did it before), but apparently I forgot the solut

c*****t
发帖数: 1879
3
So, to look for a counter example, one needs to find a case where
a first peak does not pick the end (or resulting a pick that that
is compatible with picking the end). Since the optimal strategy
(btw, is also greedy) is
1. sort the segments ending from left to right.
2. pick the one that end the first w/o conflict w/ existing picks.
3. repeat 2.
Obviously, it is very different from minOverlap, yet in many cases
they produce equivalent results.
Unfortunately, it is hard to find a counter exampl

【在 c*****t 的大作中提到】
: 【 以下文字转载自 Programming 讨论区 】
: 【 原文由 coconut 所发表 】
: Activity selection problem. For those people who don't remember,
: it asks one to pick max # of non-overlapping segments. The optimal
: strategy is to sort the segments according to where it ends and
: pick accordingly. However, this is not what I am asking.
: I am asking for a counter example that that Minimum Overlap greedy
: (sort segments according to minimum overlap). I knew that it is
: not optimal (I did it before), but apparently I forgot the solut

k**y
发帖数: 320
4
not considering the tie break cases (in which just random pick
one with min overlapping with others), i think this is the best
i can find: your method always give >.75 approximation.
i changed it a little bit so you cannot remove any element
without stadying the whole set.

【在 k**y 的大作中提到】
: not quite sure i understand. maybe the following example helps:
: {[0,10], [11,20], [10,11]} greedy picks [10,11] but the opt
: solution is [0,11]+[11,20].
: it is not hard to prove greedy gives > 0.5 approximation.

c*****t
发帖数: 1879
5
Yes. This is the idea I was looking for. Thank you so much!
------- ------- ------ --------
----------- ----- ------------
----------- ------------
----------- ------------
Damn. How could I forgot the solution. Now, looking back, I should
have realized that the segment that picked by minOverlap would cause
two segments (not one) needed by the optimal method to be removed.
Thank you.

【在 k**y 的大作中提到】
: not considering the tie break cases (in which just random pick
: one with min overlapping with others), i think this is the best
: i can find: your method always give >.75 approximation.
: i changed it a little bit so you cannot remove any element
: without stadying the whole set.

1 (共1页)
进入Science版参与讨论
相关主题
两个一笔画老问题(一个修正)。SorryRe: a dumb probability problem, please help
问一个简单的光学问题Weistrass的逼近定理
Re: What is the first-principle?补充一下!
Re: 请教一道概率题Re: 大气压 X 地球表面积 ?= 大气质量
问题征解Re: who knows the natural frequency of sound?
Re: 陈竺当选为美国国家科学院外籍院士Re: 难题非高手莫入
Re: Integer Optimization[转载] how do you do integer division?
电泳理论---物理学的应用(1).Re: help: the approximation of n!
相关话题的讨论汇总
话题: greedy话题: segments话题: optimal话题: algorithm话题: pick