42파일 WorkingDirectory =
신규파일(System.getProperty(
"user.dir"),
"티스푼");
43workingDirectory.mkdir();
64목록<문자열> n =
신규ArrayList<문자열>();
77cMax = curCut + cutsPerRound;
83GAMSOptions opt = ws.
추가옵션();
84선택.
정의(
"nrcities",
"20");
85opt.defines(
"cmax", Integer.toString(cMax - 1));
86opt.defines(
"컷데이터", 컷데이터.
getName());
91 if(!gamsdir.endsWith(GAMSGlobals.FILE_SEPARATOR))
92gamsdir += GAMSGlobals.FILE_SEPARATOR;
93파일 데이터파일 =
신규파일(gamsdir +
"api파일"+ GAMSGlobals.FILE_SEPARATOR
94 +
"데이터"+ GAMSGlobals.FILE_SEPARATOR
96opt.defines(
"tspdata",
"\""+ datafile.getAbsolutePath() +
"\"");
109mi.
인스턴스화(
"mip min z 사용 할당", 수정자);
112System.out.print(
".");
120맵<문자열, 문자열> 그래프 =
신규HashMap<문자열, 문자열>();
122목록 <문자열> 방문하지 않음 =
신규ArrayList<문자열>(n);
126 if(mi.
SyncDB().
get변수(
"x").findRecord( 키 ).getLevel() > 0.5)
133 그동안(notVisited.size() != 0)
134문자열 ii = notVisited.get(0);
135하위 투어 =
신규ArrayList<문자열>();
137 그동안(graph.get(ii) != notVisited.get(0))
143 최종목록<문자열> 소스 = subTour;
144IPredicate<String> doesNotContain =
신규IPredicate<문자열>()
146 반환!source.contains(요소);
149notVisited = (List<String>) filter(subTour, doesNotContain);
154문자열[] 키 =
"c"+curCut, i, j ;
155acut.addRecord(keys).setValue( 1 );
156miAcut.addRecord( 키 ).setValue( 1 );
161rhscut.addRecord( key ).setValue( subTour.size()-0.5 );
162miRhscut.addRecord( key ).setValue( subTour.size()-0.5 );
168 그동안(subTour.size() < n.size());
171System.out.println(
"z="+마일
SyncDB().
get변수(
"z").getFirstRecord().getLevel());
172System.out.println(
"sub_tour: ");
174System.out.print(i +
" -> ");
175System.out.println( subTour.get(0) );
179 인터페이스IPredicate<T>
부울적용(T 유형);
180정적 <T> Collection<T> 필터(Collection<T> 대상, IPredicate<T> 조건자)
181컬렉션<T> 결과 =
신규ArrayList<T>();
183 if(predicate.apply(요소))
191 "$Title 여행하는 외판원 문제 \n" +
194 "sub_tour 제거 제약 조건은 Python에 의해 생성됩니다\n" +
195 "스크립트. MIP는 계속해서 해결되지만 슬롯 커뮤니티는 \n" +
196 "n 컷이 추가된 후에만 모델을 생성합니다. \n" +
200 "$tspdata가 설정되지 않은 경우 $abort 'tspdata가 설정되지 않음' \n" +
203 " i(ii) 도시의 하위 집합 \n" +
204 "별칭 (ii,jj),(i,j,k); \n" +
206 "매개변수 c(ii,jj) 거리 행렬; \n" +
208 "$gdxin %tspdata% \n" +
211 "$nrCities를 설정하지 않은 경우 $set nrCities 20 \n" +
212 "i(ii)$(ord(ii) < %nrCities%) = 예; \n" +
214 "변수 x(ii,jj) 결정 변수 - 여행 구간 \n" +
216 "이진 변수 x; x.fx(ii,ii) = 0; \n" +
219 " rowsum(ii) 각 도시를 한 번만 출발합니다 \n" +
220 " colsum(jj)은 각 도시에 한 번만 도착합니다. \n" +
222 "* 할당 문제는 TSP의 완화입니다 \n" +
223 "객관적.. z =e= sum((i,j), c(i,j)*x(i,j)); \n" +
224 "rowsum(i).. sum(j, x(i,j)) =e= 1; \n" +
225 "colsum(j).. sum(i, x(i,j)) =e= 1; \n" +
227 "$if cmax를 설정하지 않음 $set cmax 2 \n" +
228 "컷 설정 /c0*c%cmax%/; \n" +
230 " acut(cut,ii,jj) 컷 제약 행렬 \n" +
231 " rhscut(cut) 제약 조건 rhs 자르기; \n" +
233 "등식 sscut(cut) sub_tour 제거 컷; \n" +
234 "sscut(cut).. sum((i,j), Acut(cut,i,j)*x(i,j)) =l= RHScut(cut); \n" +
236 "cc(컷) 이전 컷 설정; cc(컷) = 아니오; \n" +
237 "$if set cutdataexecute_load '%cutdata%', cc, Acut, RHScut; \n" +
239 "Acut(cut,i,j)$(cc(cut) 아님) = eps; \n" +
240 "RHScut(컷)$(cc(컷) 아님) = 카드(ii); \n" +