로드 중...
검색 중...
일치하는 항목 없음
Transport1.java
1패키지com.무료 슬롯 게임examples.transport;
2
3가져오기java.io.*;
4
5가져오기 com.게임.API.*;
6
12공개 클래스운송1{
13
14 공개 정적 공허메인(문자열[] 인수)
16 // 명령줄 인수에서 작업공간 정보 확인
17 if(args.length > 0)
19wsInfo.setSystemDirectory(인수[0]);
20 // 사용자가 지정한 시스템 디렉토리와 기본 작업 디렉토리를 사용하여 GAMSWorkspace "ws"를 생성합니다.
21 // (System.getProperty("java.io.tmpdir") 아래의 현재 날짜 및 시간으로 명명된 디렉터리)
22ws =신규 무료 슬롯 게임작업공간(wsInfo);
23}그밖에{
24 // 기본 시스템 디렉토리와 기본 작업 디렉토리를 사용하여 GAMSWorkspace "ws"를 생성합니다.
25 // (System.getProperty("java.io.tmpdir") 아래의 현재 날짜 및 시간으로 명명된 디렉터리)
27}
28
29 // 무료 슬롯 게임 모델 라이브러리의 "trnsport" 모델에서 GAMSJob "t1" 생성
30 GAMSJobt1 = ws.addJobFromGamsLib("trnsport");
31 // GAMSJob "t1" 실행
32t1.실행();
33
34 // GAMSJob의 출력 데이터베이스에서 GAMSVariable "x" 검색
35System.out.println("기본값으로 실행:");
37 for (GAMSVariableRecordrec : x)
38System.out.print("x("+ rec.getKey(0) +", "+ rec.getKey(1) +"):");
39System.out.print(", 레벨 = "+ rec.getLevel());
40System.out.println(", 한계 = "+ rec.getMarginal());
41}
42
43 // GAMSOptions "opt1" 생성
45 // "xpress"에 대해 "opt1"의 모든 모델 유형을 설정
46opt1.setAllModelTypes("익스프레스");
47 // GAMSOptions "opt1"을 사용하여 GAMSJob "t1" 실행
48t1.실행(opt1);
49
50 // GAMSJob의 출력 데이터베이스에서 GAMSVariable "x" 검색
52System.out.println("XPRESS로 실행:");
53 for (GAMSVariableRecordrec : db1.get변수("x")) {
54System.out.print("x("+ rec.getKey(0) +", "+ rec.getKey(1) +"):");
55System.out.print(", 레벨 = "+ rec.getLevel());
56System.out.println(", 한계 = "+ rec.getMarginal());
57}
58
59 // GAMSWorkspace의 작업 디렉터리에 "xpress.opt" 파일 쓰기
60 시도해 보세요{
61BufferedWriter optFile =신규버퍼링라이터(신규FileWriter(ws.workingDirectory() +무료 슬롯 게임글로벌.FILE_SEPARATOR + "xpress.opt"));
62optFile.write("알고리즘=장벽");
63optFile.close();
64}잡기(IOException e)
65e.printStackTrace();
66System.exit(-1);
67}
68
69 // GAMSOptions "opt2" 생성
71 // "xpress"에 대해 "opt2"의 모든 모델 유형을 설정
72opt2.setAllModelTypes( "익스프레스");
73 // "opt2"의 경우 "xpress.opt"를 솔버의 옵션 파일로 사용
74opt2.setOptFile(1);
75
76 시도해 보세요{
77 // GAMSOptions "opt2"를 사용하여 GAMSJob "t2"를 실행하고 "transport1_xpress.log"에 로그를 캡처합니다.
78PrintStream 출력 =신규프린트스트림(신규파일(ws.workingDirectory() +무료 슬롯 게임글로벌.FILE_SEPARATOR +"transport1_xpress.log"));
79t1.실행(opt2, 출력);
80}잡기(FileNotFoundException e)
81 // GAMSOptions "opt2"를 사용하여 GAMSJob "t2"를 실행하면 로그가 표준 출력에 기록됩니다.
82t1.실행(opt2);
83}
84
85 // GAMSJob의 출력 데이터베이스에서 GAMSVariable "x" 검색
87System.out.println("기본값이 아닌 옵션으로 XPRESS를 실행했습니다:");
88 for (GAMSVariableRecordrec : db2.get변수("x")) {
89System.out.print("x("+ rec.getKey(0) +", "+ rec.getKey(1) +"):");
90System.out.print(", 레벨 = "+ rec.getLevel());
91System.out.println(", 한계 = "+ rec.getMarginal());
92}
93
94 // 옵션 및 데이터베이스 삭제
95opt1.처분();
96opt2.처분();
97db1.처분();
98db2.폐기();
99 // GAMSWorkspace의 작업 디렉터리 정리
100정리(ws.workingDirectory());
101 // 프로그램 종료
102System.exit(0);
103}
104
105 정적 무효정리(문자열 디렉터리)
106파일 디렉토리ToDelete =신규파일(디렉토리);
107문자열 파일[] =directoryToDelete.list();
108 for(문자열 파일 : 파일)
109파일 fileToDelete =신규파일(디렉토리삭제, 파일);
110 시도해 보세요{
111fileToDelete.delete();
112}잡기(예외 e)
113e.printStackTrace();
114}
115}
116 시도해 보세요{
117directoryToDelete.delete();
118}잡기(예외 e)
119e.printStackTrace();
120}
121}
122}
GAMSVariable getVariable(문자열 식별자)
무료 슬롯 게임데이터베이스 OutDB()
void setSystemDirectory(문자열 디렉토리)
GAMSJob addJobFromGamsLib(문자열 모델 이름)
이 예는 무료 슬롯 게임의 간단한 GAMS [trnsport] 모델에서 GAMSJob을 생성하고 실행하는 방법을 보여줍니다...