python as regard to 字符串

字符串

概念

一个有序字符的合辑,储存在计算机中用于表示文本信息

创建

a = "hello word!"

特性

1.从左到右定义字符集合,下标从0开始有序访问
2.

ahello
索引01234

3.可切片

a[3: 8]

输出:lo wo

note: 切片输出时,顾头不顾尾

4.字符串不可变
当对字符串进行修改时,实际上是字符串变成了新的数据

字符串常用操作

a.strip()                     # 取消字符串  a 前后空格
a.center(20, "~")             # 将 字符串 a 20位居中 用 " " 中内容填充
a.count("l", 1, 3)            # 索引 1-3 中搜索字符 l 的个数,如果不加索引则全局搜素
a.endseitch("h")              # 判断结尾字符,返回布尔型
a.startswitch("d")            # 判断开头字符,返回布尔型
a,find("l", 3, 5)             # 寻找字符。返回索引值,如果重复出现,找到第一个就结束
a.isdigit()                   # 判断是否是数字,返回布尔型
a = a.replace("l", "a", 1)    # 对字符进行替换数字为替换次数,默认是全换,需要重新赋值
a.split("o", 1)               # 以 o 分割 output  ['hell', ' word!']
a.split("o")                  # 以 o 分割 output ['hell', ' w', 'rd!']
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
翻译Agent 𝑐 𝑖 . In this paper, we regard each charging station 𝑐 𝑖 ∈ 𝐶 as an individual agent. Each agent will make timely recommendation decisions for a sequence of charging requests 𝑄 that keep coming throughout a day with multiple long-term optimization goals. Observation 𝑜 𝑖 𝑡 . Given a charging request 𝑞𝑡 , we define the observation 𝑜 𝑖 𝑡 of agent 𝑐 𝑖 as a combination of the index of 𝑐 𝑖 , the real-world time 𝑇𝑡 , the number of current avail able charging spots of 𝑐 𝑖 (supply), the number of charging requests around 𝑐 𝑖 in the near future (future demand), the charging power of 𝑐 𝑖 , the estimated time of arrival (ETA) from location 𝑙𝑡 to 𝑐 𝑖 , and the CP of 𝑐 𝑖 at the next ETA. We further define 𝑠𝑡 = {𝑜 1 𝑡 , 𝑜2 𝑡 , . . . , 𝑜𝑁 𝑡 } as the state of all agents at step 𝑡. Action 𝑎 𝑖 𝑡 . Given an observation 𝑜 𝑖 𝑡 , an intuitional design for the action of agent𝑐 𝑖 is a binary decision, i.e., recommending 𝑞𝑡 to itself for charging or not. However, because one 𝑞𝑡 can only choose one station for charging, multiple agents’ actions may be tied together and are difficult to coordinate. Inspired by the bidding mechanism, we design each agent 𝑐 𝑖 offers a scalar value to "bid" for 𝑞𝑡 as its action 𝑎 𝑖 𝑡 . By defining 𝑢𝑡 = {𝑎 1 𝑡 , 𝑎2 𝑡 , . . . , 𝑎𝑁 𝑡 } as the joint action, 𝑞𝑡 will be recommended to the agent with the highest "bid" value, i.e., 𝑟𝑐𝑡 = 𝑐 𝑖 , where 𝑖 = arg max(𝑢𝑡)
07-11

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值