mcpc2017 The Uncertainty of Politics

探讨了在国会听证会的时间安排中如何通过合理的策略最大化预期参与数量的问题。面对多个可能重叠的听证会及其不确定的持续时间,本文提出了一种从后向前的动态规划方法来解决此问题。

5096: The Uncertainty of Politics

时间限制: 1 Sec  内存限制: 128 MB  Special Judge

题目描述

You have an upcoming trip to Washington D.C. and you are fascinated with the intricacies of Congressional committee hearings. You wish to attend as many hearings as possible during your trip, and your local representative has provided you with a pass that will get you into the audience of any hearing. But there are some challenges in planning your schedule.
Specifically:
1. There are many committees, and thus many hearings, some of which take place at overlapping times.
2. While the committees are extremely punctual in terms of when to start a hearing, they are notoriously unpredictable in terms of how long the hearing lasts. Fortunately, rules do not actually allow for a filibuster of a committee hearing, so they cannot last forever.
3. It is considered rude to enter a hearing that is already underway, or to leave a hearing before it is complete. Given that you do not wish to embarrass the representative who provided your tickets, if you attend you must attend the entire hearing. Fortunately, hearings are very near to each other; as soon as one hearing is done, you can immediately join another hearing that is about to start.
Well in advance of your trip, Congress publishes a schedule of hearings, indicating for each one the time s at which the hearing will start, and then values a and b which represent, respectively, the shortest and longest possible length of that particular hearing. You are to assume that the actual length of the hearing will be a uniformly random integer over the inclusive interval [a, b]. 
Your goal is to develop a strategy that maximizes the expected number of hearings that you can attend during your trip. As an example, consider a situation in which there are four hearings with parameters as follows:
For this schedule, the optimal strategy will allow you to achieve an expected value of 2.125 hearings. To achieve this, you begin by attending the NASA hearing, which starts at time 3 and ends with equal probability at either time 5 or time 6 (given the hearing length that is uniformly distributed over {2, 3}). If the NASA hearing does end at time 5 you will immediately head to the oil and gas exploration hearing, and there is a  1/4 chance that hearing will end at time 6, allowing you to make yet a third hearing (about hurricane recovery efforts). If the NASA hearing instead ends at time 6, you will go straight to the hurricane hearing. 
By this strategy you will attend 3 hearings 12.5% of the time and 2 hearings the other 87.5% of the time, and thus expected value of 2.125. Note that if you were to start by attending the social media and elections hearing, you might optimistically make four hearings. However, a careful analysis will demonstrate that if you attend the first hearing, your optimal expected value is only 2.10714.

输入

The input begins with an integer n that designates the total number of scheduled hearings (1 ≤ n ≤ 104).
Following that are n lines, each containing three integers s, a, and b, respectively representing the start time,minimum length, and maximum length of a hearing, such that 1 ≤ s ≤ 106 and 1 ≤ a ≤ b ≤ 106. The hearings will be listed in nondecreasing order of their start times.

输出

Display the expected number of hearings of an optimal strategy. Your answer should have an absolute or relative error of at most 10−3.

样例输入

4
1 1 7
3 2 3
5 1 4
6 10 10

样例输出

2.125

题目大意:有n个听证会,给定每个会议开始的时间,最早的结束时间和最晚的时间,求最明智的方案的参加听证会数目的期望值。


蒟蒻的思路:因为参加每一个听证会后最优方案的期望值只会收到它之后的听证会的最优方案的期望值的影响,所以第一反应就是从后往前进行一个DP。对每个听证会,将它的进行时间分为长度为1的m段,每段取在该时刻最大的期望,将一个听证会的所有时刻的最优值加在一起即为该听证会的最优解(如一个听证会进行时间是3-5时刻,那么我们分别取3、4、5这三个时刻能取得最大值,再将这三个值加在一起,最后加上该听证会自身的1,即为该听证会的最优解)


#include <bits/stdc++.h>
struct hearings
{
    int s,a,b;
};
double dp[100005];                    //dp[i]为参加第i个听证会(不参加第i个之前的听证会)的最优方案的期望值
hearings z[100005];
int main()
{
    int i,n;
    scanf("%d",&n);
    for (i=0;i<n;i++)
        scanf("%d%d%d",&z[i].s,&z[i].a,&z[i].b);
    for (i=n-1; i>=0; i--)           //从最后一个听证会往前扫
    {
        int p1,p2,e,k=n-1;
        double maxx=0;
        dp[i]++;                    //选择第i个听证会则他本身期望为1
        e=z[i].s+z[i].a;            //最早结束时间
        p2=z[i].s+z[i].b;            //p2为该听证会进行时间我们还未处理的最晚时刻(初始化为最晚结束时间)
        int m=z[i].b-z[i].a+1;        //听证会进行时间分为m段(每段长度)
        while (p2>=e)                //如果该听证会我们尚未处理完
        {
            while(k>i)                //k为开始时间晚于我们未处理的时刻的最早听证会
            {
                if (z[k].s<p2)
                    break;
                if (dp[k]>maxx)        //更新这个时刻我们能取的最优解
                    maxx=dp[k];        
                k--;
            }
            p1=e>z[k].s+1?e:z[k].s+1;    //将最优解不需要更新的时刻合并处理(不处理会TLE)(因为如果这一段时刻没有开始的听证会,则最优解不变)
            dp[i]+=maxx*(p2-p1+1)/m;    
            p2=p1-1;                    //更新p2
        }
    }
    double maxx=0;
    for (i=0;i<n;i++)
        if (dp[i]>maxx)
            maxx=dp[i];
    printf("%.16f",maxx);
    return 0;
}

内容概要:本文介绍了基于条件生成对抗网络(Conditional Generative Adversarial Networks, CGAN)的可再生能源日前场景生成方法的复现研究,旨在通过Python代码实现对风电、光伏等可再生能源出力的不确定性进行高效建模与多场景生成。该方法利用历史数据作为条件输入,训练生成器与判别器网络,从而生成符合实际统计特性的高精度出力场景集,有效支撑电力系统调度、规划与风险评估等应用。文中详细阐述了CGAN的网络结构设计、损失函数构建、训练流程优化及生成场景的质量评价指标,并提供了完整的代码实现与案例分析,验证了其在捕捉时空相关性与概率分布方面的优越性。; 适合人群:具备一定深度学习与电力系统基础知识,从事新能源预测、电力系统优化调度、场景生成等相关方向的科研人员及研究生。; 使用场景及目标:①用于可再生能源出力不确定性建模,生成满足日前调度需求的典型场景集;②支撑含高比例新能源的电力系统随机优化、鲁棒调度与风险评估研究;③为学术研究提供可复现的CGAN应用场景与代码参考。; 阅读建议:建议读者结合提供的Python代码逐模块学习,重点关注数据预处理、模型搭建与训练细节,通过调整超参数和输入数据进行实验对比,深入理解CGAN在电力系统场景生成中的实际应用价值。
内容概要:本文系统介绍了基于去噪概率扩散模型(DDPM)的光伏功率场景生成方法,并提供了完整的Python代码实现。该模型通过模拟扩散与去噪过程,从历史光伏出力数据中学习其复杂的时序特征与概率分布,进而生成高保真、多样化的光伏功率场景,能够有效刻画新能源出力的不确定性、波动性与时序相关性。文中强调该资源属于科研复现类内容,聚焦于模型原理剖析与代码实践,适用于推动新型电力系统中新能源建模与风险评估的研究进展。; 适合人群:具备一定Python编程能力与机器学习基础知识,从事新能源发电预测、电力系统规划、能源系统建模、不确定性分析等方向研究的研究生、科研人员及工程师;熟悉深度学习框架(如PyTorch)者更佳。; 使用场景及目标:①用于生成高质量的光伏功率时序场景,支撑含高比例可再生能源的电力系统随机优化调度、鲁棒规划与风险评估;②作为科研复现案例,深入理解DDPM在能源时间序列生成任务中的建模机制与训练策略;③可拓展应用于风电、负荷等其他不确定性能源变量的场景生成问题,具备良好的迁移性与研究价值。; 阅读建议:建议读者结合提供的代码与网盘资料,按照目录结构循序渐进地学习,重点掌握模型网络架构设计、前向扩散与反向去噪过程、损失函数构建及采样生成逻辑,鼓励在真实数据集上进行调试、训练与结果可视化,以深化对扩散模型内在机理的理解与应用能力。
内容概要:本文系统研究了基于多面体聚合与闵可夫斯基和的电动汽车可调能力评估方法,提出了一种结合内近似模型与外近似技术的聚合可行域建模策略,用于精确刻画大规模电动汽车集群的功率调节潜力。通过引入多面体几何表示与闵可夫斯基和运算,实现了对异构电动汽车充放电行为的高效聚合,并采用SOCP(二阶锥规划)等先进数学优化手段完成对聚合可行域的紧凑逼近与计算求解,进而评估其在配电网中的灵活性贡献。该方法为高比例新能源接入背景下电动汽车作为灵活性资源参与电网调峰、调频等辅助服务提供了理论支撑与量化工具,配套提供的Matlab代码实现了从建模到优化的全流程仿真,便于研究成果的复现与拓展。; 适合人群:具备电力系统分析、凸优化理论基础及Matlab编程能力,从事新能源并网、电动汽车与电网互动、灵活性资源调度等相关方向研究的科研人员、高校研究生及工程技术人员。; 使用场景及目标:①评估大规模电动汽车集群接入对配电网灵活性的影响及其可调度容量;②研究电动汽车聚合商参与电力系统辅助服务市场的可行性与调控潜力;③为新型电力系统中多主体、多源协同的优化调度提供精细化建模方法与技术支持; 阅读建议:建议读者深入理解多面体建模与闵可夫斯基和的基本原理,结合所提供的Matlab代码重点掌握SOCP模型的构建技巧与YALMIP等优化工具箱的使用方法,通过调整参数与场景设置进行对比分析,以深化对电动汽车聚合特性与优化求解过程的认识。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值