로드 중...
검색 중...
일치하는 항목 없음
Transport1.cs
1사용 중시스템;
2사용 중시스템.IO;
3사용 중System.Collections.Generic;
4사용 중시스템.텍스트;
5사용 중크레이지 슬롯;
6
7네임스페이스TransportSeq
8{
26 클래스운송1
27{
28 정적 공허메인(문자열[] 인수)
29{
31 if(Environment.GetCommandLineArgs().Length > 1)
32ws =신규 크레이지 슬롯작업공간(systemDirectory: Environment.GetCommandLineArgs()[1]);
33 그밖에
35ws.GamsLib("trnsport");
36
37 // 파일에서 GAMSJob을 생성하고 기본 설정으로 실행
38 GAMSJobt1 = ws.AddJobFromFile("trnsport.gms");
39
40t1.실행();
41Console.WriteLine("기본값으로 실행:");
42 foreach (GAMSVariableRecordrecint1.OutDB.GetVariable("x"))
43Console.WriteLine("x("+ Rec.Key(0) +","+ Rec.Key(1) +"): 레벨="+ 추천레벨 + " 한계="+ 추천한계);
44
45 // 다른 솔버를 사용하여 작업을 다시 실행
46 사용 중 (크레이지 슬롯옵션opt = ws.AddOptions())
47{
48opt.AllModelTypes ="익스프레스";
49t1.실행(선택);
50}
51Console.WriteLine("XPRESS로 실행:");
52 foreach (GAMSVariableRecordrecint1.OutDB.GetVariable("x"))
53Console.WriteLine("x("+ Rec.Key(0) +","+ Rec.Key(1) +"): 레벨="+ 추천레벨 + " 한계="+ 추천한계);
54
55 // 솔버 옵션 파일을 사용하여 작업 실행
56 사용 중(StreamWriter optFile =신규StreamWriter(Path.Combine(ws.WorkingDirectory,"xpress.opt")))
57 사용 중(TextWriter 로그파일 =신규StreamWriter(Path.Combine(ws.WorkingDirectory,"transport1_xpress.log")))
58 사용 중 (크레이지 슬롯옵션opt = ws.AddOptions())
59{
60optFile.WriteLine("알고리즘=장벽");
61optFile.Close();
62opt.AllModelTypes ="익스프레스";
63opt.OptFile = 1;
64t1.Run(opt, 출력: logFile);
65 //로그를 파일에 쓰는 대신. Console.Out으로 리디렉션하는 것도 가능합니다.
66 //t1.Run(선택, 출력: Console.Out);
67}
68Console.WriteLine("기본값이 아닌 옵션으로 XPRESS를 실행했습니다:");
69 foreach (GAMSVariableRecordrecint1.OutDB.GetVariable("x"))
70Console.WriteLine("x("+ Rec.Key(0) +","+ Rec.Key(1) +"): 레벨="+ 추천레벨 + " 한계="+ 추천한계);
71}
72}
73}
void Run(GAMSOptions gamsOptions=null, GAMSCheckpoint 체크포인트=null, TextWriter 출력=null, Boolean createOutDB=true)
void GamsLib(문자열 모델)
GAMSJob AddJobFromFile(문자열 fileName, GAMSCheckpoint 체크포인트=null, 문자열 jobName=null)
이것은 일련의 튜토리얼 예제 중 첫 번째 모델입니다. 여기에서는 다음을 보여줍니다. 파일에서 GAMSJob을 실행하는 방법 ...