 Timestamp:
 Aug 4, 2013 4:49:34 PM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Cbc/src/CbcHeuristicDW.cpp
r1951 r1953 365 365 // data arrays 366 366 // Block order for choosing (after sort) 367 int * whichBlock = new int [ 7*numberBlocks_];368 memset(whichBlock,0, 7*numberBlocks_*sizeof(int));367 int * whichBlock = new int [8*numberBlocks_]; 368 memset(whichBlock,0,8*numberBlocks_*sizeof(int)); 369 369 // Count of number of times block chosen 370 370 int * doneBlock = whichBlock + numberBlocks_; … … 377 377 int * priorityBlock = goodBlock+numberBlocks_; 378 378 int * orderBlock = priorityBlock+numberBlocks_; 379 // block can be fixed if nothing in master rows, maybe always same as continuous 380 int * fixedBlock = orderBlock+numberBlocks_; 379 381 // Mixture of stuff to sort blocks on 380 382 double * blockSort = new double [4*numberBlocks_]; … … 414 416 } 415 417 } 418 int numberNoMaster=0; 419 int numberSameAsContinuous=0; 420 int numberSameAsContinuousJustInts=0; 421 // Column copy 422 //const double * element = solver>getMatrixByCol()>getElements(); 423 const int * row = solver>getMatrixByCol()>getIndices(); 424 const CoinBigIndex * columnStart = solver>getMatrixByCol()>getVectorStarts(); 425 const int * columnLength = solver>getMatrixByCol()>getVectorLengths(); 426 for (int iBlock=0;iBlock<numberBlocks_;iBlock++) { 427 int nElInMaster=0; 428 int numberDifferentContinuous=0; 429 int numberDifferentContinuousJustInts=0; 430 int start=startColumnBlock_[iBlock]; 431 int end=startColumnBlock_[iBlock+1]; 432 for (int i=start;i<end;i++) { 433 int iColumn=columnsInBlock_[i]; 434 for (CoinBigIndex j=columnStart[iColumn]; 435 j<columnStart[iColumn]+columnLength[iColumn];j++) { 436 int iRow = row[j]; 437 iRow=backwardRow_[iRow]; 438 if (iRow>=0) 439 nElInMaster++; 440 } 441 if (fabs(bestSolution_[iColumn]continuousSolution_[iColumn])<1.0e5) { 442 numberDifferentContinuous++; 443 if (solver>isInteger(iColumn)) 444 numberDifferentContinuousJustInts++; 445 } 446 } 447 if (!nElInMaster) { 448 fixedBlock[iBlock]=10; 449 numberNoMaster++; 450 } else if (!numberDifferentContinuous) { 451 fixedBlock[iBlock]=2; 452 numberSameAsContinuous++; 453 } else if (!numberDifferentContinuousJustInts) { 454 fixedBlock[iBlock]=1; 455 numberSameAsContinuousJustInts++; 456 } 457 } 458 if (numberNoMaster) 459 printf("*** %d blocks have no elements in master  can be solved seperately\n", 460 numberNoMaster); 461 printf("With initial best solution %d blocks were same as continuous, %d when just looking at integers\n", 462 numberSameAsContinuous,numberSameAsContinuousJustInts); 416 463 for (pass_=0;pass_<numberPasses_;pass_++) { 417 464 double endTime2 = CoinCpuTime(); … … 796 843 columnUpper[iColumn]=saveUpper_[iColumn]; 797 844 } 798 if (!numberBlocksUsed ) {845 if (!numberBlocksUsed && affinity_) { 799 846 // resort rest using affinity 800 847 const unsigned short int * aff = affinity_+iBlock*numberBlocks_; … … 1416 1463 columnBlock[i]=blockEls[iBlock]; 1417 1464 } 1465 if (newNumber<numberBlocks) 1466 printf("Number of blocks reduced from %d to %d\n", 1467 numberBlocks,newNumber); 1418 1468 numberBlocks=newNumber; 1419 1469 }
Note: See TracChangeset
for help on using the changeset viewer.