- 博客(51)
- 收藏
- 关注
原创 RLlib/Ray:踩坑记录
出现这种报错的原因是MultiDiscrete的取值范围是左闭右开。以第一个报错中的第十维为例,MultiDiscrete的取值范围是[0, 51),因此当observation对应维度为51时就会报错。
2023-07-13 11:52:22
445
原创 Win7批量执行Python文件
平时都是用Pycharm跑代码,但是每次都需要在Configuration里修改Parameters,跑完一个才能重新修改跑下一个,很不方便,于是决定借助.bat文件实现批量执行。
2023-06-10 21:25:55
743
原创 Gurobi:线性规划(LP)无界
当模型无界时,Gurobi会提供无界射线(仅适用于无界线性模型)。无界射线是一个向量,当添加到任何可行的解时,会产生一个同样可行但改善目标的新解。具体操作如下:首先,设置参数。此时再输出model.status,就会变为3或者5。若为5,则说明模型无界。然后,我们可以获取无界射线。
2022-12-28 14:50:50
1906
5
原创 Pycharm:踩坑记录/窍门分享
当使用PyCharm的Debug模式时,最好用的莫过于Debug Console,它与断点相配合可以实现类似于Jupyter Notebook的逐块运行代码的效果。但是今天我突然发现Debug Console无法交互了,也即“>>>”没有出现,且“Show Debug Console”的按钮也不见了,非常着急。最后找到了原因,在Run/Debug Configurations的Execution中,要取消勾选第一项“Emulate terminal in output console”。
2022-12-04 11:17:43
874
原创 Gurobi:不可能infeasible的纯整数规划模型出现infeasible
我建了一个不可能infeasible的纯整数规划模型(所有变量都是整数变量),但是竟然出现了infeasible,大惊!赶紧开始看是哪里的问题。
2022-09-26 14:06:09
1371
6
原创 Python:defaultdict
当字典中的值是列表,且想向列表中不断添加元素,可使用defaultdict:Python数据结构和算法6:字典中的键如何映射多个值
2022-09-16 22:06:02
225
原创 LaTeX:使用技巧
将宏包等放入header.tex中以便多个文档共享引用格式:\documentclass[11pt]{article}\input{header.tex}\begin{document}...\end{document}
2022-05-18 12:42:37
143
原创 VS Code+LaTeX
第一步:分别安装VS Code和TeX Live第二步:在VS Code中安装插件LaTeX Workshop第三步:ctrl+P+>settings,打开settings.json文件进行配置(包括字体大小等)第四步:在C:\Users\Serena\AppData\Roaming\Code\User\snippets路径下添加latex.json文件,以使用FasTeX...
2022-04-14 21:20:36
249
原创 Python:Jupyter Notebook使用中的问题
在使用Jupyter Notebook时遇到:IOPub data rate exceeded.The notebook server will temporarily stop sending outputto the client in order to avoid crashing it.解决方法:打开Anaconda Prompt输入jupyter notebook --NotebookApp.iopub_data_rate_limit=1.0e10...
2022-03-04 21:58:31
1018
原创 二次型随机变量的均值
参考:真香的多元随机向量基础篇(均值与方差)其中,用到了期望和迹可交换的性质。参考:迹运算为什么能和期望运算交换?可以给一个简单的证明过程吗?
2021-12-15 15:17:37
4727
原创 《Integer Programming》第十章读书笔记
10 Lagrangian Duality10.1 Lagrangian Relaxation考虑如下整数规划问题(IP):其中,Ax≤bAx\le bAx≤b表示的是复杂的约束,而“好”的约束(例如网络流约束)被包含在了x∈Xx\in Xx∈X中。它的拉格朗日松弛问题是:其中,uuu被称为价格或者对偶变量或者拉格朗日乘子。因为每个拉格朗日松弛问题都是原整数规划问题的一个上界,所以为了找到最好的(也即最小的)上界,我们需要求解如下拉格朗日对偶问题:何时拉格朗日松弛问题的最优解是原整数规划问
2021-11-24 19:15:34
415
2
原创 《Reinforcement Learning》第三章自学笔记
目录Multi-armed BanditsA kkk-armed Bandit ProblemMulti-armed Banditsevaluate (evaluative feedback) V.S. instruct (instructive feedback):区分强化学习(前者)和其他学习的最重要特征associative V.S. nonassociative:前者指的是when actions are taken in more than one situationA kkk-arm
2021-10-28 15:57:42
126
原创 《Integer Programming》第三章读书笔记
3 Well-Solved Problems3.1 Properties of Easy ProblemsIn examining a problem to see if it has an efficient algorithm, the following four properties often go together:In the next sections, we examine several classes of problems for which we will see t
2021-10-28 15:56:43
363
2
原创 Stochastic dual dynamic integer programming (SDDiP)
Stochastic dual dynamic integer programming (SDDiP)Introduction: Multistage stochastic programmingwe associate decisions to the nodes of the treeThe resulting formulation, called the extensive form, isit has a very large scaleAn alternative t
2021-10-26 21:50:10
630
1
原创 《Integer Programming》第四章读书笔记
目录4 Matchings and Assignments4.1 Augmenting Paths and Optimality4.2 Bipartite Maximum Cardinality MatchingQ:拿到一个问题问自己难不难,以后。。。max matchingmin covering哪个是np难/polynomial time4 Matchings and Assignments4.1 Augmenting Paths and Optimality在一些组合算法中会用到的
2021-10-26 20:39:33
222
原创 《Integer Programming》第二章读书笔记
Chapter 2 explains how it is possible to prove that feasible solutions are optimal or close to optimal.目录2 Optimality, Relaxation, and Bounds2.1 Optimality and Relaxation2.2 Linear Programming Relaxations2.3 Combinatorial Relaxations2.4 Lagrangian Relaxat
2021-10-03 18:10:32
346
原创 《Integer Programming》第一章读书笔记
Chapter 1 introduces the reader to various integer programming problems and their formulation and introduces the important distinction between good and bad formulations.目录1 Formulations1.1 Introduction1.2 What Is an Integer Program?1.3 Formulating IPs an.
2021-09-30 22:32:30
642
原创 《Distributionally Robust Learning》第二章读书笔记
目录2 The Wasserstein Metric2.1 Basics2.2 A Distance Metric2.3 The Dual Problem2.3.1 Arbitrary Measures and Kantorovich Duality2.4 Some Special Cases2.5 The Transport Cost Function2.5.1 Transport Cost Function via Metric Learning2.6 Robustness of the Wassers
2021-09-12 20:03:01
393
4
原创 《Distributionally Robust Learning》第一章读书笔记
目录1 Introduction1.1 Robust Optimization1.2 Distributionally Robust Optimization1 IntroductionminβEP∗[hβ(x,y)](1.1)\min _{\beta} \mathbb{E}^{\mathbb{P}^{*}}\left[h_{\beta}(\mathbf{x}, y)\right]\tag{1.1}βminEP∗[hβ(x,y)](1.1)we will restrict our atte
2021-09-07 15:02:31
673
原创 《Lectures on Stochastic Programming: Modeling and Theory》第一章自学笔记
目录1 Stochastic Programming Models1.2 Inventory1.2.1 The Newsvendor Problem1.2.2 Chance Constraints1.2.3 Multistage Models1 Stochastic Programming Models1.2 Inventory1.2.1 The Newsvendor Problem1.2.2 Chance Constraints1.2.3 Multistage Models
2021-07-03 14:15:52
861
原创 深度强化学习(DRL)入门资料
DRL权威入门教程(估计看不懂):https://www.bilibili.com/video/BV1xp4y1q7kW?from=search&seid=6122807716326787903DRL权威入门书籍(估计看不下去):《Deep reinforcement learning: an introduction》 by Sutton莫烦RL基础入门课程+代码(太过简单,可以对RL做简单了解):https://mofanpy.com/李宏毅DRL教程(难度适中,讲解透彻;主要是近.
2021-05-28 15:16:03
344
原创 Python:对多个DataFrame的遍历
错误写法:df_set = [stats_V25A, stats_5B, stats_7B]for df in df_set: df.index = range(2014, 2021) df = df.fillna(0) df.loc[df.shape[0]] = [df[column].mean() for column in list(df.columns)] df.rename(index={df.shape[0]-1: 'mean'}, inplace=True)
2021-05-20 15:00:42
1832
原创 Python:if __name__ == ‘__main__‘ 如何正确理解?
本文主要参考:知乎用户在此对作者表示感谢!// file one.pydef func(): print("func() in one.py")print("top-level in one.py")if __name__ == "__main__": print("one.py is being run directly")else: print("one.py is being imported into another module")// file tw
2021-05-17 18:52:13
100
原创 Python:random.seed()
random.seed() 会改变随机生成器的种子;传入的数值用于指定随机数生成时所用算法开始时所选定的整数值,如果使用相同的seed()值,则每次生成的随机数都相同;如果不设置这个值,则系统会根据时间来自己选择这个值,此时每次生成的随机数会因时间的差异而有所不同。...
2021-04-29 22:32:56
133
原创 使用Visual Studio Code跑python代码的二三事
跑.py文件需要先选择一个解释器。(我们之所以可能需要多个环境是因为,对于不同的任务我们可能需要一个包的不同版本,但是一个环境不能安装一个包的多个版本,所以就需要多个环境;至于环境和解释器的关系,暂时没搞清楚…)......
2021-04-29 22:22:14
97
原创 动态规划:值函数迭代例子
最优方程:V(h)=min{R+α[P1C+V(0)],α[hP2C+(1−h)γP2C+(1−h)(1−γ)P1C+V(h+(1−h)γ)]}V(h)=\min \left\{R+\alpha\left[P_{1} C+V(0)\right]\right., \left.\alpha\left[h P_{2} C+(1-h) \gamma P_{2} C+(1-h)(1-\gamma) P_{1} C+V(h+(1-h) \gamma)\right]\right\}V(h)=min{R+α[P..
2021-04-29 18:18:02
686
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人