Changeset 617 for branches/devel


Ignore:
Timestamp:
Jun 5, 2007 3:30:01 AM (12 years ago)
Author:
forrest
Message:

for sos

File:
1 edited

Legend:

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

    r539 r617  
    3737
    3838#include "CbcHeuristic.hpp"
     39#include "CbcHeuristicLocal.hpp"
    3940
    4041// Default Constructor
     
    257258
    258259  CbcRounding heuristic1(model);
     260  heuristic1.setHeuristicName("rounding");
    259261  int numberHeuristics = model.numberHeuristics();
    260262  int iHeuristic;
     
    271273  if (!found)
    272274    model.addHeuristic(&heuristic1);
     275#if 0
     276  // Allow join solutions
     277  CbcHeuristicLocal heuristic2(model);
     278  heuristic2.setHeuristicName("join solutions");
     279  heuristic2.setSearchType(1);
     280  found=false;
     281  for (iHeuristic=0;iHeuristic<numberHeuristics;iHeuristic++) {
     282    CbcHeuristic * heuristic = model.heuristic(iHeuristic);
     283    CbcHeuristicLocal * cgl = dynamic_cast<CbcHeuristicLocal *>(heuristic);
     284    if (cgl) {
     285      found=true;
     286      break;
     287    }
     288  }
     289  if (!found)
     290    model.addHeuristic(&heuristic2);
     291#endif
    273292}
    274293// Do printing stuff
     
    302321    process->passInMessageHandler(model.messageHandler());
    303322    OsiSolverInterface * solver = model.solver();
     323    {
     324      // mark some columns as ineligible for presolve
     325      int numberColumns = solver->getNumCols();
     326      char * prohibited = new char[numberColumns];
     327      memset(prohibited,0,numberColumns);
     328      int numberProhibited=0;
     329      // convert to Cbc integers
     330      model.findIntegers(false);
     331      int numberObjects = model.numberObjects();
     332      if (numberObjects) {
     333        OsiObject ** objects = model.objects();
     334        for (int iObject=0;iObject<numberObjects;iObject++) {
     335          CbcSOS * obj =
     336            dynamic_cast <CbcSOS *>(objects[iObject]) ;
     337          if (obj) {
     338            // SOS
     339            int n = obj->numberMembers();
     340            const int * which = obj->members();
     341            for (int i=0;i<n;i++) {
     342              int iColumn = which[i];
     343              prohibited[iColumn]=1;
     344              numberProhibited++;
     345            }
     346          }
     347        }
     348      }
     349      if (numberProhibited)
     350        process->passInProhibited(prohibited,numberColumns);
     351      delete [] prohibited;
     352    }
    304353    int logLevel = model.messageHandler()->logLevel();
    305354#ifdef COIN_HAS_CLP
     
    707756
    708757  CbcRounding heuristic1(model);
     758  heuristic1.setHeuristicName("rounding");
    709759  int numberHeuristics = model.numberHeuristics();
    710760  int iHeuristic;
Note: See TracChangeset for help on using the changeset viewer.