Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Algorithm 最多2次重叠的区间选择算法_Algorithm_Dynamic Programming - Fatal编程技术网

Algorithm 最多2次重叠的区间选择算法

Algorithm 最多2次重叠的区间选择算法,algorithm,dynamic-programming,Algorithm,Dynamic Programming,我正在尝试求解,其中N(我不确定这个方向是否有效,因为可能是在添加新的间隔时,我们不能添加到以前的解决方案中,而是必须完全改变情况。@redtuna我确信只有a[I]这还不够,但是……你还有其他想法吗?当然,我会尝试一种贪婪启发式的搜索算法。是的,我只会在找到DP解决方案后才尝试贪婪,因为问题列在“动态”类别中。可能有贪婪的保证解决方案,而不仅仅是启发式的。@AndreiI你能解决这个问题吗? A[i] = 1 + A[q[i]] + [missing-part]; //1 stands for

我正在尝试求解,其中N(我不确定这个方向是否有效,因为可能是在添加新的间隔时,我们不能添加到以前的解决方案中,而是必须完全改变情况。@redtuna我确信只有a[I]这还不够,但是……你还有其他想法吗?当然,我会尝试一种贪婪启发式的搜索算法。是的,我只会在找到DP解决方案后才尝试贪婪,因为问题列在“动态”类别中。可能有贪婪的保证解决方案,而不仅仅是启发式的。@AndreiI你能解决这个问题吗?
A[i] = 1 + A[q[i]] + [missing-part];
//1 stands for the i-th interval
//A[q[i]] stands for the solution of the intervals that do not overlap with with the i-th interval
//[missing-part] is the maximum number of intervals from the intervals that overlap with the i-th intervals that are safe to be added.