Changeset 574


Ignore:
Timestamp:
Mar 10, 2007 7:27:13 PM (13 years ago)
Author:
forrest
Message:

probably breaking everything

Location:
branches/devel/Cbc/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Cbc/src/CbcCompareActual.cpp

    r486 r574  
    205205{
    206206#if 0
    207   // was
    208   if (weight_<0.0||treeSize_>100000) {
     207  // always choose *smallest* depth if one or both <= breadthDepth_
     208  int depthX = x->depth();
     209  int depthY = y->depth();
     210  if (depthX<=breadthDepth_||depthY<=breadthDepth_) {
     211    if (depthX!=depthY)
     212      return depthX > depthY;
     213    else
     214      return equalityTest(x,y); // so ties will be broken in consistent manner
     215  }
     216  if (weight_==-1.0||weight_==-3.0) {
     217    int adjust =  (weight_==-3.0) ? 10000 : 0;
    209218    // before solution
    210     /* printf("x %d %d %g, y %d %d %g\n",
     219    /*printf("x %d %d %g, y %d %d %g\n",
    211220       x->numberUnsatisfied(),x->depth(),x->objectiveValue(),
    212221       y->numberUnsatisfied(),y->depth(),y->objectiveValue()); */
    213     if (x->numberUnsatisfied() > y->numberUnsatisfied())
     222    if (x->numberUnsatisfied() > y->numberUnsatisfied()+adjust) {
    214223      return true;
    215     else if (x->numberUnsatisfied() < y->numberUnsatisfied())
     224    } else if (x->numberUnsatisfied() < y->numberUnsatisfied()-adjust) {
    216225      return false;
    217     else
    218       return x->depth() < y->depth();
     226    } else {
     227      int depthX = x->depth();
     228      int depthY = y->depth();
     229      if (depthX!=depthY)
     230        return depthX < depthY;
     231      else
     232        return equalityTest(x,y); // so ties will be broken in consistent manner
     233    }
    219234  } else {
    220235    // after solution
    221     return x->objectiveValue()+ weight_*x->numberUnsatisfied() >
    222       y->objectiveValue() + weight_*y->numberUnsatisfied();
     236    double weight = CoinMax(weight_,0.0);
     237    double testX =  x->objectiveValue()+ weight*x->numberUnsatisfied();
     238    double testY = y->objectiveValue() + weight*y->numberUnsatisfied();
     239    if (testX!=testY)
     240      return testX > testY;
     241    else
     242      return equalityTest(x,y); // so ties will be broken in consistent manner
    223243  }
    224244#else
  • branches/devel/Cbc/src/CbcHeuristic.cpp

    r539 r574  
    107107#ifdef COIN_HAS_CLP
    108108  OsiClpSolverInterface * osiclp = dynamic_cast< OsiClpSolverInterface*> (solver);
    109   if (osiclp&&(osiclp->specialOptions()&1024)==0) {
     109  if (osiclp&&(osiclp->specialOptions()&65536)==0) {
    110110    // go faster stripes
    111111    if (osiclp->getNumRows()<300&&osiclp->getNumCols()<500) {
  • branches/devel/Cbc/src/CbcHeuristicFPump.cpp

    r502 r574  
    813813                      lastSolution,-COIN_DBL_MAX,rhs+10.0);
    814814    double saveValue = newSolutionValue;
    815     newSolver->writeMps("sub");
     815    //newSolver->writeMps("sub");
    816816    int returnCode = smallBranchAndBound(newSolver,numberNodes_,newSolution,newSolutionValue,
    817817                                     newSolutionValue,"CbcHeuristicLocalAfterFPump");
     
    821821    }
    822822    if (returnCode) {
    823       printf("old sol of %g new of %g\n",saveValue,newSolutionValue);
     823      //printf("old sol of %g new of %g\n",saveValue,newSolutionValue);
    824824      memcpy(betterSolution,newSolution,numberColumns*sizeof(double));
    825       abort();
     825      //abort();
     826      solutionValue=newSolutionValue;
     827      solutionFound=true;
    826828    }
    827829    delete newSolver;
  • branches/devel/Cbc/src/CbcHeuristicRINS.cpp

    r502 r574  
    8787  CbcHeuristic::generateCpp(fp,"heuristicRINS");
    8888  if (howOften_!=other.howOften_)
    89     fprintf(fp,"3  heuristicLocal.setHowOften(%d);\n",howOften_);
     89    fprintf(fp,"3  heuristicRINS.setHowOften(%d);\n",howOften_);
    9090  else
    91     fprintf(fp,"4  heuristicLocal.setHowOften(%d);\n",howOften_);
     91    fprintf(fp,"4  heuristicRINS.setHowOften(%d);\n",howOften_);
    9292  fprintf(fp,"3  cbcModel->addHeuristic(&heuristicRINS);\n");
    9393}
     
    200200    }
    201201    if (nFix>numberIntegers/5) {
    202       printf("%d integers have same value\n",nFix);
     202      //printf("%d integers have same value\n",nFix);
    203203      returnCode = smallBranchAndBound(newSolver,numberNodes_,betterSolution,solutionValue,
    204204                                         model_->getCutoff(),"CbcHeuristicRINS");
    205205      if ((returnCode&1)!=0)
    206206        numberSuccesses_++;
    207       printf("return code %d",returnCode);
     207      //printf("return code %d",returnCode);
    208208      if ((returnCode&2)!=0) {
    209209        // could add cut
    210210        returnCode &= ~2;
    211         printf("could add cut with %d elements (if all 0-1)\n",nFix);
     211        //printf("could add cut with %d elements (if all 0-1)\n",nFix);
    212212      } else {
    213         printf("\n");
     213        //printf("\n");
    214214      }
    215215      numberTries_++;
  • branches/devel/Cbc/src/CbcLinked.cpp

    r539 r574  
    565565        // If model has stored then add cut (if convex)
    566566        // off until I work out problem with ibell3a
    567         if (cbcModel&&(specialOptions2_&4)!=0&&quadraticModel_&&false) {
     567        if (cbcModel&&(specialOptions2_&4)!=0&&quadraticModel_) {
    568568          int numberGenerators = cbcModel_->numberCutGenerators();
    569569          int iGenerator;
     
    10541054    printf("There are %d bilinear and %d integers\n",nBi,nInt);
    10551055    loadFromCoinModel(coinModel,true);
    1056     if (tightenBounds) {
     1056    if (tightenBounds&&numberColumns<100) {
    10571057      // first fake bounds
    10581058      for (iColumn=0;iColumn<numberColumns;iColumn++) {
     
    14771477        obj->setPriority(value);
    14781478      }
     1479    }
     1480  }
     1481}
     1482// Say convex (should work it out)
     1483void
     1484OsiSolverLink::sayConvex(bool convex)
     1485{
     1486  specialOptions2_ |= 4;
     1487  if (convex_) {
     1488    for (int iNon=0;iNon<numberNonLinearRows_;iNon++) {
     1489      convex_[iNon]=convex ? 1 : -1;
    14791490    }
    14801491  }
     
    24372448    if ((status==0||statusNegative==0)&&numberLong) {
    24382449      // need to do more work
    2439       printf("Needs more work\n");
     2450      //printf("Needs more work\n");
    24402451    }
    24412452    assert (status>0||statusNegative>0);
  • branches/devel/Cbc/src/CbcLinked.hpp

    r529 r574  
    121121  inline void setSpecialOptions2(int value)
    122122  { specialOptions2_=value;};
    123   /// Say convex (should work it out)
    124   inline void sayConvex()
    125   { specialOptions2_ |= 4;};
     123  /// Say convex (should work it out) - if convex false then strictly concave
     124  void sayConvex(bool convex);
    126125  /// Get special options
    127126  inline int specialOptions2() const
  • branches/devel/Cbc/src/CbcModel.cpp

    r566 r574  
    894894     = dynamic_cast<OsiClpSolverInterface *> (solver_);
    895895   if (clpSolver) {
    896      // Try and re-use regions
    897      //clpSolver->getModelPtr()->setPersistenceFlag(1);
     896#define CLP_QUICK_OPTIONS
     897#ifdef CLP_QUICK_OPTIONS
     898     // Try and re-use regions   
     899     ClpSimplex * simplex = clpSolver->getModelPtr();
     900     simplex->setPersistenceFlag(1);
     901     clpSolver->deleteScaleFactors();
     902     int value=131072;
     903     clpSolver->setSpecialOptions(clpSolver->specialOptions()|value);
     904     simplex->setSpecialOptions(simplex->specialOptions()|value);
     905     //if (simplex->numberRows()<50)
     906     //simplex->setAlphaAccuracy(1.0);
     907     //clpSolver->setSpecialOptions((clpSolver->specialOptions()&~128)|65536);
     908#endif
    898909     if ((specialOptions_&32)==0) {
    899910       ClpSimplex * clpSimplex = clpSolver->getModelPtr();
     
    22982309    }
    22992310  }
    2300   return ; }
     2311#ifdef CLP_QUICK_OPTIONS
     2312  {
     2313    OsiClpSolverInterface * clpSolver
     2314      = dynamic_cast<OsiClpSolverInterface *> (solver_);
     2315    if (clpSolver) {
     2316      // Try and re-use regions   
     2317      ClpSimplex * simplex = clpSolver->getModelPtr();
     2318      simplex->setPersistenceFlag(0);
     2319      clpSolver->deleteScaleFactors();
     2320      clpSolver->setSpecialOptions(clpSolver->specialOptions()&(~131072));
     2321      simplex->setSpecialOptions(simplex->specialOptions()&(~131072));
     2322      simplex->setAlphaAccuracy(-1.0);
     2323      //clpSolver->setSpecialOptions((clpSolver->specialOptions()&~128)|65536);
     2324    }
     2325  }
     2326#endif
     2327  return ;
     2328 }
    23012329
    23022330
     
    51125140    clpSolver->setSpecialOptions(saveClpOptions);
    51135141# endif
     5142
    51145143  return feasible ; }
    51155144
  • branches/devel/Cbc/src/CbcNode.cpp

    r539 r574  
    28212821        int iColumn = dynamicObject->columnNumber();
    28222822        int preferredWay;
    2823         object->infeasibility(&usefulInfo,preferredWay);
     2823        double infeasibility = object->infeasibility(&usefulInfo,preferredWay);
     2824        // may have become feasible
     2825        if (!infeasibility)
     2826          continue;
    28242827        CbcSimpleInteger * obj =
    28252828          dynamic_cast <CbcSimpleInteger *>(object) ;
     
    32683271              assert(doneHotStart);
    32693272              solver->unmarkHotStart();
     3273              solver->resolve();
    32703274              solver->markHotStart();
    32713275              // may be infeasible (if other way stopped on iterations)
     
    33093313              assert(doneHotStart);
    33103314              solver->unmarkHotStart();
     3315              solver->resolve();
    33113316              solver->markHotStart();
    33123317              // may be infeasible (if other way stopped on iterations)
Note: See TracChangeset for help on using the changeset viewer.