亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? psoarirhmetic.java

?? 交通分配的粒子分配群優化研究code
?? JAVA
字號:
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   PSOArirhmetic.java

package cn.edu.bit.util.arithmetic.wangli;

import cn.edu.bit.util.LogWriter;

public abstract class PSOArirhmetic {

	abstract boolean SetCom(double d, double ad[], double ad1[][], int i);

	public PSOArirhmetic() {
		this.particles = null;
		this.Xup = null;
		this.Xdown = null;
		this.Vmax = null;
		this.com = true;
		this.particles = null;
		this.PNum = 0;
		this.GBestIndex = 0;
		this.Xup = null;
		this.Xdown = null;
		this.W = 1.0D;
		this.C1 = 2D;
		this.C2 = 2D;
		this.com = true;
	}

	public PSOArirhmetic(int dim, int num) {
		this.PDim = dim;
		this.particles = null;
		this.Xup = null;
		this.Xdown = null;
		this.Vmax = null;
		this.com = true;
		this.particles = new Particle[num];
		for (int i = 0; i < num; i++) {
			this.particles[i] = new Particle(dim);
		}

		this.PNum = num;
		this.GBestIndex = 0;
		this.Xup = new double[dim];
		this.Xdown = new double[dim];
		this.Vmax = new double[dim];
		this.W = 0.729;
		this.C1 = 1.49445;
		this.C2 = 1.49445;
		this.com = true;
	}

	void SetXup(double up[]) {
		if (this.particles != null) {
			for (int i = 0; i < this.PDim; i++) {
				this.Xup[i] = up[i];
			}

		}
	}

	void SetXdown(double down[]) {
		if (this.particles != null) {
			for (int i = 0; i < this.PDim; i++) {
				this.Xdown[i] = down[i];
			}

		}
	}

	void SetVmax(double max[]) {
		if (this.particles != null) {
			for (int i = 0; i < this.PDim; i++) {
				this.Xup[i] = max[i];
			}

		}
	}

	void SetVmax(double percent) {
		if (this.particles != null) {
			for (int i = 0; i < this.PDim; i++) {
				this.Vmax[i] = (this.Xup[i] - this.Xdown[i]) * percent;
			}

		}
	}

	void Initialize() {//初始化
		if (this.particles != null) {//是不是測試是否分配內存了?
			this.GBestIndex = 0;
			for (int i = 0; i < this.PNum; i++) { //PNum==200
				Particle particle = this.particles[i];
				double[] temp = Init.unitary(Init.random);				
				for (int j = 0; j < particle.Dim; j++) {//	particle.Dim=19				
					particle.X[j] = temp[j];	
					particle.XBest[j] = particle.X[j];
					double randnumy = Math.random();
					particle.V[j] = randnumy * 2* this.Vmax[j] - this.Vmax[j];//速度我也改了
				}
				double fit = GetFit(particle);//得到加工成本
				particle.Fit = fit;
				particle.FitBest = particle.Fit;
				this.particles[i]= particle;//我加的,局部變量返回給全局變量
				Particle bestparticle = this.particles[this.GBestIndex];
				if (particle.Fit< bestparticle.Fit) {
					this.GBestIndex = i;
				}
			}
		}
	}

	void CalFit() {//計算所有粒子的Fit
		if (this.particles != null) {
			for (int i = 0; i < this.PNum; i++) {
				Particle particle = this.particles[i];
				particle.Fit = GetFit(particle);
				this.particles[i]= particle ;//我加的,臨時變量賦值給全局變量
			}

		}
	}

	abstract double GetFit(Particle particle);//

	public void ParticleFly() {
		//double FitBak[] = new double[PNum];
		if (this.particles != null) {
			for (int i = 0; i < this.PNum; i++) {
				Particle particle = this.particles[i];
				for (int j = 0; j < particle.Dim; j++) {//粒子速度的變化
					Particle bestparticle = this.particles[this.GBestIndex];
					particle.V[j] = this.W * particle.V[j] + Math.random() * this.C1
							* (particle.XBest[j] - particle.X[j])
							+ Math.random() * this.C2
							* (bestparticle.XBest[j] - particle.X[j]);
				}
				
				for (int j = 0; j < particle.Dim; j++) {//粒子速度的超界處理
					if (particle.V[j] > this.Vmax[j]) {
						particle.V[j] = this.Vmax[j];
					}
					if (particle.V[j] < -this.Vmax[j]) {
						particle.V[j] = -this.Vmax[j];
					}
				}
				
				for (int j = 0; j < particle.Dim; j++) {//粒子位置超界處理及賦值給路線
					particle.X[j] += particle.V[j];
					/**需要調整判斷條件,用來調整適應度*/
					//如果該緯度的值大于該路線需求,只需滿足該路線需求
					if (particle.X[j] > this.Xup[j]) {
						particle.X[j] = this.Xup[j];
					}
					if (particle.X[j] < this.Xdown[j]) {
						particle.X[j] = this.Xdown[j];
					}					
				}
				particle.X= Init.unitary(particle.X);	
				
				this.particles[i]= particle ;//我加的,臨時變量賦值給全局變量
			}

			CalFit();//計算所有粒子的Fit			

			for (int i = 0; i < this.PNum; i++) {//計算每個粒子內部的最優粒子
				Particle particle = this.particles[i];
				if (particle.Fit <= particle.FitBest) {
					particle.FitBest = particle.Fit;
					for (int j = 0; j < particle.Dim; j++) {
						particle.XBest[j] = particle.X[j];
					}
				}
				this.particles[i]= particle ;//臨時變量賦值給全局變量
			}

			this.GBestIndex = 0;
			for (int i = 0; i < this.PNum; i++) {
				Particle particle = this.particles[i];
				Particle bestparticle = this.particles[this.GBestIndex];
				if (particle.FitBest <= bestparticle.FitBest && i != this.GBestIndex) {
					this.GBestIndex = i;
				}
			}
		}
	}

	void SetW(double w) {
		this.W = w;
	}

	void SetC1(double c) {
		this.C1 = c;
	}

	void SetC2(double c) {
		this.C2 = c;
	}

	Particle Run(int n) {//以運行次數確定結果
		Initialize();
		double opt_p[] = new double[this.PDim];
		double opt_a[][] = new double[this.PNum][this.PDim];
		for (int i = 0; i < n; i++) {
			ParticleFly();
			if (!this.com) {
				continue;
			}
			Particle bestparticle = this.particles[this.GBestIndex];
			for (int k = 0; k < this.PDim; k++) {
				opt_p[k] = bestparticle.XBest[k];
			}

			for (int k = 0; k < this.PNum; k++) {
				Particle particle = this.particles[k];
				opt_a[k] = particle.X;
			}

			if (!SetCom(bestparticle.FitBest, opt_p, opt_a, this.GBestIndex)) {
				break;
			}
		}

		opt_p = null;
		opt_a = null;
		Particle bestParticle = this.particles[this.GBestIndex];
		return bestParticle;
	}

	Particle Run(double fit) {//以結果確定運行次數
		double opt_p[] = new double[this.PDim];
		double opt_a[][] = new double[this.PNum][this.PDim];
		Initialize();
		Particle bestparticle;
		do {
			ParticleFly();
			if (!this.com) {
				continue;
			}
			bestparticle = this.particles[this.GBestIndex];
			for (int k = 0; k < this.PDim; k++) {
				opt_p[k] = bestparticle.XBest[k];
			}

			for (int k = 0; k < this.PNum; k++) {
				Particle particle = this.particles[k];
				opt_a[k] = particle.X;
			}

			if (!SetCom(bestparticle.FitBest, opt_p, opt_a, this.GBestIndex)) {
				break;
			}
		} while (this.particles[this.GBestIndex].FitBest < fit);
		opt_p = null;
		opt_a = null;
		bestparticle = this.particles[this.GBestIndex];
		return bestparticle;
	}

