00001
00002
00003
00004
00005
00006
00007
00008
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
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
00039 feasible=false;
00040 break;
00041 }
00042 int priorityLevel = object[i]->priority();
00043
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 }