1 | // Copyright (C) 2000, International Business Machines |
2 | // Corporation and others. All Rights Reserved. |
3 | // This code is licensed under the terms of the Eclipse Public License (EPL). |
4 | |
5 | #include <cstdlib> |
6 | #include <cstdio> |
7 | #include <cassert> |
8 | #include <cmath> |
9 | #include <cfloat> |
10 | #include <string> |
11 | #include <iostream> |
12 | |
13 | #include "CoinPragma.hpp" |
14 | #include "CoinHelperFunctions.hpp" |
15 | #include "CoinPackedVector.hpp" |
16 | #include "CoinPackedMatrix.hpp" |
17 | #include "CoinWarmStartBasis.hpp" |
18 | |
19 | #include "OsiRowCutDebugger.hpp" |
20 | |
21 | /* |
22 | Check if any cuts cut off the known solution. |
23 | |
24 | If so then print offending cuts and return non-zero code |
25 | */ |
26 | |
27 | |
28 | int OsiRowCutDebugger::validateCuts (const OsiCuts & cs, |
29 | int first, int last) const |
30 | { |
31 | int nbad=0; |
32 | int i; |
33 | const double epsilon=1.0e-8; |
34 | const int nRowCuts = CoinMin(cs.sizeRowCuts(),last); |
35 | |
36 | for (i=first; i<nRowCuts; i++){ |
37 | |
38 | OsiRowCut rcut = cs.rowCut(i); |
39 | CoinPackedVector rpv = rcut.row(); |
40 | const int n = rpv.getNumElements(); |
41 | const int * indices = rpv.getIndices(); |
42 | const double * elements = rpv.getElements(); |
43 | int k; |
44 | double lb=rcut.lb(); |
45 | double ub=rcut.ub(); |
46 | |
47 | double sum=0.0; |
48 | |
49 | for (k=0; k<n; k++){ |
50 | int column=indices[k]; |
51 | sum += knownSolution_[column]*elements[k]; |
52 | } |
53 | // is it violated |
54 | if (sum >ub + epsilon ||sum < lb - epsilon) { |
55 | double violation=CoinMax(sum-ub,lb-sum); |
56 | std::cout<<"Cut " <<i<<" with " <<n |
57 | <<" coefficients, cuts off known solution by " <<violation |
58 | <<", lo=" <<lb<<", ub=" <<ub<<std::endl; |
59 | for (k=0; k<n; k++){ |
60 | int column=indices[k]; |
61 | std::cout<<"( " <<column<<" , " <<elements[k]<<" ) " ; |
62 | if ((k%4)==3) |
63 | std::cout <<std::endl; |
64 | } |
65 | std::cout <<std::endl; |
66 | std::cout <<"Non zero solution values are" <<std::endl; |
67 | int j=0; |
68 | for (k=0; k<n; k++){ |
69 | int column=indices[k]; |
70 | if (fabs(knownSolution_[column])>1.0e-9) { |
71 | std::cout<<"( " <<column<<" , " <<knownSolution_[column]<<" ) " ; |
72 | if ((j%4)==3) |
73 | std::cout <<std::endl; |
74 | j++; |
75 | } |
76 | } |
77 | std::cout <<std::endl; |
78 | nbad++; |
79 | } |
80 | } |
81 | return nbad; |
82 | } |
83 | |
84 | |
85 | /* If we are on the path to the known integer solution then |
86 | check out if generated cut cuts off the known solution! |
87 | |
88 | If so then print offending cut and return non-zero code |
89 | */ |
90 | |
91 | bool OsiRowCutDebugger::invalidCut(const OsiRowCut & rcut) const |
92 | { |
93 | bool bad=false; |
94 | const double epsilon=1.0e-6; |
95 | |
96 | CoinPackedVector rpv = rcut.row(); |
97 | const int n = rpv.getNumElements(); |
98 | const int * indices = rpv.getIndices(); |
99 | const double * elements = rpv.getElements(); |
100 | int k; |
101 | |
102 | double lb=rcut.lb(); |
103 | double ub=rcut.ub(); |
104 | double sum=0.0; |
105 | |
106 | for (k=0; k<n; k++){ |
107 | int column=indices[k]; |
108 | sum += knownSolution_[column]*elements[k]; |
109 | } |
110 | // is it violated |
111 | if (sum >ub + epsilon ||sum < lb - epsilon) { |
112 | double violation=CoinMax(sum-ub,lb-sum); |
113 | std::cout<<"Cut with " <<n |
114 | <<" coefficients, cuts off known solutions by " <<violation |
115 | <<", lo=" <<lb<<", ub=" <<ub<<std::endl; |
116 | for (k=0; k<n; k++){ |
117 | int column=indices[k]; |
118 | std::cout<<"( " <<column<<" , " <<elements[k]<<" ) " ; |
119 | if ((k%4)==3) |
120 | std::cout <<std::endl; |
121 | } |
122 | std::cout <<std::endl; |
123 | std::cout <<"Non zero solution values are" <<std::endl; |
124 | int j=0; |
125 | for (k=0; k<n; k++){ |
126 | int column=indices[k]; |
127 | if (fabs(knownSolution_[column])>1.0e-9) { |
128 | std::cout<<"( " <<column<<" , " <<knownSolution_[column]<<" ) " ; |
129 | if ((j%4)==3) |
130 | std::cout <<std::endl; |
131 | j++; |
132 | } |
133 | } |
134 | std::cout <<std::endl; |
135 | bad=true; |
136 | } |
137 | return bad; |
138 | } |
139 | |
140 | /* |
141 | Returns true if the column bounds in the solver do not exclude the |
142 | solution held by the debugger, false otherwise |
143 | |
144 | Inspects only the integer variables. |
145 | */ |
146 | bool OsiRowCutDebugger::onOptimalPath(const OsiSolverInterface & si) const |
147 | { |
148 | if (integerVariable_) { |
149 | int nCols=si.getNumCols(); |
150 | if (nCols!=numberColumns_) |
151 | return false; // check user has not modified problem |
152 | int i; |
153 | const double * collower = si.getColLower(); |
154 | const double * colupper = si.getColUpper(); |
155 | bool onOptimalPath=true; |
156 | for (i=0;i<numberColumns_;i++) { |
157 | if (collower[i]>colupper[i]+1.0e-12) { |
158 | printf("Infeasible bounds for %d - %g, %g\n" , |
159 | i,collower[i],colupper[i]); |
160 | } |
161 | if (si.isInteger(i)) { |
162 | // value of integer variable in solution |
163 | double value=knownSolution_[i]; |
164 | if (value>colupper[i]+1.0e-3 || value<collower[i]-1.0e-3) { |
165 | onOptimalPath=false; |
166 | break; |
167 | } |
168 | } |
169 | } |
170 | return onOptimalPath; |
171 | } else { |
172 | // no information |
173 | return false; |
174 | } |
175 | } |
176 | /* |
177 | Returns true if the debugger is active (i.e., if the debugger holds a |
178 | known solution). |
179 | */ |
180 | bool OsiRowCutDebugger::active() const |
181 | { |
182 | return (integerVariable_!=NULL); |
183 | } |
184 | |
185 | /* |
186 | Print known solution |
187 | |
188 | Generally, prints the nonzero values of the known solution. Any incorrect |
189 | values are flagged with an `*'. Zeros are printed if they are incorrect. |
190 | As an aid to finding the output when there's something wrong, the first two |
191 | incorrect values are printed again, flagged with `BAD'. |
192 | |
193 | Inspects only the integer variables. |
194 | |
195 | Returns the number of incorrect variables, or -1 if no solution is |
196 | available. A mismatch in the number of columns between the debugger's |
197 | solution and the solver qualifies as `no solution'. |
198 | */ |
199 | int |
200 | OsiRowCutDebugger::printOptimalSolution(const OsiSolverInterface & si) const |
201 | { |
202 | int nCols = si.getNumCols() ; |
203 | if (integerVariable_ && nCols == numberColumns_) { |
204 | |
205 | const double *collower = si.getColLower() ; |
206 | const double *colupper = si.getColUpper() ; |
207 | /* |
208 | Dump the nonzeros of the optimal solution. Print zeros if there's a problem. |
209 | */ |
210 | int bad[2] = {-1,-1} ; |
211 | int badVars = 0 ; |
212 | for (int j = 0 ; j < numberColumns_ ; j++) { |
213 | if (integerVariable_[j]) { |
214 | double value = knownSolution_[j] ; |
215 | bool ok = true ; |
216 | if (value > colupper[j]+1.0e-3 || value < collower[j]-1.0e-3) { |
217 | if (bad[0] < 0) { |
218 | bad[0] = j ; |
219 | } else { |
220 | bad[1] = j ; |
221 | } |
222 | ok = false ; |
223 | std::cout << "* " ; |
224 | } |
225 | if (value || !ok) std::cout << j << " " << value << std::endl ; |
226 | } |
227 | } |
228 | for (int i = 0 ; i < 2 ; i++) { |
229 | if (bad[i] >= 0) { |
230 | int j = bad[i] ; |
231 | std::cout |
232 | << "BAD " << j << " " << collower[j] << " <= " |
233 | << knownSolution_[j] << " <= " << colupper[j] << std::endl ; |
234 | } |
235 | } |
236 | return (badVars) ; |
237 | } else { |
238 | // no information |
239 | return -1; |
240 | } |
241 | } |
242 | /* |
243 | Activate a row cut debugger using the name of the model. A known optimal |
244 | solution will be used to validate cuts. See the source below for the set of |
245 | known problems. Most are miplib3. |
246 | |
247 | Returns true if the debugger is successfully activated. |
248 | */ |
249 | bool OsiRowCutDebugger::activate( const OsiSolverInterface & si, |
250 | const char * model) |
251 | { |
252 | // set to true to print an activation message |
253 | const bool printActivationNotice = false ; |
254 | int i; |
255 | //get rid of any arrays |
256 | delete [] integerVariable_; |
257 | delete [] knownSolution_; |
258 | numberColumns_ = 0; |
259 | int expectedNumberColumns = 0; |
260 | |
261 | |
262 | enum {undefined, pure0_1, continuousWith0_1, generalMip } probType; |
263 | |
264 | |
265 | // Convert input parameter model to be lowercase and |
266 | // only consider characters between '/' and '.' |
267 | std::string modelL; //name in lowercase |
268 | int iput=0; |
269 | for (i=0;i<static_cast<int> (strlen(model));i++) { |
270 | char value=static_cast<char>(tolower(model[i])); |
271 | if (value=='/') { |
272 | iput=0; |
273 | modelL.erase(); |
274 | } else if (value=='.') { |
275 | break; |
276 | } else { |
277 | modelL.append(1,value); |
278 | } |
279 | } |
280 | |
281 | |
282 | CoinPackedVector intSoln; |
283 | probType = undefined; |
284 | |
285 | //-------------------------------------------------------- |
286 | // |
287 | // Define additional problems by adding it as an additional |
288 | // "else if ( modelL == '???' ) { ... }" |
289 | // stanza below. |
290 | // |
291 | // Assign values to probType and intSoln. |
292 | // |
293 | // probType - pure0_1, continuousWith0_1, or generalMip |
294 | // |
295 | // intSoln - |
296 | // when probType is pure0_1 |
297 | // intSoln contains the indices of the variables |
298 | // at 1 in the optimal solution |
299 | // when probType is continuousWith0_1 |
300 | // intSoln contains the indices of integer |
301 | // variables at one in the optimal solution |
302 | // when probType is generalMip |
303 | // intSoln contains the the indices of the integer |
304 | // variables and their value in the optimal solution |
305 | //-------------------------------------------------------- |
306 | |
307 | // exmip1 |
308 | if ( modelL == "exmip1" ) { |
309 | probType=continuousWith0_1; |
310 | intSoln.insert(2,1.); |
311 | intSoln.insert(3,1.); |
312 | expectedNumberColumns=8; |
313 | } |
314 | |
315 | // p0033 |
316 | else if ( modelL == "p0033" ) { |
317 | probType=pure0_1; |
318 | // Alternate solution -- 21,23 replace 22. |
319 | // int intIndicesAt1[]={ 0,6,7,9,13,17,18,21,23,24,25,26,27,28,29 }; |
320 | int intIndicesAt1[]={ 0,6,7,9,13,17,18,22,24,25,26,27,28,29 }; |
321 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
322 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
323 | expectedNumberColumns=33; |
324 | } |
325 | |
326 | // flugpl |
327 | else if ( modelL == "flugpl" ) { |
328 | probType=generalMip; |
329 | int intIndicesV[] = { 1 , 3 , 4 , 6 , 7 , 9 ,10 ,12 ,13 ,15 }; |
330 | double intSolnV[] = { 6.,60., 6.,60.,16.,70., 7.,70.,12.,75.}; |
331 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
332 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
333 | expectedNumberColumns=18; |
334 | } |
335 | |
336 | // enigma |
337 | else if ( modelL == "enigma" ) { |
338 | probType=pure0_1; |
339 | int intIndicesAt1[]={ 0,18,25,36,44,59,61,77,82,93 }; |
340 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
341 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
342 | expectedNumberColumns=100; |
343 | } |
344 | |
345 | // mod011 |
346 | else if ( modelL == "mod011" ) { |
347 | probType=continuousWith0_1; |
348 | int intIndicesAt1[]={ 10,29,32,40,58,77,80,88 }; |
349 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
350 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
351 | expectedNumberColumns=10958; |
352 | } |
353 | |
354 | // probing |
355 | else if ( modelL == "probing" ) { |
356 | probType=continuousWith0_1; |
357 | int intIndicesAt1[]={ 1, 18, 33, 59 }; |
358 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
359 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
360 | expectedNumberColumns=149; |
361 | } |
362 | |
363 | // mas76 |
364 | else if ( modelL == "mas76" ) { |
365 | probType=continuousWith0_1; |
366 | int intIndicesAt1[]={ 4,11,13,18,42,46,48,52,85,93,114,119,123,128,147}; |
367 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
368 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
369 | expectedNumberColumns=151; |
370 | } |
371 | |
372 | // ltw3 |
373 | else if ( modelL == "ltw3" ) { |
374 | probType=continuousWith0_1; |
375 | int intIndicesAt1[]={ 20,23,24,26,32,33,40,47 }; |
376 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
377 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
378 | expectedNumberColumns=48; |
379 | } |
380 | |
381 | // mod008 |
382 | else if ( modelL == "mod008" ) { |
383 | probType=pure0_1; |
384 | int intIndicesAt1[]={1,59,83,116,123}; |
385 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
386 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
387 | expectedNumberColumns=319; |
388 | } |
389 | |
390 | // mod010 |
391 | else if ( modelL == "mod010" ) { |
392 | probType=pure0_1; |
393 | int intIndicesAt1[]={2,9,16,22,26,50,65,68,82,86,102,145, |
394 | 149,158,181,191,266,296,376,479,555,625,725,851,981, |
395 | 1030,1095,1260,1321,1339,1443,1459,1568,1602,1780,1856, |
396 | 1951,2332,2352,2380,2471,2555,2577,2610,2646,2647}; |
397 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
398 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
399 | expectedNumberColumns=2655; |
400 | } |
401 | |
402 | // modglob |
403 | else if ( modelL == "modglob" ) { |
404 | probType=continuousWith0_1; |
405 | int intIndicesAt1[]={204,206,208,212,216,218,220,222,230,232, |
406 | 234,236,244,248,250,254,256,258,260,262,264,266,268,274, |
407 | 278,282,284,286,288}; |
408 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
409 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
410 | expectedNumberColumns=422; |
411 | } |
412 | |
413 | // p0201 |
414 | else if ( modelL == "p0201" ) { |
415 | probType=pure0_1; |
416 | int intIndicesAt1[]={8,10,21,38,39,56,60,74,79,92,94,110,111, |
417 | 128,132,146,151,164,166,182,183,200}; |
418 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
419 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
420 | expectedNumberColumns=201; |
421 | } |
422 | |
423 | // p0282 |
424 | else if ( modelL == "p0282" ) { |
425 | probType=pure0_1; |
426 | int intIndicesAt1[]={3,11,91,101,103,117,155,169,191,199,215, |
427 | 223,225,237,240,242,243,244,246,248,251,254,256,257,260, |
428 | 262,263,273,275,276,277,280,281}; |
429 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
430 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
431 | expectedNumberColumns=282; |
432 | } |
433 | |
434 | // p0548 |
435 | else if ( modelL == "p0548" ) { |
436 | probType=pure0_1; |
437 | int intIndicesAt1[]={2,3,13,14,17,23,24,43,44,47,61,62,74,75, |
438 | 81,82,92,93,96,98,105,120,126,129,140,141,153,154,161,162, |
439 | 165,177,182,184,189,192,193,194,199,200,209,214,215,218,222, |
440 | 226,234,239,247,256,257,260,274,286,301,305,306,314,317,318, |
441 | 327,330,332,334,336,340,347,349,354,358,368,369,379,380,385, |
442 | 388,389,390,393,394,397,401,402,406,407,417,419,420,423,427, |
443 | 428,430,437,439,444,446,447,450,451,452,472,476,477,480,488, |
444 | 491,494,500,503,508,509,510,511,512,515,517,518,519,521,522, |
445 | 523,525,526,527,528,529,530,531,532,533,536,537,538,539,541, |
446 | 542,545,547}; |
447 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
448 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
449 | expectedNumberColumns=548; |
450 | } |
451 | |
452 | // p2756 |
453 | else if ( modelL == "p2756" ) { |
454 | probType=pure0_1; |
455 | int intIndicesAt1[]={7,25,50,63,69,71,81,124,164,208,210,212,214, |
456 | 220,266,268,285,299,301,322,362,399,455,464,468,475,518,574, |
457 | 588,590,612,632,652,679,751,767,794,819,838,844,892,894,913, |
458 | 919,954,966,996,998,1021,1027,1044,1188,1230,1248,1315,1348, |
459 | 1366,1367,1420,1436,1473,1507,1509,1521,1555,1558,1607,1659, |
460 | 1715,1746,1761,1789,1800,1844,1885,1913,1916,1931,1992,2002, |
461 | 2050,2091,2155,2158,2159,2197,2198,2238,2264,2292,2318,2481, |
462 | 2496,2497,2522,2531,2573,2583,2587,2588,2596,2635,2637,2639, |
463 | 2643,2645,2651,2653,2672,2675,2680,2683,2708,2727,2730,2751}; |
464 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
465 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
466 | expectedNumberColumns=2756; |
467 | } |
468 | |
469 | /* nw04 |
470 | It turns out that the NAME line in nw04.mps distributed in miplib is |
471 | actually NW-capital O-4. Who'd a thunk it? -- lh, 110402 -- |
472 | */ |
473 | else if ( modelL == "nw04" || modelL == "nwo4" ) { |
474 | probType=pure0_1; |
475 | int intIndicesAt1[]={ |
476 | 231 ,1792 ,1980 ,7548 ,21051 ,28514 ,53087 ,53382 ,76917 }; |
477 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
478 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
479 | expectedNumberColumns=87482; |
480 | } |
481 | |
482 | // bell3a |
483 | else if ( modelL == "bell3a" ) { |
484 | probType=generalMip; |
485 | int intIndicesV[]={61,62,65,66,67,68,69,70}; |
486 | double intSolnV[] = {4.,21.,4.,4.,6.,1.,25.,8.}; |
487 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
488 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
489 | expectedNumberColumns=133; |
490 | } |
491 | |
492 | // 10teams |
493 | else if ( modelL == "10teams" ) { |
494 | probType=continuousWith0_1; |
495 | int intIndicesAt1[]={236,298,339,379,443,462,520,576,616,646,690, |
496 | 749,778,850,878,918,986,996,1065,1102,1164,1177,1232,1281,1338, |
497 | 1358,1421,1474,1522,1533,1607,1621,1708,1714,1775,1835,1887, |
498 | 1892,1945,1989}; |
499 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
500 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
501 | expectedNumberColumns=2025; |
502 | } |
503 | |
504 | // rentacar |
505 | else if ( modelL == "rentacar" ) { |
506 | probType=continuousWith0_1; |
507 | int intIndicesAt1[]={ |
508 | 9502 ,9505 ,9507 ,9511 ,9512 ,9513 ,9514 ,9515 ,9516 ,9521 , |
509 | 9522 ,9526 ,9534 ,9535 ,9536 ,9537 ,9542 ,9543 ,9544 ,9548 , |
510 | 9550 ,9554 }; |
511 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
512 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
513 | expectedNumberColumns=9557; |
514 | } |
515 | |
516 | // qiu |
517 | else if ( modelL == "qiu" ) { |
518 | probType=continuousWith0_1; |
519 | int intIndicesAt1[]={ |
520 | 0 ,5 ,8 ,9 ,11 ,13 ,16 ,17 ,19 ,20 , |
521 | 24 ,28 ,32 ,33 ,35 ,37 ,40 ,47 }; |
522 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
523 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
524 | expectedNumberColumns=840; |
525 | } |
526 | |
527 | // pk1 |
528 | else if ( modelL == "pk1" ) { |
529 | probType=continuousWith0_1; |
530 | int intIndicesAt1[]={ |
531 | 1 ,4 ,5 ,6 ,7 ,11 ,13 ,16 ,17 ,23 , |
532 | 24 ,27 ,28 ,34 ,35 ,37 ,43 ,44 ,45 ,46 , |
533 | 47 ,51 ,52 ,54 }; |
534 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
535 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
536 | expectedNumberColumns=86; |
537 | } |
538 | |
539 | // pp08a |
540 | else if ( modelL == "pp08a" ) { |
541 | probType=continuousWith0_1; |
542 | int intIndicesAt1[]={ |
543 | 177 ,179 ,181 ,183 ,185 ,190 ,193 ,195 ,197 ,199 , |
544 | 202 ,204 ,206 ,208 ,216 ,220 ,222 ,229 ,235 }; |
545 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
546 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
547 | expectedNumberColumns=240; |
548 | } |
549 | |
550 | // pp08aCUTS |
551 | else if ( modelL == "pp08acuts" ) { |
552 | probType=continuousWith0_1; |
553 | int intIndicesAt1[]={ |
554 | 177 ,179 ,181 ,183 ,185 ,190 ,193 ,195 ,197 ,199 , |
555 | 202 ,204 ,206 ,208 ,216 ,220 ,222 ,229 ,235 }; |
556 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
557 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
558 | expectedNumberColumns=240; |
559 | } |
560 | |
561 | // danoint |
562 | else if ( modelL == "danoint" ) { |
563 | probType=continuousWith0_1; |
564 | int intIndicesAt1[]={3,5,8,11,15,21,24,25,31,34,37,42,46,48,51,56}; |
565 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
566 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
567 | expectedNumberColumns=521; |
568 | } |
569 | |
570 | // dcmulti |
571 | else if ( modelL == "dcmulti" ) { |
572 | probType=continuousWith0_1; |
573 | int intIndicesAt1[]={2,3,11,14,15,16,21,24,28,34,35,36,39,40,41,42, |
574 | 45,52,53,60,61,64,65,66,67}; |
575 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
576 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
577 | expectedNumberColumns=548; |
578 | } |
579 | |
580 | // egout |
581 | else if ( modelL == "egout" ) { |
582 | probType=continuousWith0_1; |
583 | int intIndicesAt1[]={0,3,5,7,8,9,11,12,13,15,16,17,18,20,21,22, |
584 | 23,24,25,26,27,28,29,32,34,36,37,38,39,40,42,43,44,45,46,47, |
585 | 48,49,52,53,54}; |
586 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
587 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
588 | expectedNumberColumns=141; |
589 | } |
590 | |
591 | // fixnet6 |
592 | else if ( modelL == "fixnet6" ) { |
593 | probType=continuousWith0_1; |
594 | int intIndicesAt1[]={1,16,23,31,37,51,64,179,200,220,243,287, |
595 | 375,413,423,533,537,574,688,690,693,712,753,773,778,783,847}; |
596 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
597 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
598 | expectedNumberColumns=878; |
599 | } |
600 | |
601 | // khb05250 |
602 | else if ( modelL == "khb05250" ) { |
603 | probType=continuousWith0_1; |
604 | int intIndicesAt1[]={1,3,8,11,12,15,16,17,18,21,22,23}; |
605 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
606 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
607 | expectedNumberColumns=1350; |
608 | } |
609 | |
610 | // lseu |
611 | else if ( modelL == "lseu" ) { |
612 | probType=pure0_1; |
613 | int intIndicesAt1[]={0,1,6,13,26,33,38,43,50,52,63,65,85}; |
614 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
615 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
616 | expectedNumberColumns=89; |
617 | } |
618 | |
619 | // air03 |
620 | else if ( modelL == "air03" ) { |
621 | probType=pure0_1; |
622 | int intIndicesAt1[]={ |
623 | 1, 3, 5, 13, 14, 28, 38, 49, 75, 76, |
624 | 151, 185, 186, 271, 370, 466, 570, 614, 732, 819, |
625 | 1151, 1257, 1490, 2303, 2524, 3301, 3616, 4129, 4390, 4712, |
626 | 5013, 5457, 5673, 6436, 7623, 8122, 8929, 10689, 10694, 10741, |
627 | 10751 |
628 | }; |
629 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
630 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
631 | expectedNumberColumns=10757; |
632 | } |
633 | |
634 | // air04 |
635 | else if ( modelL == "air04" ) { |
636 | probType=pure0_1; |
637 | int intIndicesAt1[]={ |
638 | 0, 1, 3, 4, 5, 6, 7, 9, 11, 12, |
639 | 13, 17, 19, 20, 21, 25, 26, 27, 28, 29, |
640 | 32, 35, 36, 39, 40, 42, 44, 45, 47, 48, |
641 | 49, 50, 51, 52, 53, 56, 57, 58, 60, 63, |
642 | 64, 66, 67, 68, 73, 74, 80, 81, 83, 85, |
643 | 87, 92, 93, 94, 95, 99, 101, 102, 105, 472, |
644 | 616, 680, 902, 1432, 1466, 1827, 2389, 2535, 2551, 2883, |
645 | 3202, 3215, 3432, 3438, 3505, 3517, 3586, 3811, 3904, 4092, |
646 | 4685, 4700, 4834, 4847, 4892, 5189, 5211, 5394, 5878, 6045, |
647 | 6143, 6493, 6988, 7511, 7664, 7730, 7910, 8041, 8350, 8615, |
648 | 8635, 8670 |
649 | }; |
650 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
651 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
652 | expectedNumberColumns=8904; |
653 | } |
654 | |
655 | // air05 |
656 | else if ( modelL == "air05" ) { |
657 | probType=pure0_1; |
658 | int intIndicesAt1[]={ |
659 | 2, 4, 5, 6, 7, 8, 9, 10, 14, 15, |
660 | 19, 20, 25, 34, 35, 37, 39, 40, 41, 42, |
661 | 43, 44, 45, 47, 48, 50, 52, 55, 57, 58, |
662 | 66, 72, 105, 218, 254, 293, 381, 695, 1091, 1209, |
663 | 1294, 1323, 1348, 1580, 1769, 2067, 2156, 2162, 2714, 2732, |
664 | 3113, 3131, 3145, 3323, 3398, 3520, 3579, 4295, 5025, 5175, |
665 | 5317, 5340, 6324, 6504, 6645, 6809 |
666 | }; |
667 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
668 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
669 | expectedNumberColumns=7195; |
670 | } |
671 | |
672 | // seymour |
673 | else if ( modelL == "seymour" ) { |
674 | probType=pure0_1; |
675 | int intIndicesAt1[]= |
676 | { |
677 | 1, 2, 3, 5, 6, 7, 9, 11, 12, 16, |
678 | 18, 22, 23, 25, 27, 31, 32, 34, 35, 36, |
679 | 38, 39, 40, 42, 44, 45, 46, 49, 50, 51, |
680 | 52, 54, 55, 56, 58, 61, 63, 65, 67, 68, |
681 | 69, 70, 71, 75, 79, 81, 82, 84, 85, 86, |
682 | 87, 88, 89, 91, 93, 95, 97, 98, 99, 100, |
683 | 101, 102, 103, 106, 108, 112, 116, 118, 119, 120, |
684 | 122, 123, 124, 125, 126, 129, 130, 132, 135, 137, |
685 | 140, 141, 142, 143, 144, 148, 150, 151, 154, 156, |
686 | 159, 160, 162, 163, 164, 165, 167, 169, 170, 174, |
687 | 177, 178, 180, 181, 182, 183, 188, 189, 192, 194, |
688 | 200, 201, 202, 203, 204, 211, 214, 218, 226, 227, |
689 | 228, 231, 232, 237, 240, 242, 244, 247, 248, 249, |
690 | 251, 253, 256, 257, 259, 261, 264, 265, 266, 268, |
691 | 270, 272, 278, 280, 284, 286, 288, 289, 291, 292, |
692 | 296, 299, 302, 305, 307, 308, 311, 312, 313, 314, |
693 | 315, 316, 317, 319, 321, 325, 328, 332, 334, 335, |
694 | 337, 338, 339, 340, 343, 346, 355, 357, 358, 365, |
695 | 369, 372, 373, 374, 375, 376, 378, 381, 383, 386, |
696 | 392, 396, 399, 402, 403, 412, 416, 419, 424, 425, |
697 | 426, 427, 430, 431, 432, 436, 437, 438, 440, 441, |
698 | 443, 450, 451, 452, 453, 456, 460, 461, 462, 467, |
699 | 469, 475, 476, 477, 478, 479, 485, 486, 489, 491, |
700 | 493, 498, 500, 501, 508, 513, 515, 516, 518, 519, |
701 | 520, 524, 527, 541, 545, 547, 548, 559, 562, 563, |
702 | 564, 566, 567, 570, 572, 575, 576, 582, 583, 587, |
703 | 589, 595, 599, 602, 610, 611, 615, 622, 631, 646, |
704 | 647, 649, 652, 658, 662, 665, 667, 671, 676, 679, |
705 | 683, 685, 686, 688, 689, 691, 699, 705, 709, 711, |
706 | 712, 716, 721, 722, 724, 726, 729, 732, 738, 739, |
707 | 741, 745, 746, 747, 749, 752, 757, 765, 767, 768, |
708 | 775, 779, 780, 791, 796, 798, 808, 809, 812, 813, |
709 | 817, 819, 824, 825, 837, 839, 849, 851, 852, 857, |
710 | 865, 874, 883, 885, 890, 897, 902, 907, 913, 915, |
711 | 923, 924, 927, 931, 933, 936, 938, 941, 945, 949, |
712 | 961, 970, 971, 978, 984, 985, 995, 997, 999, 1001, |
713 | 1010, 1011, 1012, 1025, 1027, 1035, 1043, 1055, 1056, 1065, |
714 | 1077, 1089, 1091, 1096, 1100, 1104, 1112, 1126, 1130, 1131, |
715 | 1132, 1134, 1136, 1143, 1149, 1162, 1163, 1164, 1183, 1184, |
716 | 1191, 1200, 1201, 1209, 1215, 1220, 1226, 1228, 1229, 1233, |
717 | 1241, 1243, 1244, 1258, 1277, 1279, 1285, 1291, 1300, 1303, |
718 | 1306, 1311, 1320, 1323, 1333, 1344, 1348, 1349, 1351, 1356, |
719 | 1363, 1364, 1365, 1366}; |
720 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
721 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
722 | expectedNumberColumns=1372; |
723 | } |
724 | |
725 | // stein27 |
726 | else if ( modelL == "stein27" ) { |
727 | probType=pure0_1; |
728 | int intIndicesAt1[]={0,1,3,4,5,6,7,8,9,11,13,16,17,19,21,22,25,26}; |
729 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
730 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
731 | expectedNumberColumns=27; |
732 | } |
733 | |
734 | // stein45 |
735 | else if ( modelL == "stein45" ) { |
736 | probType=pure0_1; |
737 | int intIndicesAt1[]={0,1,4,5,6,7,8,9,10,11,14,17,18,19,21,23,24,25,26,28, |
738 | 31,32,33,36,37,39,40,42,43,44}; |
739 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
740 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
741 | expectedNumberColumns=45; |
742 | } |
743 | |
744 | // misc03 |
745 | else if ( modelL == "misc03" ) { |
746 | probType=continuousWith0_1; |
747 | int intIndicesAt1[]={4,40,62,75,99,114,127,134,147,148,150, |
748 | 152,154,155,157}; |
749 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
750 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
751 | expectedNumberColumns=160; |
752 | } |
753 | |
754 | // misc06 |
755 | else if ( modelL == "misc06" ) { |
756 | probType=continuousWith0_1; |
757 | int intIndicesAt1[]={ |
758 | 1557 ,1560 ,1561 ,1580 ,1585 ,1588 ,1589 ,1614 ,1615 ,1616 , |
759 | 1617 ,1626 ,1630 ,1631 ,1642 ,1643 ,1644 ,1645 ,1650 ,1654 , |
760 | 1658 ,1659 }; |
761 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
762 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
763 | expectedNumberColumns=1808; |
764 | } |
765 | |
766 | // misc07 |
767 | else if ( modelL == "misc07" ) { |
768 | probType=continuousWith0_1; |
769 | int intIndicesAt1[]={21,27,57,103,118,148,185,195,205,209,243, |
770 | 245,247,249,251,253,255,257}; |
771 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
772 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
773 | expectedNumberColumns=260; |
774 | } |
775 | |
776 | // rgn |
777 | else if ( modelL == "rgn" ) { |
778 | probType=continuousWith0_1; |
779 | int intIndicesAt1[]={16 ,49 ,72 ,92 }; |
780 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
781 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
782 | expectedNumberColumns=180; |
783 | } |
784 | |
785 | // mitre |
786 | else if ( modelL == "mitre" ) { |
787 | probType=pure0_1; |
788 | int intIndicesAt1[]={ |
789 | 4,37,67,93,124,154,177,209,240,255,287,319,340, |
790 | 372,403,425,455,486,516,547,579,596,628,661,676, |
791 | 713,744,758,795,825,851,881,910,933,963,993,1021, |
792 | 1052,1082,1111,1141,1172,1182,1212,1242,1272,1303, |
793 | 1332,1351,1382,1414,1445,1478,1508,1516,1546,1576, |
794 | 1601,1632,1662,1693,1716,1749,1781,1795,1828,1860, |
795 | 1876,1909,1940,1962,1994,2027,2058,2091,2122,2128, |
796 | 2161,2192,2226,2261,2290,2304,2339,2369,2393,2426, |
797 | 2457,2465,2500,2529,2555,2590,2619,2633,2665,2696, |
798 | 2728,2760,2792,2808,2838,2871,2896,2928,2960,2981, |
799 | 3014,3045,3065,3098,3127,3139,3170,3200,3227,3260, |
800 | 3292,3310,3345,3375,3404,3437,3467,3482,3513,3543, |
801 | 3558,3593,3623,3653,3686,3717,3730,3762,3794,3814, |
802 | 3845,3877,3901,3936,3966,3988,4019,4049,4063,4096, |
803 | 4126,4153,4186,4216,4245,4276,4306,4318,4350,4383, |
804 | 4402,4435,4464,4486,4519,4550,4578,4611,4641,4663, |
805 | 4695,4726,4738,4768,4799,4830,4863,4892,4919,4950, |
806 | 4979,4991,5024,5054,5074,5107,5137,5165,5198,5228, |
807 | 5244,5275,5307,5325,5355,5384,5406,5436,5469,5508, |
808 | 5538,5568,5585,5615,5646,5675,5705,5734,5745,5774, |
809 | 5804,5836,5865,5895,5924,5954,5987,6001,6033,6064, |
810 | 6096,6126,6155,6172,6202,6232,6250,6280,6309,6328, |
811 | 6361,6392,6420,6450,6482,6500,6531,6561,6598,6629, |
812 | 6639,6669,6699,6731,6762,6784,6814,6844,6861,6894, |
813 | 6924,6955,6988,7018,7042,7075,7105,7116,7149,7179, |
814 | 7196,7229,7258,7282,7312,7345,7376,7409,7438,7457, |
815 | 7487,7520,7534,7563,7593,7624,7662,7692,7701,7738, |
816 | 7769,7794,7827,7857,7872,7904,7935,7960,7990,8022, |
817 | 8038,8071,8101,8137,8167,8199,8207,8240,8269,8301, |
818 | 8334,8363,8387,8420,8450,8470,8502,8534,8550,8580, |
819 | 8610,8639,8669,8699,8709,8741,8772,8803,8834,8867, |
820 | 8883,8912,8942,8973,9002,9032,9061,9094,9124,9128, |
821 | 9159,9201,9232,9251,9280,9310,9333,9338,9405,9419, |
822 | 9423,9428,9465,9472,9482,9526,9639,9644,9666,9673, |
823 | 9729,9746,9751,9819,9832,9833,9894,9911,9934,9990, |
824 | 10007,10012,10083,10090,10095,10137,10176,10177, |
825 | 10271,10279,10280,10288,10292,10298,10299,10319, |
826 | 10351,10490,10505,10553,10571,10579,10600,10612, |
827 | 10683,10688}; |
828 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
829 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
830 | expectedNumberColumns=10724; |
831 | } |
832 | |
833 | |
834 | // cap6000 |
835 | else if ( modelL == "cap6000" ) { |
836 | probType=pure0_1; |
837 | int intIndicesAt1[]={ |
838 | 46 ,141 ,238 ,250 ,253 ,257 ,260 ,261 ,266 ,268 , |
839 | 270 ,274 ,277 ,280 ,289 ,292 ,296 ,297 ,300 ,305 , |
840 | 306 ,310 ,314 ,317 ,319 ,321 ,324 ,329 ,332 ,333 , |
841 | 336 ,339 ,343 ,345 ,350 ,353 ,354 ,357 ,361 ,364 , |
842 | 367 ,370 ,372 ,376 ,379 ,381 ,386 ,387 ,392 ,395 , |
843 | 397 ,400 ,402 ,405 ,410 ,413 ,416 ,419 ,420 ,425 , |
844 | 427 ,430 ,434 ,436 ,441 ,444 ,447 ,451 ,454 ,456 , |
845 | 459 ,463 ,467 ,468 ,473 ,474 ,479 ,480 ,483 ,488 , |
846 | 490 ,493 ,496 ,499 ,501 ,506 ,509 ,511 ,522 ,536 , |
847 | 537 ,552 ,563 ,565 ,569 ,571 ,574 ,576 ,580 ,582 , |
848 | 588 ,591 ,596 ,597 ,601 ,607 ,609 ,613 ,616 ,618 , |
849 | 621 ,626 ,632 ,634 ,644 ,647 ,648 ,658 ,661 ,663 , |
850 | 668 ,670 ,680 ,688 ,691 ,695 ,698 ,699 ,703 ,713 , |
851 | 721 ,723 ,730 ,740 ,742 ,746 ,751 ,755 ,757 ,760 , |
852 | 765 ,770 ,775 ,777 ,781 ,785 ,792 ,796 ,801 ,804 , |
853 | 812 ,821 ,826 ,834 ,838 ,840 ,844 ,872 ,881 ,883 , |
854 | 887 ,888 ,899 ,904 ,906 ,917 ,919 ,931 ,938 ,945 , |
855 | 948 ,953 ,958 ,962 ,963 ,970 ,976 ,979 ,981 ,997 , |
856 | 1000 ,1004 ,1005 ,1009 ,1013 ,1014 ,1024 ,1026 ,1034 ,1039 , |
857 | 1055 ,1061 ,1069 ,1076 ,1078 ,1084 ,1089 ,1099 ,1101 ,1104 , |
858 | 1109 ,1111 ,1124 ,1127 ,1129 ,1133 ,1138 ,1140 ,1145 ,1148 , |
859 | 1149 ,1159 ,1166 ,1167 ,1171 ,1180 ,1187 ,1194 ,1197 ,1205 , |
860 | 1224 ,1228 ,1246 ,1255 ,1261 ,1269 ,1275 ,1286 ,1289 ,1291 , |
861 | 1311 ,1390 ,1406 ,1410 ,1413 ,1418 ,1427 ,1435 ,1440 ,1446 , |
862 | 1453 ,1455 ,1468 ,1477 ,1479 ,1486 ,1492 ,1502 ,1508 ,1509 , |
863 | 1525 ,1551 ,1559 ,1591 ,1643 ,1657 ,1660 ,1662 ,1677 ,1710 , |
864 | 1719 ,1752 ,1840 ,1862 ,1870 ,1891 ,1936 ,1986 ,2087 ,2178 , |
865 | 2203 ,2212 ,2311 ,2503 ,2505 ,2530 ,2532 ,2557 ,2561 ,2564 , |
866 | 2567 ,2571 ,2578 ,2581 ,2588 ,2591 ,2594 ,2595 ,2598 ,2603 , |
867 | 2605 ,2616 ,2620 ,2624 ,2630 ,2637 ,2643 ,2647 ,2654 ,2656 , |
868 | 2681 ,2689 ,2699 ,2703 ,2761 ,2764 ,2867 ,2871 ,2879 ,2936 , |
869 | 2971 ,3024 ,3076 ,3094 ,3119 ,3378 ,3435 ,3438 ,3446 ,3476 , |
870 | 3570 ,3605 ,3646 ,3702 ,3725 ,3751 ,3755 ,3758 ,3760 ,3764 , |
871 | 3765 ,3770 ,3773 ,3776 ,3779 ,3782 ,3784 ,3788 ,3791 ,3792 , |
872 | 3796 ,3799 ,3803 ,3804 ,3807 ,3811 ,3814 ,3816 ,3821 ,3823 , |
873 | 3826 ,3830 ,3831 ,3836 ,3838 ,3840 ,3844 ,3847 ,3851 ,3852 , |
874 | 3855 ,3859 ,3863 ,3864 ,3867 ,3895 ,3921 ,3948 ,3960 ,3970 , |
875 | 3988 ,4026 ,4032 ,4035 ,4036 ,4038 ,4041 ,4042 ,4045 ,4046 , |
876 | 4048 ,4050 ,4053 ,4055 ,4057 ,4058 ,4060 ,4063 ,4065 ,4067 , |
877 | 4069 ,4071 ,4072 ,4075 ,4076 ,4079 ,4081 ,4082 ,4085 ,4087 , |
878 | 4088 ,4090 ,4092 ,4094 ,4097 ,4099 ,4100 ,4102 ,4104 ,4107 , |
879 | 4109 ,4111 ,4113 ,4114 ,4207 ,4209 ,4213 ,4216 ,4220 ,4227 , |
880 | 4233 ,4238 ,4240 ,4248 ,4253 ,4259 ,4260 ,4267 ,4268 ,4273 , |
881 | 4280 ,4284 ,4290 ,4292 ,4295 ,4301 ,4303 ,4311 ,4319 ,4326 , |
882 | 4329 ,4332 ,4335 ,4336 ,4344 ,4349 ,4351 ,4355 ,4363 ,4371 , |
883 | 4372 ,4378 ,4388 ,4401 ,4409 ,4413 ,4417 ,4420 ,4435 ,4441 , |
884 | 4451 ,4458 ,4463 ,4468 ,4474 ,4478 ,4482 ,4483 ,4488 ,4497 , |
885 | 4499 ,4522 ,4614 ,4626 ,4645 ,4648 ,4751 ,4755 ,4758 ,4759 , |
886 | 4763 ,4840 ,4846 ,4859 ,4865 ,4883 ,4943 ,4970 ,5030 ,5084 , |
887 | 5124 ,5181 ,5224 ,5236 ,5238 ,5328 ,5362 ,5375 ,5378 ,5434 , |
888 | 5478 ,5483 ,5562 ,5581 ,5586 ,5591 ,5644 ,5684 }; |
889 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
890 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
891 | expectedNumberColumns=6000; |
892 | } |
893 | |
894 | // gen |
895 | else if ( modelL == "gen" ) { |
896 | probType=generalMip; |
897 | int intIndicesV[]={15,34,35,36,37,38,39,40,41,42,43,44,45,57,58, |
898 | 59,60,61,62,63,64,65,66,67,68,69,84,85,86,87,88,89,90,91,92, |
899 | 93,107,108,109,110,111,112,113,114,120,121,122,123,124,125, |
900 | 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140, |
901 | 141,142,143,432,433,434,435,436}; |
902 | double intSolnV[] = {1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1., |
903 | 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1., |
904 | 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1., |
905 | 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,23.,12.,11.,14.,16.}; |
906 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
907 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
908 | expectedNumberColumns=870; |
909 | } |
910 | |
911 | // dsbmip |
912 | else if ( modelL == "dsbmip" ) { |
913 | probType=generalMip; |
914 | int intIndicesV[]={ |
915 | 1694 ,1695 ,1696 ,1697 ,1698 ,1699 ,1700 ,1701 ,1702 ,1703 , |
916 | 1729 ,1745 ,1748 ,1751 ,1753 ,1754 ,1758 ,1760 ,1766 ,1771 , |
917 | 1774 ,1777 ,1781 ,1787 ,1792 ,1796 ,1800 ,1805 ,1811 ,1817 , |
918 | 1819 ,1821 ,1822 ,1824 ,1828 ,1835 ,1839 ,1841 ,1844 ,1845 , |
919 | 1851 ,1856 ,1860 ,1862 ,1864 ,1869 ,1875 ,1883 }; |
920 | double intSolnV[]={ |
921 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
922 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
923 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
924 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
925 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. }; |
926 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
927 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
928 | expectedNumberColumns=1886; |
929 | } |
930 | |
931 | |
932 | // gesa2 |
933 | else if ( modelL == "gesa2" ) { |
934 | probType=generalMip; |
935 | int intIndicesV[]={ |
936 | 323 ,324 ,336 ,337 ,349 ,350 ,362 ,363 ,375 ,376 , |
937 | 388 ,389 ,401 ,402 ,414 ,415 ,423 ,424 ,426 ,427 , |
938 | 428 ,436 ,437 ,439 ,440 ,441 ,449 ,450 ,452 ,453 , |
939 | 454 ,462 ,463 ,465 ,466 ,467 ,475 ,476 ,478 ,479 , |
940 | 480 ,489 ,491 ,492 ,493 ,502 ,504 ,505 ,506 ,514 , |
941 | 515 ,517 ,518 ,519 ,527 ,528 ,530 ,531 ,532 ,537 , |
942 | 538 ,540 ,541 ,543 ,544 ,545 ,550 ,551 ,553 ,554 , |
943 | 556 ,557 ,558 ,563 ,564 ,566 ,567 ,569 ,570 ,571 , |
944 | 573 ,577 ,579 ,580 ,582 ,583 ,584 ,592 ,593 ,595 , |
945 | 596 ,597 ,605 ,606 ,608 ,609 ,610 ,622 ,623 ,1130 , |
946 | 1131 ,1134 ,1135 ,1138 ,1139 ,1142 ,1143 ,1146 ,1147 ,1150 , |
947 | 1151 ,1154 ,1155 ,1158 ,1159 ,1161 ,1162 ,1165 ,1166 ,1169 , |
948 | 1170 ,1173 ,1174 ,1177 ,1178 ,1182 ,1183 ,1185 ,1186 ,1189 , |
949 | 1190 ,1193 ,1194 ,1196 ,1197 ,1200 ,1201 ,1204 ,1205 ,1209 , |
950 | 1210 ,1213 ,1214 ,1218 ,1222 ,1223 }; |
951 | double intSolnV[]={ |
952 | 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , |
953 | 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,2. ,1. , |
954 | 2. ,3. ,2. ,2. ,1. ,2. ,3. ,2. ,2. ,1. , |
955 | 2. ,3. ,2. ,2. ,1. ,2. ,2. ,2. ,2. ,1. , |
956 | 2. ,2. ,2. ,1. ,2. ,2. ,2. ,1. ,2. ,1. , |
957 | 2. ,2. ,1. ,2. ,2. ,2. ,2. ,1. ,2. ,1. , |
958 | 4. ,3. ,3. ,2. ,1. ,2. ,1. ,4. ,3. ,3. , |
959 | 2. ,1. ,2. ,1. ,4. ,3. ,3. ,2. ,1. ,2. , |
960 | 1. ,4. ,3. ,3. ,2. ,1. ,2. ,3. ,3. ,2. , |
961 | 1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. ,2. ,1. , |
962 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
963 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
964 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
965 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
966 | 1. ,1. ,1. ,1. ,1. ,1. }; |
967 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
968 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
969 | expectedNumberColumns=1224; |
970 | } |
971 | |
972 | // gesa2_o |
973 | else if ( modelL == "gesa2_o" ) { |
974 | probType=generalMip; |
975 | int intIndicesV[]={ |
976 | 315 ,316 ,328 ,329 ,341 ,342 ,354 ,355 ,367 ,368 , |
977 | 380 ,381 ,393 ,394 ,406 ,407 ,419 ,420 ,423 ,427 , |
978 | 428 ,432 ,433 ,436 ,440 ,441 ,445 ,446 ,449 ,453 , |
979 | 454 ,458 ,459 ,462 ,466 ,467 ,471 ,472 ,475 ,479 , |
980 | 480 ,484 ,485 ,492 ,493 ,497 ,498 ,505 ,506 ,510 , |
981 | 511 ,514 ,518 ,519 ,523 ,524 ,527 ,531 ,532 ,536 , |
982 | 537 ,539 ,540 ,543 ,544 ,545 ,549 ,550 ,552 ,553 , |
983 | 556 ,557 ,558 ,562 ,563 ,565 ,566 ,569 ,570 ,571 , |
984 | 575 ,576 ,577 ,579 ,582 ,583 ,584 ,588 ,589 ,592 , |
985 | 596 ,597 ,601 ,602 ,605 ,609 ,610 ,614 ,615 ,735 , |
986 | 739 ,740 ,748 ,826 ,839 ,851 ,852 ,855 ,856 ,889 , |
987 | 1136 ,1137 ,1138 ,1139 ,1140 ,1142 ,1143 ,1144 ,1145 ,1146 , |
988 | 1147 ,1148 ,1149 ,1152 ,1153 ,1154 ,1155 ,1156 ,1157 ,1158 , |
989 | 1159 ,1165 ,1175 ,1193 ,1194 ,1195 ,1200 ,1201 ,1202 ,1203 , |
990 | 1204 ,1205 ,1206 ,1207 ,1208 ,1209 ,1210 ,1211 ,1212 ,1213 , |
991 | 1214 ,1215 ,1216 ,1220 ,1221 ,1222 ,1223 }; |
992 | double intSolnV[]={ |
993 | 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , |
994 | 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , |
995 | 2. ,1. ,2. ,3. ,2. ,2. ,1. ,2. ,3. ,2. , |
996 | 2. ,1. ,2. ,3. ,2. ,2. ,1. ,2. ,2. ,2. , |
997 | 2. ,1. ,2. ,2. ,2. ,1. ,2. ,2. ,2. ,1. , |
998 | 2. ,1. ,2. ,2. ,1. ,2. ,2. ,2. ,2. ,1. , |
999 | 2. ,1. ,3. ,4. ,3. ,2. ,1. ,2. ,1. ,3. , |
1000 | 4. ,3. ,2. ,1. ,2. ,1. ,3. ,4. ,3. ,2. , |
1001 | 1. ,2. ,1. ,3. ,4. ,3. ,2. ,1. ,2. ,3. , |
1002 | 3. ,2. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. , |
1003 | 2. ,2. ,2. ,1. ,1. ,1. ,1. ,4. ,1. ,1. , |
1004 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1005 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1006 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1007 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1008 | 1. ,1. ,1. ,1. ,1. ,1. ,1. }; |
1009 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
1010 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
1011 | expectedNumberColumns=1224; |
1012 | } |
1013 | |
1014 | // gesa3 |
1015 | else if ( modelL == "gesa3" ) { |
1016 | probType=generalMip; |
1017 | int intIndicesV[]={ |
1018 | 298 ,299 ,310 ,311 ,322 ,323 ,334 ,335 ,346 ,347 , |
1019 | 358 ,359 ,365 ,370 ,371 ,377 ,378 ,380 ,382 ,383 , |
1020 | 389 ,390 ,392 ,394 ,395 ,401 ,402 ,404 ,405 ,406 , |
1021 | 407 ,413 ,414 ,416 ,417 ,418 ,419 ,425 ,426 ,428 , |
1022 | 429 ,430 ,431 ,437 ,438 ,440 ,441 ,442 ,443 ,449 , |
1023 | 450 ,452 ,454 ,455 ,461 ,462 ,464 ,466 ,467 ,473 , |
1024 | 474 ,476 ,478 ,479 ,485 ,486 ,488 ,490 ,491 ,497 , |
1025 | 498 ,500 ,502 ,503 ,509 ,510 ,512 ,514 ,515 ,521 , |
1026 | 522 ,524 ,526 ,527 ,533 ,534 ,536 ,538 ,539 ,545 , |
1027 | 546 ,548 ,550 ,551 ,557 ,558 ,560 ,562 ,563 ,569 , |
1028 | 572 ,574 ,575 ,1058 ,1059 ,1062 ,1063 ,1066 ,1067 ,1070 , |
1029 | 1071 ,1074 ,1075 ,1078 ,1079 ,1082 ,1083 ,1086 ,1087 ,1090 , |
1030 | 1091 ,1094 ,1095 ,1098 ,1099 ,1102 ,1103 ,1106 ,1107 ,1110 , |
1031 | 1111 ,1114 ,1115 ,1118 ,1119 ,1122 ,1123 ,1126 ,1127 ,1130 , |
1032 | 1131 ,1134 ,1135 ,1138 ,1139 ,1142 ,1143 ,1146 ,1147 ,1150 , |
1033 | 1151 }; |
1034 | double intSolnV[]={ |
1035 | 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , |
1036 | 1. ,2. ,1. ,1. ,2. ,2. ,1. ,1. ,1. ,2. , |
1037 | 2. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,2. ,1. , |
1038 | 2. ,2. ,1. ,2. ,2. ,1. ,2. ,2. ,1. ,2. , |
1039 | 2. ,1. ,2. ,2. ,1. ,2. ,1. ,1. ,2. ,2. , |
1040 | 1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. ,2. ,2. , |
1041 | 1. ,2. ,1. ,2. ,4. ,1. ,2. ,1. ,2. ,4. , |
1042 | 2. ,4. ,1. ,2. ,4. ,2. ,4. ,1. ,2. ,4. , |
1043 | 2. ,4. ,1. ,2. ,4. ,1. ,4. ,1. ,2. ,3. , |
1044 | 1. ,3. ,1. ,2. ,2. ,1. ,2. ,1. ,2. ,1. , |
1045 | 1. ,1. ,2. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1046 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1047 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1048 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1049 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1050 | 1. }; |
1051 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
1052 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
1053 | expectedNumberColumns=1152; |
1054 | } |
1055 | |
1056 | // gesa3_o |
1057 | else if ( modelL == "gesa3_o" ) { |
1058 | probType=generalMip; |
1059 | int intIndicesV[]={ |
1060 | 291 ,292 ,303 ,304 ,315 ,316 ,327 ,328 ,339 ,340 , |
1061 | 351 ,352 ,361 ,363 ,364 ,373 ,374 ,375 ,376 ,379 , |
1062 | 385 ,386 ,387 ,388 ,391 ,397 ,398 ,399 ,400 ,403 , |
1063 | 407 ,409 ,410 ,411 ,412 ,415 ,419 ,421 ,422 ,423 , |
1064 | 424 ,427 ,431 ,433 ,434 ,435 ,436 ,439 ,443 ,445 , |
1065 | 446 ,447 ,448 ,451 ,457 ,458 ,459 ,460 ,463 ,469 , |
1066 | 470 ,471 ,472 ,475 ,481 ,482 ,483 ,484 ,487 ,493 , |
1067 | 494 ,495 ,496 ,499 ,505 ,506 ,507 ,508 ,511 ,517 , |
1068 | 518 ,519 ,520 ,523 ,529 ,530 ,531 ,532 ,535 ,541 , |
1069 | 542 ,543 ,544 ,547 ,553 ,554 ,555 ,556 ,559 ,565 , |
1070 | 566 ,567 ,568 ,578 ,590 ,602 ,614 ,626 ,638 ,649 , |
1071 | 650 ,661 ,662 ,667 ,674 ,686 ,695 ,698 ,710 ,722 , |
1072 | 734 ,746 ,758 ,769 ,770 ,782 ,787 ,794 ,806 ,818 , |
1073 | 830 ,842 ,854 ,1080 ,1081 ,1082 ,1083 ,1084 ,1085 ,1086 , |
1074 | 1087 ,1088 ,1089 ,1090 ,1091 ,1092 ,1093 ,1094 ,1095 ,1096 , |
1075 | 1097 ,1098 ,1099 ,1100 ,1101 ,1102 ,1103 ,1128 ,1129 ,1130 , |
1076 | 1131 ,1132 ,1133 ,1134 ,1135 ,1136 ,1137 ,1138 ,1139 ,1140 , |
1077 | 1141 ,1142 ,1143 ,1144 ,1145 ,1146 ,1147 ,1148 ,1149 ,1150 , |
1078 | 1151 }; |
1079 | double intSolnV[]={ |
1080 | 1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. ,1. ,2. , |
1081 | 1. ,2. ,1. ,1. ,2. ,2. ,1. ,1. ,2. ,1. , |
1082 | 2. ,2. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. , |
1083 | 2. ,2. ,2. ,1. ,2. ,1. ,2. ,2. ,2. ,1. , |
1084 | 2. ,1. ,2. ,2. ,2. ,1. ,2. ,1. ,1. ,2. , |
1085 | 2. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. ,2. , |
1086 | 2. ,1. ,2. ,1. ,4. ,2. ,1. ,2. ,1. ,4. , |
1087 | 4. ,1. ,2. ,2. ,4. ,4. ,1. ,2. ,2. ,4. , |
1088 | 4. ,1. ,2. ,2. ,4. ,4. ,1. ,2. ,1. ,3. , |
1089 | 3. ,1. ,2. ,1. ,2. ,2. ,1. ,2. ,1. ,1. , |
1090 | 1. ,1. ,2. ,4. ,4. ,4. ,4. ,4. ,4. ,1. , |
1091 | 4. ,1. ,4. ,1. ,4. ,4. ,2. ,4. ,4. ,4. , |
1092 | 4. ,4. ,4. ,2. ,4. ,4. ,1. ,4. ,4. ,4. , |
1093 | 4. ,4. ,4. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1094 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1095 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1096 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1097 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1098 | 1. }; |
1099 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
1100 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
1101 | expectedNumberColumns=1152; |
1102 | } |
1103 | |
1104 | // noswot |
1105 | else if ( modelL == "noswot_z" ) { |
1106 | probType=generalMip; |
1107 | int intIndicesV[]={1}; |
1108 | double intSolnV[]={1.0}; |
1109 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
1110 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
1111 | expectedNumberColumns=128; |
1112 | } |
1113 | |
1114 | |
1115 | // qnet1 |
1116 | else if ( modelL == "qnet1" ) { |
1117 | probType=generalMip; |
1118 | int intIndicesV[]={ |
1119 | 61 ,69 ,79 ,81 ,101 ,104 ,111 ,115 ,232 ,265 , |
1120 | 267 ,268 ,269 ,285 ,398 ,412 ,546 ,547 ,556 ,642 , |
1121 | 709 ,718 ,721 ,741 ,760 ,1073 ,1077 ,1084 ,1097 ,1100 , |
1122 | 1104 ,1106 ,1109 ,1248 ,1259 ,1260 ,1263 ,1265 ,1273 ,1274 , |
1123 | 1276 ,1286 ,1291 ,1302 ,1306 ,1307 ,1316 ,1350 ,1351 ,1363 , |
1124 | 1366 ,1368 ,1371 ,1372 ,1380 ,1381 ,1385 ,1409 }; |
1125 | double intSolnV[]={ |
1126 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1127 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1128 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1129 | 1. ,1. ,1. ,1. ,2. ,1. ,1. ,1. ,1. ,3. , |
1130 | 1. ,2. ,1. ,1. ,1. ,1. ,6. ,3. ,1. ,1. , |
1131 | 5. ,2. ,1. ,2. ,2. ,1. ,2. ,1. }; |
1132 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
1133 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
1134 | expectedNumberColumns=1541; |
1135 | } |
1136 | |
1137 | // qnet1_o (? marginally different from qnet1) |
1138 | else if ( modelL == "qnet1_o" ) { |
1139 | probType=generalMip; |
1140 | int intIndicesV[]={ |
1141 | 61 ,69 ,79 ,81 ,101 ,106 ,111 ,114 ,115 ,232 , |
1142 | 266 ,267 ,268 ,269 ,277 ,285 ,398 ,412 ,546 ,547 , |
1143 | 556 ,642 ,709 ,718 ,721 ,741 ,760 ,1073 ,1077 ,1084 , |
1144 | 1097 ,1100 ,1104 ,1106 ,1109 ,1248 ,1259 ,1260 ,1263 ,1265 , |
1145 | 1273 ,1274 ,1276 ,1286 ,1291 ,1302 ,1306 ,1307 ,1316 ,1350 , |
1146 | 1351 ,1363 ,1366 ,1368 ,1371 ,1372 ,1380 ,1381 ,1385 ,1409 }; |
1147 | double intSolnV[]={ |
1148 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1149 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1150 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. , |
1151 | 1. ,1. ,1. ,1. ,1. ,1. ,2. ,1. ,1. ,1. , |
1152 | 1. ,3. ,1. ,2. ,1. ,1. ,1. ,1. ,6. ,3. , |
1153 | 1. ,1. ,5. ,2. ,1. ,2. ,2. ,1. ,2. ,1. }; |
1154 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
1155 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
1156 | expectedNumberColumns=1541; |
1157 | } |
1158 | |
1159 | // gt2 |
1160 | else if ( modelL == "gt2" ) { |
1161 | probType=generalMip; |
1162 | int intIndicesV[]={82,85,88,92,94,95,102,103,117,121,122,128, |
1163 | 141,146,151,152,165,166,176,179}; |
1164 | double intSolnV[] = {1.,3.,1.,5.,2.,1.,1.,2.,2.,2.,1.,2.,1.,1., |
1165 | 2.,1.,1.,6.,1.,1.}; |
1166 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
1167 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
1168 | expectedNumberColumns=188; |
1169 | } |
1170 | |
1171 | // fiber |
1172 | else if ( modelL == "fiber" ) { |
1173 | probType=continuousWith0_1; |
1174 | int intIndicesAt1[]={36,111,190,214,235,270,338,346,372,386, |
1175 | 421,424,441,470,473,483,484,498,580,594,597,660,689,735, |
1176 | 742,761,762,776,779,817,860,1044,1067,1122,1238}; |
1177 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
1178 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
1179 | expectedNumberColumns=1298; |
1180 | } |
1181 | |
1182 | // vpm1 |
1183 | else if ( modelL == "vpm1" ) { |
1184 | probType=continuousWith0_1; |
1185 | int intIndicesAt1[]= |
1186 | { 180,181,182,185,195,211,214,226,231,232,244,251,263,269, |
1187 | 285,294,306,307,314, 319}; |
1188 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
1189 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
1190 | expectedNumberColumns=378; |
1191 | } |
1192 | |
1193 | // vpm2 |
1194 | else if ( modelL == "vpm2" ) { |
1195 | probType=continuousWith0_1; |
1196 | int intIndicesAt1[]= |
1197 | {170,173,180,181,182,185,193,194,196,213,219,220,226, |
1198 | 245,251,262,263,267,269,273,288,289,294,319,320}; |
1199 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
1200 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
1201 | expectedNumberColumns=378; |
1202 | } |
1203 | // markshare1 |
1204 | else if ( modelL == "markshare1" ) { |
1205 | probType=continuousWith0_1; |
1206 | int intIndicesAt1[]= |
1207 | {12 ,13 ,17 ,18 ,22 ,27 ,28 ,29 ,33 ,34 ,35 ,36 , |
1208 | 39 ,42 ,43 ,44 ,46 ,47 ,49 ,51 ,52 ,53 ,54 ,55 ,59 }; |
1209 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
1210 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
1211 | expectedNumberColumns=62; |
1212 | } |
1213 | |
1214 | // markshare2 |
1215 | else if ( modelL == "markshare2" ) { |
1216 | probType=continuousWith0_1; |
1217 | int intIndicesAt1[]= |
1218 | {16 ,21 ,25 ,26 ,29 ,30 ,31 ,32 ,34 ,35 , |
1219 | 37 ,40 ,42 ,44 ,45 ,47 ,48 ,52 ,53 ,57 , |
1220 | 58 ,59 ,60 ,61 ,62 ,63 ,65 ,71 ,73 }; |
1221 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
1222 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
1223 | expectedNumberColumns=74; |
1224 | } |
1225 | |
1226 | // l152lav |
1227 | else if ( modelL == "l152lav" ) { |
1228 | probType=pure0_1; |
1229 | int intIndicesAt1[]={1,16,30,33,67,111,165,192,198,321,411,449, |
1230 | 906,961,981,1052,1075,1107,1176,1231,1309,1415,1727,1847, |
1231 | 1902,1917,1948,1950}; |
1232 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
1233 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
1234 | expectedNumberColumns=1989; |
1235 | } |
1236 | |
1237 | // bell5 |
1238 | else if ( modelL == "bell5" ) { |
1239 | probType=generalMip; |
1240 | int intIndicesV[]={ |
1241 | 0 ,1 ,2 ,3 ,4 ,6 ,33 ,34 ,36 ,47 , |
1242 | 48 ,49 ,50 ,51 ,52 ,53 ,54 ,56 }; |
1243 | double intSolnV[]={ |
1244 | 1. ,1. ,1. ,1. ,1. ,1. ,1. ,1. ,11. ,2. , |
1245 | 38. ,2. ,498. ,125. ,10. ,17. ,41. ,19. }; |
1246 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
1247 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
1248 | expectedNumberColumns=104; |
1249 | } |
1250 | |
1251 | // blend2 |
1252 | else if ( modelL == "blend2" ) { |
1253 | probType=generalMip; |
1254 | int intIndicesV[]={24,35,44,45,46,52,63,64,70,71,76,84,85, |
1255 | 132,134,151,152,159,164,172,173,289,300,309,310,311, |
1256 | 317,328,329,335,336,341,349,350}; |
1257 | double intSolnV[] = {2.,1.,1.,1.,1.,1.,1.,1.,2.,1.,1.,1., |
1258 | 2.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1., |
1259 | 1.,1.,1.,1.,1.,1.,1.,1.,1.}; |
1260 | int vecLen = sizeof(intIndicesV)/sizeof(int); |
1261 | intSoln.setVector(vecLen,intIndicesV,intSolnV); |
1262 | expectedNumberColumns=353; |
1263 | } |
1264 | |
1265 | // seymour1 |
1266 | else if ( modelL == "seymour_1" ) { |
1267 | probType=continuousWith0_1; |
1268 | int intIndicesAt1[]= |
1269 | {0,2,3,4,6,7,8,11,12,15,18,22,23,25,27,31,32,34,35,36,37,39,40,41,42,44,45,46,49,51,54,55,56,58,61,62,63,65,67,68,69,70,71,75,79,81,82,84,85,86,87,88,89,91,93,94,95,97,98,99,101,102,103,104,106,108,110,111,112,116,118,119,120,122,123,125,126,128,129,130,131,135,140,141,142,143,144,148,149,151,152,153,156,158,160,162,163,164,165,167,169,170,173,177,178,179,181,182,186,188,189,192,193,200,201,202,203,204,211,214,218,226,227,228,231,233,234,235,238,242,244,246,249,251,252,254,257,259,260,263,266,268,270,271,276,278,284,286,288,289,291,292,299,305,307,308,311,313,315,316,317,319,321,325,328,332,334,335,337,338,340,343,346,347,354,355,357,358,365,369,372,373,374,375,376,379,381,383,386,392,396,399,402,403,412,416,423,424,425,427,430,431,432,436,437,438,440,441,443,449,450,451,452}; |
1270 | int numIndices = sizeof(intIndicesAt1)/sizeof(int); |
1271 | intSoln.setConstant(numIndices,intIndicesAt1,1.0); |
1272 | probType=generalMip; |
1273 | expectedNumberColumns=1372; |
1274 | } |
1275 | |
1276 | // check to see if the model parameter is |
1277 | // a known problem. |
1278 | if ( probType != undefined && si.getNumCols() == expectedNumberColumns) { |
1279 | |
1280 | // Specified model is a known problem |
1281 | |
1282 | numberColumns_ = si.getNumCols(); |
1283 | |
1284 | integerVariable_= new bool[numberColumns_]; |
1285 | knownSolution_=new double[numberColumns_]; |
1286 | //CoinFillN(integerVariable_, numberColumns_,0); |
1287 | //CoinFillN(knownSolution_,numberColumns_,0.0); |
1288 | |
1289 | if ( probType == pure0_1 ) { |
1290 | |
1291 | // mark all variables as integer |
1292 | CoinFillN(integerVariable_,numberColumns_,true); |
1293 | // set solution to 0.0 for all not mentioned |
1294 | CoinFillN(knownSolution_,numberColumns_,0.0); |
1295 | |
1296 | // mark column solution that have value 1 |
1297 | for ( i=0; i<intSoln.getNumElements(); i++ ) { |
1298 | int col = intSoln.getIndices()[i]; |
1299 | knownSolution_[col] = intSoln.getElements()[i]; |
1300 | assert( knownSolution_[col]==1. ); |
1301 | } |
1302 | |
1303 | } |
1304 | else { |
1305 | // Probtype is continuousWith0_1 or generalMip |
1306 | assert( probType==continuousWith0_1 || probType==generalMip ); |
1307 | |
1308 | OsiSolverInterface * siCopy = si.clone(); |
1309 | assert(siCopy->getMatrixByCol()->isEquivalent(*si.getMatrixByCol())); |
1310 | |
1311 | // Loop once for each column looking for integer variables |
1312 | for (i=0;i<numberColumns_;i++) { |
1313 | |
1314 | // Is the this an integer variable? |
1315 | if(siCopy->isInteger(i)) { |
1316 | |
1317 | // integer variable found |
1318 | integerVariable_[i]=true; |
1319 | |
1320 | |
1321 | // Determine optimal solution value for integer i |
1322 | // from values saved in intSoln and probType. |
1323 | double soln; |
1324 | if ( probType==continuousWith0_1 ) { |
1325 | |
1326 | // Since 0_1 problem, had better be binary |
1327 | assert( siCopy->isBinary(i) ); |
1328 | |
1329 | // intSoln only contains integers with optimal value of 1 |
1330 | if ( intSoln.isExistingIndex(i) ) { |
1331 | soln = 1.0; |
1332 | assert( intSoln[i]==1. ); |
1333 | } |
1334 | else { |
1335 | soln = 0.0; |
1336 | } |
1337 | |
1338 | } else { |
1339 | // intSoln only contains integers with nonzero optimal values |
1340 | if ( intSoln.isExistingIndex(i) ) { |
1341 | soln = intSoln[i]; |
1342 | assert( intSoln[i]>=1. ); |
1343 | } |
1344 | else { |
1345 | soln = 0.0; |
1346 | } |
1347 | } |
1348 | |
1349 | // Set bounds in copyied problem to fix variable to its solution |
1350 | siCopy->setColUpper(i,soln); |
1351 | siCopy->setColLower(i,soln); |
1352 | |
1353 | } |
1354 | else { |
1355 | // this is not an integer variable |
1356 | integerVariable_[i]=false; |
1357 | } |
1358 | } |
1359 | |
1360 | // All integers have been fixed at optimal value. |
1361 | // Now solve to get continuous values |
1362 | #if 0 |
1363 | assert( siCopy->getNumRows()==5); |
1364 | assert( siCopy->getNumCols()==8); |
1365 | int r,c; |
1366 | for ( r=0; r<siCopy->getNumRows(); r++ ) { |
1367 | std::cerr <<"rhs[" <<r <<"]=" <<(si.rhs())[r] <<" " <<(siCopy->rhs())[r] <<std::endl; |
1368 | } |
1369 | for ( c=0; c<siCopy->getNumCols(); c++ ) { |
1370 | std::cerr <<"collower[" <<c <<"]=" <<(si.collower())[c] <<" " <<(siCopy->collower())[c] <<std::endl; |
1371 | std::cerr <<"colupper[" <<c <<"]=" <<(si.colupper())[c] <<" " <<(siCopy->colupper())[c] <<std::endl; |
1372 | } |
1373 | #endif |
1374 | // make sure all slack basis |
1375 | //CoinWarmStartBasis allSlack; |
1376 | //siCopy->setWarmStart(&allSlack); |
1377 | siCopy->setHintParam(OsiDoScale,false); |
1378 | siCopy->initialSolve(); |
1379 | #if 0 |
1380 | for ( c=0; c<siCopy->getNumCols(); c++ ) { |
1381 | std::cerr <<"colsol[" <<c <<"]=" <<knownSolution_[c] <<" " <<(siCopy->colsol())[c] <<std::endl; |
1382 | } |
1383 | OsiRelFltEq eq; |
1384 | assert( eq(siCopy->getObjValue(),3.2368421052632)); |
1385 | #endif |
1386 | assert (siCopy->isProvenOptimal()); |
1387 | knownValue_ = siCopy->getObjValue(); |
1388 | // Save column solution |
1389 | CoinCopyN(siCopy->getColSolution(),numberColumns_,knownSolution_); |
1390 | |
1391 | delete siCopy; |
1392 | } |
1393 | } else if (printActivationNotice) { |
1394 | if (probType != undefined && |
1395 | si.getNumCols() != expectedNumberColumns) { |
1396 | std::cout |
1397 | << std::endl |
1398 | << " OsiRowCutDebugger::activate: expected " << expectedNumberColumns |
1399 | << " cols but see " << si.getNumCols() << "; cannot activate." |
1400 | << std::endl ; |
1401 | } else { |
1402 | std::cout |
1403 | << " OsiRowCutDebugger::activate: unrecognised problem " |
1404 | << model << "; cannot activate." << std::endl ; |
1405 | } |
1406 | } |
1407 | |
1408 | //if (integerVariable_!=NULL) si.rowCutDebugger_=this; |
1409 | |
1410 | return (integerVariable_!=NULL); |
1411 | } |
1412 | |
1413 | /* |
1414 | Activate a row cut debugger using a full solution array. It's up to the user |
1415 | to get it correct. Returns true if the debugger is activated. |
1416 | |
1417 | The solution array must be getNumCols() in length, but only the entries for |
1418 | integer variables need to be correct. |
1419 | |
1420 | keepContinuous defaults to false, but in some uses (nonlinear solvers, for |
1421 | example) it's useful to keep the given values, as they reflect constraints |
1422 | that are not present in the linear relaxation. |
1423 | */ |
1424 | bool |
1425 | OsiRowCutDebugger::activate (const OsiSolverInterface &si, |
1426 | const double *solution, |
1427 | bool keepContinuous) |
1428 | { |
1429 | // set true to get a debug message about activation |
1430 | const bool printActivationNotice = false ; |
1431 | int i ; |
1432 | //get rid of any arrays |
1433 | delete [] integerVariable_ ; |
1434 | delete [] knownSolution_ ; |
1435 | OsiSolverInterface *siCopy = si.clone() ; |
1436 | numberColumns_ = siCopy->getNumCols() ; |
1437 | integerVariable_ = new bool[numberColumns_] ; |
1438 | knownSolution_ = new double[numberColumns_] ; |
1439 | |
1440 | /* |
1441 | Fix the integer variables from the supplied solution (making sure that the |
1442 | values are integer). |
1443 | */ |
1444 | for (i = 0 ; i < numberColumns_ ; i++) { |
1445 | if (siCopy->isInteger(i)) { |
1446 | integerVariable_[i] = true ; |
1447 | double soln = floor(solution[i]+0.5) ; |
1448 | siCopy->setColUpper(i,soln) ; |
1449 | siCopy->setColLower(i,soln) ; |
1450 | } else { |
1451 | integerVariable_[i] = false ; |
1452 | } |
1453 | } |
1454 | /* |
1455 | Solve the lp relaxation, then cache the primal solution and objective. If |
1456 | we're preserving the values of the given continuous variables, we can't |
1457 | trust the solver's calculation of the objective; it may well be using |
1458 | different values for the continuous variables. |
1459 | */ |
1460 | siCopy->setHintParam(OsiDoScale,false); |
1461 | //siCopy->writeMps("bad.mps") ; |
1462 | siCopy->initialSolve() ; |
1463 | if (keepContinuous == false) { |
1464 | if (siCopy->isProvenOptimal()) { |
1465 | CoinCopyN(siCopy->getColSolution(),numberColumns_,knownSolution_) ; |
1466 | knownValue_ = siCopy->getObjValue() ; |
1467 | if (printActivationNotice) { |
1468 | std::cout |
1469 | << std::endl << "OsiRowCutDebugger::activate: activated (opt), z = " |
1470 | << knownValue_ << std::endl ; |
1471 | } |
1472 | } else { |
1473 | if (printActivationNotice) { |
1474 | std::cout |
1475 | << std::endl |
1476 | << "OsiRowCutDebugger::activate: solution was not optimal; " |
1477 | << "cannot activate." << std::endl ; |
1478 | } |
1479 | delete [] integerVariable_ ; |
1480 | delete [] knownSolution_ ; |
1481 | integerVariable_ = NULL ; |
1482 | knownSolution_ = NULL ; |
1483 | knownValue_ = COIN_DBL_MAX ; |
1484 | } |
1485 | } else { |
1486 | CoinCopyN(solution,numberColumns_,knownSolution_) ; |
1487 | const double *c = siCopy->getObjCoefficients() ; |
1488 | knownValue_ = 0.0 ; |
1489 | for (int j = 0 ; j < numberColumns_ ; j++) { |
1490 | knownValue_ += c[j]*solution[j] ; |
1491 | } |
1492 | knownValue_ = knownValue_*siCopy->getObjSense() ; |
1493 | if (printActivationNotice) { |
1494 | std::cout |
1495 | << std::endl |
1496 | << "OsiRowCutDebugger::activate: activated, z = " << knownValue_ |
1497 | << std::endl ; |
1498 | } |
1499 | } |
1500 | delete siCopy; |
1501 | return (integerVariable_ != NULL) ; |
1502 | } |
1503 | |
1504 | |
1505 | //------------------------------------------------------------------- |
1506 | // Default Constructor |
1507 | //------------------------------------------------------------------- |
1508 | OsiRowCutDebugger::OsiRowCutDebugger () |
1509 | :knownValue_(COIN_DBL_MAX), |
1510 | numberColumns_(0), |
1511 | integerVariable_(NULL), |
1512 | knownSolution_(NULL) |
1513 | { |
1514 | // nothing to do here |
1515 | } |
1516 | |
1517 | //------------------------------------------------------------------- |
1518 | // Alternate Constructor with model name |
1519 | //------------------------------------------------------------------- |
1520 | // Constructor with name of model |
1521 | OsiRowCutDebugger::OsiRowCutDebugger ( |
1522 | const OsiSolverInterface & si, |
1523 | const char * model) |
1524 | :knownValue_(COIN_DBL_MAX), |
1525 | numberColumns_(0), |
1526 | integerVariable_(NULL), |
1527 | knownSolution_(NULL) |
1528 | { |
1529 | activate(si,model); |
1530 | } |
1531 | // Constructor with full solution (only integers need be correct) |
1532 | OsiRowCutDebugger::OsiRowCutDebugger (const OsiSolverInterface &si, |
1533 | const double *solution, |
1534 | bool enforceOptimality) |
1535 | :knownValue_(COIN_DBL_MAX), |
1536 | numberColumns_(0), |
1537 | integerVariable_(NULL), |
1538 | knownSolution_(NULL) |
1539 | { |
1540 | activate(si,solution,enforceOptimality); |
1541 | } |
1542 | |
1543 | //------------------------------------------------------------------- |
1544 | // Copy constructor |
1545 | //------------------------------------------------------------------- |
1546 | OsiRowCutDebugger::OsiRowCutDebugger (const OsiRowCutDebugger & source) |
1547 | : knownValue_(COIN_DBL_MAX), numberColumns_(0), integerVariable_(NULL), knownSolution_(NULL) |
1548 | { |
1549 | // copy |
1550 | if (source.active()) { |
1551 | assert(source.integerVariable_ != NULL); |
1552 | assert(source.knownSolution_ != NULL); |
1553 | knownValue_ = source.knownValue_; |
1554 | numberColumns_=source.numberColumns_; |
1555 | integerVariable_=new bool[numberColumns_]; |
1556 | knownSolution_=new double[numberColumns_]; |
1557 | CoinCopyN(source.integerVariable_, numberColumns_, integerVariable_ ); |
1558 | CoinCopyN(source.knownSolution_, numberColumns_, knownSolution_); |
1559 | } |
1560 | } |
1561 | |
1562 | //------------------------------------------------------------------- |
1563 | // Destructor |
1564 | //------------------------------------------------------------------- |
1565 | OsiRowCutDebugger::~OsiRowCutDebugger () |
1566 | { |
1567 | // free memory |
1568 | delete [] integerVariable_; |
1569 | delete [] knownSolution_; |
1570 | } |
1571 | |
1572 | //---------------------------------------------------------------- |
1573 | // Assignment operator |
1574 | //------------------------------------------------------------------- |
1575 | OsiRowCutDebugger & |
1576 | OsiRowCutDebugger::operator=(const OsiRowCutDebugger& rhs) |
1577 | { |
1578 | if (this != &rhs) { |
1579 | delete [] integerVariable_; |
1580 | delete [] knownSolution_; |
1581 | knownValue_ = COIN_DBL_MAX; |
1582 | // copy |
1583 | if (rhs.active()) { |
1584 | assert(rhs.integerVariable_ != NULL); |
1585 | assert(rhs.knownSolution_ != NULL); |
1586 | knownValue_ = rhs.knownValue_; |
1587 | numberColumns_ = rhs.numberColumns_; |
1588 | integerVariable_ = new bool[numberColumns_]; |
1589 | knownSolution_ = new double[numberColumns_]; |
1590 | CoinCopyN(rhs.integerVariable_,numberColumns_,integerVariable_ ); |
1591 | CoinCopyN(rhs.knownSolution_,numberColumns_,knownSolution_); |
1592 | } |
1593 | } |
1594 | return *this; |
1595 | } |
1596 | |
1597 | /* |
1598 | Edit a solution after column changes (typically column deletion and/or |
1599 | transposition due to preprocessing). |
1600 | |
1601 | Given an array which translates current column indices to original column |
1602 | indices, shrink the solution to match. The transform is irreversible |
1603 | (in the sense that the debugger doesn't keep a record of the changes). |
1604 | */ |
1605 | void |
1606 | OsiRowCutDebugger::redoSolution(int numberColumns,const int * originalColumns) |
1607 | { |
1608 | const bool printRecalcMessage = false ; |
1609 | assert (numberColumns<=numberColumns_); |
1610 | if (numberColumns<numberColumns_) { |
1611 | char * mark = new char[numberColumns_]; |
1612 | memset (mark,0,numberColumns_); |
1613 | int i; |
1614 | for (i=0;i<numberColumns;i++) |
1615 | mark[originalColumns[i]]=1; |
1616 | numberColumns=0; |
1617 | for (i=0;i<numberColumns_;i++) { |
1618 | if (mark[i]) { |
1619 | integerVariable_[numberColumns]=integerVariable_[i]; |
1620 | knownSolution_[numberColumns++]=knownSolution_[i]; |
1621 | } |
1622 | } |
1623 | delete [] mark; |
1624 | numberColumns_=numberColumns; |
1625 | if (printRecalcMessage) { |
1626 | # if 0 |
1627 | FILE * fp = fopen("xx.xx" ,"wb" ); |
1628 | assert (fp); |
1629 | fwrite(&numberColumns,sizeof(int),1,fp); |
1630 | fwrite(knownSolution_,sizeof(double),numberColumns,fp); |
1631 | fclose(fp); |
1632 | exit(0); |
1633 | # endif |
1634 | printf("debug solution - recalculated\n" ); |
1635 | } |
1636 | } |
1637 | } |
1638 | |