40파일 WorkingDirectory =
신규파일(System.getProperty(
"user.dir"),
"컷스톡");
41workingDirectory.mkdir();
47GAMSOptions opt = ws.
추가옵션();
49opt.setAllModelTypes(
"복합단지");
52opt.defines(
"pmax", String.valueOf(maxpattern));
53opt.defines(
"solveMasterAs",
"RMIP");
56Map<String, Double> d =
신규HashMap<String, Double>();
58d.put(
"i1", Double.valueOf(97) );
59d.put(
"i2", Double.valueOf(610) );
60d.put(
"i3", Double.valueOf(395) );
61d.put(
"i4", Double.valueOf(211) );
63Map<String, Double> w =
신규HashMap<String, Double>();
65w.put(
"i1", Double.valueOf(45) );
66w.put(
"i2", Double.valueOf(36) );
67w.put(
"i3", Double.valueOf(31) );
68w.put(
"i4", Double.valueOf(14) );
78rawWidth.addRecord().setValue( 100 );
79 for(문자열 i : d.keySet())
81 for(Entry<String, Double> e : d.entrySet())
82demand.addRecord( e.getKey() ).setValue( e.getValue() );
83 for(Entry<String, Double> e : w.entrySet())
84width.addRecord( e.getKey() ).setValue( e.getValue() );
89masterInitJob.
실행(opt, masterCP, cutstockData);
91 GAMSJobmasterJob = ws.
addJobFromString(
"execute_load 'csdata', aip, pp; %solveMasterAs%를 사용하여 마스터 min z 해결;", 마스터CP);
98 for(Entry<String, Double> e : w.entrySet())
99문자열[] 키 =
신규String[] e.getKey(), 패턴.addRecord( Integer.toString(++patternCount) ).getKey(0) ;
100patternData.addRecord(keys).setValue( (
int)(r / e.getValue()) );
117masterJob.
실행(opt, masterCP, cutstockData);
121demandDual.addRecord( dem.getKey(0) ).setValue( dem.getMarginal() );
125 if(subMI.
SyncDB().
get변수(
"z").findRecord().getLevel() < -0.00001)
126 if(patternCount == maxpattern)
127System.out.println(
"패턴이 벗어났습니다. 최대 패턴을 늘리십시오(현재 ["+최대 패턴+
"])");
131System.out.println(
"새 패턴 값: "+ 하위MI.
SyncDB().
getVariable(
"z").findRecord().getLevel());
132 GAMSSetRecords = 패턴.addRecord( Integer.toString(++patternCount) );
134 if(y.getLevel() > 0.5)
135문자열[] 키 =
신규문자열[] y.getKey(0), s.getKey(0) ;
136patternData.addRecord( 키 ).setValue( Math.round(y.getLevel()) );
146opt.defines(
"solveMasterAs",
"MIP");
147마스터Job.
실행(선택, cutstockData);
149System.out.println(
"최적의 해결책: "+masterJob.
아웃DB().
get변수(
"z").findRecord().getLevel());
152 if(xp.getLevel() > 0.5)
153System.out.println(
" 패턴 ["+xp.getKey(0)+
"] ["+xp.getLevel()+
"] 회: ");
155@SuppressWarnings(
"미사용")
157Iterator<GAMSParameterRecord> it = param.iterator();
160System.out.println(
" ["+rec.getKey(0)+
"] : ["+ 추천
getValue()+
"]");
174 "$Title 재고 절단 - 마스터 문제 \n" +
185 "$if가 설정되지 않은 경우 $pmax $set pmax 1000 \n" +
186 "p개의 가능한 패턴 설정 /1*%pmax%/ \n" +
187 " p의 pp(p) 동적 하위 집합 \n" +
189 " aip(i,p) p에서 성장하는 패턴의 너비 i 수;\n" +
192 "가변 xp(p) 패턴이 사용되었습니다 \n" +
194 "정수 변수 xp; xp.up(p) = sum(i, d(i)); \n" +
196 "사용된 패턴의 방정식 숫자 \n" +
197 " 수요(i) 수요를 충족; \n" +
199 "numpat.. z =e= sum(pp, xp(pp)); \n" +
200 "수요(i).. sum(pp, aip(i,pp)*xp(pp)) =g= d(i); \n" +
202 "모델 마스터 /numpat, 수요/; \n" +
206 "$Title 재고 절단 - 가격 문제는 배낭 모델입니다 \n" +
218 " 마스터 수요 제약 조건의 demdual(i) 이중 /#i eps/; \n" +
220 "변수 z, y(i) 새로운 패턴; \n" +
221 "정수 변수 y; y.up(i) = ceil(r/w(i)); \n" +
226 "defobj.. z =e= 1 - sum(i, demdual(i)*y(i)); \n" +
227 "배낭.. sum(i, w(i)*y(i)) =l= r; \n" +
228 "모델 가격 /defobj, 배낭/; \n" +