常见智能优化算法

on

|

views

and

comments

第一大节

第一小节

这是一句需要引用的话。1

给定一个长度为 n 的字符序列 a,初始时序列中全部都是字符 L

有 q 次修改,每次给定一个 x,若 ax​ 为 L,则将 ax​ 修改成 R,否则将 ax​ 修改成 L

11111111111111111111111111111111111111111111111111111111

11111111111111111111111111111111111111111111111111111

对于一个只含字符 LR 的字符串 s,若其中不存在连续的 L 和 R,则称 s 满足要求。

每次修改后,请输出当前序列 a 中最长的满足要求的连续子串的长度。

%%{init: {'theme':'base', 'themeVariables': { 'primaryColor':'#E8F4F8','primaryTextColor':'#2C3E50','primaryBorderColor':'#5DADE2','lineColor':'#85C1E2','secondaryColor':'#F0F8FF','tertiaryColor':'#E8F8F5','fontSize':'14px'}}}%%
mindmap
  root((密度链框架))
    高输出质量
      显著提高生成结果的流畅性和相关性
      通过对提示的优化和生成内容的密度标准化
      使输出更加精确
    更好的控制
      用户可以设定明确的目标
      提供具体的示例来引导生成过程
      使模型更好地满足用户需求
    灵活性与适应性
      适用于多种不同的任务和场景
      通过调整输入提示和反馈机制
      适应不同需求和灵活变化的环境
    持续学习
      通过反馈机制帮助模型不断学习
      适应用户的偏好
      长时间使用可逐渐提高输出质量
graph LR
    A(密度链框架)
    A -- 高输出质量 --> B["通过对提示的优化和生成内容的密度标准化,可以显著提高生成结果的流畅性和相关性,从而使输出更加精确"];
    A -- 更好的控制 --> C["用户可以通过设定明确的目标和提供具体的示例,来引导生成过程,使得模型能够更好地满足用户需求"];
    A -- 灵活性与适应性 --> D["密度链框架能够适用于多种不同的任务和场景,通过调整输入提示和反馈机制,用户可以适应不同的需求和灵活变化的环境"];
    A -- 持续学习 --> E["通过反馈机制,该框架能够帮助模型不断学习和<br>适应用户的偏好,使得长时间使用下来,<br>可以逐渐提高模型的输出质量"];

    %% --- 样式定义 ---

    %% 根节点样式
    style A fill:#fff,stroke:#333,stroke-width:1.5px,rx:10px,padding:10px

    %% 终端文本节点样式 (设置边框和背景为白色以模拟“无框”)
    style B fill:#fff,stroke:#fff,color:#000
    style C fill:#fff,stroke:#fff,color:#000
    style D fill:#fff,stroke:#fff,color:#000
    style E fill:#fff,stroke:#fff,color:#000

    %% 连接线样式 (匹配颜色)
    linkStyle 0 stroke:#9370DB,stroke-width:2px
    linkStyle 1 stroke:#00BFFF,stroke-width:2px
    linkStyle 2 stroke:#3CB371,stroke-width:2px
    linkStyle 3 stroke:#FFD700,stroke-width:2px
graph TD
    A(密度链框架)
    A -- 高输出质量 --> B["通过对提示的优化和生成内容的密度标准化,可以显著提高生成结果的流畅性和相关性,从而使输出更加精确"]
    A -- 更好的控制 --> C["用户可以通过设定明确的目标和提供具体的示例,来引导生成过程,使得模型能够更好地满足用户需求"]
    A -- 灵活性与适应性 --> D["密度链框架能够适用于多种不同的任务和场景,通过调整输入提示和反馈机制,用户可以适应不同的需求和灵活变化的环境"]
    A -- 持续学习 --> E["通过反馈机制,该框架能够帮助模型不断学习和适应用户的偏好,使得长时间使用下来,可以逐渐提高模型的输出质量"]
    
    %% --- 样式定义 ---
    %% 根节点样式
    style A fill:#fff,stroke:#333,stroke-width:1.5px,rx:10px,padding:10px
    %% 终端文本节点样式
    style B fill:#fff,stroke:#fff,color:#000
    style C fill:#fff,stroke:#fff,color:#000
    style D fill:#fff,stroke:#fff,color:#000
    style E fill:#fff,stroke:#fff,color:#000
    %% 连接线样式
    linkStyle 0 stroke:#9370DB,stroke-width:2px
    linkStyle 1 stroke:#00BFFF,stroke-width:2px
    linkStyle 2 stroke:#3CB371,stroke-width:2px
    linkStyle 3 stroke:#FFD700,stroke-width:2px
%%{init:{
  "theme":"base",
  "themeVariables":{"background":"transparent"},   /* 主题背景透明 */
  "themeCSS":".mermaid{background:transparent!important;} svg{background:transparent!important;}"
}}%%

