\documentclass[10.5pt]{article}
\usepackage{algorithm}
\usepackage[noend]{algorithmic}
\usepackage{amsmath}
\usepackage{bm}
\renewcommand{\algorithmicrequire}{\textbf{Input:}} % Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{\textbf{Output:}} % Use Output in the format of Algorithm
\begin{document}
{\small
\begin{algorithm}
\caption{Algorithm for joint deployment and routing}\label{alg:pce}
\begin{algorithmic}[1]
\REQUIRE network topology G(V$\cup$ L,E),$\gamma _i=<s_i,t_i,b_i,SC_i> \in \Gamma$
\ENSURE $x_{i,l},y_{o,l}$ and the selected path of each $\gamma_i$ \ $\bm{Step 1:Calculating \ feasible \ paths \ and \ link \ bandwidth}$
\FOR{all $\gamma \in \Gamma$}
\FOR{all l $\in$ L}
\STATE $cost_{\gamma ,l} \Leftarrow $the cost of request $\gamma$ traverse PM l
\ENDFOR
\STATE Select three PMs with low cost as the feasible path PMs
\STATE $P_\gamma \Leftarrow$ the set of feasible paths
\FOR{all path in $P_\gamma$}
\FOR{all e $\in$ E}
\IF{$\gamma$ traverse e}
\STATE $B_e \Leftarrow B_e +d_\gamma$
\ENDIF
\ENDFOR
\IF{$\left \{B_e \right \} > b_e$}
\STATE remove path from $P_\gamma$
\ENDIF
\STATE $B_{path} \Leftarrow B_{path} \cup \left \{B_e \right \}$
\ENDFOR
\STATE P = P $\cup P_\gamma,$B = B$\cup \left \{ B_{path} \right \}$
\ENDFOR
$\bm{Step 2:Sorting \ the \ link \ bandwidth}$
\FOR{$SC_i \in SCs$}
\STATE $X_i = \left \{ \right \}$ //the set of $x_{i,l}$
\STATE $\Gamma_i \Leftarrow$ the flow set of traverse $SC_i$
\FOR{all $\gamma \in \Gamma_i$}
\FOR{all path $\in$ $P_\gamma$}
\STATE $B_i = B_i \cup B_{path}$
\ENDFOR
\ENDFOR
\STATE Order $\lambda_i$ in non-decreasing degree order and set $X_i \leftarrow x_{i,l}$,$P_i \leftarrow y_{\gamma ,p}$
\STATE $\lambda = \lambda \cup \lambda_i$
\ENDFOR
$\bm{Step 3:Updating \ the \ forwarding \ table \ capacity}$
\FOR{all v $\in$ V}
\STATE $y_{o,l}=0$
\IF{the forwarding table capacity of switch v does not satify Eq.(3)}
\STATE remove $x_{i,l}$ from $X_i$ and $y_{\gamma ,p}$ from $P_i$
\ELSIF{$y_{o,l} == 0$ is not satified Eq.(4)}
\STATE $y_{o,l}=1$
\ENDIF
\STATE $Y = y \cup y_{o,l}$
\ENDFOR
$\bm{Step 4:Calculating \ the \ number \ of \ cores \ using \ CPU \ per \ PM}$
\FOR{all l $\in$ L}
\FOR{$SC_i \in SCs$}
\IF{the number of CPU cores of PM l is satisfied Eq.(1)}
\STATE $R_l \Leftarrow R_l - (x_{i,l} \times y_{i,l}+y_{o,l} \times y(o,l))$
\ELSE
\STATE remove $y_{o,l},x_{i,l}$ and $P_i$
\ENDIF
\ENDFOR
\ENDFOR
\end{algorithmic}
\end{algorithm}}
\end{document}
效果如下:
二:论文eps图
#LINK N proposed ALG-1 ALG-2
A 6 1.35146 1.35146 2.61590
B 12 2.63290 2.63290 4.95446
C 18 4.19496 4.19496 6.79023
D 24 5.51183 5.51183 8.20803
E 30 8.59923 8.59923 12.91023
F 36 8.59923 8.59923 14.67736
G 42 9.90530 9.90530 16.56306
H 48 11.57430 11.57430 20.36260
I 54 12.88210 12.88210 22.89410
J 60 14.72120 14.72120 25.10080
set terminal png font "Microsoft YaHei, 9"
set output ‘04biggestLinkLoad.png‘
set key left reverse Left spacing 1.2
set xlabel "No. of Requests(x 10^3)"
set ylabel "Max. Link Load(Gpbs)"
file = "04biggestLinkLoad.dat"
set pointsize 2
plot file u 2:3 with linespoint pointtype 4 linewidth 2 dashtype 5 t "proposed", file u 2:4 with linespoint pointtype 6 linewidth 2 t "ALG-1", file u 2:5 with linespoint pointtype 8 linewidth 2 t "ALG-2"
效果:
set terminal png font "Microsoft YaHei, 9"
set output ‘04biggestLinkLoad.png‘
set key left reverse Left spacing 1.2
set xlabel "No. of Requests(x 10^3)"
set ylabel "Max. Link Load(Gpbs)"
file = "04biggestLinkLoad.dat"
set pointsize 2
plot file u 2:3 with linespoint pointtype 4 linewidth 2 dashtype 5 t "proposed", file u 2:4 with linespoint pointtype 6 linewidth 2 t "ALG-1", file u 2:5 with linespoint pointtype 8 linewidth 2 t "ALG-2"
效果:
cd D:
cd xxx\texlive\2019\bin\win32
备:visio生成的pdf图有边框,去除的办法
1. 在visio中,选 设计----大小----适应绘图;此时可发现图片虽被自适应,但虚线到外边框还有白色空白,下面去空白;
2. 点 文件---选项-----自定义功能(在弹出对话框的左侧)-----勾上开发工具(在右侧)----保存
3. 在visio的上面工具一栏会发现多了开发工具(developer),点 开发工具------显示shapeSheet-----页-----在打开的选项卡中找到“print properties”,
将“PageLeftMargin”、“PageRightMargin”、“PageTopMargin”和“PageBottomMargin”均修改为0(上方有类似于excel的编辑的小窗口,下边右上方有关闭按钮),关闭表格。
4. 再将步骤1操作一次,自适应绘图,发现已去除空白;
5. 另存为pdf 注意:保存时先选pdf格式,然后点 “选项(option)”-----在弹出的对话框中将“辅助功能文档结构标记”前的勾去掉-----点击“确定”,保存就好了;
6. 用acrobat 将保存的pdf打开,另存为eps格式;
7. 再次编译latex查看结果,发现生成的图片分辨率高,且已经没有了外边框。。。
8. 结束。
原文:https://www.cnblogs.com/gejuncheng/p/12288039.html