Commit aa06df5e authored by Hu Jintao's avatar Hu Jintao

调整参数

parent 3c6c46d5
......@@ -37,16 +37,6 @@ public class BisheTestMain implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
/*//解析注解
Class<BisheTestMain> bisheTestMainClass = BisheTestMain.class;
path annotation = bisheTestMainClass.getAnnotation(path.class);
String rmCmd = annotation.rmCmd();
String saveCmd1 = annotation.saveCmd1();
String saveCmd2 = annotation.saveCmd2();
String saveCmd3 = annotation.saveCmd3();
String saveCmd4 = annotation.saveCmd4();
String saveCmd5 = annotation.saveCmd5();
String savePath = annotation.savePath();*/
System.out.println("========================================");
......@@ -92,34 +82,20 @@ public class BisheTestMain implements ApplicationRunner {
nodeMaps.put(result[link[1][tm]],func[link[1][tm]]);
}
}
//T3路由表
int [][] lastHop = doMap.lastHop;
System.out.println("exec start timestamp: " + System.currentTimeMillis());
System.out.println("========================================");
System.out.println();
//将路由结果保存
Stack[] route = doMap.route;
int routeNumber = 0;
int nextHop = 1;
long waitT = doMap.startT-System.currentTimeMillis();
if (waitT > 0){
Thread.sleep(waitT);
}
System.out.println("exec start timestamp: " + System.currentTimeMillis());
System.out.println("========================================");
System.out.println();
//List<Integer> sequence = Arrays.asList(result);
// System.out.println("optimal mapping scheme"+sequence);
String loc = null;
String file_path = "passport.jpg";
int number = 1;
double eta = ETA;
Long currentime = System.currentTimeMillis();
......@@ -133,59 +109,8 @@ public class BisheTestMain implements ApplicationRunner {
for (int i = 0;i<tranDelay.size();i++){
tranDelay.set(i,tranDelay.get(i)/(i+2)+(Math.random()*10+1));
}
DataPackage dataPackage = combine(number, routeNumber, sequence, loc, file_path, eta, currentime, fun1time, compCapacity,route,nextHop,tranDelay);
DataPackage dataPackage = combine(number, sequence, loc, file_path, eta, currentime, fun1time, compCapacity,tranDelay);
send(dataPackage, targetIp, 2020);
/*//接收卫星回传信息
for(int i = 0;i<sequence.size();i++){
ServerSocket serverSocket = new ServerSocket(8900);
//获取数据流
Socket accept = serverSocket.accept();
InputStream inputStream = accept.getInputStream();
//读取数据流
ObjectInputStream objectInputStream = new ObjectInputStream(new BufferedInputStream(inputStream));
Object object = null;
try {
object = objectInputStream.readObject();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
List<String> strings = (List) object;
//输出数据流
for (String s:strings
) {
System.out.println(s);
}
serverSocket.close();
accept.close();
System.out.println();
}
//生成保存目录
File dirpath = new File(savePath);
if (!dirpath.exists()){
creatParent(dirpath);
dirpath.mkdir();
}
try { // 起作用的代码其实就下面这一行, 参数是linux中要执行的代码
Runtime.getRuntime().exec(rmCmd).waitFor();
Runtime.getRuntime().exec(saveCmd1).waitFor();//jthudocker
Runtime.getRuntime().exec(saveCmd2).waitFor();//jthudocker
Runtime.getRuntime().exec(saveCmd3).waitFor();//jthudocker
for(int i =1;i<sequence.size();i++){
Runtime.getRuntime().exec("docker cp sate"+sequence.get(i)+saveCmd4+sequence.get(i)+".jpg").waitFor();
}
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(saveCmd5);
System.out.println("========================================");*/
// System.out.print("File size :");
// System.out.println(dataPackage.getPicture().getData().length / 1000+"k");
}
private void creatParent(File dirpath) {
......@@ -196,19 +121,17 @@ public class BisheTestMain implements ApplicationRunner {
}
}
private static DataPackage combine(int number, int routeNumber, List<Integer> sequence, String loc, String file_path,
double eta, Long Currentime, Long fun1time, List<Double> compCapacity, Stack[] route, int nextHop, LinkedList<Double> tranDelay) {
private static DataPackage combine(int number, List<Integer> sequence, String loc, String file_path,
double eta, Long Currentime, Long fun1time, List<Double> compCapacity,
LinkedList<Double> tranDelay) {
DataPackage dataPackage = new DataPackage();
dataPackage.setNumber(number);
dataPackage.setRouteNumber(routeNumber);
dataPackage.setPicture(loadPicture(file_path));
dataPackage.setSequence(sequence);
dataPackage.setEta(eta);
dataPackage.setCurrentime(Currentime);
dataPackage.setFun1time(fun1time);
dataPackage.setCompCapacity(compCapacity);
dataPackage.setRoute(route);
dataPackage.setCurrentHop(nextHop);
dataPackage.setTranDelay(tranDelay);
return dataPackage;
}
......@@ -248,15 +171,4 @@ public class BisheTestMain implements ApplicationRunner {
}
}
/**
* 得到0.5到1的随机数
* @return
*/
public static Double getRangeDate(){
Double max=1.0;
Double min=0.5;
Random random = new Random();
return random.nextDouble()%(max-min) + min;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment