📄 application1.java
字号:
package test1;
import javax.swing.UIManager;
import java.awt.*;
public class Application1 {
boolean packFrame = false;
//Construct the application
public Application1() {
Frame1 frame = new Frame1();
//Validate frames that have preset sizes
//Pack frames that have useful preferred size info, e.g. from their layout
if (packFrame) {
frame.pack();
}
else {
frame.validate();
}
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
frame.setVisible(true);
}
//Main method
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e) {
e.printStackTrace();
}
new Application1();
ColonyInitialization aa=new ColonyInitialization();
double[][] ant=new double[10][15];
double[] aim= new double[10];
double[][] antd= new double[10][10];
double[][] gg=new double[10][10];
double[][] m=new double[10][10];
double[][] p=new double[10][10];
double vv;
double[] maxp=new double[10];
double[][] antk=new double[10][15];
for(int k=1;k<=500;){
if(k==1) {
ant=aa.colIn(k,null);
}
vv=VisibleDistrict.visDis(k);
aim=Aim.aimOptim(ant);
antd=AntDistance.antDis(ant);
gg=Expectation.Eption(aim);
if(k==1){
m = InformationDensity.infDen(k - 1, 0.9, null);
p = TransferProbablity.tranProb(gg,m);
}
if(k>1){
m = InformationDensity.infDen(k - 1, 0.9, p);
p = TransferProbablity.tranProb(gg,m);
}
maxp=MaxProbablity.maxPro(vv,antd,p);
antk=AntTransfer.antTran(ant,antd,vv,p,maxp);
ant=antk;
k++;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -