/home/coin/SVN-release/OS-2.1.1/Bonmin/src/CbcBonmin/Heuristics/BonDummyPump.cpp

Go to the documentation of this file.
00001 // (C) Copyright CNRS
00002 // This code is published under the Common Public License.
00003 //
00004 // Authors :
00005 // Pierre Bonami, LIF Université de la Méditérannée-CNRS
00006 //
00007 // Date : 06/18/2008
00008 
00009 #include "BonDummyPump.hpp"
00010 #include "CbcModel.hpp"
00011 #include "OsiBranchingObject.hpp"
00012 
00013 namespace Bonmin {
00014 
00016   DummyPump::DummyPump():
00017     LocalSolverBasedHeuristic(){
00018   }
00020   DummyPump::DummyPump(BonminSetup * setup):
00021     LocalSolverBasedHeuristic(setup){
00022   }
00023 
00025   DummyPump::DummyPump
00026              (const DummyPump &other):
00027     LocalSolverBasedHeuristic(other){
00028   }
00029 
00030   DummyPump::~DummyPump(){
00031   }
00032 
00034   int
00035   DummyPump::solution(double & objectiveValue,
00036                                  double * newSolution){
00037     if(model_->getNodeCount() || model_->getCurrentPassNumber() > 1) return 0;
00038     //int numberObjects = model_->numberObjects();
00039     //OsiObject ** objects = model_->objects();
00040     OsiTMINLPInterface * nlp = dynamic_cast<OsiTMINLPInterface *>
00041                                (setup_->nonlinearSolver()->clone());
00042 
00043     OsiBranchingInformation info = model_->usefulInformation();
00044     info.solution_ = model_->getColSolution();
00045     int numcols = model_->getNumCols();
00046     vector<double> vals;
00047     vector<int> inds;
00048 
00049     for(int i = 0 ;i < numcols ; i++){
00050        if(nlp->isInteger(i)){
00051             vals.push_back(info.solution_[i]);
00052             inds.push_back(i);
00053        }
00054     }
00055     nlp->switchToFeasibilityProblem(inds.size(), vals(), inds(), 1., 0., 1);
00056 
00057     double cutoff = info.cutoff_; 
00058     int r_val = doLocalSearch(nlp, newSolution, objectiveValue, cutoff);
00059     delete nlp;
00060     return r_val;
00061   }
00062 
00063   void
00064   DummyPump::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions){
00065    roptions->SetRegisteringCategory("Test heuristics", RegisteredOptions::UndocumentedCategory);
00066    roptions->AddStringOption2(
00067      "dummy_pump_heuristic",
00068      "if yes runs a heuristic which looks like a dummy FP",
00069      "no",
00070      "no", "don't run it",
00071      "yes", "runs the heuristic",
00072      "");
00073    roptions->setOptionExtraInfo("dummy_pump_heuristic", 63);
00074   }
00075 
00077    void 
00078    DummyPump::Initialize(Ipopt::SmartPtr<Bonmin::OptionsList> options){
00079    }
00080 }/* ends bonmin namespace*/

Generated on Mon May 3 03:05:15 2010 by  doxygen 1.4.7