深度强化学习(二)

#! https://zhuanlan.zhihu.com/p/686235508

深度强化学习(二)(贝尔曼方程)

一.贝尔曼方程(将 Q π Q_\pi Qπ 表示成 Q π Q_\pi Qπ

Theorem :假设 R t R_t Rt S t 、 A t 、 S t + 1 S_t 、 A_t 、 S_{t+1} StAtSt+1 的函数。那么
Q π ( s t , a t ) = E S t + 1 , A t + 1 [ R t + γ ⋅ Q π ( S t + 1 , A t + 1 ) ∣ S t = s t , A t = a t ] . (1.1) Q_\pi\left(s_t, a_t\right)=\mathbb{E}_{S_{t+1}, A_{t+1}}\left[R_t+\gamma \cdot Q_\pi\left(S_{t+1}, A_{t+1}\right) \mid S_t=s_t, A_t=a_t\right] .\tag{1.1} Qπ(st,at)=ESt+1,At+1[Rt+γQπ(St+1,At+1)St=st,At=at].(1.1)

proof:令 S t + 1 : = { S t + 1 , S t + 2 , ⋯ } \mathcal{S}_{t+1:}=\left\{S_{t+1}, S_{t+2}, \cdots\right\} St+1:={St+1,St+2,}, A t + 1 : = { A t + 1 , A t + 2 , ⋯ } \mathcal{A}_{t+1:}=\left\{A_{t+1}, A_{t+2}, \cdots\right\} At+1:={At+1,At+2,},由 U t U_t Ut的定义知 U t = R t + γ ⋅ U t + 1 U_t=R_t+\gamma \cdot U_{t+1} Ut=Rt+γUt+1

Q π ( s t , a t ) = E S t + 1 : , A t + 1 : [ U t ∣ S t = s t , A t = a t ] = E S t + 1 : , A t + 1 : [ R t + γ ⋅ U t + 1 ∣ S t = s t , A t = a t ] = E S t + 1 , A t + 1 [ R t ∣ S t = s t , A t = a t ] ⏟ ( 1 ) + γ ⋅ E S t + 1 : , A t + 1 : [ U t + 1 ∣ S t = s t , A t = a t ] ⏟ ( 2 ) \begin{aligned} Q_\pi\left(s_t, a_t\right)&=\mathbb{E}_{\mathcal{S}_{t+1:}, \mathcal{A}_{t+1:}}\left[U_t \mid S_t=s_t, A_t=a_t\right]\\ &=\mathbb{E}_{\mathcal{S}_{t+1:}, \mathcal{A}_{t+1:}}\left[R_t+\gamma \cdot U_{t+1} \mid S_t=s_t, A_t=a_t\right]\\ &= \underbrace{\Bbb E_{\cal S_{t+1},\cal A_{t+1}}\left[R_t|S_t=s_t,A_t=a_t \right]}_{(1)}+\gamma\cdot\underbrace{ \mathbb{E}_{\mathcal{S}_{t+1:}, \mathcal{A}_{t+1:}}\left[U_{t+1} \mid S_t=s_t, A_t=a_t\right]}_{(2)}\\ \end{aligned} Qπ(st,at)=ESt+1:,At+1:[UtSt=st,At=at]=ESt+1:,At+1:[Rt+γUt+1St=st,At=at]=(1) ESt+1,At+1[RtSt=st,At=at]+γ(2) ESt+1:,At+1:[Ut+1St=st,At=at]
其中, t t t时刻的回报 R t R_{t} Rt只与 t + 1 t+1 t+1时刻的状态 S t + 1 S_{t+1} St+1有关,而 S t + 1 S_{t+1} St+1只与 S t , A t S_t,A_t St,At有关,则
( 1 ) = E S t + 1 , A t + 1 [ R t ∣ S t = s t , A t = a t ] = E S t + 1 [ R t ∣ S t = s t , A t = a t ] = E S t + 1 , A t + 1 [ R t ∣ S t = s t , A t = a t ] \begin{aligned} (1)&=\Bbb E_{\cal S_{t+1},\cal A_{t+1}}\left[R_t|S_t=s_t,A_t=a_t \right]\\ &= \Bbb E_{S_{t+1}}\left [R_t|S_t=s_t,A_t=a_t\right]\\ &= \Bbb E_{S_{t+1},A_{t+1}}\left [R_t|S_t=s_t,A_t=a_t\right] \end{aligned} (1)=ESt+1,At+1[RtSt=st,At=at]=ESt+1[RtSt=st,At=at]=ESt+1,At+1[RtSt=st,At=at]
( 2 ) (2) (2)中的式子变形可得
( 2 ) = E S t + 1 : , A t + 1 : [ U t + 1 ∣ S t = s t , A t = a t ] = E S t + 1 , A t + 1 , S t + 2 , A t + 2 [ U t + 1 ∣ S t = s t , A t = a t ] = E S t + 1 , A t + 1 [ E S t + 2 , A t + 2 [ U t + 1 ∣ S t + 1 , A t + 1 , S t = s t , A t = a t ] ∣ S t = s t , A t = a t ] 利用马尔可夫性 = E S t + 1 , A t + 1 [ E S t + 2 , A t + 2 [ U t + 1 ∣ S t + 1 , A t + 1 ] ∣ S t = s t , A t = a t ] = E S t + 1 , A t + 1 [ Q π ( S t + 1 , A t + 1 ) ∣ S t = s t , A t = a t ] \begin{aligned} (2)&= \mathbb{E}_{\mathcal{S}_{t+1:}, \mathcal{A}_{t+1:}}\left[U_{t+1} \mid S_t=s_t, A_t=a_t\right]\\ &= \Bbb E_{S_{t+1},A_{t+1},\cal S _{t+2},\cal A _{t+2}}\left[U_{t+1}|S_t=s_t,A_t=a_t \right]\\ &= \Bbb E_{S_{t+1},A_{t+1}}\left[\Bbb E_{\cal S_{t+2},\cal A_{t+2}}\left[U_{t+1}|S_{t+1},A_{t+1},S_t=s_t,A_t=a_t\right]|S_t=s_t,A_t=a_t \right]利用马尔可夫性\\ &=\Bbb E_{S_{t+1},A_{t+1}}\left[\Bbb E_{\cal S_{t+2},\cal A_{t+2}}\left[U_{t+1}|S_{t+1},A_{t+1}\right]|S_t=s_t,A_t=a_t \right] \\ &=\mathbb{E}_{S_{t+1}, A_{t+1}}\left[Q_\pi\left(S_{t+1}, A_{t+1}\right) \mid S_t=s_t, A_t=a_t\right] \end{aligned} (2)=ESt+1:,At+1:[Ut+1St=st,At=at]=ESt+1,At+1,St+2,At+2[Ut+1St=st,At=at]=ESt+1,At+1[ESt+2,At+2[Ut+1St+1,At+1,St=st,At=at]St=st,At=at]利用马尔可夫性=ESt+1,At+1[ESt+2,At+2[Ut+1St+1,At+1]St=st,At=at]=ESt+1,At+1[Qπ(St+1,At+1)St=st,At=at]
由此证毕。

二.贝尔曼方程 (将  Q π 表示成  V π )  \text { (将 } Q_\pi \text { 表示成 } V_\pi \text { ) }  ( Qπ 表示成 Vπ ) 

Theorem :假设 R t R_t Rt S t 、 A t 、 S t + 1 S_t 、 A_t 、 S_{t+1} StAtSt+1 的函数。那么
Q π ( s t , a t ) = E S t + 1 [ R t + γ ⋅ V π ( S t + 1 ) ∣ S t = s t , A t = a t ] (1.2) Q_\pi\left(s_t, a_t\right)=\mathbb{E}_{S_{t+1}}\left[R_t+\gamma \cdot V_\pi\left(S_{t+1}\right) \mid S_t=s_t, A_t=a_t\right]\tag{1.2} Qπ(st,at)=ESt+1[Rt+γVπ(St+1)St=st,At=at](1.2)

proof: 由于  V π ( S t + 1 ) = E A t + 1 ∼ π ( ⋅ ∣ S t + 1 ) [ Q ( S t + 1 , A t + 1 ) ] = E A t + 1 [ Q π ( S t + 1 , A t + 1 ) ∣ S t + 1 ] \text { 由于 } V_\pi\left(S_{t+1}\right)=\mathbb{E}_{A_{t+1}\sim \pi\left(\cdot \mid S_{t+1}\right)}\left[Q\left(S_{t+1}, A_{t+1}\right)\right]=\Bbb E_{A_{t+1}}\left[ Q_{\pi}(S_{t+1},A_{t+1})|S_{t+1}\right]  由于 Vπ(St+1)=EAt+1π(St+1)[Q(St+1,At+1)]=EAt+1[Qπ(St+1,At+1)St+1]
( 2 ) = E S t + 1 , A t + 1 [ Q π ( S t + 1 , A t + 1 ) ∣ S t = s t , A t = a t ] = E S t + 1 [ E A t + 1 [ Q π ( S t + 1 , A t + 1 ) ∣ S t + 1 ] ∣ S t = s t , A t = a t ] = E S t + 1 [ V π ( S t + 1 ) ∣ S t = s t , A t = a t ] \begin{aligned} (2)= &\mathbb{E}_{S_{t+1}, A_{t+1}}\left[Q_\pi\left(S_{t+1}, A_{t+1}\right) \mid S_t=s_t, A_t=a_t\right]\\ =&\Bbb E_{S_{t+1}}\left[\Bbb E_{A_{t+1}}\left[ Q_{\pi}(S_{t+1},A_{t+1})|S_{t+1}\right]|S_t=s_t,A_t=a_t\right]\\ =&\Bbb E_{S_{t+1}}\left[V_\pi\left(S_{t+1}\right)|S_t=s_t,A_t=a_t\right] \end{aligned} (2)===ESt+1,At+1[Qπ(St+1,At+1)St=st,At=at]ESt+1[EAt+1[Qπ(St+1,At+1)St+1]St=st,At=at]ESt+1[Vπ(St+1)St=st,At=at]
证毕

三.贝尔曼方程(将 V π V_\pi Vπ 表示成 V π V_\pi Vπ )

Theorem :假设 R t R_t Rt S t 、 A t 、 S t + 1 S_t 、 A_t 、 S_{t+1} StAtSt+1 的函数。那么
V π ( s t ) = E A t , S t + 1 [ R t + γ ⋅ V π ( S t + 1 ) ∣ S t = s t ] (1.3) V_\pi\left(s_t\right)=\mathbb{E}_{A_t, S_{t+1}}\left[R_t+\gamma \cdot V_\pi\left(S_{t+1}\right) \mid S_t=s_t\right]\tag{1.3} Vπ(st)=EAt,St+1[Rt+γVπ(St+1)St=st](1.3)

proof:
V π ( s t ) = E A t , S t + 1 , A t + 1 [ U t ∣ S t = s t ] = E A t , S t + 1 , A t + 1 , [ R t + γ U t + 1 ∣ S t = s t ] = E A t , S t + 1 , A t + 1 [ R t ∣ S t = s t ] + γ E A t , S t + 1 , A t + 1 [ U t + 1 ∣ S t = s t ] = E A t , S t + 1 [ R t ∣ S t = s t ] + γ E S t + 1 [ E A t A t + 1 , S t + 2 [ U t + 1 ∣ S t + 1 , S t = s t ] ∣ S t = s t ] = E A t , S t + 1 [ R t ∣ S t = s t ] + γ E S t + 1 [ E A t + 1 , S t + 2 [ U t + 1 ∣ S t + 1 ] ∣ S t = s t ] 马尔可夫性 = E A t , S t + 1 [ R t ∣ S t = s t ] + γ E S t + 1 [ V π ( S t + 1 ) ∣ S t = s t ] = E A t , S t + 1 [ R t ∣ S t = s t ] + γ E A t , S t + 1 [ V π ( S t + 1 ) ∣ S t = s t ] 马尔可夫性 证毕 \begin{aligned} V_\pi\left(s_t\right)&=\Bbb E_{A_t,\cal S_{t+1}, \cal A_{t+1}}\left[U_t \mid S_t=s_t\right] \\ & =\Bbb E_{A_t,\cal S_{t+1}, \cal A_{t+1}},\left[R_t+\gamma U_{t+1}|S_t=s_t\right] \\ & =\Bbb E_{A_t,\cal S_{t+1}, \cal A_{t+1}}\left[R_t \mid S_t=s_t\right] +\gamma \Bbb E_{A_t,\cal S_{t+1}, \cal A_{t+1}}\left[U_{t+1} \mid S_t=s_t\right] \\ & =\Bbb E_{A_t, S_{t+1}}\left[R_t \mid S_t=s_t\right] +\gamma \Bbb E_{S_{t+1}}\left[\Bbb E_{A_t \cal A_{t+1}, \cal S_{t+2}}\left[U_{t+1} \mid S_{t+1},S_t=s_t\right]\mid S_{t}=s_t\right]\qquad \\ & =\Bbb E_{A_t, S_{t+1}}\left[R_t \mid S_t=s_t\right]+ \gamma \Bbb E_{S_{t+1}}\left[ E_{ \cal A_{t+1}, \cal S_{t+2}}\left[U_{t+1} \mid S_{t+1}\right]\mid S_{t}=s_t\right]马尔可夫性\\ & = \Bbb E_{A_t, S_{t+1}}\left[R_t \mid S_t=s_t\right]+ \gamma \Bbb E_{S_{t+1}}\left[V_{\pi}(S_{t+1})\mid S_{t}=s_t\right]\\ &=\Bbb E_{A_t, S_{t+1}}\left[R_t \mid S_t=s_t\right]+ \gamma \Bbb E_{A_t, S_{t+1}}\left[V_{\pi}(S_{t+1})\mid S_{t}=s_t\right]马尔可夫性\\ \textbf{证毕} \end{aligned} Vπ(st)证毕=EAt,St+1,At+1[UtSt=st]=EAt,St+1,At+1,[Rt+γUt+1St=st]=EAt,St+1,At+1[RtSt=st]+γEAt,St+1,At+1[Ut+1St=st]=EAt,St+1[RtSt=st]+γESt+1[EAtAt+1,St+2[Ut+1St+1,St=st]St=st]=EAt,St+1[RtSt=st]+γESt+1[EAt+1,St+2[Ut+1St+1]St=st]马尔可夫性=EAt,St+1[RtSt=st]+γESt+1[Vπ(St+1)St=st]=EAt,St+1[RtSt=st]+γEAt,St+1[Vπ(St+1)St=st]马尔可夫性
或者直接利用式 1.2 1.2 1.2,两边同时对 A t ∼ π ( ⋅ ∣ s t ) A_t\sim \pi(\cdot|s_t) Atπ(st)求期望得
E A t ∼ π ( ⋅ ∣ s t ) [ Q π ( s t , A t ) ] = E A t ∼ π ( ⋅ ∣ s t ) [ E S t + 1 [ R t + γ ⋅ V π ( S t + 1 ) ∣ S t = s t , A t ] ] ⇕ E A t [ Q π ( S t , A t ) ∣ S t = s t ] = E A t [ E S t + 1 [ R t + γ ⋅ V π ( S t + 1 ) ∣ S t = s t , A t ] ∣ S t = s t ] = E S t + 1 , A t [ R t + γ ⋅ V π ( S t + 1 ) ∣ S t = s t ] \begin{aligned} \Bbb E_{A_t\sim \pi(\cdot|s_t)}[Q_\pi\left(s_t, A_t\right)]&=\Bbb E_{A_t\sim \pi(\cdot|s_t)}[\mathbb{E}_{S_{t+1}}\left[R_t+\gamma \cdot V_\pi\left(S_{t+1}\right) \mid S_t=s_t,A_t\right]]\\ \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \Updownarrow \\ \Bbb E_{A_t}[Q_\pi\left(S_t, A_t\right)\mid S_t=s_t]&=\Bbb E_{A_t}[\mathbb{E}_{S_{t+1}}\left[R_t+\gamma \cdot V_\pi\left(S_{t+1}\right) \mid S_t=s_t,A_t\right]\mid S_t=s_t]\\ &=\mathbb{E}_{S_{t+1},A_{t}}[R_t+\gamma \cdot V_\pi\left(S_{t+1}\right) \mid S_t=s_t] \end{aligned} EAtπ(st)[Qπ(st,At)]EAt[Qπ(St,At)St=st]=EAtπ(st)[ESt+1[Rt+γVπ(St+1)St=st,At]]=EAt[ESt+1[Rt+γVπ(St+1)St=st,At]St=st]=ESt+1,At[Rt+γVπ(St+1)St=st]

利用式 1.3 1.3 1.3,进一步写出显示表达式可得
V π ( s t ) = E A t , S t + 1 [ R t ∣ S t = s t ] + γ E A t , S t + 1 [ V π ( S t + 1 ) ∣ S t = s t ] = E A t [ E S t + 1 [ R t ∣ A t , S t = s t ] ∣ S t = s t ] + γ E A t [ E S t + 1 [ V π ( S t + 1 ) ∣ A t , S t = s t ] ∣ S t = s t ] = ∑ A t π ( a t ∣ s t ) E S t + 1 [ R t ∣ A t , S t = s t ] + γ ∑ A t π ( a t ∣ s t ) E S t + 1 [ V π ( S t + 1 ) ∣ A t , S t = s t ] = ∑ A t π ( a t ∣ s t ) ∑ S t + 1 r ⋅ p ( s t + 1 ∣ s t , a t ) + γ ∑ A t π ( a t ∣ s t ) ∑ S t + 1 V π ( s t + 1 ) ⋅ p ( s t + 1 ∣ s t , a t ) \begin{aligned} V_{\pi}(s_t)&=\Bbb E_{A_t, S_{t+1}}\left[R_t \mid S_t=s_t\right]+ \gamma \Bbb E_{A_t, S_{t+1}}\left[V_{\pi}(S_{t+1})\mid S_{t}=s_t\right]\\ &= \Bbb E_{A_t}[\Bbb E_{S_{t+1}}[R_t\mid A_t,S_t=s_t ]\mid S_t=s_t] +\gamma \Bbb E_{A_t}\left[\Bbb E_{S_{t+1}}\left[V_{\pi(S_{t+1})}\mid A_t,S_t=s_t\right]\mid S_t=s_t \right]\\ & =\sum_{A_t}\pi(a_t\mid s_{t})\Bbb E_{S_{t+1}}[R_t\mid A_t ,S_t=s_t]+\gamma \sum_{A_t}\pi(a_t\mid s_t)\Bbb E_{S_{t+1}}\left[V_{\pi(S_{t+1})}\mid A_t,S_t=s_t\right] \\ &=\sum_{A_t}\pi(a_t\mid s_{t})\sum_{S_{t+1}}r\cdot p(s_{t+1}\mid s_t,a_t)+\gamma \sum_{A_t}\pi(a_t\mid s_t)\sum_{S_{t+1}}V_{\pi}(s_{t+1})\cdot p(s_{t+1}\mid s_t,a_t) \end{aligned} Vπ(st)=EAt,St+1[RtSt=st]+γEAt,St+1[Vπ(St+1)St=st]=EAt[ESt+1[RtAt,St=st]St=st]+γEAt[ESt+1[Vπ(St+1)At,St=st]St=st]=Atπ(atst)ESt+1[RtAt,St=st]+γAtπ(atst)ESt+1[Vπ(St+1)At,St=st]=Atπ(atst)St+1rp(st+1st,at)+γAtπ(atst)St+1Vπ(st+1)p(st+1st,at)
其中 r = r ( s t , s t + 1 , a t ) r=r(s_t,s_{t+1},a_t) r=r(st,st+1,at)

四.最优贝尔曼方程

Theorem :假设 R t R_t Rt S t 、 A t 、 S t + 1 S_t 、 A_t 、 S_{t+1} StAtSt+1 的函数。那么
Q ⋆ ( s t , a t ) = E S t + 1 ∼ p ( ⋅ ∣ s t , a t ) [ R t + γ ⋅ max ⁡ A ∈ A Q ⋆ ( S t + 1 , A ) ∣ S t = s t , A t = a t ] (1.4) Q_{\star}\left(s_t, a_t\right)=\mathbb{E}_{S_{t+1} \sim p\left(\cdot \mid s_t, a_t\right)}\left[R_t+\gamma \cdot \max _{A \in \mathcal{A}} Q_{\star}\left(S_{t+1}, A\right) \mid S_t=s_t, A_t=a_t\right] \tag{1.4} Q(st,at)=ESt+1p(st,at)[Rt+γAAmaxQ(St+1,A)St=st,At=at](1.4)

由贝尔曼方程可知
Q ⋆ ( s t , a t ) = E S t + 1 , A t + 1 [ R t + γ ⋅ Q ⋆ ( S t + 1 , A t + 1 ) ∣ S t = s t , A t = a t ] Q_{\star}\left(s_t, a_t\right)=\mathbb{E}_{S_{t+1}, A_{t+1}}\left[R_t+\gamma \cdot Q_{\star}\left(S_{t+1}, A_{t+1}\right) \mid S_t=s_t, A_t=a_t\right] Q(st,at)=ESt+1,At+1[Rt+γQ(St+1,At+1)St=st,At=at]
因为动作 A t + 1 = argmax ⁡ A Q ⋆ ( S t + 1 , A ) A_{t+1}=\operatorname{argmax}_A Q_{\star}\left(S_{t+1}, A\right) At+1=argmaxAQ(St+1,A) 是状态 S t + 1 S_{t+1} St+1 的确定性函数, 所以
Q ⋆ ( s t , a t ) = E S t + 1 [ R t + γ ⋅ max ⁡ A ∈ A Q ⋆ ( S t + 1 , A ) ∣ S t = s t , A t = a t ] Q_{\star}\left(s_t, a_t\right)=\mathbb{E}_{S_{t+1}}\left[R_t+\gamma \cdot \max _{A \in \mathcal{A}} Q_{\star}\left(S_{t+1}, A\right) \mid S_t=s_t, A_t=a_t\right] Q(st,at)=ESt+1[Rt+γAAmaxQ(St+1,A)St=st,At=at]

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/736874.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基于SpringBoot疫情打卡健康评测系统

基于SpringBoot疫情打卡健康评测系统~ 开发语言:Java 数据库:MySQL 技术:SpringBootMyBatis 工具:IDEA/Ecilpse、Navicat、Maven 系统展示 学生端功能效果展示 试卷表 在线考试 打卡管理 居家管理 学生返校申请管理 管理…

救命!我终于会写一份简单的产品说明书了

写一份简单的说明书其实也不简单,需要有前期的调研准备,撰写时的条框梳理,收尾的清晰明了。网络上有很多撰写产品说明书的方法,却也有一些模糊的地方,下面就来看看LookLook同学是怎么完成一份简单的产品说明书的。 一、…

【Python】一文详细介绍plt.rcParams 在 Matplotlib 中的原理、作用、注意事项

【Python】一文详细介绍plt.rcParams 在 Matplotlib 中的原理、作用、注意事项 🌈 个人主页:高斯小哥 🔥 高质量专栏:Matplotlib之旅:零基础精通数据可视化、Python基础【高质量合集】、PyTorch零基础入门教程&#x…

53. 最大子数组和(力扣LeetCode)

文章目录 53. 最大子数组和题目描述暴力(运行超时)贪心 53. 最大子数组和 题目描述 给你一个整数数组 nums ,请你找出一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。 子数组是数组…

Nginx 反向代理与负载均衡是如何运行?

Nginx 是一个流行的开源Web服务器,它不仅可以用作正向代理服务器(处理客户端请求并转发给后端服务器),还可以用作反向代理服务器和负载均衡器。以下是Nginx反向代理与负载均衡是如何运行的概述: 1. 反向代理配置&…

是什么原因影响到服务器的稳定性

由于现在互联网行业发展迅速,所以各个企业都会通过网站来宣传自己的产品和企业,因此企业就需要通过租用服务器来作为 自己的网站存储空间,所以很多企业在选择服务器的时候,肯定会考虑到服务器的稳定性。 服务器稳定的几个关键&…

c++ primer plus 笔记 第十六章 string类和标准模板库

string类 string自动调整大小的功能: string字符串是怎么占用内存空间的? 前景: 如果只给string字符串分配string字符串大小的空间,当一个string字符串附加到另一个string字符串上,这个string字符串是以占用…

Python_使用带AES的压缩算法模块PyZipper

Python_使用带AES的压缩算法模块PyZipper 一、概述二、安装 PyZipper三、创建加密的 ZIP 文件四、解压加密的 ZIP 文件五、使用注意 一、概述 PyZipper 是一个用于创建、读取和修改 ZIP 文件的 Python 库,支持 AES 加密,提供了比标准库 zipfile 更多的功…

css 用flex做成田字型

哈喽&#xff0c;各位小伙伴&#xff01;今天给大家来css控制div完成田字型样式&#xff0c;来&#xff0c;看看下面的效果图&#xff1a; 一看就知道你们想要代码了&#xff0c;不急。代码&#xff1a; <!DOCTYPE html> <html lang"en"> <head>&…

芯片设计流程中的def文件

Def文件的内容 DEF (design exchange format)文件描述了特定设计中所有物理元素的精确放置和连线信息。它们通常包含&#xff1a; 标准单元的精确放置位置宏的位置电源网格的设计时钟树的设计特殊单元的布局&#xff0c;如模拟单元连线信息&#xff0c;包括信号连线和电源连线…

python基础练习 序列求和

资源限制 内存限制&#xff1a;256.0MB C/C时间限制&#xff1a;1.0s Java时间限制&#xff1a;3.0s Python时间限制&#xff1a;5.0s 问题描述 求123...n的值。 输入格式 输入包括一个整数n。 输出格式 输出一行&#xff0c;包括一个整数&#xff0c;表示123...n…

JAVA全面基础知识(第七部分)

大家好我是程序员阿存&#xff0c;混迹在java圈的辛苦码农。今天要和大家聊的是一款&#xff0c;项目源码以及部署相关请联系存哥&#xff0c;文末附上联系信息 。 这篇文章给大家分享的是JAVA的基础知识&#xff0c; &#x1f495;&#x1f495;作者&#xff1a;程序员阿存 &…

哪里下载短视频素材?推荐几个短视频素材下载网站

当短视频行业的迅速崛起&#xff0c;剪辑影视短片的魅力无法抗拒&#xff0c;越来越多朋友爱看短视频&#xff0c;但从哪里找到高清、无水印和无字幕的短视频素材呢&#xff1f;今天&#xff0c;我将为大家推荐几个可获取短视频素材的优秀网站&#xff0c;下面让我们一起去看看…

ftl简单demo

包含&#xff1a; 遍历列表、获取列表长度、判断语句 <!DOCTYPE html> <html lang"en" xmlns"http://www.w3.org/1999/html"><head><meta charset"UTF-8"/><meta http-equiv"X-UA-Compatible" content&qu…

python界面开发 - filedialog 文件选择对话框

文章目录 1. Tkinter 开发2. filedialog 文件选择对话框3. python图形界面开发3.1. Python图形界面开发——Tkinter3.2. Python图形界面开发——PyQt3.3. Python图形界面开发——wxPython3.4. Python图形界面开发—— PyGTK&#xff1a;基于GTK3.5. Python图形界面开发—— Kiv…

ImGui::SetWindowFontScale 设置局部字体大小

在ImGui中&#xff0c;ImGui::Text 是一个常用的控件&#xff0c;用于显示文字。它会根据当前的字体设置自动调整文本的大小。如果你想手动控制文本的大小&#xff0c;可以使用 ImGui::SetWindowFontScale 函数&#xff0c;该函数允许你在窗口中设置特定的字体缩放比例。 以下…

吴恩达机器学习-可选实验室:逻辑回归(Logistic Regression))

