Changeset 1199 for trunk/Clp/src/ClpMain.cpp
 Timestamp:
 May 8, 2008 11:03:42 AM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Clp/src/ClpMain.cpp
r1185 r1199 723 723 } 724 724 } 725 #ifdef CLP_MULTIPLE_FACTORIZATIONS 726 int denseCode = parameters[whichParam(DENSE,numberParameters,parameters)].intValue(); 727 if (denseCode>=model2>numberRows()) { 728 model2>factorization()>goDense(); 729 } 730 #endif 725 731 try { 726 732 status=model2>initialSolve(solveOptions); … … 1731 1737 for (int i=0;i<=lengthNamelength;i++) { 1732 1738 char * maskOut = newMasks[nEntries]; 1733 memcpy(maskOut,oldMask,nBefore);1739 CoinMemcpyN(oldMask,nBefore,maskOut); 1734 1740 for (int k=0;k<i;k++) 1735 1741 maskOut[k+nBefore]='?'; 1736 memcpy(maskOut+nBefore+i,ast+1,nAfter);1742 CoinMemcpyN(ast+1,nAfter,maskOut+nBefore+i); 1737 1743 nEntries++; 1738 1744 assert (nEntries<=maxMasks); … … 1958 1964 delete [] number; 1959 1965 delete [] numberExact; 1966 } 1967 void sortOnOther(int * column, 1968 const CoinBigIndex * rowStart, 1969 int * order, 1970 int * other, 1971 int nRow, 1972 int nInRow, 1973 int where) 1974 { 1975 if (nRow<2where>=nInRow) 1976 return; 1977 // do initial sort 1978 int kRow; 1979 int iRow; 1980 for ( kRow=0;kRow<nRow;kRow++) { 1981 iRow = order[kRow]; 1982 other[kRow]=column[rowStart[iRow]+where]; 1983 } 1984 CoinSort_2(other,other+nRow,order); 1985 int first=0; 1986 iRow=order[0]; 1987 int firstC=column[rowStart[iRow]+where]; 1988 kRow=1; 1989 while (kRow<nRow) { 1990 int lastC=9999999;; 1991 for (;kRow<nRow+1;kRow++) { 1992 if (kRow<nRow) { 1993 iRow=order[kRow]; 1994 lastC=column[rowStart[iRow]+where]; 1995 } else { 1996 lastC=9999999; 1997 } 1998 if (lastC>firstC) 1999 break; 2000 } 2001 // sort 2002 sortOnOther(column,rowStart,order+first,other,kRowfirst, 2003 nInRow,where+1); 2004 firstC=lastC; 2005 first=kRow; 2006 } 1960 2007 } 1961 2008 static void statistics(ClpSimplex * originalModel, ClpSimplex * model) … … 2120 2167 if ((k%3)!=0) 2121 2168 printf("\n"); 2169 #define SYM 2170 #ifndef SYM 2122 2171 if (model>logLevel()<2) 2123 2172 return ; 2173 #endif 2124 2174 int kMax = model>logLevel()>3 ? 1000000 : 10; 2125 2175 k=0; … … 2158 2208 delete [] number; 2159 2209 printf("\n\n"); 2210 if (model>logLevel()==63 2211 #ifdef SYM 2212 true 2213 #endif 2214 ) { 2215 // get column copy 2216 CoinPackedMatrix columnCopy = *matrix; 2217 const int * columnLength = columnCopy.getVectorLengths(); 2218 number = new int[numberRows+1]; 2219 memset(number,0,(numberRows+1)*sizeof(int)); 2220 for (iColumn=0;iColumn<numberColumns;iColumn++) { 2221 int length=columnLength[iColumn]; 2222 number[length]++; 2223 } 2224 k=0; 2225 for (iRow=1;iRow<=numberRows;iRow++) { 2226 if (number[iRow]) { 2227 k++; 2228 } 2229 } 2230 int * row = columnCopy.getMutableIndices(); 2231 const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); 2232 double * element = columnCopy.getMutableElements(); 2233 int * order = new int[numberColumns]; 2234 int * other = new int[numberColumns]; 2235 for (iColumn=0;iColumn<numberColumns;iColumn++) { 2236 int length=columnLength[iColumn]; 2237 order[iColumn]=iColumn; 2238 other[iColumn]=length; 2239 CoinBigIndex start = columnStart[iColumn]; 2240 CoinSort_2(row+start,row+start+length,element+start); 2241 } 2242 CoinSort_2(other,other+numberColumns,order); 2243 int jColumn=number[0]+number[1]; 2244 for (iRow=2;iRow<=numberRows;iRow++) { 2245 if (number[iRow]) { 2246 printf("XX %d columns have %d entries\n",number[iRow],iRow); 2247 int kColumn = jColumn+number[iRow]; 2248 sortOnOther(row,columnStart, 2249 order+jColumn,other,number[iRow],iRow,0); 2250 // Now print etc 2251 if (iRow<500000) { 2252 for (int lColumn =jColumn;lColumn<kColumn;lColumn++) { 2253 iColumn = order[lColumn]; 2254 CoinBigIndex start = columnStart[iColumn]; 2255 if (model>logLevel()==63) { 2256 printf("column %d %g <= ",iColumn,columnLower[iColumn]); 2257 for (CoinBigIndex i=start;i<start+iRow;i++) 2258 printf("( %d, %g) ",row[i],element[i]); 2259 printf("<= %g\n",columnUpper[iColumn]); 2260 } 2261 } 2262 } 2263 jColumn =kColumn; 2264 } 2265 } 2266 delete [] order; 2267 delete [] other; 2268 delete [] number; 2269 } 2160 2270 // get row copy 2161 2271 CoinPackedMatrix rowCopy = *matrix; 2162 2272 rowCopy.reverseOrdering(); 2163 //const int * column = rowCopy.getIndices();2164 2273 const int * rowLength = rowCopy.getVectorLengths(); 2165 //const CoinBigIndex * rowStart = rowCopy.getVectorStarts();2166 //const double * element = rowCopy.getElements();2167 2274 number = new int[numberColumns+1]; 2168 2275 memset(number,0,(numberColumns+1)*sizeof(int)); … … 2205 2312 } 2206 2313 } 2314 } 2315 if (model>logLevel()==63 2316 #ifdef SYM 2317 true 2318 #endif 2319 ) { 2320 int * column = rowCopy.getMutableIndices(); 2321 const CoinBigIndex * rowStart = rowCopy.getVectorStarts(); 2322 double * element = rowCopy.getMutableElements(); 2323 int * order = new int[numberRows]; 2324 int * other = new int[numberRows]; 2325 for (iRow=0;iRow<numberRows;iRow++) { 2326 int length=rowLength[iRow]; 2327 order[iRow]=iRow; 2328 other[iRow]=length; 2329 CoinBigIndex start = rowStart[iRow]; 2330 CoinSort_2(column+start,column+start+length,element+start); 2331 } 2332 CoinSort_2(other,other+numberRows,order); 2333 int jRow=number[0]+number[1]; 2334 double * weight = new double[numberRows]; 2335 double * randomColumn = new double[numberColumns+1]; 2336 double * randomRow = new double [numberRows+1]; 2337 int * sortRow = new int [numberRows]; 2338 int * possibleRow = new int [numberRows]; 2339 int * backRow = new int [numberRows]; 2340 int * stackRow = new int [numberRows]; 2341 int * sortColumn = new int [numberColumns]; 2342 int * possibleColumn = new int [numberColumns]; 2343 int * backColumn = new int [numberColumns]; 2344 int * backColumn2 = new int [numberColumns]; 2345 int * mapRow = new int [numberRows]; 2346 int * mapColumn = new int [numberColumns]; 2347 int * stackColumn = new int [numberColumns]; 2348 double randomLower = CoinDrand48(); 2349 double randomUpper = CoinDrand48(); 2350 double randomInteger = CoinDrand48(); 2351 int * startAdd = new int[numberRows+1]; 2352 int * columnAdd = new int [2*numberElements]; 2353 double * elementAdd = new double[2*numberElements]; 2354 int nAddRows=0; 2355 startAdd[0]=0; 2356 for (iColumn=0;iColumn<numberColumns;iColumn++) { 2357 randomColumn[iColumn] = CoinDrand48(); 2358 backColumn2[iColumn]=1; 2359 } 2360 for (iColumn=2;iColumn<=numberColumns;iColumn++) { 2361 if (number[iColumn]) { 2362 printf("XX %d rows have %d entries\n",number[iColumn],iColumn); 2363 int kRow = jRow+number[iColumn]; 2364 sortOnOther(column,rowStart, 2365 order+jRow,other,number[iColumn],iColumn,0); 2366 // Now print etc 2367 if (iColumn<500000) { 2368 int nLook=0; 2369 for (int lRow =jRow;lRow<kRow;lRow++) { 2370 iRow = order[lRow]; 2371 CoinBigIndex start = rowStart[iRow]; 2372 if (model>logLevel()==63) { 2373 printf("row %d %g <= ",iRow,rowLower[iRow]); 2374 for (CoinBigIndex i=start;i<start+iColumn;i++) 2375 printf("( %d, %g) ",column[i],element[i]); 2376 printf("<= %g\n",rowUpper[iRow]); 2377 } 2378 int first = column[start]; 2379 double sum=0.0; 2380 for (CoinBigIndex i=start;i<start+iColumn;i++) { 2381 int jColumn = column[i]; 2382 double value = element[i]; 2383 jColumn = first; 2384 assert (jColumn>=0); 2385 sum += value*randomColumn[jColumn]; 2386 } 2387 if (rowLower[iRow]>1.0e30&&rowLower[iRow]) 2388 sum += rowLower[iRow]*randomLower; 2389 else if (!rowLower[iRow]) 2390 sum += 1.234567e7*randomLower; 2391 if (rowUpper[iRow]<1.0e30&&rowUpper[iRow]) 2392 sum += rowUpper[iRow]*randomUpper; 2393 else if (!rowUpper[iRow]) 2394 sum += 1.234567e7*randomUpper; 2395 sortRow[nLook]=iRow; 2396 randomRow[nLook++]=sum; 2397 // best way is to number unique elements and bounds and use 2398 if (fabs(sum)>1.0e4) 2399 sum *= 1.0e6; 2400 weight[iRow]=sum; 2401 } 2402 assert (nLook<=numberRows); 2403 CoinSort_2(randomRow,randomRow+nLook,sortRow); 2404 randomRow[nLook]=COIN_DBL_MAX; 2405 double last=COIN_DBL_MAX; 2406 int iLast=1; 2407 for (int iLook=0;iLook<nLook+1;iLook++) { 2408 if (randomRow[iLook]>last) { 2409 if (iLast>=0) { 2410 int n=iLookiLast; 2411 if (n>1) { 2412 //printf("%d rows possible?\n",n); 2413 } 2414 } 2415 iLast=iLook; 2416 last=randomRow[iLook]; 2417 } 2418 } 2419 } 2420 jRow =kRow; 2421 } 2422 } 2423 CoinPackedMatrix columnCopy = *matrix; 2424 const int * columnLength = columnCopy.getVectorLengths(); 2425 const int * row = columnCopy.getIndices(); 2426 const CoinBigIndex * columnStart = columnCopy.getVectorStarts(); 2427 const double * elementByColumn = columnCopy.getElements(); 2428 for (iColumn=0;iColumn<numberColumns;iColumn++) { 2429 int length=columnLength[iColumn]; 2430 CoinBigIndex start = columnStart[iColumn]; 2431 double sum = objective[iColumn]; 2432 if (columnLower[iColumn]>1.0e30&&columnLower[iColumn]) 2433 sum += columnLower[iColumn]*randomLower; 2434 else if (!columnLower[iColumn]) 2435 sum += 1.234567e7*randomLower; 2436 if (columnUpper[iColumn]<1.0e30&&columnUpper[iColumn]) 2437 sum += columnUpper[iColumn]*randomUpper; 2438 else if (!columnUpper[iColumn]) 2439 sum += 1.234567e7*randomUpper; 2440 if (model>isInteger(iColumn)) 2441 sum += 9.87654321e6*randomInteger; 2442 for (CoinBigIndex i=start;i<start+length;i++) { 2443 int iRow = row[i]; 2444 sum += elementByColumn[i]*weight[iRow]; 2445 } 2446 sortColumn[iColumn]=iColumn; 2447 randomColumn[iColumn]=sum; 2448 } 2449 { 2450 CoinSort_2(randomColumn,randomColumn+numberColumns,sortColumn); 2451 for (iColumn=0;iColumn<numberColumns;iColumn++) { 2452 int i=sortColumn[iColumn]; 2453 backColumn[i]=iColumn; 2454 } 2455 randomColumn[numberColumns]=COIN_DBL_MAX; 2456 double last=COIN_DBL_MAX; 2457 int iLast=1; 2458 for (int iLook=0;iLook<numberColumns+1;iLook++) { 2459 if (randomColumn[iLook]>last) { 2460 if (iLast>=0) { 2461 int n=iLookiLast; 2462 if (n>1) { 2463 //printf("%d columns possible?\n",n); 2464 } 2465 for (int i=iLast;i<iLook;i++) { 2466 possibleColumn[sortColumn[i]]=n; 2467 } 2468 } 2469 iLast=iLook; 2470 last=randomColumn[iLook]; 2471 } 2472 } 2473 for (iRow =0;iRow<numberRows;iRow++) { 2474 CoinBigIndex start = rowStart[iRow]; 2475 double sum=0.0; 2476 int length=rowLength[iRow]; 2477 for (CoinBigIndex i=start;i<start+length;i++) { 2478 int jColumn = column[i]; 2479 double value = element[i]; 2480 jColumn=backColumn[jColumn]; 2481 sum += value*randomColumn[jColumn]; 2482 //if (iColumn==23089iRow==23729) 2483 //printf("row %d cola %d colb %d value %g rand %g sum %g\n", 2484 // iRow,jColumn,column[i],value,randomColumn[jColumn],sum); 2485 } 2486 sortRow[iRow]=iRow; 2487 randomRow[iRow]=weight[iRow]; 2488 randomRow[iRow]=sum; 2489 } 2490 CoinSort_2(randomRow,randomRow+numberRows,sortRow); 2491 for (iRow=0;iRow<numberRows;iRow++) { 2492 int i=sortRow[iRow]; 2493 backRow[i]=iRow; 2494 } 2495 randomRow[numberRows]=COIN_DBL_MAX; 2496 last=COIN_DBL_MAX; 2497 iLast=1; 2498 // Do backward indices from order 2499 for (iRow=0;iRow<numberRows;iRow++) { 2500 other[order[iRow]]=iRow; 2501 } 2502 for (int iLook=0;iLook<numberRows+1;iLook++) { 2503 if (randomRow[iLook]>last) { 2504 if (iLast>=0) { 2505 int n=iLookiLast; 2506 if (n>1) { 2507 //printf("%d rows possible?\n",n); 2508 // Within group sort as for original "order" 2509 for (int i=iLast;i<iLook;i++) { 2510 int jRow=sortRow[i]; 2511 order[i]=other[jRow]; 2512 } 2513 CoinSort_2(order+iLast,order+iLook,sortRow+iLast); 2514 } 2515 for (int i=iLast;i<iLook;i++) { 2516 possibleRow[sortRow[i]]=n; 2517 } 2518 } 2519 iLast=iLook; 2520 last=randomRow[iLook]; 2521 } 2522 } 2523 // Temp out 2524 for (int iLook=0;iLook<numberRows1000000;iLook++) { 2525 iRow=sortRow[iLook]; 2526 CoinBigIndex start = rowStart[iRow]; 2527 int length=rowLength[iRow]; 2528 int numberPossible = possibleRow[iRow]; 2529 for (CoinBigIndex i=start;i<start+length;i++) { 2530 int jColumn = column[i]; 2531 if (possibleColumn[jColumn]!=numberPossible) 2532 numberPossible=1; 2533 } 2534 int n=numberPossible; 2535 if (numberPossible>1) { 2536 //printf("pppppossible %d\n",numberPossible); 2537 for (int jLook=iLook+1;jLook<iLook+numberPossible;jLook++) { 2538 int jRow=sortRow[jLook]; 2539 CoinBigIndex start2 = rowStart[jRow]; 2540 assert (numberPossible==possibleRow[jRow]); 2541 assert(length==rowLength[jRow]); 2542 for (CoinBigIndex i=start2;i<start2+length;i++) { 2543 int jColumn = column[i]; 2544 if (possibleColumn[jColumn]!=numberPossible) 2545 numberPossible=1; 2546 } 2547 } 2548 if (numberPossible<2) { 2549 // switch off 2550 for (int jLook=iLook;jLook<iLook+n;jLook++) 2551 possibleRow[sortRow[jLook]]=1; 2552 } 2553 // skip rest 2554 iLook += n1; 2555 } else { 2556 possibleRow[iRow]=1; 2557 } 2558 } 2559 for (int iLook=0;iLook<numberRows;iLook++) { 2560 iRow=sortRow[iLook]; 2561 int numberPossible = possibleRow[iRow]; 2562 // Only if any integers 2563 int numberIntegers=0; 2564 CoinBigIndex start = rowStart[iRow]; 2565 int length=rowLength[iRow]; 2566 for (CoinBigIndex i=start;i<start+length;i++) { 2567 int jColumn = column[i]; 2568 if (model>isInteger(jColumn)) 2569 numberIntegers++; 2570 } 2571 if (numberPossible>1&&!numberIntegers) { 2572 //printf("possible %d  but no integers\n",numberPossible); 2573 } 2574 if (numberPossible>1&&(numberIntegerstrue)) { 2575 // 2576 printf("possible %d  %d integers\n",numberPossible,numberIntegers); 2577 int lastLook=iLook; 2578 int nMapRow=1; 2579 for (int jLook=iLook+1;jLook<iLook+numberPossible;jLook++) { 2580 // stop if too many failures 2581 if (jLook>iLook+10&&nMapRow<0) 2582 break; 2583 // Create identity mapping 2584 int i; 2585 for (i=0;i<numberRows;i++) 2586 mapRow[i]=i; 2587 for (i=0;i<numberColumns;i++) 2588 mapColumn[i]=i; 2589 int offset=jLookiLook; 2590 int nStackC=0; 2591 // build up row and column mapping 2592 int nStackR=1; 2593 stackRow[0]=iLook; 2594 bool good=true; 2595 while (nStackR) { 2596 nStackR; 2597 int look1 = stackRow[nStackR]; 2598 int look2 = look1 + offset; 2599 assert (randomRow[look1]==randomRow[look2]); 2600 int row1=sortRow[look1]; 2601 int row2=sortRow[look2]; 2602 assert (mapRow[row1]==row1); 2603 assert (mapRow[row2]==row2); 2604 mapRow[row1]=row2; 2605 mapRow[row2]=row1; 2606 CoinBigIndex start1 = rowStart[row1]; 2607 CoinBigIndex offset2 = rowStart[row2]start1; 2608 int length=rowLength[row1]; 2609 assert( length==rowLength[row2]); 2610 for (CoinBigIndex i=start1;i<start1+length;i++) { 2611 int jColumn1 = column[i]; 2612 int jColumn2 = column[i+offset2]; 2613 if (randomColumn[backColumn[jColumn1]]!= 2614 randomColumn[backColumn[jColumn2]]) { 2615 good=false; 2616 break; 2617 } 2618 if (mapColumn[jColumn1]==jColumn1) { 2619 // not touched 2620 assert (mapColumn[jColumn2]==jColumn2); 2621 if (jColumn1!=jColumn2) { 2622 // Put on stack 2623 mapColumn[jColumn1]=jColumn2; 2624 mapColumn[jColumn2]=jColumn1; 2625 stackColumn[nStackC++]=jColumn1; 2626 } 2627 } else { 2628 if(mapColumn[jColumn1]!=jColumn2 2629 mapColumn[jColumn2]!=jColumn1) { 2630 // bad 2631 good=false; 2632 printf("bad col\n"); 2633 break; 2634 } 2635 } 2636 } 2637 if (!good) 2638 break; 2639 while (nStackC) { 2640 nStackC; 2641 int iColumn = stackColumn[nStackC]; 2642 int iColumn2 = mapColumn[iColumn]; 2643 assert (iColumn!=iColumn2); 2644 int length=columnLength[iColumn]; 2645 assert (length==columnLength[iColumn2]); 2646 CoinBigIndex start = columnStart[iColumn]; 2647 CoinBigIndex offset2 = columnStart[iColumn2]start; 2648 for (CoinBigIndex i=start;i<start+length;i++) { 2649 int iRow = row[i]; 2650 int iRow2 = row[i+offset2]; 2651 if (mapRow[iRow]==iRow) { 2652 // First (but be careful) 2653 if (iRow!=iRow2) { 2654 //mapRow[iRow]=iRow2; 2655 //mapRow[iRow2]=iRow; 2656 int iBack=backRow[iRow]; 2657 int iBack2=backRow[iRow2]; 2658 if (randomRow[iBack]==randomRow[iBack2]&& 2659 iBack2iBack==offset) { 2660 stackRow[nStackR++]=iBack; 2661 } else { 2662 //printf("randomRow diff  weights %g %g\n", 2663 // weight[iRow],weight[iRow2]); 2664 // bad 2665 good=false; 2666 break; 2667 } 2668 } 2669 } else { 2670 if(mapRow[iRow]!=iRow2 2671 mapRow[iRow2]!=iRow) { 2672 // bad 2673 good=false; 2674 printf("bad row\n"); 2675 break; 2676 } 2677 } 2678 } 2679 if (!good) 2680 break; 2681 } 2682 } 2683 // then check OK 2684 if (good) { 2685 for (iRow =0;iRow<numberRows;iRow++) { 2686 CoinBigIndex start = rowStart[iRow]; 2687 int length=rowLength[iRow]; 2688 if (mapRow[iRow]==iRow) { 2689 for (CoinBigIndex i=start;i<start+length;i++) { 2690 int jColumn = column[i]; 2691 backColumn2[jColumn]=istart; 2692 } 2693 for (CoinBigIndex i=start;i<start+length;i++) { 2694 int jColumn = column[i]; 2695 if (mapColumn[jColumn]!=jColumn) { 2696 int jColumn2 =mapColumn[jColumn]; 2697 CoinBigIndex i2 = backColumn2[jColumn2]; 2698 if (i2<0) { 2699 good=false; 2700 } else if (element[i]!=element[i2+start]) { 2701 good=false; 2702 } 2703 } 2704 } 2705 for (CoinBigIndex i=start;i<start+length;i++) { 2706 int jColumn = column[i]; 2707 backColumn2[jColumn]=1; 2708 } 2709 } else { 2710 int row2 = mapRow[iRow]; 2711 assert (iRow = mapRow[row2]); 2712 if (rowLower[iRow]!=rowLower[row2] 2713 rowLower[row2]!=rowLower[iRow]) 2714 good=false; 2715 CoinBigIndex offset2 = rowStart[row2]start; 2716 for (CoinBigIndex i=start;i<start+length;i++) { 2717 int jColumn = column[i]; 2718 double value = element[i]; 2719 int jColumn2 = column[i+offset2]; 2720 double value2 = element[i+offset2]; 2721 if (value!=value2mapColumn[jColumn]!=jColumn2 2722 mapColumn[jColumn2]!=jColumn) 2723 good=false; 2724 } 2725 } 2726 } 2727 if (good) { 2728 // check rim 2729 for (iColumn=0;iColumn<numberColumns;iColumn++) { 2730 if (mapColumn[iColumn]!=iColumn) { 2731 int iColumn2 = mapColumn[iColumn]; 2732 if(objective[iColumn]!=objective[iColumn2]) 2733 good=false; 2734 if (columnLower[iColumn]!=columnLower[iColumn2]) 2735 good=false; 2736 if (columnUpper[iColumn]!=columnUpper[iColumn2]) 2737 good=false; 2738 if (model>isInteger(iColumn)!=model>isInteger(iColumn2)) 2739 good=false; 2740 } 2741 } 2742 } 2743 if (good) { 2744 // temp 2745 if (nMapRow<0) { 2746 //const double * solution = model>primalColumnSolution(); 2747 // find mapped 2748 int nMapColumn=0; 2749 for (int i=0;i<numberColumns;i++) { 2750 if (mapColumn[i]>i) 2751 nMapColumn++; 2752 } 2753 nMapRow=0; 2754 int kRow=1; 2755 for (int i=0;i<numberRows;i++) { 2756 if (mapRow[i]>i) { 2757 nMapRow++; 2758 kRow=i; 2759 } 2760 } 2761 printf("%d columns, %d rows\n",nMapColumn,nMapRow); 2762 if (nMapRow==1) { 2763 CoinBigIndex start = rowStart[kRow]; 2764 int length=rowLength[kRow]; 2765 printf("%g <= ",rowLower[kRow]); 2766 for (CoinBigIndex i=start;i<start+length;i++) { 2767 int jColumn = column[i]; 2768 if (mapColumn[jColumn]!=jColumn) 2769 printf("* "); 2770 printf("%d,%g ",jColumn,element[i]); 2771 } 2772 printf("<= %g\n",rowUpper[kRow]); 2773 } 2774 } 2775 // temp 2776 int row1=sortRow[lastLook]; 2777 int row2=sortRow[jLook]; 2778 lastLook=jLook; 2779 CoinBigIndex start1 = rowStart[row1]; 2780 CoinBigIndex offset2 = rowStart[row2]start1; 2781 int length=rowLength[row1]; 2782 assert( length==rowLength[row2]); 2783 CoinBigIndex put=startAdd[nAddRows]; 2784 double multiplier=length<11 ? 2.0 : 1.125; 2785 double value=1.0; 2786 for (CoinBigIndex i=start1;i<start1+length;i++) { 2787 int jColumn1 = column[i]; 2788 int jColumn2 = column[i+offset2]; 2789 columnAdd[put]=jColumn1; 2790 elementAdd[put++]=value; 2791 columnAdd[put]=jColumn2; 2792 elementAdd[put++]=value; 2793 value *= multiplier; 2794 } 2795 nAddRows++; 2796 startAdd[nAddRows]=put; 2797 } else { 2798 printf("ouch  did not check out as good\n"); 2799 } 2800 } 2801 } 2802 // skip rest 2803 iLook += numberPossible1; 2804 } 2805 } 2806 } 2807 if (nAddRows) { 2808 double * lower = new double [nAddRows]; 2809 double * upper = new double[nAddRows]; 2810 int i; 2811 //const double * solution = model>primalColumnSolution(); 2812 for (i=0;i<nAddRows;i++) { 2813 lower[i]=0.0; 2814 upper[i]=COIN_DBL_MAX; 2815 } 2816 printf("Adding %d rows with %d elements\n",nAddRows, 2817 startAdd[nAddRows]); 2818 //ClpSimplex newModel(*model); 2819 //newModel.addRows(nAddRows,lower,upper,startAdd,columnAdd,elementAdd); 2820 //newModel.writeMps("modified.mps"); 2821 delete [] lower; 2822 delete [] upper; 2823 } 2824 delete [] startAdd; 2825 delete [] columnAdd; 2826 delete [] elementAdd; 2827 delete [] order; 2828 delete [] other; 2829 delete [] randomColumn; 2830 delete [] weight; 2831 delete [] randomRow; 2832 delete [] sortRow; 2833 delete [] backRow; 2834 delete [] possibleRow; 2835 delete [] sortColumn; 2836 delete [] backColumn; 2837 delete [] backColumn2; 2838 delete [] possibleColumn; 2839 delete [] mapRow; 2840 delete [] mapColumn; 2841 delete [] stackRow; 2842 delete [] stackColumn; 2207 2843 } 2208 2844 delete [] number;
Note: See TracChangeset
for help on using the changeset viewer.