로드 중...
검색 중...
일치하는 항목 없음
transport13.cpp
이 파일의 문서로 이동하세요.
1
25#include "피망 슬롯h"
26#include "수송.h"
27
28#include <iostream>
29#include <지도>
30#include <문자열>
31#include <튜플>
32#include <벡터>
33
34네임스페이스 사용게임;
35네임스페이스 사용표준;
36
42int 메인(intargc,문자* argv[])
43{
44cout <<"---------- 수송 13 ------------"<< endl;
45
46 시도해 보세요{
47벡터<string> 식물"시애틀", "샌디에고"};
48벡터<string> 시장"뉴욕", "시카고", "토피카"};
49map<string, double> 용량
50{"시애틀", 350.0 }, { "샌디에이고", 600.0 }
51};
52map<string, double> 수요
53{"뉴욕", 325.0 }, { "시카고", 300.0 }, { "토피카", 275.0 }
54};
55맵<튜플<문자열, 문자열>,더블> 거리
56make_tuple("시애틀", "뉴욕"), 2.5 },
57make_tuple("시애틀", "시카고"), 1.7 },
58make_tuple("시애틀", "토피카"), 1.8 },
59make_tuple("샌디에고", "뉴욕"), 2.5 },
60make_tuple("샌디에고", "시카고"), 1.8 },
61make_tuple("샌디에이고", "토피카"), 1.4 }
62};
63
65 if(인수 > 1)
66wsInfo.setSystemDirectory(argv[1]);
68
69 운송t(ws);
70
71 for (문자열p : 식물)
72t.i().추가기록(p);
73
74 for (문자열m : 시장)
75t.j().추가기록(m);
76
77 for (문자열p : 식물)
78t.a().추가기록(p).세트값(용량[p]);
79
80 for (문자열m : 시장)
81t.b().추가기록(m).세트값(수요[m]);
82
83 for (자동dis : 거리)
84t.d().추가기록(get<0>(dis.first), get<1>(dis.first)).세트값(거리[dis.first]);
85
86t.f().추가기록().세트값(90);
87
88t.선택().setAllModelTypes("복합체");
89
91
92cout <<"목표: "<< 티.z().첫 번째 레코드().레벨() << endl;
93 for (GAMSVariableRecordrec : t.x())
94cout <<"x("<< Rec.key(0) <<","<< Rec.key(1) <<"): 레벨="<< Rec.level() <<
95 " 한계="<< rec.marginal() << endl;
96
97}잡기 (피망 슬롯예외&ex)
98cout <<"피망 슬롯예외 발생: "<< ex.what() << endl;
99}잡기(예외 &ex)
100cout << ex.what() << endl;
101}
102
103 반환0;
104}
피망 슬롯::GAMSSet j() const
j(j): 시장
void run(피망 슬롯::GAMSCheckpoint 체크포인트, std::ostream &output)
trnsport 모델을 실행합니다.
피망 슬롯::GAMSParameter b() const
b(i): 경우에 따라 시장 j의 수요
피망 슬롯::GAMSParameter f() const
f: 천 마일당 케이스당 화물(달러)
피망 슬롯::GAMSVariable x() const
x(i,j): 케이스의 배송 수량
피망 슬롯::GAMSParameter a() const
a(i): 경우에 따라 플랜트 i의 용량
피망 슬롯::GAMSParameter d() const
d(i,j): 수천 마일 단위의 거리
피망 슬롯::GAMSVariable z() const
z: 총 운송 비용(천 달러)
피망 슬롯::GAMSOptions opt() const
trnsport 모델 실행을 위한 옵션.
피망 슬롯::GAMSSet i() const
i(i): 통조림 공장
void setAllModelTypes(const std::string &solver)
void setValue(const double val)
GAMSParameterRecord addRecord(const std::벡터< std::string > &keys)
GAMSSetRecord addRecord(const std::벡터< std::string > &keys)
GAMSVariableRecord firstRecord(const std::벡터< std::string > &slice)
void setSystemDirectory(const std::string &systemDir)
int main(int argc, char *argv[])
피망 슬롯 trnsport 모델에 대한 래퍼 클래스 정의.