flowchart LR
    Start(("开始"))
    Init["初始化<br/>空双端队列 dq<br/>结果数组 result<br/>i = 0"]
    CheckLoop{"i < n?"}
    CheckFront{"检查队头<br/>dq 非空且<br/>dq.front() <= i - k?"}
    PopFront["从队头弹出<br/>dq.pop_front()"]aa
    CheckBack{"维护队尾单调性<br/>dq 非空且<br/>nums[i] >=<br/>nums[dq.back()]?"}
    PopBack["从队尾弹出<br/>dq.pop_back()"]
    PushBack["新索引入队<br/>dq.push_back(i)"]
    CheckWindow{"窗口已形成?<br/>(i >= k - 1)"}
    RecordMax["记录窗口最大值<br/>result.push(nums[dq.front()])"]
    Increment["i = i + 1"]
    Return["返回结果数组<br/>result"]
    End(("结束"))
    
    Start --> Init
    Init --> CheckLoop
    CheckLoop -->|是| CheckFront
    CheckLoop -->|否| Return
    CheckFront -->|是| PopFront
    PopFront --> CheckFront
    CheckFront -->|否| CheckBack
    CheckBack -->|是| PopBack
    PopBack --> CheckBack
    CheckBack -->|否| PushBack
    PushBack --> CheckWindow
    CheckWindow -->|是| RecordMax
    RecordMax --> Increment
    CheckWindow -->|否| Increment
    Increment --> CheckLoop
    Return --> End
    
    style Init fill:#E1BEE7,stroke:#333,stroke-width:2px
    style CheckLoop fill:#FFE0B2,stroke:#333,stroke-width:2px
    style CheckFront fill:#FFE0B2,stroke:#333,stroke-width:2px
    style PopFront fill:#F8BBD0,stroke:#333,stroke-width:2px
    style CheckBack fill:#B3E5FC,stroke:#333,stroke-width:2px
    style PopBack fill:#F8BBD0,stroke:#333,stroke-width:2px
    style PushBack fill:#C8E6C9,stroke:#333,stroke-width:2px
    style CheckWindow fill:#FFE0B2,stroke:#333,stroke-width:2px
    style RecordMax fill:#B2EBF2,stroke:#333,stroke-width:2px
    style Increment fill:#FFE0B2,stroke:#333,stroke-width:2px
    style Return fill:#E1BEE7,stroke:#333,stroke-width:2px
%%{init: {
  "theme": "base",
  "themeVariables": {"background": "transparent"},  /* 主题背景透明 */
  "themeCSS": ".mermaid{background:transparent!important;} svg{background:transparent!important;}"
}}%%

graph LR
    A["1. 环境准备"]
    B["2. 获取源码"]
    C["3. 执行编译"]
    D["4. 执行编译"]
    E["5. 参数调优"]
    F["6. 运行分析"]

    A --> B
    B --> C
    C --> D
    D --> E
    E --> F

    style A fill:#E1BEE7,stroke:#333,stroke-width:2px
    style B fill:#FFE0B2,stroke:#333,stroke-width:2px
    style C fill:#FFE0B2,stroke:#333,stroke-width:2px
    style D fill:#F8BBD0,stroke:#333,stroke-width:2px
    style E fill:#B3E5FC,stroke:#333,stroke-width:2px
    style F fill:#F8BBD0,stroke:#333,stroke-width:2px

第二大节

人际关系的四种类型
  • 幸福而稳定的
    • 交往结果 > CL > Cla
    • 交往结果 > CLalt > C
  • 不幸福也不稳定的
    • 交往结果 < CL < Cla
    • 交往结果 < CLalt < C
  • 不幸福但是稳定的
  • 幸福但是不稳定的

第二小节

这是一句需要引用的话。2

参考资料:

  1. 张三.《某某研究》;链接:https://example.com
  2. 张三.《某某研究》;链接:https://example.com/abc
Tags

养生学习资源推荐

在任何时候,有一个健康的身体,都是自己最大的资本。年轻的我们应该好好关心自己的健康,有一个健康的身心才能有高效的工作效率,才能让自己的生活随心所欲。本文对网上一些关于养生的资料进行了一个汇总。 ...

真源计划-完善我的数学体系知识

作为一名大四数学专业的同学,我深知数学在人生道路上的基础地位──无论是更深层的理论研究,还是编程、算法的设计,都离不开扎实的数学功底。遗憾的是,由于辅修计算机专业,平时精力并没有很多放在数学上,导致...

保持专注

要提高工作学习的生产力,应该考虑优先提高效率而不是堆时间,而效率的关键在于专注。对于大多数人来说,他一天工作8小时,但是可能最多3小时可以保持专注甚至更少。本文将对如何让自己专注时间变长这一话题进行...

英语学习资源推荐

上大学最重要最应该学好的两门学科应该是数学和英语两门了。笔者作为一个从农村出来,高中费了老大劲高考也就135,听英语听力像是听外星人说话,看很多阅读材料看得脑壳疼的英语不怎么好的学生,在大四开始之际...