/home/coin/SVN-release/OS-2.4.2/Bonmin/src/Algorithms/Branching/BonRandomChoice.cpp

Go to the documentation of this file.
00001 // (C) Copyright CNRS 2008
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Pierre Bonami, LIF, CNRS-Marseille Universites.
00007 //
00008 // Date : 03/17/2008
00009 #include "BonRandomChoice.hpp"
00010 #include "BonminConfig.h"
00011 #include "CoinFinite.hpp"
00012 
00013 int BonRandomChoice::setupList(OsiBranchingInformation * info, bool initialize){
00014   if (initialize) {
00015     status_=-2;
00016     delete [] goodSolution_;
00017     bestObjectIndex_=-1;
00018     numberStrongDone_=0;
00019     numberStrongIterations_ = 0;
00020     numberStrongFixed_ = 0;
00021     goodSolution_ = NULL;
00022     goodObjectiveValue_ = COIN_DBL_MAX;
00023     numberOnList_=0;
00024     }
00025     numberUnsatisfied_=0;
00026     int numberObjects = solver_->numberObjects();
00027     assert (numberObjects);
00028     int bestPriority=COIN_INT_MAX;
00029     std::fill(list_, list_+numberObjects, -1);
00030     OsiObject ** object = info->solver_->objects();
00031     // Say feasible
00032     bool feasible = true;
00033     for (int i=0;i<numberObjects;i++) {
00034     int way;
00035     double value = object[i]->infeasibility(info,way);
00036     if (value>0.0) {
00037       if (value==COIN_DBL_MAX) {
00038   // infeasible
00039   feasible=false;
00040   break;
00041       }
00042       int priorityLevel = object[i]->priority();
00043       // Better priority? Flush choices.
00044       if (priorityLevel<bestPriority) {
00045         numberUnsatisfied_ = 0;
00046         std::fill(list_, list_+numberObjects, -1);
00047       }
00048       bestPriority = priorityLevel;
00049       if (priorityLevel==bestPriority) {
00050         list_[numberUnsatisfied_]=i;
00051         numberUnsatisfied_++;
00052         }
00053       }
00054     }
00055     return numberUnsatisfied_;
00056  }

Generated on Wed Nov 30 03:03:53 2011 by  doxygen 1.4.7