当前位置: 首页 > news >正文

如何在IEEE论文中添加伪代码pseudocode

前言

记录写论文过程中需要重复用的一些小技巧:


一、如何在IEEE论文中添加伪代码pseudocode

pseudocode是经常需要在论文中使用的流程图,掌握如何写伪代码图是必须得。

1.引入库

代码如下(示例):


# 头部添加不可少的包
\usepackage{algorithm}
\usepackage{algorithmic}
\makeatletter
\newcommand{\removelatexerror}{\let\@latex@error\@gobble}# 在正文中添加如下内容,即可生成伪代码图
\begin{figure}[!t]\label{alg:LSB}\renewcommand{\algorithmicrequire}{\textbf{Input:}}\renewcommand{\algorithmicensure}{\textbf{Output:}}\removelatexerror\begin{algorithm}[H]\caption{Local Search Based Algorithm}\begin{algorithmic}[1]\REQUIRE Candidate set $\mathbb{S}$, Initial set $\mathbb{X} = \varnothing$          %%input\ENSURE Optimum set $\mathbb{X}$  %%output\STATE Let $\mathbb{X} \leftarrow r$, if $\widetilde u({v})$ is the maximum over all singletons $r \in \mathbb{S}$.\WHILE {there exists an element $a \in R\backslash S$ such that $\widetilde u(S \cup \left\{ a \right\}) > \left( {1 + \frac{\varepsilon }{{{n^2}}}} \right)\widetilde u(S)$}\STATE let $S \leftarrow S \cup \left\{ a \right\}$.\ENDWHILE\WHILE{there exists an element $a \in S$ such that $\widetilde u(S\backslash \left\{ a \right\}) > \left( {1 + \frac{\varepsilon }{{{n^2}}}} \right)\widetilde u(S)$}\STATE let $S \leftarrow S\backslash \left\{ a \right\}$.\ENDWHILE\STATE Return the maximum of $\widetilde u(S)$ and $\widetilde u(R\backslash S)$, where the local optimal set is $S$ or $R\backslash S$.\end{algorithmic}\end{algorithm}
\end{figure}

总结

持续更新

http://www.lryc.cn/news/109757.html

相关文章:

  • 【css】css隐藏元素
  • JUC并发编程(二)ForkJoinPool、Future、CompletableFuture、CAS
  • 大数据课程F2——HIve的安装操作
  • 华为云hcip核心知识笔记(存储服务规划)
  • 四、JVM-对象内存模型
  • 2023-08-05 LeetCode每日一题(合并两个有序链表)
  • 【每天40分钟,我们一起用50天刷完 (剑指Offer)】第四十七天 47/50
  • 离散型制造业生产管理云MES系统解决方案
  • 【Vue】全家桶介绍
  • 【雕爷学编程】MicroPython动手做(33)——物联网之天气预报2
  • macOS 虚拟桌面黑屏(转)
  • 查看gz文件 linux zcat file.gz mtx.gz
  • 互联网——根服务器
  • 华为OD机试之报文回路(Java源码)
  • 林大数据结构【2019】
  • 2023华数杯数学建模A题思路分析 - 隔热材料的结构优化控制研究
  • Linux常用命令——dos2unix命令
  • 【NLP pytorch】基于BERT_TextCNN新闻文本分类实战(项目详解)
  • 决策树与随机森林
  • Nginx 网站服务
  • Python爬虫——爬虫时如何知道是否代理ip伪装成功?
  • flink1.17 json_tuple udf 实现
  • Vue3实现6位验证码输入框,用户可以连续输入和删除
  • 如何在终端设置代理(设置jupyter notebook同理)
  • git报错:Error merging: refusing to merge unrelated histories
  • QT-QLabel显示图片,按QLabel控件的大小自动缩放
  • 【JS代码调试技巧】你必须知道的Javascript技巧汇总
  • JAVA-@Configuration注解属性proxyBeanMethods
  • 锁策略, cas 和 synchronized 优化过程总结
  • 正点原子HAL库入门1~GPIO