用texstudio写伪代码
示例:
\documentclass[11pt,twoside,a4paper]{article}\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{amsmath}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\begin{document}%% 写算法伪代码或者流程的前期准备
\renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm\begin{algorithm}[h]\caption{Pseudocode of Simulated Annealing Algorithm} % 名称\begin{algorithmic}[1]\Require$x_0$: initial individual or state;$T_0$: a high enough initial temperature;$T_{min}$: the lowest limit of temperature;\Ensureoptimal state or approximate optimal state;\State set $x_0 = x_{best}$, compute initial energy function $E(x_0)$;\While {$T > T_{min}$}\For{$i = 1$; $i<n$; $i++$ }\State perturb current state $x_i$ for a new state $x_{new}$ and compute energy function $E(x_{new})$;\State compute $\Delta$ = $E(x_{new}-E(x_{(i)})$;\If {$\Delta$$E<0$} \State $x_{best} = x_{new}$\Else \State the probability $P = exp(-dE/T_{(i)})$;\If {$rand(0,1) < P$ }\State $x_{best} = x_{new}$\Else \State $x_{best} = x_{best}$\EndIf\EndIf\EndFor\State $T = T * $ $ \alpha$, where $\alpha$ is decay factor ;\EndWhile\end{algorithmic}
\end{algorithm}\end{document}
效果:
代码分析:
- 指定文档类型:
\documentclass[11pt,twoside,a4paper]{article} //
- 加载宏包:
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{amsmath}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
- 文档开始结束标志
\begin{document}在begin和end中间插入代码
\end{document}
- 写算法伪代码之前的准备
\renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm
- 算法开始和结束标志:
\begin{algorithm}[h]在中间插入算法的代码。
\end{algorithm}
用texstudio写伪代码相关推荐
- 如何在word中写伪代码
如何在word中写伪代码 1.下载texlive 参考 2.下载Aurora 链接:https://pan.baidu.com/s/1A_IFxdJ6rrpuWUY1DN-YOQ 提取码:ylmo 复 ...
- WPS中用Aurora写伪代码
WPS中用Aurora写伪代码 第一步 在Properties->Packages中添加 \usepackage{algorithm} \usepackage{algpseudocode} \u ...
- Java学习day015 如何写伪代码
day015 如何写伪代码 在学习的过程中老师要求我们在写程序之前先写伪代码,一开始我是拒绝的但奈何没有用,小的程序直接都写出来了再返回写伪代码有点烦,但是一想如果程序大一点复杂一点如何下手都是问题 ...
- 记录第一次使用Texlive+TexStudio写论文时遇到的问题(随时更新)
第一次使用LaTex写论文,遇到了各种小问题,在这里记录一下(理解不正确的地方还请读者指正) 1.windows下安装Texlive+TexStudio可以参考:https://jingyan.bai ...
- 算法描述怎么写伪代码java_算法描述---伪代码
算法描述 算法描述是指对设计出的算法,用一种方式进行详细的描述,以便与人交流.描述可以使用自然语言.伪代码,也可使用程序流程图,但描述的结果必须满足算法的五个特征. 使用自然语言描述算法显然很有吸引力 ...
- 算法描述怎么写伪代码java_伪代码描述算法
伪代码是自然语言和类编程语言组成的混合结构.它比自然语言更精确,描述算法很简洁:同时也可以很容易转换成计算机程序.下面就为大家介绍一下伪代码描述算法的介绍. 伪代码描述算法 一.算法描述是指对设计出的 ...
- python伪代码怎么写_word怎么写代码 word怎么写伪代码
word自动编号怎么实现先写带有编号的内容,然后在加一页目录,把 你的问题,可用自动生成目录解决.要想自动生成题目,打文件时应设置题目格式. 一.输入题目时这样操作 1.打开WORD文档输入题目时,点 ...
- 在 word中使用aurora写伪代码出现 problems running latex
首先需要在word中安装aurora,教程可以参照下方链接: aurora在word中安装的具体操作 当然,有很多选择,网上教程也比较多,大家可以任选. 安装问题需要注意问题 1 Properties ...
- 【如何写伪代码】-【学习笔记】
伪代码 重点实现算法的主要思路 重点元素 算法的名称 算法的输入输出 算法的指令序列 算法的循环语句(for) 算法的分支语句(if-else-) 算法的赋值语句(变量=-) 算法的结束(出口) 算法 ...
- 用LaTex写伪代码(使用algorithm2e包)
添加宏 \usepackage{algorithm2e} 也可以设置一些参数: \usepackage[ruled,linesnumbered]{algorithm2e} ruled在顶部和底部画一条 ...
最新文章
- Spring的Bean生命周期,11 张高清流程图及代码,深度解析
- 用户名字符串和密码字符串登录验证
- mongoose的基本使用
- 解决apktool d file.apk出现Error occured while disassembling class以及apktool源码编译
- like语句百分号前置会使用到索引吗?
- strcompare php,PHP中的startswith()和endsWith()函数
- 一个通用的Makefile
- 微赞dataconfig.php,php生成微信jssdk wx.config参数,调用js接口
- 安装shifter实践指南
- Unity3D ML-agents 入坑指导
- 【openGL】安装篇(上):Windows
- 阿里云服务器被攻击黑洞怎么办?
- FPGA 数字信号处理之 FSK 调制、解调的实现与仿真基于 verilog + ise + modelsim + matlab (保姆级)
- 【平常心无焦虑探讨】未来谁将被淘汰—在日常网络安全工作中使用GPT的感受
- SEO优化推广的特点
- 【优化求解】基于猫群算法CSO求解最优目标matlab源码
- Python项目实战学习 外星人入侵 创建外星人飞船并实现外星人动态移动效果
- 一文教你股票买卖问题实用而装逼的解法
- 南开大学计算机考研历年分数线,南开大学计算机科学与技术考研历年分数线报录比及导师信息...
- python数据可视化之美专业图表绘制指南_2019第23周:评《R语言数据可视化之美:专业图表绘制指南》...