Changeset 1953 for trunk


Ignore:
Timestamp:
Aug 4, 2013 4:49:34 PM (6 years ago)
Author:
forrest
Message:

yet more changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcHeuristicDW.cpp

    r1951 r1953  
    365365  // data arrays
    366366  // 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));
    369369  // Count of number of times block chosen
    370370  int * doneBlock = whichBlock + numberBlocks_;
     
    377377  int * priorityBlock = goodBlock+numberBlocks_;
    378378  int * orderBlock = priorityBlock+numberBlocks_;
     379  // block can be fixed if nothing in master rows, maybe always same as continuous
     380  int * fixedBlock = orderBlock+numberBlocks_;
    379381  // Mixture of stuff to sort blocks on
    380382  double * blockSort = new double [4*numberBlocks_];
     
    414416    }
    415417  }
     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.0e-5) {
     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);
    416463  for (pass_=0;pass_<numberPasses_;pass_++) {
    417464    double endTime2 = CoinCpuTime();
     
    796843            columnUpper[iColumn]=saveUpper_[iColumn];
    797844          }
    798           if (!numberBlocksUsed) {
     845          if (!numberBlocksUsed && affinity_) {
    799846            // re-sort rest using affinity
    800847            const unsigned short int * aff = affinity_+iBlock*numberBlocks_;
     
    14161463          columnBlock[i]=blockEls[iBlock];
    14171464      }
     1465      if (newNumber<numberBlocks)
     1466        printf("Number of blocks reduced from %d to %d\n",
     1467               numberBlocks,newNumber);
    14181468      numberBlocks=newNumber;
    14191469    }
Note: See TracChangeset for help on using the changeset viewer.