latex编写的NSGAII流程图

差点吐,算是强行使用间距写出来的,回头得看看有什么办法获得node位置信息,就能方便很多

%可以增加周围空白
\documentclass[tikz,border=8pt]{standalone}
\usepackage{mathpazo}
\usetikzlibrary{shapes.geometric,arrows}
\usetikzlibrary{calc}
\usepackage{xcolor}
\usepackage[UTF8]{ctex}

\tikzstyle{startstop} = [rectangle, rounded corners, minimum width = 2.5cm, minimum height=1cm,text centered, draw = black, fill = red!30]
%aspect表示形状,3就两边比较尖尖
\tikzstyle{judge}=[diamond, aspect = 3, minimum width=2cm, minimum height=1cm,text centered, draw=black, fill = green!30]
\tikzstyle{process} = [rectangle, minimum width=2.5cm, minimum height=1cm, text centered, draw=black, fill = yellow!20]

\tikzstyle{arrow} = [->,>=stealth]

\begin{document}

	\begin{tikzpicture}[scale=0.5]
		%绘制过程框体
		\node[startstop] (start) {开始};
		\node[process,below of=start,yshift=-.8cm](chushihua){初始化};
		\node[process,below of=chushihua,yshift=-.8cm](gen){Gen=1};
		\node[process,below of=gen,yshift=-.8cm](RtNonD){$R_{t}$非支配排序形成的非支配集};
		\node[process,below of=RtNonD,yshift=-.8cm](I1){i=1};
		\node[process,below of=I1,yshift=-.8cm](jingying){将$Z_{i}$放入新父代种群$P_{t}+1$(精英策略)};
		\node[judge,below of=jingying,yshift=-1cm] (judge1) {$P_{t}+1$的个数等于N};
		\node[process,below of=judge1,yshift=-1cm](jiaobian){交叉 变异};
		\node[process,below of=jiaobian,yshift=-.8cm](zidai){新的子代种群+1};
		\node[process,below of=zidai,yshift=-.8cm](genP1){Gen=Gen+1};
		\node[judge,below of=genP1,yshift=-1cm] (judge2) {Gen==100};
		\node[startstop,below of= judge2,yshift=-1cm] (stop) {结束};
		
		\node[judge,right of=judge1,xshift=6cm] (judge3)
		 {$Z_{i}=Z_{i}+1=Z_{i}+2=...=$};
		 %得有align属性才支持\\换行
		\node[process,above of=judge3,yshift=1cm,align=center](paixu){$Z_{i},...,Z_{i+1}$进行拥挤度\\排序,拥挤度大的个体};
		\node[process,above of=paixu,yshift=.8cm](zijia){i=i+1};
		
		\node[process,above of=judge2,yshift=2.8cm,xshift=-5cm,align=center](hequn){子代和父代种群\\合并成大小为2N\\的种群$R_{t}$};
		
		%绘制连线
		\draw[arrow](start) -- (chushihua);
		\draw[arrow](chushihua) -- (gen);
		\draw[arrow](gen) -- (RtNonD);
		\draw[arrow](RtNonD) -- (I1);
		\draw[arrow](I1) -- (jingying);
		\draw[arrow](jingying) -- (judge1);
		\draw[arrow](judge1) --node[anchor=mid,right=0.1cm] {Y} (jiaobian);
		\draw[arrow](jiaobian) -- (zidai);
		\draw[arrow](zidai) -- (genP1);
		\draw[arrow](genP1) -- (judge2);
		\draw[arrow](paixu) -- (zijia);
		%anchor是针对这条线的
		\draw[arrow](judge2) --node[anchor=mid,right=0.1cm] {Y}  (stop);
		\draw[arrow](judge1) -- node[anchor=mid,above=0.1cm] {N} (judge3);
		\draw[arrow](judge2) --($(judge2.west)-(6.4,0)$) node[anchor=mid,above=0.1cm,right=2.5cm] {N} --(hequn);
		%这个绝对路径还是太难受了,有没有办法得到节点的位置?
		\draw[arrow](hequn) --($(hequn.south)+(0,25.8cm)$) --($(hequn.south)+(10,25.8cm)$);
		\draw[arrow](judge3) -- node[anchor=mid,right=0.1cm] {Y} (paixu);
		\draw[arrow](judge3) --($(judge3.east)+(1cm,0)$) node[anchor=mid,right=0.1cm] {N}--($(judge3.east)+(1cm,4.1cm)$)-- (paixu);
		\draw[arrow](zijia) --($(zijia.north)+(0,0.8cm)$) --($(zijia.north)+(-14cm,0.8cm)$);
		
%		\draw[arrow]
	\end{tikzpicture}
\end{document}

结果类似于:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值