在这个不评分的实验中&#xff0c;你会探索sigmoid函数(也称为逻辑函数)探索逻辑回归;哪个用到了sigmoid函数 import numpy as np %matplotlib widget import matplotlib.pyplot as plt from plt_one_addpt_onclick import plt_one_addpt_onclick from lab_utils_common impor…

2024最新版使用PyCharm搭建Anaconda

2024最新版使用PyCharm搭建Anaconda 因为pycharm自带的包不全&#xff0c;或者下载的时候比较慢&#xff0c;所以我们直接用anaconda的包&#xff0c;毕竟我们以后还会学到很多的包&#xff0c;不多说&#xff0c;直接开干&#xff01; 一、下载Pycharm、Anacoda pycharm中文网…

基于若依的ruoyi-nbcio流程管理系统中自定义业务流程发布动态更新业务流程关联信息

更多ruoyi-nbcio功能请看演示系统 gitee源代码地址 前后端代码&#xff1a; https://gitee.com/nbacheng/ruoyi-nbcio 演示地址&#xff1a;RuoYi-Nbcio后台管理系统 更多nbcio-boot功能请看演示系统 gitee源代码地址 后端代码&#xff1a; https://gitee.com/nbacheng/n…

代码随想录-动态规划5(1049. 最后一块石头的重量 II、494. 目标和、474. 一和零)

1049. 最后一块石头的重量 II class Solution { public:int lastStoneWeightII(vector<int>& stones) {int target 0;int flag 0;for (int i0; i<stones.size();i){target stones[i];}vector<int> dp(target/21, 0);for (int i0; i<stones.size();i)…