【2021-07-06更新】
- 测试地址更新:http://39.101.244.246:8080/web/
- 算法部署ip同步更新:39.101.244.246
- 数据库已存在6张订单,默认6张订单计算,可以根据orders更改。
直接运行即可。
算法模块在服务器部署。
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.util.Scanner;public class Main {
public static void main(String[] args) throws IOException {
SocketAddress address = new InetSocketAddress("82.157.191.64", 12345);Socket sock = new Socket();sock.connect(address);BufferedReader is = null;PrintWriter os = null;os = new PrintWriter(sock.getOutputStream()); //管道的写工具is = new BufferedReader(new InputStreamReader(sock.getInputStream())); //管道的读工具int n, m;Scanner sc = new Scanner(System.in);System.out.println("所有数据请用空格或换行分割,不要添加其他字符");System.out.println("机器编号从0开始,请不要超出指定数量m");System.out.println("请输入工件数量n 机器数量m:");String str = new String();n = sc.nextInt();m = sc.nextInt();str += n + " " + m + " ";for (int i = 0; i < n; ++i) {
int p;System.out.println("请输入job_" + i + "的工序数量p");p = sc.nextInt();str += p + " ";while (p-- > 0) {
int x, y;System.out.println("请输入机器号x, 运行时间y");x = sc.nextInt();y = sc.nextInt();str += x + " " + y + " ";}}os.write(str);os.flush();System.out.println("已发送...");str = "";while ((str = is.readLine()) != null) {
if(str.equals("-1")) {
break;}System.out.println(str);}os.close();is.close();sock.close();}
}
输入样例
3 3
3
0 3
1 2
2 2
3
0 2
2 1
1 4
2
1 4
2 3