	void GetBest(double r[]) {
		Particle bestparticle = this.particles[this.GBestIndex];
		for (int i = 0; i < bestparticle.Dim; i++) {//取出最好的粒子
			r[i] = bestparticle.XBest[i];//kkkkkkk  r[]的作用?
			LogWriter.log("采用第"+i+"工序加工的零件由:"+r[i]);
		}
		double sumtime =0.0;
    	double[] matime=new double[Init.col];
    	for(int j = 0; j < bestparticle.Dim; j++){
    		sumtime=sumtime+bestparticle.X[j]*Init.cost[j];
    		for(int i=0;i<Init.col;i++){
    			matime[i]=matime[i]+bestparticle.X[j]*Init.tour[j][i];
    		}
    	}
    	
    	for(int j = 0; j < Init.col; j++){
    		LogWriter.log("第"+j+"machine time:"+matime[j]);	
    	}
    	LogWriter.log("sum cost:"+sumtime);
    	LogWriter.log("/////////////////////////");
	}

//	public void getExcelBest() {
//		try {
//			double[] r = new double[PDim];
//			Particle bestparticle = particles[GBestIndex];
//			double[] temp12to1 = new double[Init.row];
//			double[] temp1to12 = new double[Init.row];
//			double[] temp4to9 = new double[Init.row];
//			double[] temp9to4 = new double[Init.row];
//			for (int i = 0; i < bestparticle.Dim; i++) {
//				r[i] = bestparticle.XBest[i];
//				if (i < Init.row) {
//					temp12to1[i] = bestparticle.X[i];
//				} else if (i < 2 * Init.row) {
//					temp1to12[i - Init.row] = bestparticle.X[i];
//				} else if (i < 3 * Init.row) {
//					temp4to9[i - 2 * Init.row] = bestparticle.X[i];
//				} else {
//					temp9to4[i - 3 * Init.row] = bestparticle.X[i];
//				}
//			}
//			double[][] itojquantity = Init.getQuantityInfo(temp12to1,
//					temp1to12, temp4to9, temp9to4);
//			double[][] itojtime = Init.getTimeInfo(itojquantity,
//					Init.initsaturq, Init.initt0);
//			double[] time12to1 = Init.getLineTime(itojtime, Init.inittour12to1);
//			double[] time1to12 = Init.getLineTime(itojtime, Init.inittour1to12);
//			double[] time4to9 = Init.getLineTime(itojtime, Init.inittour4to9);
//			double[] time9to4 = Init.getLineTime(itojtime, Init.inittour9to4);
//			OutputStream os = new FileOutputStream("c:\\excel2.xls");
//			WritableWorkbook workbook = Workbook.createWorkbook(os);
//			WritableSheet pathssheet = workbook.createSheet("paths", 0);
//			Label label = new Label(0, 0, "路徑集A 1");
//			pathssheet.addCell(label);
//			pathssheet.mergeCells(0, 0, 1, 0);
//			label = new Label(2, 0, "路徑集A 2");
//			pathssheet.addCell(label);
//			pathssheet.mergeCells(2, 0, 3, 0);
//			label = new Label(4, 0, "路徑集A 3");
//			pathssheet.addCell(label);
//			pathssheet.mergeCells(4, 0, 5, 0);
//			label = new Label(6, 0, "路徑集A 4");
//			pathssheet.addCell(label);
//			pathssheet.mergeCells(6, 0, 7, 0);
//			String temp = "";
//			String time = "";
//			for (int i = 0; i < Init.row; i++) {
//				temp = temp12to1[i] + "";
//				//temp = temp.substring(0, temp.indexOf(".") + 5);
//				time = time12to1[i] + "";
//				//time = time.substring(0, time.indexOf(".") + 5);
//				label = new Label(0, i + 1, temp);
//				pathssheet.addCell(label);
//				label = new Label(1, i + 1, time);
//				pathssheet.addCell(label);
//				temp = temp1to12[i] + "";
//				//temp = temp.substring(0, temp.indexOf(".") + 5);
//				time = time1to12[i] + "";
//				//time = time.substring(0, time.indexOf(".") + 5);
//				label = new Label(2, i + 1, temp);
//				pathssheet.addCell(label);
//				label = new Label(3, i + 1, time);
//				pathssheet.addCell(label);
//				temp = temp4to9[i] + "";
//				//temp = temp.substring(0, temp.indexOf(".") + 5);
//				time = time4to9[i] + "";
//				//time = time.substring(0, time.indexOf(".") + 5);
//				label = new Label(4, i + 1, temp);
//				pathssheet.addCell(label);
//				label = new Label(5, i + 1, time);
//				pathssheet.addCell(label);
//				temp = temp9to4[i] + "";
//				//temp = temp.substring(0, temp.indexOf(".") + 5);
//				time = time9to4[i] + "";
//				//time = time.substring(0, time.indexOf(".") + 5);
//				label = new Label(6, i + 1, temp);
//				pathssheet.addCell(label);
//				label = new Label(7, i + 1, time);
//				pathssheet.addCell(label);
//			}
//			
//			WritableSheet roadssheet = workbook.createSheet("roads", 1);
//			label = new Label(0, 0, "(i,j)");
//			roadssheet.addCell(label);
//			label = new Label(0, 1, "x");
//			roadssheet.addCell(label);
//			label = new Label(0, 2, "(i,j)");
//			roadssheet.addCell(label);
//			label = new Label(0, 3, "x");
//			roadssheet.addCell(label);
//			int k=1;
//			for (int i = 0; i < 12; i++) {
//				for (int j = 0; j < 12; j++) {
//					double quantity = itojquantity[i][j];
//					if (quantity != 0) {
//						temp = quantity+ "";
//						temp = temp.substring(0, temp.indexOf(".") + 3);
//						if(k<18) {
//							label = new Label(k, 0, "("+i+","+j+")");
//							roadssheet.addCell(label);
//							label = new Label(k, 1, temp);
//							roadssheet.addCell(label);
//						}else {
//							label = new Label(k-17, 2, "("+i+","+j+")");
//							roadssheet.addCell(label);
//							label = new Label(k-17, 3, temp);
//							roadssheet.addCell(label);
//						}
//						k++;
//						LogWriter.log("從" + i + "到" + j + "的路況信息為:" + quantity);
//					}
//				}
//			}
//			double netTime = Init.getNetTime(itojtime);
//			label = new Label(0, 6, "netTime="+netTime);
//			roadssheet.addCell(label);			
//			double sumTime = Init.getSumtime(itojquantity, itojtime);			
//			label = new Label(0, 8, "sumTime="+sumTime);
//			roadssheet.addCell(label);
//			workbook.write();
//			workbook.close();
//
//		} catch (FileNotFoundException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (RowsExceededException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (WriteException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//
//	}

