Ignore:
Timestamp:
Feb 13, 2008 3:52:57 PM (11 years ago)
Author:
forrest
Message:

add diving heuristics

File:
1 edited

Legend:

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

    r867 r871  
    1288412884  }
    1288512885}
     12886/* Return pseudo costs
     12887   If not all integers or not pseudo costs - returns all zero
     12888   Length of arrays are numberIntegers() and entries
     12889      correspond to integerVariable()[i]
     12890      User must allocate arrays before call
     12891*/
     12892void
     12893CbcModel::fillPseudoCosts(double * downCosts, double * upCosts) const
     12894{
     12895  CoinZeroN(downCosts,numberIntegers_);
     12896  CoinZeroN(upCosts,numberIntegers_);
     12897  if (!allDynamic())
     12898    return; // Odd problem
     12899  int numberColumns = getNumCols();
     12900  int * back = new int[numberColumns];
     12901  int i;
     12902  for (i=0;i<numberColumns;i++)
     12903    back[i]=-1;
     12904  for (i=0;i<numberIntegers_;i++)
     12905    back[integerVariable_[i]]=i;
     12906  for ( i=0;i<numberObjects_;i++) {
     12907    CbcSimpleIntegerDynamicPseudoCost * obj =
     12908      dynamic_cast <CbcSimpleIntegerDynamicPseudoCost *>(object_[i]) ;
     12909    assert (obj);
     12910    int iColumn = obj->columnNumber();
     12911    iColumn = back[iColumn];
     12912    assert (iColumn>=0);
     12913    downCosts[iColumn]=obj->downDynamicPseudoCost();
     12914    upCosts[iColumn]=obj->upDynamicPseudoCost();
     12915  }
     12916  delete [] back;
     12917}
Note: See TracChangeset for help on using the changeset viewer.