	public void SetCom() {
		this.com = true;
	}

	public void close() {
		if (this.particles != null) {
			this.particles = null;
		}
		if (this.Xup != null) {
			this.Xup = null;
		}
		if (this.Xdown != null) {
			this.Xdown = null;
		}
		if (this.Vmax != null) {
			this.Vmax = null;
		}
	}

	Particle particles[];

	int PNum;

	int GBestIndex;

	double W;

	double C1;

	double C2;

	double Xup[];

	double Xdown[];

	double Vmax[];

	boolean com;

	int PDim;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品亚洲午夜一区二区三区| 亚洲激情欧美激情| 精品一区二区免费| 精品捆绑美女sm三区| 久久精品国产色蜜蜜麻豆| 日韩网站在线看片你懂的| 裸体健美xxxx欧美裸体表演| 精品久久国产字幕高潮| 国内国产精品久久| 中文字幕av一区二区三区免费看| 高清国产午夜精品久久久久久| 国产精品理伦片| 91在线播放网址| 亚洲国产精品影院| 日韩精品中文字幕在线一区| 国产九色精品成人porny| 国产精品电影一区二区三区| 在线亚洲一区观看| 日韩电影在线看| 国产视频一区在线观看| 99视频在线精品| 日韩av高清在线观看| 久久久亚洲国产美女国产盗摄| 91麻豆精东视频| 亚洲18女电影在线观看| 欧美成人一区二区三区在线观看| 成人免费毛片嘿嘿连载视频| 亚洲主播在线播放| 精品国免费一区二区三区| 懂色av一区二区三区蜜臀| 亚洲国产精品综合小说图片区| 精品国产免费人成在线观看| 91论坛在线播放| 久久国产精品99精品国产| 中文字幕一区免费在线观看| 5566中文字幕一区二区电影| 国产91清纯白嫩初高中在线观看| 亚洲福利视频一区| 国产婷婷精品av在线| 在线观看91av| 成人久久久精品乱码一区二区三区 | 欧美在线你懂得| 国产一区二区三区黄视频 | 69精品人人人人| 成人av在线观| 捆绑调教一区二区三区| 亚洲女同ⅹxx女同tv| 久久综合久久久久88| 欧美狂野另类xxxxoooo| av在线综合网| 国产九九视频一区二区三区| 日韩成人免费电影| 亚洲精品免费在线| av亚洲精华国产精华| 中文无字幕一区二区三区| 91精品欧美综合在线观看最新| 色激情天天射综合网| 风流少妇一区二区| 韩国三级中文字幕hd久久精品| 亚洲国产乱码最新视频| 亚洲欧美另类小说| 国产精品久久久久影院亚瑟| 精品电影一区二区| 日韩午夜在线影院| 欧美日韩国产经典色站一区二区三区 | 欧美一三区三区四区免费在线看| 色94色欧美sute亚洲线路一ni| 丰满少妇久久久久久久| 狠狠色丁香久久婷婷综合丁香| 日韩电影免费在线看| 五月婷婷激情综合网| 亚洲国产精品一区二区久久| 亚洲欧洲精品成人久久奇米网| 久久精品亚洲一区二区三区浴池 | 国产色产综合产在线视频 | 国产人久久人人人人爽| 久久亚洲二区三区| 久久久精品国产99久久精品芒果 | 美女一区二区视频| 蜜臀av一区二区在线免费观看| 天天综合网 天天综合色| 亚洲成av人片在www色猫咪| 亚洲一区二区三区四区的| 亚洲另类一区二区| 亚洲一区二区高清| 日韩中文字幕91| 毛片基地黄久久久久久天堂| 精品无码三级在线观看视频| 国产麻豆视频精品| 成人伦理片在线| 日本福利一区二区| 欧美日韩国产首页| 日韩欧美亚洲国产精品字幕久久久| 欧美v日韩v国产v| 久久久亚洲精品石原莉奈| 国产精品天天看| 亚洲激情中文1区| 亚洲va欧美va国产va天堂影院| 日本欧美一区二区三区乱码| 久久99热99| 成人app软件下载大全免费| 91视频一区二区| 欧美日韩国产a| 久久亚洲精品国产精品紫薇| 亚洲天堂2016| 爽好久久久欧美精品| 国产综合色在线视频区| 波多野结衣中文一区| 色哟哟一区二区在线观看| 91精品在线观看入口| 中文字幕第一页久久| 亚洲综合丁香婷婷六月香| 日本欧美一区二区| 成人免费毛片高清视频| 91精品国产高清一区二区三区蜜臀| 久久综合色综合88| 亚洲欧美日韩一区二区| 久久精品国产一区二区三 | 亚洲一区二区三区四区在线免费观看| 日韩电影免费在线| 99久久精品国产网站| 欧美一级国产精品| 亚洲欧美日韩在线| 久久66热re国产| 色一情一伦一子一伦一区| 精品国产乱码久久久久久1区2区| 亚洲视频图片小说| 国产尤物一区二区在线| 在线精品亚洲一区二区不卡| www国产精品av| 亚洲福利电影网| av在线这里只有精品| 欧美mv日韩mv亚洲| 一区二区三区中文在线| 国产精品综合在线视频| 欧美日韩亚洲综合在线| 国产精品每日更新在线播放网址| 日韩电影免费在线| 欧美日韩在线电影| 成人欧美一区二区三区白人| 极品少妇xxxx精品少妇| 欧美理论电影在线| 一区二区三区中文在线| 成人午夜视频在线| 久久影视一区二区| 免播放器亚洲一区| 欧美日韩免费观看一区二区三区| 国产精品久久毛片a| 国产酒店精品激情| 精品999在线播放| 日韩国产精品久久| 欧美日精品一区视频| 亚洲天堂精品视频| 99久久久久久99| 国产精品欧美一区二区三区| 国产九九视频一区二区三区| 日韩精品一区二区三区中文精品| 亚洲v日本v欧美v久久精品| 色综合久久99| 亚洲女人的天堂| 91日韩一区二区三区| 最新成人av在线| av色综合久久天堂av综合| 欧美国产成人在线| 成人h版在线观看| 国产精品色婷婷久久58| 成人国产精品免费观看| 国产欧美精品区一区二区三区| 国产伦精品一区二区三区在线观看 | 欧美一级理论片| 美腿丝袜亚洲色图| 精品国产免费一区二区三区香蕉| 麻豆91精品视频| 精品黑人一区二区三区久久| 国产乱淫av一区二区三区 | 91丨porny丨最新| 亚洲精品中文字幕乱码三区| 色综合久久久网| 午夜欧美视频在线观看| 8v天堂国产在线一区二区| 美女www一区二区| 国产亚洲午夜高清国产拍精品| 国产成人免费视频精品含羞草妖精| 欧美精品一区二| 国产91精品免费| 亚洲欧洲无码一区二区三区| 色老汉av一区二区三区| 亚洲成人av一区二区| 欧美成人精品高清在线播放| 国产一区中文字幕| 国产日韩v精品一区二区| 99在线热播精品免费| 亚洲欧美日韩中文字幕一区二区三区 | 成人精品小蝌蚪| 久久91精品久久久久久秒播| 五月激情六月综合| 亚洲第一会所有码转帖| 亚洲卡通动漫在线| 亚洲欧美激情小说另类| 性欧美疯狂xxxxbbbb|